Installing Oracle Database 12c R1 On Linux 6 With ASM
Installing Oracle Database 12c R1 On Linux 6 With ASM
Installing Oracle Database 12c R1 On Linux 6 With ASM
Tutorial Target
Installing Oracle Database 12c R1 on Linux 6 with ASM
Required Software Oracle VirtualBox software, version 5. This tutorial was implemented on VirtualBox 5.0.20 for Windows which
and Packages can be downloaded from Oracle web site.
Oracle Virtualbox VM appliance which has a fresh installation of Oracle Linux 6.7 (seed VM).
o The procedure to create it from scratch is documented here, or can be watched at Youtube here.
o Alternatively, you can download a pre-built one from here.
Oracle Grid Infrastructure 12c R1 (12.1.0.2) installation files. This can be downloaded from Oracle site.
Search for a page titled Oracle Grid Infrastructure Downloads. At the time of this writing, its link is here.
WinSCP utility: to copy the files to and from the Oracle VM box
Xming : to display the GUI windows in your hosting Windows PC. Just look for its download page, download it,
and install it using Full Installation option. It is straight forward.
Putty : which provides a command line prompt to connect to a Linux server from Windows
Note: If you have your own Virtual machine which has Oracle 12c Database installed in it, you can use it for the course practices and skip all
this practice. However, all the code examples in the course were derived from a virtual appliance that had been built using this practice.
Therefore, I recommend you to build a virtual appliance using this practice tutorial.
Practice Plan
1. Clone the Oracle Linux pre-built VM appliance from a seed
Note: Download the required software and packages before you start implementing the tutorial.
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 2
Installation Architecture
The tutorial builds a system with the following architecture diagram:
Host
SID: ORADB
SID: +ASM
ver.: 12.1.0.2
ver.: 12.1.0.2
Non-CDB
/u01/app/12.1.0/grid
/u01/app/oracle/
owner: grid
product/12.1.0/db_1
owner:oracle
+DATA ( 50GB )
+FRA ( 50GB )
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 3
Tutorial Procedure
1. Clone the Oracle Linux pre-built VM appliance from an Oracle VirtualBox which has a fresh
installation of Oracle Linux 6.7 64-bit
Make sure you have enough free disk space to clone the appliance
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 4
Depending on your hardware specs, it roughly may take between 10 and 40 minutes to finish.
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 5
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 6
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 7
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 8
First, make sure the Network adapter in the appliance settings is attached to Bridged Adapter. This will make your VM appliance appears in your
network as a separate host and will be assigned an IP address based on your network configuration. For more information, check out this
documentation.
When you make a clone of a VM appliance, the MAC address of the network card of the cloned appliance will be changed. This will make Linux
add a new device eth1 and the old one eth0 will be inactive. You need to fix this later in the practice.
Obtain the new MAC address from the Settings of the Clone appliance:
Open a terminal window and edit the udev rule for network devices /etc/udev/rules.d/70-persistent-net.rules
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 9
Delete the section lines in the file that belongs to the old MAC address, i.e. delete the rule for eth1
Reboot
Note: If you do not know the DNS IP address in your network, try the following command in the command prompt in the host machine
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 10
Obtain the IP address assigned to the VM appliance and take a note of it.
We are going to make the IP Address assigned to the appliance a static IP.
The utility window will open. Make sure the Device Configuration select and press ENTER
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 11
Enter the IP address of the machine and DNS and Gateway IP addresses taken from the previous step:
Note: if you find an asterisk symbol on the Use DHCP, you can remove it using the SPACE key on the keyboard.
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 12
IPADDR=192.168.1.144
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
192.168.1.144 srv1.localdomain srv1
Reboot
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 13
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 14
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 15
Open terminal window and as oracle make a backup copy of the bash profile file:
su - oracle
mv ~/.bash_profile ~/.bash_profile_bkp
vi ~/.bash_profile
# .bash_profile
# ---------------------------------------------------
# .bash_profile
# ---------------------------------------------------
# OS User: oracle
# Application: Oracle Database Software Owner
# Version: Oracle 12c Release 1
# ---------------------------------------------------
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# ---------------------------------------------------
# ORACLE_SID
# ---------------------------------------------------
# Specifies the Oracle system identifier (SID) CASE SENSITIVE
ORACLE_SID=ORADB; export ORACLE_SID
# ---------------------------------------------------
# ORACLE_UNQNAME
# ---------------------------------------------------
# Set ORACLE_UNQNAME equal to the database unique name.
# ---------------------------------------------------
ORACLE_UNQNAME=ORADB; export ORACLE_UNQNAME
# ---------------------------------------------------
# JAVA_HOME
# ---------------------------------------------------
JAVA_HOME=/usr/bin/java; export JAVA_HOME
# ---------------------------------------------------
# ORACLE_BASE
# ---------------------------------------------------
# Specifies the base of the Oracle directory structure
# for Optimal Flexible Architecture (OFA) compliant
# database software installations.
# ---------------------------------------------------
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
# ---------------------------------------------------
# ORACLE_HOME
# ---------------------------------------------------
# Directory containing the Oracle Database software.
# ---------------------------------------------------
ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1;
export ORACLE_HOME
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 16
# ---------------------------------------------------
# ORACLE_TERM
# ---------------------------------------------------
# Defines a terminal definition. If not set, it
# defaults to the value of your TERM environment
# variable. Used by all character mode products.
# ---------------------------------------------------
ORACLE_TERM=xterm; export ORACLE_TERM
# ---------------------------------------------------
# NLS_DATE_FORMAT
# ---------------------------------------------------
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"
export NLS_DATE_FORMAT
# ---------------------------------------------------
# TNS_ADMIN
# ---------------------------------------------------
# Specifies the directory containing the Oracle Net
# Services configuration files like listener.ora,
# tnsnames.ora, and sqlnet.ora.
# ---------------------------------------------------
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
# ---------------------------------------------------
# PATH
# ---------------------------------------------------
# Used by the shell to locate executable programs;
# must include the $ORACLE_HOME/bin directory.
# ---------------------------------------------------
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/local/bin
export PATH
# ---------------------------------------------------
# LD_LIBRARY_PATH
# ---------------------------------------------------
# Specifies the list of directories that the shared
# library loader searches to locate shared object
# libraries at runtime.
# ---------------------------------------------------
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
# ---------------------------------------------------
# CLASSPATH
# ---------------------------------------------------
# Specifies the directory or list of directories that
# contain compiled Java classes.
# ---------------------------------------------------
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
# ---------------------------------------------------
# THREADS_FLAG
# ---------------------------------------------------
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 17
Switch back to root user and create grid user and assign it to its groups:
su - grid
mv ~/.bash_profile ~/.bash_profile_bkp
vi ~/.bash_profile
# .bash_profile
# OS User: grid
# Application: Oracle Grid Infrastructure
# Version: Oracle 12c Release 1
# ---------------------------------------------------
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# ---------------------------------------------------
# ORACLE_SID
# ---------------------------------------------------
# Specifies the Oracle system identifier (SID)
# for the Automatic Storage Management (ASM)instance
# running on this node.
# ---------------------------------------------------
ORACLE_SID=+ASM; export ORACLE_SID
# ---------------------------------------------------
# JAVA_HOME
# ---------------------------------------------------
# Specifies the directory of the Java SDK and Runtime
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 18
# Environment.
# ---------------------------------------------------
JAVA_HOME=/usr/bin/java; export JAVA_HOME
# ---------------------------------------------------
# ORACLE_BASE
# ---------------------------------------------------
# Specifies the base of the Oracle directory structure
# for Optimal Flexible Architecture (OFA) compliant
# installations. The Oracle base directory for the
# grid installation owner is the location where
# diagnostic and administrative logs, and other logs
# associated with Oracle ASM and Oracle Clusterware
# are stored.
# ---------------------------------------------------
ORACLE_BASE=/u01/app/grid; export ORACLE_BASE
# ---------------------------------------------------
# ORACLE_HOME
# ---------------------------------------------------
# Specifies the directory containing the Oracle
# Grid Infrastructure software. For grid
# infrastructure for a cluster installations, the Grid
# home must not be placed under one of the Oracle base
# directories, or under Oracle home directories of
# Oracle Database installation owners, or in the home
# directory of an installation owner. During
# installation, ownership of the path to the Grid
# home is changed to root. This change causes
# permission errors for other installations.
# ---------------------------------------------------
ORACLE_HOME=/u01/app/12.1.0/grid; export ORACLE_HOME
# ---------------------------------------------------
# ORACLE_TERM
# ---------------------------------------------------
ORACLE_TERM=xterm; export ORACLE_TERM
# ---------------------------------------------------
# TNS_ADMIN
# ---------------------------------------------------
# Specifies the directory containing the Oracle Net
# Services configuration files like listener.ora,
# tnsnames.ora, and sqlnet.ora.
# ---------------------------------------------------
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
# ---------------------------------------------------
# PATH
# ---------------------------------------------------
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/local/bin
export PATH
# ---------------------------------------------------
# TEMP, TMP, and TMPDIR
export TEMP=/tmp
export TMPDIR=/tmp
# ---------------------------------------------------
# UMASK
# ---------------------------------------------------
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 19
umask 022
Create Oracle software grid home directories. Logout from grid and login as root, then perform the following:
mkdir -p /u01/app/oracle
mkdir -p /u01/app/grid
mkdir -p /u01/app/12.1.0/grid
chown -R grid:oinstall /u01
chown oracle:oinstall /u01/app/oracle
chmod -R 775 /u01
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 20
Install Oracle ASMLib package (it takes a few minutes to download and install, the VM machine should be able to connect to the Internet)
The oracleasm kernel driver for the 64-bit (x86_64) Red Hat Compatible Kernel for Oracle Linux 6 can be installed manually from ULN or
http://public-yum.oracle.com using the yum tool:
Further information can be obtained from a page in Oracle site titled:"Oracle ASMLib Downloads for Oracle Linux 6"
http://www.oracle.com/technetwork/server-storage/linux/asmlib/ol6-1709075.html
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
kmod-oracleasm x86_64 2.0.8-6.el6_7 public_ol6_latest 35 k
Transaction Summary
================================================================================
Install 1 Package(s)
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 21
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 22
List the disks in the OS, you should see the disks created earlier:
In order to use those disks with ASM, partitions should be created in them.
Do this for all the disks which have the sizes 2,50,50 GB. In my case they were sdb,sdc,sdd
Verify:
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 23
Reboot!
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 24
Use WinSCP to copy Oracle Grid Infrastructure installation files to the VM appliance. As grid user, I created the directory /home/grid/source
to copy the installation files to it
su - grid
mkdir source
After the files were copied, as root, make grid user and oinstall group the owner of the installation files:
su -
chown grid:oinstall /home/grid/source/linuxamd64_12102_grid_*
Run Xming to view Oracle GUI Installer windows in your host Windows client machine. You should see its icon in the task bar mini icons.
Then, you need to configure PyTTY session with port forwarding enabled to be able to display GUI windows via Xming server and test it with
xclock command.
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 25
Xclock is not installed in our appliance. To install it, simply run the following command:
Run xclock to test the configuration changes. You should see the clock application running in your host Windows machine:
Switch to grid user then use xauth command to set our session cookies for X11 forwarding to work
cd source
unzip linuxamd64_12102_grid_1of2.zip > /dev/null
unzip linuxamd64_12102_grid_2of2.zip > /dev/null
rm linuxamd64_12102_grid_*
cd grid
./runInstaller
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 26
In the next wizard window, we expect to see the ASM disks. But they actually did not appear in our case, as shown below:
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 27
To fix this, we need to change the discovery path. Click on Change Discovery Path button and change it to /dev/oracleasm/disks/*
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 28
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 29
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 30
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 31
Do not close the Putty command prompt window at this stage. Go to next section and execute the commands over there using the same Putty
window. If you have already closed it, start it, login as root, and re-run the xauth list again, switch to grid, and re-run the commands xauth add
and export DISPLAY as shown earlier.
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 32
asmca
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 33
Although it is optional, if your disk free space allows it, Id recommend shutting down the VM and taking a backup copy of it at this stage.
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 34
Switch to oracle user and create a directory to save the installation files in it:
su - oracle
mkdir source
cd source
unzip linuxamd64_12102_database_1of2.zip > /dev/null
unzip linuxamd64_12102_database_2of2.zip > /dev/null
rm linuxamd64_12102_database_*
Similar to what we have done with grid, get the Xming working for current oracle user session, as follows:
cd database/
./runInstaller
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 35
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 36
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 37
When prompt, the run following script as root in a separate prompt window:
/u01/app/oracle/product/12.1.0/db_1/root.sh
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 38
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 39
dbca
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 40
Enter the SID. Make sure it is in uppercase, because it should be the same value as the ORACLE_SID environment variable.
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 41
No need to create a listener here. The database will be registered in the listener created in the Grid home. Just click on Next button.
I had issues with selecting from the drop list items in the following windows with my mouse. It worked fine with me using the keyboard.
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 42
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 43
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 44
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 45
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 46
echo $ORACLE_SID
ORADB
sqlplus system
If you want to test from hosting machine, use the IP address based url, for example: https://192.168.1.144:5500/em
by Ahmed Baraka
Practice Installing Oracle Database 12c R1 on Linux 6 with ASM | page: 47
vi /u01/app/oracle/product/12.1.0/db_1/network/admin/sqlnet.ora
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
vi /u01/app/oracle/product/12.1.0/db_1/network/admin/tnsnames.ora
ORADB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = srv1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORADB.localdomain)
)
)
sqlplus system/oracle@oradb
#as root:
shutdown -h now
by Ahmed Baraka