DB Automation – 12cR2 RAC Setup & CDB Database Creation

Posted On March 8, 2017

Filed under Uncategorized

Comments Dropped leave a response

“Automation is key to transforming the DBA role from vertical to horizontal”.

This post will introduce DBA automation by using response file to install  GRID, DB Soft, ASM and DB automatically:

Creating response file to install Grid Infrastructure:

root@pridb1 oracle]# ./12cr2_grid_infrastucture_reponsefile_create.sh
####################################################################
ORACLE GRID INFRASTRUCTURE 12C RELEASE RESPONSE FILE GENERATE SCRIPT
Version 1.0
####################################################################

Please enter base location for source installation: 
/oracle 

Please enter grid base location: 
/oracle/gridbase

Please enter group for osdba - default: oinstall 
oinstall
Please enter group for osoper: - default: null
dba
Please enter group for osdba: - default: dba
dba

Please enter scan name: 
orapri.oracle.lab

Please enter scan port: 
1521

Please enter cluster name: 
prirac-cluster

Please enter first node name: 
pridb1

Please enter second node name: 
pridb2

Please enter domain name for nodes
oracle.lab

Listing all network interface:

eth0      Link encap:Ethernet  HWaddr 00:21:F6:E6:FE:8F  
          inet addr:192.168.1.31  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::221:f6ff:fee6:fe8f/64 Scope:Link
eth1      Link encap:Ethernet  HWaddr 00:21:F6:F7:6F:0C  
          inet addr:172.16.1.11  Bcast:172.16.1.255  Mask:255.255.255.0
          inet6 addr: fe80::221:f6ff:fef7:6f0c/64 Scope:Link
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host

Please public interface name to configure:
eth0

Please public network to configure:
192.168.1.0

Please private interface name to configure:
eth1    

Please private network to configure:
172.16.1.0

ASMLib is configured on this machine!

DiskGroup Discovery String is: ORCL:*

Please enter name for CRS Voting diskgroup:
CRS

Please password for ASM sys password:
sysadmin

Please AU for diskgroup CRS Voting Diskgroup:
8

Please enter diskgroup redundancy: EXTERNAL,NORMAL,HIGH OR FLEX
normal

DISK01: /dev/xvdc1
DISK02: /dev/xvdc2
DISK03: /dev/xvdc3
DISK04: /dev/xvde1
DISK05: /dev/xvde2
DISK06: /dev/xvde3
DISK07: /dev/xvde4
DISK08: /dev/xvdd1

You are using ASMLib for ASM Diskgroup

Please enter first disk to configure CRS Diskgroup:
disk01

Please enter second disk to configure CRS Diskgroup:
disk02

Please enter ASM Monitor password:
sysadmin

Please enter Grid Infrastructure DiskGroup Name:
MGMT

Please enter diskgroup redundancy for GRID Management Diskgroup: EXTERNAL,NORMAL,HIGH OR FLEX
external

DISK01: /dev/xvdc1
DISK02: /dev/xvdc2
DISK03: /dev/xvdc3
DISK04: /dev/xvde1
DISK05: /dev/xvde2
DISK06: /dev/xvde3
DISK07: /dev/xvde4
DISK08: /dev/xvdd1

You are using ASMLib for ASM Diskgroup

Please enter disk name to configure GRID Management Diskgroup:
disk08

Please AU for GRID Management Diskgroup:
8

 

Execute GridSetup.sh in silent mode

[root@pridb1 oracle]# ./gridSetup.sh -silent -ignorePrereqFailure -responseFile /tmp/grid12.2.rsp
Launching Oracle Grid Infrastructure Setup Wizard...
[WARNING] [INS-30011] The SYS password entered does not conform to the Oracle recommended standards.
[WARNING] [INS-30011] The ASMSNMP password entered does not conform to the Oracle recommended standards.
[WARNING] [INS-41808] Possible invalid choice for OSASM Group.
[WARNING] [INS-41810] Possible invalid choice for OSOPER Group.
[WARNING] [INS-41812] OSOPER and OSASM are the same OS group.
[WARNING] [INS-40109] The specified Oracle Base location is not empty on this server.
[WARNING] [INS-40110] The specified Oracle Base location is not empty on following nodes: [pridb2].
[WARNING] [INS-13013] Target environment does not meet some mandatory requirements.
   CAUSE: Some of the mandatory prerequisites are not met. See logs for details. /oracle/oraInventory/logs/GridSetupActions2017-03-07_06-53-57AM/gridSetupActions2017-03-07_06-53-57AM.log
   ACTION: Identify the list of failed prerequisite checks from the log: /oracle/oraInventory/logs/GridSetupActions2017-03-07_06-53-57AM/gridSetupActions2017-03-07_06-53-57AM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
You can find the log of this install session at:
 /oracle/oraInventory/logs/GridSetupActions2017-03-07_06-53-57AM/gridSetupActions2017-03-07_06-53-57AM.log

As a root user, execute the following script(s):
        1. /oracle/grid12r2/root.sh

Execute /oracle/grid12r2/root.sh on the following nodes: 
[pridb1, pridb2]

Run the script on the local node first. After successful completion, you can start the script in parallel on all other nodes.

Successfully Setup Software.

Execute root.sh and ConfigTools

[root@pridb1 oracle]#/oracle/grid12r2/root.sh
Check /oracle/grid12r2/install/root_pridb1_2017-03-07_07-10-54-129564524.log for the output of root script

[root@pridb2 oracle]# /oracle/grid12r2/root.sh
Check /oracle/grid12r2/install/root_pridb2_2017-03-07_15-54-36-402439024.log for the output of root script


[oracle@pridb1 grid12r2]$ /oracle/grid12r2/gridSetup.sh -executeConfigTools -responseFile /tmp/grid12.2.rsp -silent
Launching Oracle Grid Infrastructure Setup Wizard...

You can find the logs of this session at:
/oracle/oraInventory/logs/GridSetupActions2017-03-07_04-01-21PM

Successfully Configured Software.

[oracle@pridb1 grid12r2]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr
               ONLINE  ONLINE       pridb1                   STABLE
               ONLINE  ONLINE       pridb2                   STABLE
ora.CRS.dg
               ONLINE  ONLINE       pridb1                   STABLE
               ONLINE  ONLINE       pridb2                   STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       pridb1                   STABLE
               ONLINE  ONLINE       pridb2                   STABLE
ora.MGMT.dg
               ONLINE  ONLINE       pridb1                   STABLE
               ONLINE  ONLINE       pridb2                   STABLE
ora.chad
               ONLINE  ONLINE       pridb1                   STABLE
               ONLINE  ONLINE       pridb2                   STABLE
ora.net1.network
               ONLINE  ONLINE       pridb1                   STABLE
               ONLINE  ONLINE       pridb2                   STABLE
ora.ons
               ONLINE  ONLINE       pridb1                   STABLE
               ONLINE  ONLINE       pridb2                   STABLE
ora.proxy_advm
               OFFLINE OFFLINE      pridb1                   STABLE
               OFFLINE OFFLINE      pridb2                   STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       pridb2                   STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       pridb1                   STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       pridb1                   STABLE
ora.MGMTLSNR
      1        ONLINE  ONLINE       pridb1                   169.254.149.1 172.16
                                                             .1.11,STABLE
ora.asm
      1        ONLINE  ONLINE       pridb1                   Started,STABLE
      2        ONLINE  ONLINE       pridb2                   Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       pridb1                   STABLE
ora.mgmtdb
      1        ONLINE  ONLINE       pridb1                   Open,STABLE
ora.pridb1.vip
      1        ONLINE  ONLINE       pridb1                   STABLE
ora.pridb2.vip
      1        ONLINE  ONLINE       pridb2                   STABLE
ora.qosmserver
      1        ONLINE  ONLINE       pridb1                   STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       pridb2                   STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       pridb1                   STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       pridb1                   STABLE

Create response file to install Oracle software on RAC

[root@pridb1 oracle]# ./12cr2_db_software_reponsefile_create.sh
####################################################################
ORACLE DATABASE SOFTWARE 12C RELEASE RESPONSE FILE GENERATE SCRIPT
Version 1.0
####################################################################

Please enter base location for source installation: 
/oracle

Please enter oracle software base location: 
/oracle/12.2.0.1

Please enter oracle software home location: 
/oracle/12.2.0.1/db_1

Please enter unix_group_name: default-oinstall 
oinstall

Please enter Database Edition: EE or SE2 
EE

Please enter group for osdba - default: dba 
dba

Please enter group for osoper: - default: null
dba

Please enter group for osbackupdba: - default: dba
dba

Please enter group for osdgdba - default:  dba 
dba

Please enter group for oskmdba: - default:  dba
dba

Please enter group for osracdba: - default: dba
dba

Please enter enter cluster names:
pridb1,pridb2

Please execute runInstaller with response file to install Oracle Software

Perform Oracle Database Software installation

[oracle@pridb1 database]$ ./runInstaller -ignoreSysPrereqs -silent -ShowProgress -ignorePrereqFailure -responseFile /tmp/db12.2.rsp
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 41413 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 4852 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-03-06_04-22-10PM. Please wait ...[oracle@pridb1 database]$ [WARNING] [INS-13013] Target environment does not meet some mandatory requirements.
   CAUSE: Some of the mandatory prerequisites are not met. See logs for details. /oracle/oraInventory/logs/installActions2017-03-06_04-22-10PM.log
   ACTION: Identify the list of failed prerequisite checks from the log: /oracle/oraInventory/logs/installActions2017-03-06_04-22-10PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
You can find the log of this install session at:
 /oracle/oraInventory/logs/installActions2017-03-06_04-22-10PM.log

Prepare in progress.
..................................................   7% Done.

Prepare successful.

Copy files in progress.
..................................................   14% Done.
..................................................   20% Done.
..................................................   25% Done.
..................................................   30% Done.
..................................................   36% Done.
..................................................   45% Done.
..................................................   50% Done.
..................................................   55% Done.
..................................................   60% Done.
..................................................   65% Done.
..........
Copy files successful.

Link binaries in progress.
....................
Link binaries successful.

Setup files in progress.
....................
Setup files successful.

Setup Inventory in progress.

Setup Inventory successful.

Finish Setup successful.
The installation of Oracle Database 12c was successful.
Please check '/oracle/oraInventory/logs/silentInstall2017-03-06_04-22-10PM.log' for more details.

Copy Files to Remote Nodes in progress.
..................................................   70% Done.
..................................................   75% Done.
..................................................   80% Done.
..................................................   85% Done.

Copy Files to Remote Nodes successful.

Prepare in progress.

Prepare successful.
..........
Setup in progress.
....................
Setup successful.
The Cluster Node Addition of /oracle/12.2.0.1/db_1 was successful.
Please check '/oracle/oraInventory/logs/silentInstall2017-03-06_04-22-10PM.log' for more details.

Setup Oracle Base in progress.

Setup Oracle Base successful.
..................................................   97% Done.

As a root user, execute the following script(s):
        1. /oracle/12.2.0.1/db_1/root.sh

Execute /oracle/12.2.0.1/db_1/root.sh on the following nodes: 
[pridb1, pridb2]


..................................................   100% Done.
Successfully Setup Software.

root@pridb1 ~]# /oracle/12.2.0.1/db_1/root.sh
Check /oracle/12.2.0.1/db_1/install/root_pridb1_2017-03-08_19-02-40-293418787.log for the output of root script

[root@pridb2 oracle]# /oracle/12.2.0.1/db_1/root.sh
Check /oracle/12.2.0.1/db_1/install/root_pridb2_2017-03-08_19-13-12-554678715.log for the output of root script

Create response file for ASM Diskgroup creation

[root@pridb1 oracle]# ./asmca_responefile_create.sh 
####################################################################
ORACLE 12cR2 ASM DISKGROUP CREATE RESPONSE FILE GENERATE SCRIPT
Version 1.0
Oracle ACS: Dzung Tran
####################################################################
####################################################################
Colllecting ASM Enviroment to create response file:

ORACLE_HOME=/oracle/grid12r2
ORACLE_SID=+ASM1

####################################################################

Please enter diskgroup name you want to create
DATA

Please AU size you want to create
8

Please specify ASM Compatible: default - 11.2.0.0.0
11.2.0.0.0

Please specify RDBMS Compatible: default - 11.2.0.0.0
11.2.0.0.0

Please enter diskgroup redundancy: EXTERNAL,NORMAL,HIGH OR FLEX
normal


DISK01: /dev/xvdc1
DISK02: /dev/xvdc2
DISK03: /dev/xvdc3
DISK04: /dev/xvde1
DISK05: /dev/xvde2
DISK06: /dev/xvde3
DISK07: /dev/xvde4
DISK08: /dev/xvdd1

You are using ASMLib for ASM Diskgroup

Please enter first disk to configure CRS Diskgroup:
DISK01

Please failgroup name for first disk:
fgrp1     

Please enter second disk to configure CRS Diskgroup:
DISK02 

Please failgroup name for second disk:
fgrp2

Please check validate information from asm_diskgrp_create.sh

Using ASM silient mode to create all DISKGROUP

Create ASM diskgroup from the response file

[oracle@pridb1 ~]$ ./asm_diskgrp_create.sh

Disk groups created successfully. Check /oracle/gridbase/cfgtoollogs/asmca/asmca-170308PM070637.log for details.

[oracle@pridb1 ~]$ asmcmd lsdg
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N        4096            4096   4096  8388608     30576    29568            10192            9688              0             Y  CRS/
MOUNTED  NORMAL  N        4096            4096   4096  8388608     28224    27856                0           13928              0             N  DATA/
MOUNTED  EXTERN  N        4096            4096   4096  8388608     40952     6904                0            6904              0             N  MGMT/

Create response file for Container Database Creation

[root@pridb1 oracle]# ./dbca_responefile_create.sh
####################################################################
ORACLE DATABASE SOFTWARE 12C RELEASE RESPONSE FILE GENERATE SCRIPT
Version 1.0
Oracle ACS: Dzung Tran
####################################################################

####################################################################
Do you want to Create container Database

1.Yes or 2.No
yes

Oracle Database Templates

1.General_Purpose or Transaction Process

2.Data Warehouse

3.Customer Database

Please specify type of database:
1

Please specify type of database global name:
cdb12r2

Please specify type of database sid name:
cdb12r2

Please enter pluggable prefix name:
pdb

Please specify number of Pluggble Database you want create:
2

Please specify password SYS for CDB:
sysadmin123

Please specify password SYSTEM for CDB:
sysadmin123

Please specify PDB Admin User Name:
pdbadmin

Please specify password for PDB Admin User Name :
sysadmin123

Please specify CharecterSet : default - AL32UTF8
AL32UTF8

Please specify National CharecterSet : default - AL16UTF16
AL16UTF16

Please specify total memory for database: 
2000

Please specify all node names: 
pridb1,pridb2

What kind of storage you are using, choice 1 or 2: 
1.ASM or 2.ClusterFileSystem: 
1

Please enter diskgroup to store datafiles
DATA

Please enter ASM Sys Password
sysadmin

Please check validate information from /tmp/dbca_create_silent.sh

Using DBCA with silent installtion to create Database

Using DBCA to create Container Database

[oracle@pridb1 database]$ /tmp/dbca_create_silent.sh
Copying database files
1% complete
11% complete
21% complete
Creating and starting Oracle instance
23% complete
25% complete
26% complete
27% complete
30% complete
33% complete
34% complete
35% complete
Creating cluster database views
37% complete
50% complete
Completing Database Creation
51% complete
53% complete
55% complete
57% complete
Creating Pluggable Databases
61% complete
65% complete
78% complete
Executing Post Configuration Actions
100% complete
Look at the log file "/oracle/gridbase/cfgtoollogs/dbca/cdb12r2/cdb12r2.log" for further details.
[oracle@pridb1 database]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Wed Mar 8 20:10:53 2017

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO
         4 PDB2                           READ WRITE NO
SQL> select name from v$database;

NAME
---------
CDB12R2

Leave a comment