Oracle Database 12cR2 with ASM on Oracle Linux 6.7

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.
[[email protected] /]# 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.
[[email protected] u01]# mkdir -p /u01/app/oracle/product/12.2.0/dbhome_1
[[email protected] u02]# mkdir -p /u02/app/grid/product/12.2.0/gihome_1
  • We’ll check which group does oracle user belongs to.
[[email protected] /]# 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.
[[email protected] /]# usermod -g oinstall -G oracle oracle
[[email protected] /]# 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.
[[email protected] /]# 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.

[[email protected] /]# chown -R oracle:oinstall /u01
[[email protected] /]# chown -R oracle:oinstall /u02

Now we’ll verify, if the changes have been applied or not.

[[email protected] /]# 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.
[[email protected] 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.

[[email protected] 12c]$ mkdir database
 [[email protected] 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.

[[email protected] 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.
[[email protected] 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.

[[email protected] 12c]# yum install kmod-oracleasm
[[email protected] 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.
[[email protected] 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.

[[email protected] 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.

[[email protected] 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.
[[email protected] 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.

[[email protected] 12c]# /etc/init.d/oracleasm createdisk DATA01 /dev/sdb3;
 Marking disk "DISK1" as an ASM disk: [OK]
 [[email protected] 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.

[[email protected] 12c]# /etc/init.d/oracleasm scandisks;
 Scanning the system for Oracle ASMLib disks: [ OK ]
 [[email protected] 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.
[[email protected] ~]$ /u02/app/grid/product/12.2.0/gihome_1/./gridSetup.sh
Launching Oracle Grid Infrastructure Setup Wizard...


Grid Install

  • Select configure Oracle Grid Infrastructure for a Standalone Server(Oracle Restart) and click Next.


Grid Install

  • 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.


Grid Install

  • 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.

Grid Install

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.


Grid Install

  • 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.

Grid Install

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.


Grid Install

  • 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.

Grid Install

  • 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.


Grid Install

  • Verify the OraInvetory location and click Next.

Note : Leave it as it is.


Grid Install

  • 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.


Grid Install

  • 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.

[[email protected] ~]# /tmp/GridSetupActions2018-03-18_04-15-59AM/CVU_12.2.0.1.0_oracle/runfixup.sh
All Fix-up operations were completed successfully.

Grid Install

It’s installed the missing package and now only one warning for Physical Memory, which we’ve decided to ignore, so click NEXT.

Grid Install

Click Yes as we want to ignore Physical Memory warning.


Grid Install

  • Installation Summary, verify your selections and click on Install.

Grid Install

  • During the installation you’ll be prompted with below Pop-up, Allow to run Root Script, Click on Yes.

Grid Install

  • 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.

[[email protected] 12c]$ ls
database linuxx64_12201_database.zip linuxx64_12201_grid_home.zip oracleasmlib-2.0.12-1.el6.x86_64.rpm
[[email protected] 12c]$ cd database/
[[email protected] database]$ ls
install response rpm runInstaller sshsetup stage welcome.html

Run runInstaller as shown below.

[[email protected] database]$ ./runInstaller
Starting Oracle Universal Installer...

12c Database Install
Uncheck I wish to receive security updates via My Oracle Support. and Click NEXT

12c Database Install

  • Click Yes to proceed.

12c Database Install

  • Select Install database software only and click NEXT.

12c Database Install

  • Select Single instance database installation and click NEXT.

12c Database Install

  • You can select Enterprise Edition or Standard Edition, Select the one which you want to install and click NEXT.

12c Database Install

Select the directory for Oracle base and Oracle Home in software location field, which we have created and click NEXT.


12c Database Install

  • Select group as oracle and click NEXT.

12c Database Install

  • 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.

12c Database Install

  • After running Fixup script click on OK

12c Database Install

  • Installation Summary, verify your selections and click on Install.

12c Database Install

  • Run the root.sh script as a root user from the location shown above.
[[email protected] ~]# 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.


12c Database Install

  • 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.
[[email protected] ~]$ 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.
[[email protected] ~]$ . .bash_profile
 ORACLE PROFILE LOADED
  • Now let’s try login to Database first, as sysdba.
[[email protected] ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.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 (12.2.0.1.0).

  • Same way we’ll do for Grid profile.
[[email protected] ~]$ 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.
[[email protected] ~]$ . .bash_profile_ASM
ASM PROFILE LOADED
  • Now let’s try login to Grid, as sysasm.
[[email protected] ~]$ sqlplus / as sysasm

SQL*Plus: Release 12.2.0.1.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 12.2.0.1.0 - 64bit Production

SQL>

Hurrah, we’re able to connect to Oracle Grid Infrastructure 12cR2 (12.2.0.1.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.

Creating database manually on Oracle Database 12cR2 with ASM.

Peace 🙂

2 thoughts on “Oracle Database 12cR2 with ASM on Oracle Linux 6.7

Leave a Reply

Your email address will not be published. Required fields are marked *