Saturday, July 6, 2024
Oracle Database 23ai Free RPM Installation On Oracle Linux 8 (OL8)
Wednesday, April 6, 2022
Oracle Database 21c Express Edition (XE) RPM Installation On Oracle Linux 7 (OL7) and 8 (OL8)
This article describes the Oracle Database 21c Express Edition (XE) RPM installation on Oracle Linux 7 (OL7) and 8 (OL8) 64-bit. The article is based on a server installation with a minimum of 2G swap and secure Linux set to permissive. An example of this type of Linux installation can be seen here (OL7 or OL8).
◉ Oracle Installation
Download the 21c XE RPM file for your distribution from the Express Edition (XE) download page here.
With the RPM file downloaded, we can install the Oracle prerequisites and software using the following command as the "root" user. It automatically pulls down all dependencies, including the "oracle-database-preinstall-21c" package. If we do this the "oracle" user doesn't have a home directory created, so I install the preinstall package first, so the "oracle" user is as I expect it. The additional command is included below, but commented out.
# OL7
#yum install -y oracle-database-preinstall-21c
yum -y localinstall oracle-database-xe-21c-1.0-1.ol7.x86_64.rpm
# OL8
#dnf install -y oracle-database-preinstall-21c
dnf -y localinstall oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm
On RHEL you will need to manually get the prerequisites RPM from the Yum repository and run it manually before installing the database RPM.
# RHEL7
curl -o oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm
yum -y localinstall oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm
rm oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm
# RHEL8
curl -o oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/getPackage/oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm
yum -y localinstall oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm
rm oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm
◉ Create Database
We can do some minor configuration by editing the "/etc/sysconfig/oracle-xe-21c.conf" file before before continuing, but we don't need to.
Running the following script as the "root" user creates a database called "XE", with a pluggable database (PDB) called "XEPDB1". It's interactive by default as we have to specify a password, which is used for the SYS, SYSTEM and PDBADMIN users. There is an example of running it silently also.
# Interactive
/etc/init.d/oracle-xe-21c configure
# Silent
/etc/init.d/oracle-xe-21c configure <<EOF
SysPassword1
SysPassword1
EOF
◉ Auto-Start
We configure the database to auto-start using the following command from the "root" user.
systemctl start oracle-xe-21c
systemctl enable oracle-xe-21c
◉ Vagrant Example
If you want to see it in action, you might want to try these Vagrant builds.
Source: oracle-base.com
Monday, September 6, 2021
Oracle Database 21c RPM Installation On Oracle Linux 7 (OL7) and Oracle Linux 8 (OL8)
Oracle 21c can be installed on Oracle Linux using an RPM. This article describes the RPM installation of Oracle Database 21c 64-bit on Oracle Linux 7 (OL7) 64-bit or Oracle Linux 8 (OL8) 64-bit. The article is based on a server installation with a minimum of 2G swap and secure Linux set to permissive.
1. Hosts File
The "/etc/hosts" file must contain a fully qualified name for the server.
<IP-address> <fully-qualified-machine-name> <machine-name>
For example.
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
192.168.56.107 ol8-21.localdomain ol8-21
Set the correct hostname in the "/etc/hostname" file.
ol8-21.localdomain
2. Oracle Installation
Download the relevant RPM from download page here.
◉ OL7 : oracle-database-ee-21c-1.0-1.ol7.x86_64.rpm
◉ OL8 : oracle-database-ee-21c-1.0-1.ol8.x86_64.rpm
With the RPM file downloaded, you can install the Oracle prerequisites and software using the following command as the "root" user. It automatically pulls down all dependencies, including the "oracle-database-preinstall-21c" package. If you do this the "oracle" user doesn't have a home directory created, so I install the preinstall package first, so the "oracle" user is as I expect it. The additional command is included below, but commented out.
# OL7
# yum install -y oracle-database-preinstall-21c
yum -y localinstall oracle-database-ee-21c-1.0-1.ol7.x86_64.rpm
# OL8
# dnf install -y oracle-database-preinstall-21c
dnf -y localinstall oracle-database-ee-21c-1.0-1.ol8.x86_64.rpm
On RHEL you will need to manually get the prerequisites RPM from the Yum repository and run it manually before installing the database RPM.
# RHEL7
curl -o oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm
yum -y localinstall oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm
rm oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm
# RHEL8
curl -o oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/getPackage/oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm
yum -y localinstall oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm
rm oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm
The ORACLE_HOME for the software installation is "/opt/oracle/product/21c/dbhome_1".
3. Create Database
In addition to the software installation, the RPM creates a script that allows you to create a demo database called "ORCLCDB", with a pluggable database (PDB) called "ORCLPDB1".
# /etc/init.d/oracledb_ORCLCDB-21c configure
Configuring Oracle Database ORCLCDB.
Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
46% complete
Completing Database Creation
51% complete
54% complete
Creating Pluggable Databases
58% complete
77% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/opt/oracle/cfgtoollogs/dbca/ORCLCDB.
Database Information:
Global Database Name:ORCLCDB
System Identifier(SID):ORCLCDB
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log" for further details.
Database configuration completed successfully. The passwords were auto generated, you must change them by connecting to the database using 'sqlplus / as sysdba' as the oracle user.
#
You can of course create a database in the normal way, using the Database Configuration Assistant (DBCA). You don't have to use this script.
4. Thoughts
Here are some thoughts about this method of installation.
◉ The mechanism is designed for a software-only installation of the Oracle database software. It is not a single command to get Oracle running. As a result it doesn't feel particularly simpler than doing a regular silent installation of the database software, but people with less experience may disagree.
◉ The RPM can only be used to install the software, not update it. This is a "one-shot" solution.
◉ You have no control of the software installation itself. If you have a corporate standard you use for your installations, this is not the solution for you. Remember, the ORACLE_HOME for the software installation is "/opt/oracle/product/21c/dbhome_1".
◉ Even with a ULN subscription, it is unlikely you would want to pull this software down for each installation. You would need to create a local Yum repository to host it.
◉ It's an interesting exercise, but I would not consider using this approach for anything other than demos at this time.
Source: oracle-base.com
Friday, September 3, 2021
Oracle Database 21c RAC On Oracle Linux 8 Using VirtualBox and Vagrant
This article describes the "hands-off" installation of Oracle Database 21c RAC on Oracle Linux 8 using VirtualBox and Vagrant with no additional shared disk devices.
◉ TL;DR
If you are comfortable with VirtualBox, Vagrant and RAC you might want to jump straight to the GitHub repository and use the basic instructions here.
◉ Introduction
One of the biggest obstacles preventing people from setting up test RAC environments is the requirement for shared storage. In a production environment, shared storage is often provided by a SAN or high-end NAS device, but both of these options are very expensive when all you want to do is get some experience installing and using RAC. A cheaper alternative is to use virtualization to fake the shared storage.
Using VirtualBox you can run multiple Virtual Machines (VMs) on a single server, allowing you to run both RAC nodes on a single machine. In addition, it allows you to set up shared virtual disks, overcoming the obstacle of expensive shared storage.
◉ Required Software
Download and install the following software on your PC. If you can't figure out this step, you probably shouldn't be considering a RAC installation.
- Vagrant
- A Git client for your PC, so you can clone the vagrant repository.
You will also need to download the 21c grid and database software
- Grid :LINUX.X64_213000_grid_home.zip
- Database : LINUX.X64_213000_db_home.zip
◉ Clone Repository
Pick an area on your PC file system to act as the base for this git repository and issue the following command.
git clone https://github.com/oraclebase/vagrant.git
Copy the Oracle software under the "..../software/" directory. From the "rac/ol8_21" subdirectory, the structure should look like this.
$ tree
.
+--- config
| +--- install.env
| +--- vagrant.yml
+--- dns
| +--- scripts
| | +--- root_setup.sh
| | +--- setup.sh
| +--- Vagrantfile
+--- node1
| +--- scripts
| | +--- oracle_create_database.sh
| | +--- oracle_db_software_installation.sh
| | +--- oracle_grid_software_config.sh
| | +--- oracle_grid_software_installation.sh
| | +--- oracle_user_environment_setup.sh
| | +--- root_setup.sh
| | +--- setup.sh
| +--- Vagrantfile
+--- node2
| +--- scripts
| | +--- oracle_user_environment_setup.sh
| | +--- root_setup.sh
| | +--- setup.sh
| +--- Vagrantfile
+--- README.md
+--- shared_scripts
| +--- configure_chrony.sh
| +--- configure_hosts_base.sh
| +--- configure_hosts_scan.sh
| +--- configure_shared_disks.sh
| +--- install_os_packages.sh
| +--- oracle_software_patch.sh
| +--- prepare_u01_disk.sh
+--- software
| +--- LINUX.X64_213000_db_home.zip
| +--- LINUX.X64_213000_grid_home.zip
| +--- put_software_here.txt
$
When you clone the repository on Windows it is important you maintain the line terminators. All ".sh" scripts are run inside the Linux VMs, so they need UNIX style line terminators. If your Git client is set to convert all files to Windows style line terminators on a clone/pull, you will run into problems when those scripts are called from Linux.
◉ Amend File Paths
The "config" directory contains a "install.env" and a "vagrant.yml" file. The combination of these two files contain all the config used for this build. You can alter the configuration of the build here, but remember to make sure the combination of the two stay consistent.
At minimum you will have to amend the following paths in the "vagrant.yml" file, providing suitable paths for the shared disks on your PC.
asm_crs_disk_1: /u05/VirtualBox/shared/ol8_21_rac/asm_crs_disk_1.vdi
asm_crs_disk_2: /u05/VirtualBox/shared/ol8_21_rac/asm_crs_disk_2.vdi
asm_crs_disk_3: /u05/VirtualBox/shared/ol8_21_rac/asm_crs_disk_3.vdi
asm_crs_disk_size: 2
asm_data_disk_1: /u05/VirtualBox/shared/ol8_21_rac/asm_data_disk_1.vdi
asm_data_disk_size: 40
asm_reco_disk_1: /u05/VirtualBox/shared/ol8_21_rac/asm_reco_disk_1.vdi
asm_reco_disk_size: 20
For example, if you were working on a Windows PC, you might create a path called "C:\VirtualBox\shared\ol8_21_rac" and use the following settings.
asm_crs_disk_1: C:\VirtualBox\shared\ol8_21_rac\asm_crs_disk_1.vdi
asm_crs_disk_2: C:\VirtualBox\shared\ol8_21_rac\asm_crs_disk_2.vdi
asm_crs_disk_3: C:\VirtualBox\shared\ol8_21_rac\asm_crs_disk_3.vdi
asm_crs_disk_size: 2
asm_data_disk_1: C:\VirtualBox\shared\ol8_21_rac\asm_data_disk_1.vdi
asm_data_disk_size: 40
asm_reco_disk_1: C:\VirtualBox\shared\ol8_21_rac\asm_reco_disk_1.vdi
asm_reco_disk_size: 20
If you don't alter them, they will get written to "C:\u05\VirtualBox\shared\ol8_21_rac".
◉ Build the RAC
The following commands will leave you with a functioning RAC installation.
Start the DNS server.
cd dns
vagrant up
Start the second node of the cluster. This must be running before you start the first node.
cd ../node2
vagrant up
Start the first node of the cluster. This will perform all of the installations operations. Depending on the spec of the host system, this could take a long time. On one of my servers it took about 3.5 hours to complete.
cd ../node1
vagrant up
◉ Turn Off RAC
Perform the following to turn off the RAC cleanly.
cd node2
vagrant halt
cd ../node1
vagrant halt
cd ../dns
vagrant halt
◉ Remove Whole RAC
The following commands will destroy all VMs and the associated files, so you can run the process again.
cd node2
vagrant destroy -f
cd ../node1
vagrant destroy -f
cd ../dns
vagrant destroy -f
◉ Description of the Build
From here on we will describe the sections in the build process. Remember, all parameters come from the following two files.
◉ DNS Server Build
The DNS server build is really simple. You can see an example of the vagrant output I received here. This VM took about 2 minutes to build.
The Vagrantfile contains the definition of the VirtualBox VM that will be built, using the parameters from the vagrant.yml file. The default values produce a VM with the following characteristics.
- OS : Oracle Linux 8
- VM Name : ol8_21_dns
- CPUs : 1
- RAM : 1G
- NIC 1 : NAT Network
- NIC 2 : 192.168.56.100 - An IP on the "public" network used by the cluster nodes.
- Disk 1 : The box disk with the operating system pre-installed.
The last stage of the VM build it to run the setup.sh script, which simply runs the root_setup.sh script.
The root_setup.sh script does the following.
- Sources the install.env file to make sure all environment variables for the build are present.
- Gets the latest Yum repository file.
- Adds entries to the "/etc/hosts" file in the VM for the public, private and virtual IP addresses of each RAC node, as well as the SCAN IP addresses. These are built using environment variables.
- Installs and enables Dnsmasq. This presents the contents of the "/etc/hosts" file as a DNS server, which is a much simpler alternative to using BIND for the DNS setup. It's not going to be perfect for every DNS solution, but it is really good for this.
Once the vagrant up command completes you will be left with a functioning DNS server ready for use with your RAC.
If you have any problems with the DNS build, don't continue with the RAC nodes until you fix them.
◉ RAC Node 2 Build
The basic setup of the OS for the RAC nodes are very similar, but node 2 doesn't perform any installation actions, so we need this in place before starting node 1. You can see an example of the vagrant output I received here. This VM took about 5 minutes to build.
The Vagrantfile contains the definition of the VirtualBox VM that will be built, using the parameters from the vagrant.yml file. The default values produce a VM with the following characteristics.
- OS : Oracle Linux 8
- VM Name : ol8_21_rac2
- CPUs : 4
- RAM : 6144M
- NIC 1 : NAT Network
- NIC 2 : 192.168.56.102 - An IP on the "public" network used by the cluster nodes.
- NIC 3 : 192.168.1.102 - An IP on the "private" network used by the cluster nodes.
- Disk 1 : The box disk with the operating system pre-installed.
- Disk 2 : A disk which will be local to the VM, used for the "/u01" mount point.
- Disk 3 : CRS disk 1.
- Disk 4 : CRS disk 2.
- Disk 5 : CRS disk 3.
- Disk 6 : DATA disk.
- Disk 7 : RECO disk.
The last stage of the VM build it to run the setup.sh script, which simply runs the root_setup.sh.
The root_setup.sh script does the following.
- Sources the install.env file to make sure all environment variables for the build are present.
- Run prepare_u01_disk.sh to partition the "/dev/sdb" local disk, create a file system on the resulting "/dev/sdb1" partition, add an entry into the "/etc/fstab" so it mounts automatically in future, and manually mount it for the first time.
- Run install_os_packages.sh to configure the Yum repositories and install the OS packages needed for the RAC node. This includes the "oracle-database-preinstall-21c" package, which does some of the OS setup for us. It also includes all packages listed in the documentation, even though some are already installed by the preinstall package. Some extra packages are included just because they are needed by the automation of the setup.
- Set the passwords for the "root" and "oracle" users. This is pretty stupid, but we need this to make the whole process silent.
- Run configure_hosts_base.sh to add the public, private and virtual addresses to the "/etc/hosts" file. We don't need the SCAN addresses as they are provided by the DNS. We could use the DNS to provide the local IP addresses too, but I prefer to have these here also.
- Configure the "/etc/resolv.conf" to point to the DNS server VM.
- Run configure_chrony.sh to configure Chrony, so we don't get NTP errors during the installation.
- Run configure_shared_disks.sh to configure the shared disks used by ASM. If the ASM disks aren't already partitioned, it partitions them. It then configures UDEV, so the disks are mounted correctly in this VM after each restart.
- Set the hostname.
- Run oracle_user_environment_setup.sh to create the environment scripts for the "oracle" user, create the GRID_HOME and DB_HOME directories, and partially prepare password-less authentication (user equivalence) for the "oracle" user. This process will be completed by node 1.
- Source the "/home/oracle/scripts/setEnv.sh" script the previous script created.
- Partially prepare password-less authentication (user equivalence) for the "root" user. This process will be completed by node 1. This is not necessary for RAC to function, but it is necessary for the automation of this installation.
Once the vagrant up command completes you will be left with a prepared RAC node 2.
If you have any problems with the node 2 build, don't continue with the node 1 build until you fix them.
◉ RAC Node 1 Build
The basic setup of the OS for the RAC nodes are very similar, but unlike node 2, the node 1 setup also includes the software installation and configuration actions. Remember, the DNS and node 2 VMs should be running before starting this node. You can see an example of the vagrant output I received here. This VM took about 50 minutes to build.
The Vagrantfile contains the definition of the VirtualBox VM that will be built, using the parameters from the vagrant.yml file. The default values produce a VM with the following characteristics.
- OS : Oracle Linux 8
- VM Name : ol8_21_rac1
- CPUs : 2
- RAM : 7168M
- NIC 1 : NAT Network
- NIC 2 : 192.168.56.101 - An IP on the "public" network used by the cluster nodes.
- NIC 3 : 192.168.1.101 - An IP on the "private" network used by the cluster nodes.
- Disk 1 : The box disk with the operating system pre-installed.
- Disk 2 : A disk which will be local to the VM, used for the "/u01" mount point.
- Disk 3 : CRS disk 1.
- Disk 4 : CRS disk 2.
- Disk 5 : CRS disk 3.
- Disk 6 : DATA disk.
- Disk 7 : RECO disk.
The last stage of the VM build it to run the setup.sh script, which simply runs the root_setup.sh.
The root_setup.sh script does all of the same actions as the node 2 build described above, but it also includes the installation and configuration steps. Rather than repeat the explanations of the common steps we will just focus on the differences here.
- In addition to repeating the password-less authentication (user equivalence) steps from node 2 for the "oracle" and "root" users, the node 1 root_setup.sh script uses sshpass and ssh-copy-id to complete the password-less authentication.
- Install the "cvuqdisk" package on node 1 and node 2.
- Run oracle_grid_software_installation.sh to perform a silent installation of the Grid Infrastructure software.
- Run "orainstRoot.sh" on node 1 then node 2.
- Run "root.sh" on node 1 then node 2.
- Run oracle_grid_software_config.sh to perform a silent configuration of the Grid Infrastructure, then show the cluster status.
- Run oracle_db_software_installation.sh to perform a silent installation of the database software.
- Run "root.sh" on node 1 then node 2.
- Apply the OJVM Patch for the DB software on both nodes using calls to the oracle_software_patch.sh script.
- Run oracle_create_database.sh to perform a silent creation of a database using DBCA. Once complete it displays the status of the installed services.
- Once the vagrant up command completes you will be left with a fully configured and running 2 node RAC.
Source: oracle-base.com
Friday, August 20, 2021
Oracle Database 21c Installation On Oracle Linux 8 (OL8)
Oracle 21c is an innovation release, so it may not be suitable for most production systems.
This article describes the installation of Oracle Database 21c 64-bit on Oracle Linux 8 (OL8) 64-bit. The article is based on a server installation with a minimum of 2G swap and secure Linux set to permissive.
◉ Download Software
Download the Oracle software from OTN or MOS depending on your support status.
- OTN: Oracle Database 21c (21.3) Software (64-bit)
- edelivery: Oracle Database 21c (21.3) Software (64-bit)
◉ Hosts File
The "/etc/hosts" file must contain a fully qualified name for the server.
<IP-address> <fully-qualified-machine-name> <machine-name>
For example.
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
192.168.56.107 ol8-21.localdomain ol8-21
Set the correct hostname in the "/etc/hostname" file.
ol8-21.localdomain
◉ Oracle Installation Prerequisites
Perform either the Automatic Setup or the Manual Setup to complete the basic prerequisites. The Additional Setup is required for all installations.
◉ Automatic Setup
If you plan to use the "oracle-database-preinstall-21c" package to perform all your prerequisite setup, issue the following command.
# dnf install -y oracle-database-preinstall-21c
It is probably worth doing a full update as well, but this is not strictly speaking necessary.
# yum update -y
It's worth running the all the DNF commands listed in the manual setup section. Depending on the OS package groups you have selected, some additional packages might also be needed.
If you are using RHEL8 or CentOS8, you can pick up the RPM from the OL8 repository and install it. It will pull the dependencies from your normal repositories.
curl -o oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/getPackage/ oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm
yum -y localinstall oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm
◉ Manual Setup
If you have not used the "oracle-database-preinstall-21c" package to perform all prerequisites, you will need to manually perform the following setup tasks.
Add the following lines to the "/etc/sysctl.conf" file, or in a file called "/etc/sysctl.d/98-oracle.conf".
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
Run one of the following commands to change the current kernel parameters, depending on which file you edited.
/sbin/sysctl -p
# Or
/sbin/sysctl -p /etc/sysctl.d/98-oracle.conf
Add the following lines to a file called "/etc/security/limits.d/oracle-database-preinstall-21c.conf" file.
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728
oracle soft data unlimited
oracle hard data unlimited
The following packages are listed as required. Don't worry if some don't install. It won't prevent the installation.
dnf install -y bc
dnf install -y binutils
dnf install -y compat-openssl10
dnf install -y elfutils-libelf
dnf install -y glibc
dnf install -y glibc-devel
dnf install -y ksh
dnf install -y libaio
dnf install -y libXrender
dnf install -y libX11
dnf install -y libXau
dnf install -y libXi
dnf install -y libXtst
dnf install -y libgcc
dnf install -y libnsl
dnf install -y libstdc++
dnf install -y libxcb
dnf install -y libibverbs
dnf install -y make
dnf install -y policycoreutils
dnf install -y policycoreutils-python-utils
dnf install -y smartmontools
dnf install -y sysstat
# Added by me.
dnf install -y unixODBC
Create the new groups and users.
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
#groupadd -g 54324 backupdba
#groupadd -g 54325 dgdba
#groupadd -g 54326 kmdba
#groupadd -g 54327 asmdba
#groupadd -g 54328 asmoper
#groupadd -g 54329 asmadmin
#groupadd -g 54330 racdba
useradd -u 54321 -g oinstall -G dba,oper oracle
Uncomment the extra groups you require.
◉ Additional Setup
Set the password for the "oracle" user.
passwd oracle
Set secure Linux to permissive by editing the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows.
SELINUX=permissive
Once the change is complete, restart the server or run the following command.
# setenforce Permissive
If you have the Linux firewall enabled, you will need to disable or configure it, as shown here. To disable it, do the following.
# systemctl stop firewalld
# systemctl disable firewalld
If you are not using Oracle Linux and UEK, you will need to manually disable transparent huge pages.
Create the directories in which the Oracle software will be installed.
mkdir -p /u01/app/oracle/product/21.0.0/dbhome_1
mkdir -p /u02/oradata
chown -R oracle:oinstall /u01 /u02
chmod -R 775 /u01 /u02
Putting mount points directly under root without mounting separate disks to them is typically a bad idea. It's done here for simplicity, but for a real installation "/" storage should be reserved for the OS.
Unless you are working from the console, or using SSH tunnelling, login as root and issue the following command.
xhost +<machine-name>
The scripts are created using the cat command, with all the "$" characters escaped. If you want to manually create these files, rather than using the cat command, remember to remove the "\" characters before the "$" characters.
Create a "scripts" directory.
mkdir /home/oracle/scripts
Create an environment file called "setEnv.sh". The "$" characters are escaped using "\". If you are not creating the file with the cat command, you will need to remove the escape characters.
cat > /home/oracle/scripts/setEnv.sh <<EOF
# Oracle Settings
export TMP=/tmp
export TMPDIR=\$TMP
export ORACLE_HOSTNAME=ol8-21.localdomain
export ORACLE_UNQNAME=cdb1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/21.0.0/dbhome_1
export ORA_INVENTORY=/u01/app/oraInventory
export ORACLE_SID=cdb1
export PDB_NAME=pdb1
export DATA_DIR=/u02/oradata
export PATH=/usr/sbin:/usr/local/bin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$PATH
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
EOF
Add a reference to the "setEnv.sh" file at the end of the "/home/oracle/.bash_profile" file.
echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile
Create a "start_all.sh" and "stop_all.sh" script that can be called from a startup/shutdown service. Make sure the ownership and permissions are correct.
cat > /home/oracle/scripts/start_all.sh <<EOF
#!/bin/bash
. /home/oracle/scripts/setEnv.sh
export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES
dbstart \$ORACLE_HOME
EOF
cat > /home/oracle/scripts/stop_all.sh <<EOF
#!/bin/bash
. /home/oracle/scripts/setEnv.sh
export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES
dbshut \$ORACLE_HOME
EOF
chown -R oracle:oinstall /home/oracle/scripts
chmod u+x /home/oracle/scripts/*.sh
Once the installation is complete and you've edited the "/etc/oratab", you should be able to start/stop the database with the following scripts run from the "oracle" user.
~/scripts/start_all.sh
~/scripts/stop_all.sh
◉ Installation
Log into the oracle user. If you are using X emulation then set the DISPLAY environmental variable.
DISPLAY=<machine-name>:0.0; export DISPLAY
Switch to the ORACLE_HOME directory, unzip the software directly into this path and start the Oracle Universal Installer (OUI) by issuing one of the following commands in the ORACLE_HOME directory. The interactive mode will display GUI installer screens to allow user input, while the silent mode will install the software without displaying any screens, as all required options are already specified on the command line.
# Unzip software.
cd $ORACLE_HOME
unzip -oq /path/to/software/LINUX.X64_213000_db_home.zip
# Interactive mode.
./runInstaller
# Silent mode.
./runInstaller -ignorePrereq -waitforcompletion -silent \
-responseFile ${ORACLE_HOME}/install/response/db_install.rsp \
oracle.install.option=INSTALL_DB_SWONLY \
ORACLE_HOSTNAME=${ORACLE_HOSTNAME} \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=${ORA_INVENTORY} \
SELECTED_LANGUAGES=en,en_GB \
ORACLE_HOME=${ORACLE_HOME} \
ORACLE_BASE=${ORACLE_BASE} \
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 \
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false \
DECLINE_SECURITY_UPDATES=true
Run the root scripts when prompted.
As a root user, execute the following script(s):
1. /u01/app/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/21.0.0/dbhome_1/root.sh
◉ Database Creation
You create a database using the Database Configuration Assistant (DBCA). The interactive mode will display GUI screens to allow user input, while the silent mode will create the database without displaying any screens, as all required options are already specified on the command line.
# Start the listener.
lsnrctl start
# Interactive mode.
dbca
# Silent mode.
dbca -silent -createDatabase \
-templateName General_Purpose.dbc \
-gdbname ${ORACLE_SID} -sid ${ORACLE_SID} -responseFile NO_VALUE \
-characterSet AL32UTF8 \
-sysPassword SysPassword1 \
-systemPassword SysPassword1 \
-createAsContainerDatabase true \
-numberOfPDBs 1 \
-pdbName ${PDB_NAME} \
-pdbAdminPassword PdbPassword1 \
-databaseType MULTIPURPOSE \
-memoryMgmtType auto_sga \
-totalMemory 2000 \
-storageType FS \
-datafileDestination "${DATA_DIR}" \
-redoLogFileSize 50 \
-emConfiguration NONE \
-ignorePreReqs
◉ Post Installation
Edit the "/etc/oratab" file setting the restart flag for each instance to 'Y'.
cdb1:/u01/app/oracle/product/21.0.0/db_1:Y
Enable Oracle Managed Files (OMF) and make sure the PDB starts when the instance starts.
sqlplus / as sysdba <<EOF
alter system set db_create_file_dest='${DATA_DIR}';
alter pluggable database ${PDB_NAME} save state;
exit;
EOF
Source: oracle-base.com
Friday, June 4, 2021
Oracle Database 19c RAC On Oracle Linux 8 Using VirtualBox and Vagrant
This article describes the "hands-off" installation of Oracle Database 19c RAC on Oracle Linux 8 using VirtualBox and Vagrant with no additional shared disk devices.
◉ TL;DR
If you are comfortable with VirtualBox, Vagrant and RAC you might want to jump straight to the GitHub repository and use the basic instructions here.
◉ Introduction
One of the biggest obstacles preventing people from setting up test RAC environments is the requirement for shared storage. In a production environment, shared storage is often provided by a SAN or high-end NAS device, but both of these options are very expensive when all you want to do is get some experience installing and using RAC. A cheaper alternative is to use virtualization to fake the shared storage.
Using VirtualBox you can run multiple Virtual Machines (VMs) on a single server, allowing you to run both RAC nodes on a single machine. In addition, it allows you to set up shared virtual disks, overcoming the obstacle of expensive shared storage.
◉ Required Software
Download and install the following software on your PC. If you can't figure out this step, you probably shouldn't be considering a RAC installation.
➙ VirtualBox
➙ Vagrant
➙ A Git client for your PC, so you can clone the vagrant repository.
You will also need to download the 19c grid and database software, along with the latest combo patch for grid. This means you must have an Oracle Support account to complete this installation.
➙ Grid :LINUX.X64_193000_grid_home.zip
➙ Database : LINUX.X64_193000_db_home.zip
➙ Patch 30783556: COMBO OF OJVM RU COMPONENT 19.7.0.0.200414 + GI RU 19.7.0.0.200414
◉ Clone Repository
Pick an area on your PC file system to act as the base for this git repository and issue the following command.
git clone https://github.com/oraclebase/vagrant.git
Copy the Oracle software under the "..../software/" directory. From the "rac/ol8_19" subdirectory, the structure should look like this.
$ tree
.
+--- config
| +--- install.env
| +--- vagrant.yml
+--- dns
| +--- scripts
| | +--- root_setup.sh
| | +--- setup.sh
| +--- Vagrantfile
+--- node1
| +--- scripts
| | +--- oracle_create_database.sh
| | +--- oracle_db_software_installation.sh
| | +--- oracle_grid_software_config.sh
| | +--- oracle_grid_software_installation.sh
| | +--- oracle_user_environment_setup.sh
| | +--- root_setup.sh
| | +--- setup.sh
| +--- Vagrantfile
+--- node2
| +--- scripts
| | +--- oracle_user_environment_setup.sh
| | +--- root_setup.sh
| | +--- setup.sh
| +--- Vagrantfile
+--- README.md
+--- shared_scripts
| +--- configure_chrony.sh
| +--- configure_hosts_base.sh
| +--- configure_hosts_scan.sh
| +--- configure_shared_disks.sh
| +--- install_os_packages.sh
| +--- oracle_software_patch.sh
| +--- prepare_u01_disk.sh
+--- software
| +--- LINUX.X64_193000_db_home.zip
| +--- LINUX.X64_193000_grid_home.zip
| +--- p6880880_190000_Linux-x86-64.zip
| +--- p30783556_190000_Linux-x86-64.zip
| +--- put_software_here.txt
$
When you clone the repository on Windows it is important you maintain the line terminators. All ".sh" scripts are run inside the Linux VMs, so they need UNIX style line terminators. If your Git client is set to convert all files to Windows style line terminators on a clone/pull, you will run into problems when those scripts are called from Linux.
◉ Amend File Paths
The "config" directory contains a "install.env" and a "vagrant.yml" file. The combination of these two files contain all the config used for this build. You can alter the configuration of the build here, but remember to make sure the combination of the two stay consistent.
At minimum you will have to amend the following paths in the "vagrant.yml" file, providing suitable paths for the shared disks on your PC.
asm_crs_disk_1: /u05/VirtualBox/shared/ol8_19_rac/asm_crs_disk_1.vdi
asm_crs_disk_2: /u05/VirtualBox/shared/ol8_19_rac/asm_crs_disk_2.vdi
asm_crs_disk_3: /u05/VirtualBox/shared/ol8_19_rac/asm_crs_disk_3.vdi
asm_crs_disk_size: 2
asm_data_disk_1: /u05/VirtualBox/shared/ol8_19_rac/asm_data_disk_1.vdi
asm_data_disk_size: 40
asm_reco_disk_1: /u05/VirtualBox/shared/ol8_19_rac/asm_reco_disk_1.vdi
asm_reco_disk_size: 20
For example, if you were working on a Windows PC, you might create a path called "C:\VirtualBox\shared\ol8_19_rac" and use the following settings.
asm_crs_disk_1: C:\VirtualBox\shared\ol8_19_rac\asm_crs_disk_1.vdi
asm_crs_disk_2: C:\VirtualBox\shared\ol8_19_rac\asm_crs_disk_2.vdi
asm_crs_disk_3: C:\VirtualBox\shared\ol8_19_rac\asm_crs_disk_3.vdi
asm_crs_disk_size: 2
asm_data_disk_1: C:\VirtualBox\shared\ol8_19_rac\asm_data_disk_1.vdi
asm_data_disk_size: 40
asm_reco_disk_1: C:\VirtualBox\shared\ol8_19_rac\asm_reco_disk_1.vdi
asm_reco_disk_size: 20
If you don't alter them, they will get written to "C:\u05\VirtualBox\shared\ol8_19_rac".
◉ Build the RAC
The following commands will leave you with a functioning RAC installation.
Start the DNS server.
cd dns
vagrant up
Start the second node of the cluster. This must be running before you start the first node.
cd ../node2
vagrant up
Start the first node of the cluster. This will perform all of the installations operations. Depending on the spec of the host system, this could take a long time. On one of my servers it took about 3.5 hours to complete.
cd ../node1
vagrant up
◉ Turn Off RAC
Perform the following to turn off the RAC cleanly.
cd node2
vagrant halt
cd ../node1
vagrant halt
cd ../dns
vagrant halt
◉ Remove Whole RAC
The following commands will destroy all VMs and the associated files, so you can run the process again.
cd node2
vagrant destroy -f
cd ../node1
vagrant destroy -f
cd ../dns
vagrant destroy -f
◉ Description of the Build
From here on we will describe the sections in the build process. Remember, all parameters come from the following two files.
◉ DNS Server Build
The DNS server build is really simple. You can see an example of the vagrant output I received here. This VM took about 2 minutes to build.
The Vagrantfile contains the definition of the VirtualBox VM that will be built, using the parameters from the vagrant.yml file. The default values produce a VM with the following characteristics.
◉ OS : Oracle Linux 8.2
◉ VM Name : ol8_19_dns
◉ CPUs : 1
◉ RAM : 1G
◉ NIC 1 : NAT Network
◉ NIC 2 : 192.168.56.100 - An IP on the "public" network used by the cluster nodes.
◉ Disk 1 : The box disk with the operating system pre-installed.
The last stage of the VM build it to run the setup.sh script, which simply runs the root_setup.sh script.
The root_setup.sh script does the following.
◉ Sources the install.env file to make sure all environment variables for the build are present.
◉ Gets the latest Yum repository file.
◉ Adds entries to the "/etc/hosts" file in the VM for the public, private and virtual IP addresses of each RAC node, as well as the SCAN IP addresses. These are built using environment variables.
◉ Installs and enables Dnsmasq. This presents the contents of the "/etc/hosts" file as a DNS server, which is a much simpler alternative to using BIND for the DNS setup. It's not going to be perfect for every DNS solution, but it is really good for this.
Once the vagrant up command completes you will be left with a functioning DNS server ready for use with your RAC.
If you have any problems with the DNS build, don't continue with the RAC nodes until you fix them.
◉ RAC Node 2 Build
The basic setup of the OS for the RAC nodes are very similar, but node 2 doesn't perform any installation actions, so we need this in place before starting node 1. ,You can see an example of the vagrant output I received here. This VM took about 5 minutes to build.
The Vagrantfile contains the definition of the VirtualBox VM that will be built, using the parameters from the vagrant.yml file. The default values produce a VM with the following characteristics.
◉ OS : Oracle Linux 8.2
◉ VM Name : ol8_19_rac2
◉ CPUs : 4
◉ RAM : 6144M
◉ NIC 1 : NAT Network
◉ NIC 2 : 192.168.56.102 - An IP on the "public" network used by the cluster nodes.
◉ NIC 3 : 192.168.1.102 - An IP on the "private" network used by the cluster nodes.
◉ Disk 1 : The box disk with the operating system pre-installed.
◉ Disk 2 : A disk which will be local to the VM, used for the "/u01" mount point.
◉ Disk 3 : CRS disk 1.
◉ Disk 4 : CRS disk 2.
◉ Disk 5 : CRS disk 3.
◉ Disk 6 : DATA disk.
◉ Disk 7 : RECO disk.
The last stage of the VM build it to run the setup.sh script, which simply runs the root_setup.sh.
The root_setup.sh script does the following.
- Sources the install.env file to make sure all environment variables for the build are present.
- Run prepare_u01_disk.sh to partition the "/dev/sdb" local disk, create a file system on the resulting "/dev/sdb1" partition, add an entry into the "/etc/fstab" so it mounts automatically in future, and manually mount it for the first time.
- Run install_os_packages.sh to configure the Yum repositories and install the OS packages needed for the RAC node. This includes the "oracle-database-preinstall-19c" package, which does some of the OS setup for us. It also includes all packages listed in the documentation, even though some are already installed by the preinstall package. Some extra packages are included just because they are needed by the automation of the setup.
- Set the passwords for the "root" and "oracle" users. This is pretty stupid, but we need this to make the whole process silent.
- Run configure_hosts_base.sh to add the public, private and virtual addresses to the "/etc/hosts" file. We don't need the SCAN addresses as they are provided by the DNS. We could use the DNS to provide the local IP addresses too, but I prefer to have these here also.
- Configure the "/etc/resolv.conf" to point to the DNS server VM.
- Run configure_chrony.sh to configure Chrony, so we don't get NTP errors during the installation.
- Run configure_shared_disks.sh to configure the shared disks used by ASM. If the ASM disks aren't already partitioned, it partitions them. It then configures UDEV, so the disks are mounted correctly in this VM after each restart.
- Set the hostname.
- Run oracle_user_environment_setup.sh to create the environment scripts for the "oracle" user, create the GRID_HOME and DB_HOME directories, and partially prepare password-less authentication (user equivalence) for the "oracle" user. This process will be completed by node 1.
- Source the "/home/oracle/scripts/setEnv.sh" script the previous script created.
- Partially prepare password-less authentication (user equivalence) for the "root" user. This process will be completed by node 1. This is not necessary for RAC to function, but it is necessary for the automation of this installation.
Once the vagrant up command completes you will be left with a prepared RAC node 2.
If you have any problems with the node 2 build, don't continue with the node 1 build until you fix them.
◉ RAC Node 1 Build
The basic setup of the OS for the RAC nodes are very similar, but unlike node 2, the node 1 setup also includes the software installation and configuration actions. Remember, the DNS and node 2 VMs should be running before starting this node. You can see an example of the vagrant output I received here. This VM took about 1.5 hours to build.
The Vagrantfile contains the definition of the VirtualBox VM that will be built, using the parameters from the vagrant.yml file. The default values produce a VM with the following characteristics.
◉ OS : Oracle Linux 8.2
◉ VM Name : ol8_19_rac1
◉ CPUs : 2
◉ RAM : 7168M
◉ NIC 1 : NAT Network
◉ NIC 2 : 192.168.56.101 - An IP on the "public" network used by the cluster nodes.
◉ NIC 3 : 192.168.1.101 - An IP on the "private" network used by the cluster nodes.
◉ Disk 1 : The box disk with the operating system pre-installed.
◉ Disk 2 : A disk which will be local to the VM, used for the "/u01" mount point.
◉ Disk 3 : CRS disk 1.
◉ Disk 4 : CRS disk 2.
◉ Disk 5 : CRS disk 3.
◉ Disk 6 : DATA disk.
◉ Disk 7 : RECO disk.
The last stage of the VM build it to run the setup.sh script, which simply runs the root_setup.sh.
The root_setup.sh script does all of the same actions as the node 2 build described above, but it also includes the installation and configuration steps. Rather than repeat the explanations of the common steps we will just focus on the differences here.
- In addition to repeating the password-less authentication (user equivalence) steps from node 2 for the "oracle" and "root" users, the node 1 root_setup.sh script uses sshpass and ssh-copy-id to complete the password-less authentication.
- Install the "cvuqdisk" package on node 1 and node 2.
- Run oracle_grid_software_installation.sh to perform a silent installation of the Grid Infrastructure software.
- Run "orainstRoot.sh" on node 1 then node 2.
- Run "root.sh" on node 1 then node 2.
- Run oracle_grid_software_config.sh to perform a silent configuration of the Grid Infrastructure, then show the cluster status.
- Run oracle_db_software_installation.sh to perform a silent installation of the database software.
- Run "root.sh" on node 1 then node 2.
- Apply the OJVM Patch for the DB software on both nodes using calls to the oracle_software_patch.sh script.
- Run oracle_create_database.sh to perform a silent creation of a database using DBCA. Once complete it displays the status of the installed services.
Once the vagrant up command completes you will be left with a fully configured and running 2 node RAC.
◉ Extra Notes
I usually try to stick to base releases of Oracle software, so people without an Oracle Support contract can still test the build. That is difficult here as the 19.7 release update (RU) includes a number of fixes related to running Oracle 19c RAC on OL8.2. It's possible to get round some of these by downgrading OpenSSL to a previous release, but that's messy, so I stuck with making the 19.7 patch a requirement.
If you are interested in trying to complete the installation without the 19.7 RU, here are some things to consider. These are not necessary if you apply the patches as part of the installations using the "-applyRU" parameter. Thanks to Abdellatif AG in the comments for pointing this out.
There is an incompatibility with the way the 19.3 GI installer tests for passwordless SSH and the way SCP works on OL8.2. The workaround for this is to do the following on each RAC node. This information came from a private MOS note (Doc ID 2555697.1). Thanks to Simon Coter for helping me with this.
# Before the installation.
mv /usr/bin/scp /usr/bin/scp.orig
echo "/usr/bin/scp.orig -T \$*" > /usr/bin/scp
chmod 555 /usr/bin/scp
# After the installation.
#mv /usr/bin/scp.orig /usr/bin/scp
The 19.3 software was released before OL8 was certified, so it's not on the list of valid distributions. You can get round this by faking the distribution with the following environment variable.
export CV_ASSUME_DISTID=OEL7.6
Even with these workarounds in place the DBCA still fails to create a database because of the bug described in MOS Doc ID 29529394.8, which states there is no workaround.
For anyone determined to try and make the installation work without the 19.7 RU, focus on downgrading OpenSSL. The errors produced will lead you to the following MOS notes, but they are mostly a distraction from the real problem.
- INS-06005 During Grid Infrastructure Install Due to Missing Execution Access to ping Command (Doc ID 2301337.1)
- Bug 30189609 - CVU Fails to Detect the Passwordless SSH as well as to Setup Passwordless SSH Connectivity (Doc ID 30189609.8)
- Bug 30159782 - Remote Copy Fails if using openssh-7.2. 7.4, etc. (Doc ID 30159782.8)
- GridSetup Results Error Remote node(s) not configured for passwordless SSH connectivity (Doc ID 2523358.1)
- Bug 29529394 - DBCA/NETCA FAIL TO VERIFY SSH CONNECTIVITY [INS-06005] UNABLE TO GET SSH CONNECTIVITY DETAILS (Doc ID 29529394.8)
- INS-06006 GI RunInstaller Fails If OpenSSH Is Upgraded to 8.x (Doc ID 2555697.1)
Source: oracle-base.com







