Wednesday, 6 December 2017

Oracle Database 12c Release 1 (12.1) RAC On Oracle Linux 7 Using VirtualBox Part-2

◉ Install the Grid Infrastructure


Make sure both virtual machines are started. Install the following package from the Oracle grid media as the "root" user.

# cd /media/sf_12.1.0.2/grid/rpm
# rpm -Uvh cvuqdisk*

Login to "ol7-121-rac1" as the "oracle" user and start the Oracle installer.

$ cd /media/sf_12.1.0.2/grid
$ ./runInstaller

Select the "Install and Configure Oracle Grid Infrastructure for a Cluster" option, then click the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Accept the "Configure a Standard cluster" option by clicking the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Select the "Typical Installation" option, then click the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

On the "Specify Cluster Configuration" screen, enter the correct SCAN Name and click the "Add" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Enter the details of the second node in the cluster, then click the "OK" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Click the "SSH Connectivity..." button and enter the password for the "oracle" user. Click the "Setup" button to configure SSH connectivity, and the "Test" button to test it once it is complete. Once the test is complete, click the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

If you are doing a 12.1.0.1 installation, you will have to click the "Identify network interfaces" button, but in 12.1.0.2 this is on the following screen.

Check the public and private networks are specified correctly. If the NAT interface is displayed, remember to mark it as "Do Not Use". Click the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Enter "/u01/app/12.1.0.2/grid" as the software location and "Automatic Storage Manager" as the cluster registry storage type. Enter the ASM password, select "dba" as the group and click the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Set the redundancy to "External", click the "Change Discovery Path" button and set the path to "/dev/oracleasm/*". Return the main screen and select all 4 disks and click the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Accept the default inventory directory by clicking the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

If you want the root scripts to run automatically, enter the relevant credentials. I prefer to run them manually. Click the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Wait while the prerequisite checks complete. If you have any issues use the "Fix & Check Again" button. Once possible fixes are complete, check the "Ignore All" checkbox and click the "Next" button. It is likely the "Physical Memory" and "Device Checks for ASM" tests will fail for this type of installation. This is OK.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

If you are happy with the summary information, click the "Install" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Wait while the installation takes place.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

When prompted, run the configuration scripts on each node.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

The output from the "orainstRoot.sh" file should look something like that listed below.

# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
#

The output of the "root.sh" will vary a little depending on the node it is run on.

Once the scripts have completed, return to the "Execute Configuration Scripts" screen on "ol7-121-rac1" and click the "OK" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Wait for the configuration assistants to complete.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

If any of the configuration steps fail you should check the specified log to see if the error is a show-stopper or not. If you are not using a DNS to resolve the SCAN you can expect the verification phase to fail with an error like the following.

INFO: Checking Single Client Access Name (SCAN)...
INFO: Checking name resolution setup for "rac-scan.localdomain"...
INFO: ERROR:
INFO: PRVF-4664 : Found inconsistent name resolution entries for SCAN name "rac-scan.localdomain"
INFO: ERROR:
INFO: PRVF-4657 : Name resolution setup check for "rac-scan.localdomain" (IP address: 192.168.2.201) failed
INFO: ERROR:
INFO: PRVF-4664 : Found inconsistent name resolution entries for SCAN name "rac-scan.localdomain"
INFO: Verification of SCAN VIP and Listener setup failed

Provided this is the only error, it is safe to ignore this and continue by clicking the "Next" button.

Click the "Close" button to exit the installer.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

The grid infrastructure installation is now complete. We can check the status of the installation using the following commands.

$ grid_env
$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       ol7-121-rac1             STABLE
               ONLINE  ONLINE       ol7-121-rac2             STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       ol7-121-rac1             STABLE
               ONLINE  ONLINE       ol7-121-rac2             STABLE
ora.asm
               ONLINE  ONLINE       ol7-121-rac1             Started,STABLE
               ONLINE  ONLINE       ol7-121-rac2             Started,STABLE
ora.net1.network
               ONLINE  ONLINE       ol7-121-rac1             STABLE
               ONLINE  ONLINE       ol7-121-rac2             STABLE
ora.ons
               ONLINE  ONLINE       ol7-121-rac1             STABLE
               ONLINE  ONLINE       ol7-121-rac2             STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       ol7-121-rac2             STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       ol7-121-rac1             STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       ol7-121-rac1             STABLE
ora.MGMTLSNR
      1        ONLINE  ONLINE       ol7-121-rac1             169.254.255.49 192.1
                                                             68.1.101,STABLE
ora.cvu
      1        ONLINE  ONLINE       ol7-121-rac1             STABLE
ora.mgmtdb
      1        ONLINE  ONLINE       ol7-121-rac1             Open,STABLE
ora.oc4j
      1        ONLINE  ONLINE       ol7-121-rac1             STABLE
ora.ol7-121-rac1.vip
      1        ONLINE  ONLINE       ol7-121-rac1             STABLE
ora.ol7-121-rac2.vip
      1        ONLINE  ONLINE       ol7-121-rac2             STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       ol7-121-rac2             STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       ol7-121-rac1             STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       ol7-121-rac1             STABLE
--------------------------------------------------------------------------------
$

At this point it is probably a good idea to shutdown both VMs and take snapshots. Remember to make a fresh zip of the ASM disks on the host machine, which you will need to restore if you revert to the post-grid snapshots.

$ cd /u04/VirtualBox/ol7-121-rac
$ zip PostGrid.zip *.vdi

◉ Install the Database Software


Make sure the "ol7-121-rac1" and "ol7-121-rac2" virtual machines are started, then login to "ol7-121-rac1" as the oracle user and start the Oracle installer. Check that all services are up using "crsctl stat res -t", as described before.

$ cd /media/sf_12.1.0.2/database
$ ./runInstaller

Uncheck the security updates checkbox and click the "Next" button and "Yes" on the subsequent warning dialog.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Select the "Install database software only" option, then click the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Accept the "Oracle Real Application Clusters database installation" option by clicking the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Make sure both nodes are selected, then click the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Select the required languages, then click the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Select the "Enterprise Edition" option, then click the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Enter "/u01/app/oracle" as the Oracle base and "/u01/app/oracle/product/12.1.0.2/db_1" as the software location, then click the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Select the desired operating system groups, then click the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Wait for the prerequisite check to complete. If there are any problems either click the "Fix & Check Again" button, or check the "Ignore All" checkbox and click the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

If you are happy with the summary information, click the "Install" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Wait while the installation takes place.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

When prompted, run the configuration script on each node. When the scripts have been run on each node, click the "OK" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Click the "Close" button to exit the installer.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Shutdown both VMs and take snapshots. Remember to make a fresh zip of the ASM disks on the host machine, which you will need to restore if you revert to the post-db snapshots.

$ cd /u04/VirtualBox/ol7-121-rac
$ zip PostDB.zip *.vdi

◉ Create a Database


Make sure the "ol7-121-rac1" and "ol7-121-rac2" virtual machines are started, then login to "ol7-121-rac1" as the oracle user and start the Database Creation Asistant (DBCA).

$ dbca
Select the "Create Database" option and click the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Select the "Create a database with default configuration" option. Enter the container database name (cdbrac), pluggable database name (pdb1) and administrator password. Click the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Wait for the prerequisite checks to complete. If there are any problems either fix them, or check the "Ignore All" checkbox and click the "Next" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

If you are happy with the summary information, click the "Finish" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

Wait while the database creation takes place.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

If you want to modify passwords, click the "Password Management" button. When finished, click the "Close" button.

Oracle Database 12c, Oracle Linux, Linux 7, Oracle Database Tutorials and Materials

The RAC database creation is now complete.

◉ Check the Status of the RAC


There are several ways to check the status of the RAC. The srvctl utility shows the current configuration and status of the RAC database.

$ srvctl config database -d cdbrac
Database unique name: cdbrac
Database name: cdbrac
Oracle home: /u01/app/oracle/product/12.1.0.2/db_1
Oracle user: oracle
Spfile: +DATA/CDBRAC/PARAMETERFILE/spfile.296.890818285
Password file: +DATA/CDBRAC/PASSWORD/pwdcdbrac.276.890817261
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group:
Database instances: cdbrac1,cdbrac2
Configured nodes: ol7-121-rac1,ol7-121-rac2
Database is administrator managed
$

$ srvctl status database -d cdbrac
Instance cdbrac1 is running on node ol7-121-rac1
Instance cdbrac2 is running on node ol7-121-rac2
$

The V$ACTIVE_INSTANCES view can also display the current status of the instances.

$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Sat Sep 19 09:45:35 2015

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SQL> SELECT inst_name FROM v$active_instances;

INST_NAME
--------------------------------------------------------------------------------
ol7-121-rac1.localdomain:cdbrac1
ol7-121-rac2.localdomain:cdbrac2

SQL>