Setting Up Oracle Database 19c and Grid on Linux

Setting up Oracle Database 19c and Grid requires thorough preparation of the environment, including essential configurations for hosts, security, disk setup, and user access. Here’s a comprehensive guide that walks you through each step, ensuring a smooth installation on a Linux environment.


1. Configuring the Hosts File

The /etc/hosts file is essential for name resolution in network configurations. Add the following to link your IP address with the hostname for easy referencing:

# Open /etc/hosts and add <IP-address>  hostname:
10.0.1.211    higorara

This setup ensures that the hostname higorara can be referenced by its IP, 10.0.1.211, within the system.


2. Configuring Security Settings

Linux’s SELinux and firewall configurations may interfere with Oracle installations. Here’s how to adjust these settings:

  • SELinux Configuration: Modify /etc/selinux/config to change SELinux from enforcing to permissive.
  setenforce Permissive  # apply the change
  getenforce  # verify the current status
  # OR
  vi /etc/selinux/config  # change SELINUX=enforcing to SELINUX=permissive
  • Disable the Firewall: Oracle Grid and Database installations often require unrestricted access to the system. Stop and disable the firewall service as follows:
  systemctl stop firewalld
  systemctl disable firewalld
  systemctl status firewalld  # check that the firewall is inactive

3. Preparing Disks and Mount Points for Installation

To install Oracle binaries and set up ASM, ensure that disk partitions and directories are correctly configured.

  • Create Installation Directories:
    Once the disks are prepared and /u01 is mounted according to this guide, create directories for Oracle and Grid installations:
  mkdir -p /u01/app/oracle/product/19.0.0/db_1
  mkdir -p /u01/app/grid/product/19.0.0/grid
  mkdir -p /u01/app/grid/grid_base
  chown -R oracle:oinstall /u01
  chown -R grid:oinstall /u01/app/grid/
  chmod -R 775 /u01

4. Installing Required Packages

Install the necessary packages to ensure compatibility with Oracle 19c:

yum install -y oracle-database-preinstall-19c
yum install -y oracleasm oracleasm-support

These packages handle dependencies and kernel settings for Oracle installations, simplifying the setup process.


5. Creating Users and Groups

To manage Oracle ASM and Database installations, configure users and groups for appropriate permissions.

  • Create Groups for ASM:
  groupadd -g 54327 asmdba
  groupadd -g 54328 asmoper
  groupadd -g 54329 asmadmin
  • Configure the Grid User:
  useradd -g oinstall -G dba,asmadmin,asmdba,asmoper,racdba grid
  passwd grid  # set password
  • Configure the Oracle User:
  usermod -a -G asmadmin,asmdba oracle
  passwd oracle  # set password

6. Configuring ASM (Automatic Storage Management) – ASMLib and Disk Creation

Oracle ASM improves storage management by integrating the disks directly with Oracle’s systems.

  1. Configure ASMLib:
   oracleasm configure -i
   # Provide responses:
   # Default user to own the driver interface []: grid
   # Default group to own the driver interface []: asmadmin
   # Start Oracle ASM library driver on boot (y/n) [n]: y
   # Scan for Oracle ASM disks on boot (y/n) [y]: y
  1. Initialize and Verify ASM Disks:
   oracleasm init
   oracleasm status
  1. Create ASM Disks (assuming you’ve prepared these logical volumes as per the guide above):
   oracleasm createdisk DATA01 /dev/vg_data/lv_data1
   oracleasm createdisk DATA02 /dev/vg_data/lv_data2
   oracleasm createdisk DATA03 /dev/vg_data/lv_data3
   oracleasm createdisk DATA04 /dev/vg_data/lv_data4
  1. List and Verify Disks:
   oracleasm listdisks
   ls -l /dev/oracleasm/disks
   oracleasm scandisks  # re-scan for marked disks
   oracleasm querydisk -d ASMDISK10  # verify specific disk details
  • To remove a specific ASM disk:
    bash oracleasm deletedisk ASMDISK10

Step 7: Download and Install Oracle Binaries

To install Oracle Database 19c and Grid Infrastructure, it’s essential to use the correct user accounts for each component. Use the grid user for the Grid Infrastructure installation and the oracle user for the database binaries. Follow the steps below for successful setup and patching.

1. Download the Required Binaries

Start by downloading Oracle Database 19c and Oracle Grid Infrastructure from Oracle’s official site.

  • Download the necessary .zip files onto your server. To streamline this, create a script named wget.sh that contains all download URLs, making it executable and running it as follows:
  chmod +x wget.sh
  ./wget.sh
  • After running, enter your Oracle login credentials as prompted. Ensure adequate space in the /tmp directory for the downloads.

2. Begin Session with the Correct User

It’s important to execute the following steps using the appropriate user account:

  • Grid Installation: Log in as the grid user to install Grid Infrastructure.
  • Database Installation: Log in as the oracle user for Oracle Database binaries.

3. Extract Binaries and Set Up Directories

Grid Binary Extraction

With the grid user, extract the Grid binary:

su - grid
unzip -q V982068-01.zip -d /u01/app/grid/product/19.0.0/grid
Prepare Grid Patch Directory

Create a directory specifically for the Grid patch, then extract the patch into this directory:

mkdir -p /u01/patch_grid
unzip /tmp/p34774469_190000_Linux-x86-64.zip -d /u01/patch_grid
Apply the Latest OPatch for Grid

Backup the current OPatch directory and extract the updated version for Grid Infrastructure:

mv /u01/app/grid/product/19.0.0/grid/OPatch /u01/app/grid/product/19.0.0/grid/OPatch.bkp
unzip -q /tmp/p6880880_190000_Linux-x86-64.zip -d /u01/app/grid/product/19.0.0/grid
Run Grid Setup with Patch

Navigate to the Grid home directory and start the Grid installer with the patch applied:

./gridSetup -applyRU /u01/patch_grid

4. Database Binary Extraction

Switch to the oracle user and extract the Oracle Database binary:

su - oracle
unzip -q V982063-01.zip -d /u01/app/oracle/product/19.0.0/db_1

5. Prepare Database Patch Directory

Create a directory for the database patch and extract it:

mkdir -p /u01/patch_oracle
unzip /tmp/p34774469_190000_Linux-x86-64.zip -d /u01/patch_oracle

6. Apply the Latest OPatch for Database

Again, move the current OPatch directory and extract the updated version for the Oracle Database:

mv /u01/app/oracle/product/19.0.0/db_1/OPatch /u01/app/oracle/product/19.0.0/db_1/OPatch.bkp
unzip -q /tmp/p6880880_190000_Linux-x86-64.zip -d /u01/app/oracle/product/19.0.0/db_1

7. Download and Install Oracle Binaries

To properly install Oracle Database 19c and Grid Infrastructure, you’ll need to use the appropriate user accounts for each component. Use the grid user for Grid Infrastructure and the oracle user for database binaries. Follow these steps closely to set up and apply patches as outlined.

1. Download Binaries

  • Download Oracle Database 19c and Oracle Grid Infrastructure from Oracle’s official site.
  • Download the required .zip files to the server. To automate this, you may create a script called wget.sh that lists all necessary URLs. Use the following commands:
  chmod +x wget.sh
  ./wget.sh

Enter your Oracle login credentials when prompted. Ensure there’s enough space in the /tmp directory.

2. Start Session with Correct Users

  • Grid Installation: Start a session as the grid user to handle Grid Infrastructure installation.
  • Database Installation: Switch to the oracle user for Oracle Database binary installation. This distinction is essential to set the correct permissions and configuration.

3. Extract and Prepare Directories

  • Grid Binary Extraction:
  • As the grid user, extract the Grid binary: su - grid unzip -q V982068-01.zip -d /u01/app/grid/product/19.0.0/grid
  • Prepare Patch Directory for Grid:
  • Create a directory for the Grid patch: mkdir -p /u01/patch_grid unzip /tmp/p34774469_190000_Linux-x86-64.zip -d /u01/patch_grid
  • Apply the Latest OPatch for Grid:
  • Move the current OPatch directory as a backup and apply the latest version: mv /u01/app/grid/product/19.0.0/grid/OPatch /u01/app/grid/product/19.0.0/grid/OPatch.bkp unzip -q /tmp/p6880880_190000_Linux-x86-64.zip -d /u01/app/grid/product/19.0.0/grid
  • Run Grid Setup with Patch Applied:
  • Use gridSetup to apply the patch:
    bash ./gridSetup -applyRU /u01/patch_grid

4. Database Binary Extraction

  • Switch to the oracle user to handle Oracle Database installation:
  su - oracle
  • Extract the Oracle Database binary into the designated directory:
  unzip -q V982063-01.zip -d /u01/app/oracle/product/19.0.0/db_1

5. Prepare Patch Directory for Database

  • Create a directory for the database patch:
  mkdir -p /u01/patch_oracle
  unzip /tmp/p34774469_190000_Linux-x86-64.zip -d /u01/patch_oracle

6. Apply the Latest OPatch for Database

  • Similar to the Grid setup, move the current OPatch directory and apply the latest version for the database:
  mv /u01/app/oracle/product/19.0.0/db_1/OPatch /u01/app/oracle/product/19.0.0/db_1/OPatch.bkp
  unzip -q /tmp/p6880880_190000_Linux-x86-64.zip -d /u01/app/oracle/product/19.0.0/db_1

7. Run Oracle Installer with Patch Applied

  • Apply the patch during installation using the runInstaller command:
  ./runInstaller -applyRU /u01/patch_oracle

Following these steps ensures that the binaries are correctly installed with all necessary patches, using the correct user accounts for each component to maintain permissions and security.


Conclusion

Following these detailed steps will set up Oracle Database 19c and Oracle ASM efficiently, ensuring your environment is optimized and ready for production or further development. Proper configuration of security, users, disks, and necessary binaries will streamline Oracle’s performance and stability on your system.

Leave a Reply

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