Install Oracle Grid Infrastructure 19c and Oracle Database 19c on Linux
This post describes how to setup Oracle Grid Infrastructure 19c (Oracle ASM and Oracle Restart) and Oracle Database 19c including a Database orcl on RHEL 8 running as a Oracle VirtualBox guest on Windows.
Preparation
Download the GI and DB software from Oracle and save it for example to c:\sw\oracle\gi\19c_linux and c:\sw\oracle\db\19c_linux. Then we need a new VM as described here. To be able to use ASM we need some additional disk devices. Run this in a command prompt on the VirtualBox host:
set "VHOST="
(set /p VHOST=Enter VM name ^(e.g. lin1^):
rem add and attach 2 50g disks for diskgroup +DATA
call vboxmanage createmedium disk --filename c:\vms\%VHOST%\%VHOST%_2.vdi --sizebyte=53687091200 --variant Standard
call vboxmanage createmedium disk --filename c:\vms\%VHOST%\%VHOST%_3.vdi --sizebyte=53687091200 --variant Standard
call vboxmanage storageattach %VHOST% --storagectl "SATA" --port 1 --device 0 --type hdd --medium c:\vms\%VHOST%\%VHOST%_2.vdi
call vboxmanage storageattach %VHOST% --storagectl "SATA" --port 2 --device 0 --type hdd --medium c:\vms\%VHOST%\%VHOST%_3.vdi
rem add and attach 3 14g disks for diskgroup +FRA
call vboxmanage createmedium disk --filename c:\vms\%VHOST%\%VHOST%_4.vdi --sizebyte=15032385536 --variant Standard
call vboxmanage createmedium disk --filename c:\vms\%VHOST%\%VHOST%_5.vdi --sizebyte=15032385536 --variant Standard
call vboxmanage createmedium disk --filename c:\vms\%VHOST%\%VHOST%_6.vdi --sizebyte=15032385536 --variant Standard
call vboxmanage storageattach %VHOST% --storagectl "SATA" --port 3 --device 0 --type hdd --medium c:\vms\%VHOST%\%VHOST%_4.vdi
call vboxmanage storageattach %VHOST% --storagectl "SATA" --port 4 --device 0 --type hdd --medium c:\vms\%VHOST%\%VHOST%_5.vdi
call vboxmanage storageattach %VHOST% --storagectl "SATA" --port 5 --device 0 --type hdd --medium c:\vms\%VHOST%\%VHOST%_6.vdi)
Now we create the users oracle and grid on the linux VM, unzip the software and set some kernel parameters:
bash -c "# add groups and users
groupadd -g 2000 oinstall ; groupadd -g 2001 dba ; groupadd -g 2002 asmdba ; groupadd -g 2003 asmadmin
useradd -u 2000 -g 2000 -G disk,dba,asmdba,vboxsf oracle && echo 'oracle:changeme'|chpasswd
useradd -u 2001 -g 2000 -G disk,dba,asmdba,asmadmin,vboxsf grid && echo 'grid:changeme'|chpasswd
# create environment files
echo 'export ORACLE_HOME=/u01/app/19.0.0/grid' > ~grid/grid.env
echo 'export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/jdk/bin:\$ORACLE_HOME/OPatch:\$PATH' >> ~grid/grid.env
echo 'export ORACLE_SID=+ASM' >> ~grid/grid.env
chown grid:oinstall ~grid/grid.env
echo 'source ~/grid.env' >> ~grid/.bash_profile
echo 'export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1' > ~oracle/ora19.env
echo 'export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/jdk/bin:\$ORACLE_HOME/OPatch:\$PATH' >> ~oracle/ora19.env
echo 'export ORACLE_SID=orcl' >> ~oracle/ora19.env
chown oracle:oinstall ~oracle/ora19.env
echo 'source ~/ora19.env' >> ~oracle/.bash_profile
# create directories
mkdir -p /u01 && chmod 775 /u01 && chown grid:oinstall /u01
mkdir -p /u01/app/19.0.0/grid # GRID_HOME
mkdir -p /u01/app/grid # GRID_BASE
mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1 # ORACLE_HOME
chown grid:oinstall /u01/app && chown -R grid:oinstall /u01/app/19.0.0 && chown grid:oinstall /u01/app/grid
chown -R oracle:oinstall /u01/app/oracle # ORACLE_BASE
chmod 775 /u01/app && chmod -R 775 /u01/app/19.0.0 && chmod 775 /u01/app/grid
chmod -R 775 /u01/app/oracle
# unpack sw
echo 'Unpacking Grid Infrastructure sw. Please wait...'
if [ \`ls /u01/app/19.0.0/grid|wc -l\` -eq 0 ] ; then
su - grid -c 'cd /u01/app/19.0.0/grid ; cp /sw/oracle/gi/19c_linux/LINUX.X64_193000_grid_home.zip . ; unzip -q ./LINUX.X64_193000_grid_home.zip ; rm -f ./LINUX.X64_193000_grid_home.zip'
fi
echo 'Unpacking Database sw. Please wait...'
if [ \`ls /u01/app/oracle/product/19.0.0/dbhome_1|wc -l\` -eq 0 ] ; then
su - oracle -c 'cd /u01/app/oracle/product/19.0.0/dbhome_1 ; cp /sw/oracle/db/19c_linux/LINUX.X64_193000_db_home.zip . ; unzip -q ./LINUX.X64_193000_db_home.zip ; rm -f LINUX.X64_193000_db_home.zip'
fi
if ! rpm -q cvuqdisk ; then rpm -i /u01/app/19.0.0/grid/cv/rpm/cvuqdisk-1.0.10-1.rpm ; fi
# adjust parameters
echo 'fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576' > /etc/sysctl.d/97-oracle-database-sysctl.conf
/sbin/sysctl --system"
Grid Infrastructure Installation
The following will perform a silent installation of the GI. If you prefer the GUI installation take a look here:
cat > ~grid/rsp_grid.rsp << EOF
oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v19.0.0
INVENTORY_LOCATION=/u01/app/oraInventory
oracle.install.option=HA_CONFIG
ORACLE_BASE=/u01/app/grid
oracle.install.asm.OSDBA=asmdba
oracle.install.asm.OSASM=asmadmin
oracle.install.crs.config.scanType=LOCAL_SCAN
oracle.install.crs.config.ClusterConfiguration=STANDALONE
oracle.install.crs.config.configureAsExtendedCluster=false
oracle.install.crs.config.gpnp.configureGNS=false
oracle.install.crs.config.autoConfigureClusterNodeVIP=false
oracle.install.crs.config.gpnp.gnsOption=CREATE_NEW_GNS
oracle.install.crs.configureGIMR=false
oracle.install.asm.configureGIMRDataDG=false
oracle.install.crs.config.sharedFileSystemStorage.ocrLocations=
oracle.install.crs.config.useIPMI=false
oracle.install.asm.diskGroup.name=DATA
oracle.install.asm.diskGroup.redundancy=NORMAL
oracle.install.asm.diskGroup.AUSize=4
oracle.install.asm.diskGroup.disksWithFailureGroupNames=/dev/sdb,,/dev/sdc,
oracle.install.asm.diskGroup.disks=/dev/sdb,/dev/sdc
oracle.install.asm.diskGroup.diskDiscoveryString=/dev/sd*
oracle.install.asm.gimrDG.AUSize=1
oracle.install.asm.configureAFD=false
oracle.install.crs.configureRHPS=false
oracle.install.crs.config.ignoreDownNodes=false
oracle.install.config.managementOption=NONE
oracle.install.config.omsPort=0
oracle.install.crs.rootconfig.executeRootScript=true
oracle.install.crs.rootconfig.configMethod=ROOT
oracle.install.asm.monitorPassword=changeme
oracle.install.asm.SYSASMPassword=changeme
EOF
chown grid:oinstall ~grid/rsp_grid.rsp
su - grid -c "export CV_ASSUME_DISTID=OL7 && echo changeme|/u01/app/19.0.0/grid/gridSetup.sh -silent -responseFile /home/grid/rsp_grid.rsp"
We can now check if the GI services are running:
su - grid -c "source ~/grid.env ; crsctl stat res -t"
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE lin4 STABLE
ora.FRA.dg
ONLINE ONLINE lin4 STABLE
ora.LISTENER.lsnr
ONLINE ONLINE lin4 STABLE
ora.asm
ONLINE ONLINE lin4 Started,STABLE
ora.ons
OFFLINE OFFLINE lin4 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
1 ONLINE ONLINE lin4 STABLE
ora.diskmon
1 OFFLINE OFFLINE STABLE
ora.evmd
1 ONLINE ONLINE lin4 STABLE
--------------------------------------------------------------------------------
If there were errors and for example the asm Resource is missing you can uninstall the Grid Infrastructure software as described here and continue the installation from here.
Next we create a Fast Recovery Area (FRA) diskgroup:
su - grid -c "
sqlplus / as sysasm << EOF
create diskgroup fra normal redundancy
disk '/dev/sdd'
disk '/dev/sde'
disk '/dev/sdf';
EOF"
Database Installation
The following will perform a silent installation of the DB. If you prefer the GUI installation take a look here:
cat > ~oracle/rsp_db.rsp << EOF
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSBACKUPDBA_GROUP=dba
oracle.install.db.OSDGDBA_GROUP=dba
oracle.install.db.OSKMDBA_GROUP=dba
oracle.install.db.OSRACDBA_GROUP=dba
oracle.install.db.rootconfig.executeRootScript=true
oracle.install.db.rootconfig.configMethod=ROOT
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.ConfigureAsContainerDB=false
oracle.install.db.config.starterdb.memoryOption=false
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.managementOption=DEFAULT
oracle.install.db.config.starterdb.omsPort=0
oracle.install.db.config.starterdb.enableRecovery=false
EOF
chown oracle:oinstall ~oracle/rsp_db.rsp
su - oracle -c "export CV_ASSUME_DISTID=OL7 && echo changeme|/u01/app/oracle/product/19.0.0/dbhome_1/runInstaller -silent -responseFile /home/oracle/rsp_db.rsp"
Now we create the orcl database:
su - oracle -c "dbca -silent -createDatabase \
-gdbName orcl.fritz.box -sid orcl -templateName General_Purpose.dbc \
-memoryPercentage 40 -databaseType MULTIPURPOSE \
-sysPassword changeme -systemPassword changeme -pdbAdminPassword changeme \
-storageType ASM -datafileDestination +DATA \
-recoveryAreaDestination +FRA -recoveryAreaSize 14000 \
-createAsContainerDatabase true -pdbName pdb1"
The database is now ready to use and we can login with:
# type exit to logout
su - oracle -c "sqlplus / as sysdba"
Useful commands
If you want to apply an RU patch you can do so as described here.
If you would like to install Oracle Grid Infrastructure with a GUI (Oracle Universal Installer) you can do that with:
# as the grid user start a X terminal and run
export CV_ASSUME_DISTID=OL7
/u01/app/19.0.0/grid/gridSetup.sh
If you would like to install Oracle Database with a GUI (Oracle Universal Installer) you can do that with:
# as the oracle user start a X terminal and run
export CV_ASSUME_DISTID=OL7
/u01/app/oracle/product/19.0.0/dbhome_1/runInstaller
To delete the orcl database:
# as oracle:
dbca -silent -deleteDatabase -sourceDB orcl -sysDBAUserName sys -forceArchiveLogDeletion -sysDBAPassword changeme -sid orcl
If you need to delete the 5 additional disk devices for ASM:
set "VHOST="
(set /p VHOST=Enter VM name ^(e.g. lin1^):
call vboxmanage storageattach %VHOST% --storagectl "SATA" --port 1 --device 0 --type hdd --medium none
call vboxmanage storageattach %VHOST% --storagectl "SATA" --port 2 --device 0 --type hdd --medium none
call vboxmanage storageattach %VHOST% --storagectl "SATA" --port 3 --device 0 --type hdd --medium none
call vboxmanage storageattach %VHOST% --storagectl "SATA" --port 4 --device 0 --type hdd --medium none
call vboxmanage storageattach %VHOST% --storagectl "SATA" --port 5 --device 0 --type hdd --medium none
call vboxmanage closemedium disk c:\vms\%VHOST%\%VHOST%_2.vdi --delete
call vboxmanage closemedium disk c:\vms\%VHOST%\%VHOST%_3.vdi --delete
call vboxmanage closemedium disk c:\vms\%VHOST%\%VHOST%_4.vdi --delete
call vboxmanage closemedium disk c:\vms\%VHOST%\%VHOST%_5.vdi --delete
call vboxmanage closemedium disk c:\vms\%VHOST%\%VHOST%_6.vdi --delete)
To uninstall the Grid Infrastructure software in silent mode you can do the following. If you want to recreate the installation afterwards continue here.
su - grid -c 'export CV_ASSUME_DISTID=OL7 && /u01/app/19.0.0/grid/deinstall/deinstall -silent -checkonly -local -o /tmp && \
/u01/app/19.0.0/grid/deinstall/deinstall -silent -paramfile=/tmp/deinstall_OraGI19Home1.rsp'
# run the rootdeinstall.sh script as root
/tmp/`ls -atr /tmp|grep deinstall|tail -1`/rootdeinstall.sh
rm -rf /etc/oraInst.loc ; rm -rf /opt/ORCLfmap ; rm -rf /etc/oratab
Leave a Reply