Installation of Oracle Database 12cR2 and Oracle Grid Infrastructure 12cR2 on Oracle Enterprise Linux 6.7 (Physical Server –
Not a VM).
Every DBA Trainee or a Jr DBA must need to perform installation of Oracle Database on their home / test machines for practicing their DBA activities. However installation of Oracle Database is not a rocket science and pretty easy. You will find many blogs across the internet for step by step installation guide in which the demonstration will be on various Virtual Machines. Here we will see the installation of Oracle Database as well as Oracle Grid Infrastructure (ASM) on a Physical Bare Metal Server.
Before we proceed with the installation, some of the points need to be taken care. As we’re installing Database with ASM, we should have some raw partitions on the server. Which we’ll use to create ASM Disks. Here I’m assuming you already have downloaded Database and Grid setup from Oracle’s official website. If you haven’t you can download it Here.
1. Running preinstall for Oracle12cR2 from Oracle’s yum repository.
- This preinstall package from Oracle will make all necessary changes in the environment and set required kernel parameters.
[root@dbnode1 /]# yum install oracle-rdbms-server-12cR1-preinstall
Once we’re done with this preinstall package, we’re good to proceed with actual installation. We need to make directories to hold Oracle Software binaries.
2. Making directories & adding groups.
- We’ll make directories to hold Oracle Database and Oracle Grid Infrastructure. We’ll perform these actions with root user.
[root@dbnode1 u01]# mkdir -p /u01/app/oracle/product/12.2.0/dbhome_1 [root@dbnode1 u02]# mkdir -p /u02/app/grid/product/12.2.0/gihome_1
- We’ll check which group does oracle user belongs to.
[root@dbnode1 /]# groups oracle oracle : oracle
Here as we can see user oracle belongs to only one group which is a default group for the user oracle.
- We’ll assign require group to user oracle and verify.
[root@dbnode1 /]# usermod -g oinstall -G oracle oracle [root@dbnode1 /]# groups oracle oracle : oinstall oracle
Now we can see user oracle’s primary group is oinstall and secondary group is oracle.
3. Changing ownership of the created directories.
- Now we’ll have to change the ownership of the created directories to user oracle and group oinstall. So first we will check the current ownership of the directories.
[root@dbnode1 /]# ls -lrth | grep u0 drwxr-xr-x. 3 root root 4.0K Mar 17 23:00 u01 drwxr-xr-x. 3 root root 4.0K Mar 17 23:01 u02
And as we can see above, current user is root and the group is also root which is a default group of the root user.
[root@dbnode1 /]# chown -R oracle:oinstall /u01 [root@dbnode1 /]# chown -R oracle:oinstall /u02
Now we’ll verify, if the changes have been applied or not.
[root@dbnode1 /]# ls -lrth | grep u0 drwxr-xr-x. 3 oracle oinstall 4.0K Mar 17 23:00 u01 drwxr-xr-x. 3 oracle oinstall 4.0K Mar 17 23:01 u02
And here we can see, now the user is ‘oracle‘ and group is ‘oinstall‘. So now we can proceed with extracting zip. Don’t forget to switch to oracle user now. Further actions are supposed to be performed by oracle user.
4. Extracting zip to respective directories to begin installation.
- We’ll redirect to the directory where we have downloaded the zip file.
[oracle@dbnode1 12c]$ ls linuxx64_12201_database.zip linuxx64_12201_grid_home.zip
As we can see above, we have zip file for database as well as grid. We’ll make one directory named database to extract linuxx64_12201_database.zip.
[oracle@dbnode1 12c]$ mkdir database [oracle@dbnode1 12c]$ ls database linuxx64_12201_database.zip linuxx64_12201_grid_home.zip
Here we have database directory created. So we’re good to unzip database setup.
[oracle@dbnode1 12c]$ unzip linuxx64_12201_database.zip -d database
This will extract database setup to the directory named database.
- Little twist for Grid Infrastructure. As we extracted database setup in the directory named database, while extracting grid setup we’re supposed to extract setup into the directory which we want as Grid Home.
[oracle@dbnode1 12c]$ unzip linuxx64_12201_grid_home.zip -d /u02/app/grid/product/12.2.0/gihome_1/
This will extract grid setup into the grid home directory from where we can begin grid installation.
5. Installing ASMLib driver and creating ASM Disks.
- We can install kmod-oracleasm and oracleasm-support directly from the yum repository.
To perform these installation operation, we’ll need to switch to the root user or optionally we can also use sudo if any other user has ‘sudo’ access.
[root@dbnode1 12c]# yum install kmod-oracleasm [root@dbnode1 12c]# yum install oracleasm-support
- However, we need to download oracleasmlib from Oracle’s website and install it using rpm. To download it directly within terminal using wget utility, we can use below command.
[root@dbnode1 12c]# wget http://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.12-1.el6.x86_64.rpm
After downloading we will have to install it using rpm.
[root@dbnode1 12c]# rpm -ivh oracleasmlib-2.0.12-1.el6.x86_64.rpm
Once it is installed, we can verify all necessary ASM packages by using following rpm command.
[root@dbnode1 12c]# rpm -qa | grep oracleasm oracleasmlib-2.0.12-1.el6.x86_64 oracleasm-support-2.1.11-2.el6.x86_64 kmod-oracleasm-2.0.8-15.el6_9.x86_64
- If we’ve all three packages installed, then we’re good to proceed further with configuration of ASM Driver. We’ll have to perform below action as a root user.
[root@dbnode1 12c]# /etc/init.d/oracleasm configure -i Configuring the Oracle ASM library driver. This will configure the on-boot properties of the Oracle ASM library driver. The following questions will determine whether the driver is loaded on boot and what permissions it will have. The current values will be shown in brackets (''). Hitting <ENTER> without typing an answer will keep that current value. Ctrl-C will abort. Default user to own the driver interface : oracle Default group to own the driver interface : oinstall Start Oracle ASM library driver on boot (y/n) [n]: y Scan for Oracle ASM disks on boot (y/n) [y]: y Writing Oracle ASM library driver configuration: done Dropping Oracle ASMLib disks: [ OK ] Shutting down the Oracle ASMLib driver: [ OK ]
- Once we’re done with configuration of ASMLib driver, we’re good to proceed further with ASM Disks Creation.
We can perform this action with root or oracle user as well. However while performing with oracle user we might have to grant some permissions of /tmp and log directories so we’ll prefer to do with root user as we’ll not have to create asm disks on a daily basis.
[root@dbnode1 12c]# /etc/init.d/oracleasm createdisk DATA01 /dev/sdb3; Marking disk "DISK1" as an ASM disk: [OK] [root@dbnode1 12c]# /etc/init.d/oracleasm createdisk FRA01 /dev/sdb5; Marking disk "DISK1" as an ASM disk: [OK]
After disk creation we’ll scan the disks and then list them.
[root@dbnode1 12c]# /etc/init.d/oracleasm scandisks; Scanning the system for Oracle ASMLib disks: [ OK ] [root@dbnode1 12c]# /etc/init.d/oracleasm listdisks; DATA01 FRA01
Now we’ve asm disks named DATA01 and FRA01 we’re good to initiate database and grid installation.
6. Initiating installation.
- Now we’re good to initiate Database‘s and Grid Infrastructure‘s installation. We’ll install Grid Infrastructure first and then Database.
[oracle@dbnode1 ~]$ /u02/app/grid/product/12.2.0/gihome_1/./gridSetup.sh Launching Oracle Grid Infrastructure Setup Wizard...
- Select configure Oracle Grid Infrastructure for a Standalone Server(Oracle Restart) and click Next.
- Create ASM Disk Group. Provide disk group name, which is DATA1 in my case, give redundancy External and click Next.
Note : If your created disks are not visible, Select Show All Disks from drop down or you can also try changing Discovery Path.
- Changing ASM Disks’ discovery path. Enter path of your oracleasm disk and click OK.
- Provide password for sysasm and asmsnmp user, in my case I’m setting same password for both users. set your password and click NEXT.
Note : You might be prompted for password standard warning, so either you may set password as per Oracle standard or you may ignore the warning.
Click yes and proceed.
- Enterprise Manager Cloud Control setup, leave it unchecked and click Next.
Note : I’m leaving this unchecked as I haven’t setup Cloud Control on my server.
- Select groups and click NEXT.
Note : Users of the selected group will be able to perform asmdba operations and will be able to connect as sysasm.
Note : You’ll be prompted with warning saying you have selected same group for OSOPER and OSASM, as we’ve selected same group. here we can click and Yes and ignore this warning.
- Select ORACLE_BASE and ORACLE_HOME for Grid Infrastructure and click NEXT.
Note : If you notice here, you’ve no remedy to change ORACLE_HOME for Grid Infrastructure, and it’s the location where we have placed setup of Grid Infrastructure.
- Click Yes on the warning
Note : It’s given me this warning because, Oracle recommends 10 GB of free space on the mountpoint where we’re installing grid. I’ve 15 GB of mountpoint here, however Grid Setup has occupied 7 GB, so I’m ignoring this warning as I’ve good amount of space available.
- Verify the OraInvetory location and click Next.
Note : Leave it as it is.
- Supply root password to Automatically run configuration script or leave it unchecked to run script manually and click NEXT
Note : Here, in this screen we can supply root credentials so that we’ll not have to run root.sh manually during the installation.
- To fix prerequisite failures click on Fix & Check Again. and Run fixup script as root user.
Note : If you’ll follow all steps shown in this guide then you should also get only these two warning from which you can ignore warning for Physical Memory as Grid Infrastructure 18c requires 8GB of RAM as per Oracle. And the another warning is for one package, if you get more than one, need to panic. Just click on Fix and Check Again. if it show Yes under Fixable column it should fix. And if you encounters anything else, you may have to fix it manually.
[root@dbnode1 ~]# /tmp/GridSetupActions2018-03-18_04-15-59AM/CVU_184.108.40.206.0_oracle/runfixup.sh All Fix-up operations were completed successfully.
It’s installed the missing package and now only one warning for Physical Memory, which we’ve decided to ignore, so click NEXT.
Click Yes as we want to ignore Physical Memory warning.
- Installation Summary, verify your selections and click on Install.
- During the installation you’ll be prompted with below Pop-up, Allow to run Root Script, Click on Yes.
- We’ve Successfully Installed Oracle Grid Infrastructure 12c.
- As we’ve successfully installed Grid Infrastructure, we’ll now begin Database installation.
To initiate installation of Database let’s navigate to the directory where we have extracted the setup.
[oracle@dbnode1 12c]$ ls database linuxx64_12201_database.zip linuxx64_12201_grid_home.zip oracleasmlib-2.0.12-1.el6.x86_64.rpm [oracle@dbnode1 12c]$ cd database/ [oracle@dbnode1 database]$ ls install response rpm runInstaller sshsetup stage welcome.html
Run runInstaller as shown below.
[oracle@dbnode1 database]$ ./runInstaller Starting Oracle Universal Installer...
- Click Yes to proceed.
- Select Install database software only and click NEXT.
- Select Single instance database installation and click NEXT.
- You can select Enterprise Edition or Standard Edition, Select the one which you want to install and click NEXT.
Select the directory for Oracle base and Oracle Home in software location field, which we have created and click NEXT.
- Select group as oracle and click NEXT.
- For any prerequisite failure click on Fix & check Again button. and run the fixup script from the given location as a root user. Failures which says yes in Fixable column will be fixed.
- After running Fixup script click on OK
- Installation Summary, verify your selections and click on Install.
- Run the root.sh script as a root user from the location shown above.
[root@dbnode1 ~]# sh /u01/app/oracle/product/12.2.0/dbhome_1/root.sh Performing root user operation. The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/app/oracle/product/12.2.0/dbhome_1 Enter the full pathname of the local bin directory: [/usr/local/bin]: The contents of "dbhome" have not changed. No need to overwrite. The contents of "oraenv" have not changed. No need to overwrite. The contents of "coraenv" have not changed. No need to overwrite. Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed. Do you want to setup Oracle Trace File Analyzer (TFA) now ? yes|[no] : Oracle Trace File Analyzer (TFA - User Mode) is available at : /u01/app/oracle/product/12.2.0/dbhome_1/suptools/tfa/release/tfa_home/bin/tfactl OR Oracle Trace File Analyzer (TFA - Daemon Mode) can be installed by running this script : /u01/app/oracle/product/12.2.0/dbhome_1/suptools/tfa/release/tfa_home/install/roottfa.sh
Keep on pressing Enter key unless you want any changes in default values. Once done click OK on a prompt.
- We’ve Successfully Installed Oracle Database 12cR2.
6. Setting up .bash_profile
- So now we have successfully installed Oracle Database 12cR2 & Oracle Grid Infrastructure 12cR2. And we have also setup ASMLib and Created ASM disks. One last but not least step is required before we could access our Database and Grid.
Setting up bash profile for Database as .bash_profile and for Grid as .bash_profile_ASM. To setup bash profile we will login with oracle user and make below changes in .bash_profile for Database profile first.
- For Database Profile.
[oracle@dbnode1 ~]$ vi .bash_profile # Oracle Settings TMP=/tmp; export TMP TMPDIR=$TMP; export TMPDIR ORACLE_HOSTNAME=dbnode1.demunix.com; export ORACLE_HOSTNAME ORACLE_UNQNAME=DEMTEST; export ORACLE_UNQNAME ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1; export ORACLE_HOME ORACLE_SID=DEMTEST; export ORACLE_SID PATH=/usr/sbin:$PATH; export PATH PATH=$ORACLE_HOME/bin:$PATH; export PATH LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH echo "ORACLE PROFILE LOADED"
Then will insert profile content, to save the changes and exit [ESC] and :wq
- To load this profile.
[oracle@dbnode1 ~]$ . .bash_profile ORACLE PROFILE LOADED
- Now let’s try login to Database first, as sysdba.
[oracle@dbnode1 ~]$ sqlplus / as sysdba SQL*Plus: Release 220.127.116.11.0 Production on Tue Mar 20 03:36:35 2018 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to an idle instance. SQL>
Cheers, we’re able to login to Oracle Database 12cR2 (18.104.22.168.0).
- Same way we’ll do for Grid profile.
[oracle@dbnode1 ~]$ vi .bash_profile_ASM #ASM Settings TMP=/tmp; export TMP TMPDIR=$TMP; export TMPDIR ORACLE_HOSTNAME=dbnode1.demunix.com; export ORACLE_HOSTNAME ORACLE_BASE=/u02/app/grid; export ORACLE_BASE ORACLE_HOME=$ORACLE_BASE/product/12.2.0/gihome_1; export ORACLE_HOME ORACLE_SID=+ASM; export ORACLE_SID PATH=/usr/sbin:$PATH; export PATH PATH=$ORACLE_HOME/bin:$PATH; export PATH LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH echo "ASM PROFILE LOADED"
Then again will insert profile content for grid profile, to save the changes and exit [ESC] and :wq
- To load this profile.
[oracle@dbnode1 ~]$ . .bash_profile_ASM ASM PROFILE LOADED
- Now let’s try login to Grid, as sysasm.
[oracle@dbnode1 ~]$ sqlplus / as sysasm SQL*Plus: Release 22.214.171.124.0 Production on Tue Mar 20 03:40:26 2018 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 126.96.36.199.0 - 64bit Production SQL>
Hurrah, we’re able to connect to Oracle Grid Infrastructure 12cR2 (188.8.131.52.0) as well.
Note : Keep one logic in mind, in this demonstration we’ve setup Database and Grid on single user i.e. oracle. Hence we’ve created two different bash profiles so that we can access both, Database and Grid with one oracle user. So whenever we want to user Database we will load .bash_profile which is the default profile of oracle user and will be loaded by default when user login. And to use Grid we’ll have to explicitly load .bash_profile_ASM so that we can login to Grid.
- We can now login to grid and check our created Diskgroup.
SQL> Select NAME,STATE,TYPE,TOTAL_MB from v$asm_diskgroup; NAME STATE TYPE TOTAL_MB ----- ------- ------ --------- DATA1 MOUNTED EXTERN 25600
So now we have Diskgroup as well, so now we can go ahead and create our Datbase with ASM using DBCA or manually.