Saturday, January 2, 2021

Oracle 19c installation on Amazon AWS EC2

This article provides all the details on how to install Oracle 19c database software on Oracle Enterprise Linux (OEL) 7 in an Amazon AWS EC2 instance. Additionally, the installation option chosen below creates a starter Oracle 19c database as well.

Note: For easier identification purposes, all Operating system (OS) commands and Oracle database commands that are to be executed in the Linux server are shown in Orange color in Bold.

Create an Oracle Linux server in AWS

https://aws.amazon.com/

 

Note: You can skip the below AWS account creation process if you already have an existing account.

  

 

 

https://console.aws.amazon.com/

 

 

Enter ami-00cf6ad74f988f94b in the top left-hand corner.

Note: You can choose an existing key pair if you already have one.

 


 

 

 

 

 

Elastic IP addresses

 

An Elastic IP address is a static IPv4 address designed for dynamic cloud computing. An Elastic IP address is associated with only one server at any given time in your AWS account. An Elastic IP address is a public IPv4 address, which is reachable from the internet.

 


 

 

Install Productivity software tools in your PC

TigerVNC Viewer (Windows PC only)

https://bintray.com/tigervnc/stable/tigervnc/1.10.0

Chicken VNC (MAC computers only)

MAC Operating System requires a separate tool called “Chicken VNC”.

http://sourceforge.net/projects/cotvnc/  and Download it

MobaXterm

https://mobaxterm.mobatek.net/

Add recommended packages and the Oracle 19c package in the Oracle Linux server

 

Please login to the Oracle Linux server using MobaXterm with user name ec2-user and port 22

 

sudo su - root

 

cat /etc/oracle-release

yum install oracle-database-preinstall-19c

yum install vnc

yum install vnc-server

yum install xterm

yum groupinstall "X Window System"

yum install kdebase

yum install gnome-terminal

yum groupinstall "KDE"

yum install unzip

yum install zip

yum groupinstall fonts

yum update

 

usermod -g dba oracle (The RPM oracle-database-preinstall-19c already creates the oracle operating system user with oinstall as the default group. This command changes the default group to dba)

 

rm -rf  /tmp/.X11-unix/

cd  /lib/systemd/system

Make a copy of vncserver@.service

Edit vncserver@.service and replace <USER>  with oracle. Leave the remaining lines of the file unmodified.

 

systemctl  daemon-reload

systemctl  enable  vncserver@:1.service

systemctl  start  vncserver@:1.service

 

Edit /etc/rc.d/rc.local and add the line service iptables restart

 

chmod  +x  /etc/rc.d/rc.local

service iptables restart

 

sudo su - oracle 

vncpasswd (Enter oracle as the password)

 

export DISPLAY=:1.0

xhost +

 

exit

passwd root (Enter oracle as the root password)

 

cd /etc/sysconfig

cp iptables iptables.backup

 

Edit iptables and edit the dports line as shown below

 

-A INPUT -p tcp -m state --state NEW -m tcp -m multiport --dports 22,5901 -j ACCEPT

 

        

 

Add 4 GB Swap space

 

dd if=/dev/zero of=/swapfile1 bs=1024 count=4194304

chown root:root /swapfile1

chmod 0600 /swapfile1

mkswap /swapfile1

swapon /swapfile1

 

Edit /etc/fstab and add the line shown below

/swapfile1 none swap sw 0 0

free -m  (The swapsize must be shown as 4GB now)

 

Stop and Start the instance (server) in AWS console

 

 

 

 

 

Download Oracle 19c database software to your PC

https://www.oracle.com/database/technologies/oracle19c-linux-downloads.html

Download LINUX.X64_193000_db_home.zip

 


 

Downloading Oracle software requires a new Oracle account. A free account can be created in a few minutes.

 

Login to the Oracle server using TigerVNC Viewer

Open a new terminal

su – root (If prompted for password, enter oracle)

Create the inventory location

cd /etc

vi oraInst.loc  (Letter I in CAPITALS)

Add the below lines in the oraInst.loc file

inventory_loc=/var/opt/oracle/oraInventory

inst_group=dba

 

 mkdir -p /var/opt/oracle

chown -R oracle:dba /var/opt/oracle

 mkdir -p /u01/app/oracle

mkdir -p /u01/app/oraInventory

chown -R oracle:dba /u01/app/oracle

chown -R oracle:dba /u01/app/oraInventory

chmod -R 775 /u01/app

sudo su - oracle

mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1

cd /u01/app/oracle/product/19.0.0/dbhome_1

 

Note: Transfer this software zip file LINUX.X64_193000_db_home.zip to the /u01/app/oracle/product/19.0.0/dbhome_1 directory in Oracle server using MobaXterm’s SFTP session.

 Now come back to the Terminal inside the Linux server

ls -lrt LINUX.X64_193000_db_home.zip (This zip file must be owned by oracle:dba. Otherwise change the ownership by running chown oracle:dba LINUX.X64_193000_db_home.zip as root operating system user)

echo $USER  (Must show oracle)

unzip LINUX.X64_193000_db_home.zip

Setup software and create an Oracle 19c database

 Login to the Oracle server using TigerVNC Viewer

Open a new terminal

echo $USER  (Must show oracle)

export DISPLAY=:1.0

xhost +

 

cd /var/opt/oracle

mkdir oraInventory  (Let us create the inventory location for the Oracle installation log file.)

cd /u01/app/oracle/product/19.0.0/dbhome_1

./runInstaller  (Letter I in CAPITALS)

 


Close the Linux terminal

Open a new Linux terminal

 .  oraenv (DOT followed by a whitespace followed by oraenv)

Enter the values shown in the below screenshot

 

Validation of Oracle database creation

 

select name from v$database; (Must show ORCL)

select status from v$instance; (Must shown OPEN)

 

select file_name from dba_data_files;

select tablespace_name from dba_tablespaces;

exit

 



Friday, March 27, 2020

Oracle Data Guard - How to rebuild PRIMARY after a Failover

If the primary database is not available for a long duration or suffered a permanent failure, then we have to consider a failover (not switchover) to the standby database to make it as the new primary database. Later, we also have to rebuild the old primary database and make it the new standby database.

Assumptions : 

a) The FLASHBACK database feature is turned on.
b) Oracle database version is Oracle 12c R1 (12.1.0.2)

Note: The last full backup on primary server must be successful and available. This will help in having at least a traditional backup/restore alternative in case the failover to the standby database is not successful.

Failover

Run the below steps on the standby server 

a) alter database recover managed standby database cancel; (Must return "Database altered" message quickly.)
b) alter database recover managed standby database finish; (Must return "Database altered" message quickly.)
c) alter database activate standby database; (Must return "Database altered" message quickly.)

At this stage, the database role must be turned as PRIMARY

d) shutdown immediate;
e) startup;

f) select to_char(standby_became_primary_scn) from v$database;  (NOTE THIS SCN value)

Now, it is strongly recommended to take a full database backup.


Rebuild OLD primary database

Run the below steps on the old primary server (which had a permanent problem that made you to do the failover in the first place).


1) shutdown immediate; (If it is already in running status)
2) startup mount;
3) flashback database to SCN nnnnn (Replace nnnnn with the actual SCN value noted in #f above)

4)  alter database convert to physical standby;
5) alter database recover managed standby database disconnect from session; (This will start the managed recovery process - MRP0 in the background)

6) select database_role from v$database; (Must show PHYSICAL STANDBY)

7) select switchover_status from v$database; It can show either "SWITCHOVER PENDING" or "NOT ALLOWED". Both are valid values.

Oracle database 8i to 12c R1 upgrade

This blog post provides the overall approach to upgrade from Oracle 8i (specifically 8.1.7.4) to Oracle 12c R1 (specifically 12.1.0.2)

Is your current version 8.1.7.4 (8i R3) ?

If so, this is the approach. You have to perform two upgrades. The first one is called an intermediate upgrade.

We recommend you to use dbua tool (database upgrade assistant GUI tool) instead of export and import tools.

1) Oracle 8.1.7.4 (8i R3) to Oracle 10.2.0.5

Do you have access to Oracle support https://support.oracle.com ?

If so, request them to provide you Oracle 10.2.0.1 software (base edition) through a service request.  Install this 10.2.0.1 base software - Then download 8202632 which is the patch number for patchset 10.2.0.5 and apply to the 10.2.0.1 installed folder to bring it up to 10.2.0.5


Now do a direct upgrade from Oracle 8.1.7.4 to 10.2.0.5

https://docs.oracle.com/cd/B19306_01/server.102/b14238.pdf 


2) In a separate path, install Oracle 12.1.0.2

Then upgrade the 10.2.0.5 upgraded database to Oracle 12.1.0.2.

https://docs.oracle.com/database/121/UPGRD/E41397-13.pdf 

Monday, February 3, 2020

Best R Tutorial for beginners

If you are new to the R programming language (a beginner), then the best tutorial that we recommend is https://www.tutorialspoint.com/r/index.htm. It is free and very interactive. There are LIVE DEMOs for most examples and you can practice them using your web browser.

Saturday, February 1, 2020

VirtualBox Error in supR3HardenedWinReSpawn VBoxHardening

Problem

One of our students was getting the error VirtualBox Error in supR3HardenedWinReSpawn with log details in VBoxHardening.log while starting a virtual machine.

This issue happens even after uninstalling VirtualBox and reinstalling using a different version. It happens both with version 6.x and 5.x respectively.

Solution

This problem was resolved after uninstalling "Trusteer Endpoint Protection" offered by IBM in the student's Windows 10 operating system.

We tried other potential solutions described in https://superuser.com/questions/1307424/virtualbox-5-2-6-and-5-2-6-error-in-supr3hardenedwinrespawn but uninstalling "Trusteer Endpoint Protection" offered by IBM solved the problem.