Prerequisites For Installing Oracle Database

Prerequisites Required for Installing Oracle Database

In this article, I am going to discuss the Prerequisites Required for Installing Oracle Database. Please read our previous article where we discussed the Basic Linux Commands.

Prerequisites For Installing Oracle Database

Until now we learned how to install Virtual Box, and Oracle Linux and learned a few basic Linux commands. Now we are going to learn how to install the oracle database. There are a few prerequisites for installing the oracle database.

Step1: Edit the host file.

The host file is an operating system (computer file) file that maps hostnames to IP addresses. If you need to edit the file you need to log in as root. The order of editing the host is as below

<IP-address> <fully-qualified-machine-name> <machine-name>

You can find the host file in the vi /etc/hosts. Open a terminal. In order to make changes to the host file, you need to log in as root. So, login as root.

Prerequisites Required for Installing Oracle Database

After logging as root. So, we need the hostname and the IP address to edit the file. In order to get the hostname, we use the command hostname(oracletest.com).

Prerequisites Required for Installing Oracle Database

In order to know the IP address, we use the below command(ifconfig).

Prerequisites Required for Installing Oracle Database

Copy the IP address and follow the process. Using the below command you can open the host file.

Command: vi /etc/hosts

Prerequisites Required for Installing Oracle Database

Now you are in the hosts file. As usual, we press the Escape button and then go to the end of the last line (second line) and press A (insert mode). The cursor will be prompted to the next line. Paste the IP Address.

Prerequisites Required for Installing Oracle Database

Press tab and give the oracletest.com(fully-qualified-machine-name) and tab oracletest (machine name) and save using ESCAPE and enter wq (write and quit). In this step, we are mapping the IP Address with the hostname.

Prerequisites Required for Installing Oracle Database

This is the first step we have updated the host file and saved the file.

Step 2: Automatic Setup for Oracle Prerequisite

We need to install packages from oracle before installing the database. There are two types of installing packages.

  1. Automatic Setup
  2. Manual Setup

Previously DBAs used to do a lot of work while installing the oracle database. DBAs need to install many packages. In order to avoid this oracle itself created this package which install all the packages to reduce the load on DBAs. Now we are using the automatic setup.

Automatic Setup:

In an Automatic setup, we need to install all the packages. we can run only one command which installs all the packages.

Command: yum install -y oracle-database-preinstall-19c

This package will install all the packages.

Yum is the command that is used to install packages. This command only works in Oracle Linux. If you have Ubuntu Linux it doesn’t work. Paste in a terminal. Make sure we need to connect to the internet during the installation of packages. You can check the below screenshot that my internet connection is Wired connected.

Automatic Setup for Oracle Prerequisite

If you are not sure whether the internet is working on your virtual machine or not. Try opening Google Chrome or Mozilla Firefox and check the connectivity once and then try to install the packages. After checking the internet connection. Copy the below command and paste it into the terminal.

Note: This command works only for installing the 19c database. There will be other database versions which will be discussed later. Make sure you are connected as root.

Automatic Setup for Oracle Prerequisite

Once you pasted the command press enter and it shows that there is a lot of processing and creation of users.

Automatic Setup for Oracle Prerequisite

You can leave it for some time and shows you below that installation of packages is completed.

Automatic Setup for Oracle Prerequisite

This command installs a lot of packages, users, and groups related to oracle. To know what all the groups present in the user oracle execute the command id oracle.

Automatic Setup for Oracle Prerequisite

The user oracle is in the primary group called oinstall. You can also see the oracle user is part of groups dba, oper, backupdba, dgdba, kmdba, racdba.

Step 3: Create Directories.

We need to create directories. These directories are required while creating the oracle database and installing oracle software. Commands for creating directories:

Create Directories

mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1
This is the location where the Oracle software is installed and the database is created.

mkdir -p /u02/oradata
In this location, you can save database files for the oracle database.

chown -R oracle:oinstall /u01/u02
We are changing the owner for the directories /u01, and /u02 to the oracle, and the group owner to oinstall.

chmod -R 775 /u01 /u02

This command is used to change the permission for the directories /u01 /u02 to 775. The digit 775. It has 3 digits, the first digit is for the user owner, the second digit is permission for the group owner, and the third digit is for the permission of all the other users. In this case, we have given 775 so the user can read, write, and execute on /u01 and /u02. The group owner can also read, write, and execute on /u01 /u02. But the other users can only read and execute on /u01 /u02. They cannot write anything in those directories.

chmod -R 775 /u01 /u02

Prerequisites Required for Installing Oracle Database

Make sure the directories are present in the files.

Prerequisites Required for Installing Oracle Database

Step 4: Disable the Firewall

This is the requirement in order to install the oracle database. We are performing this action only for training purposes. In real-time scenarios, we are not supposed to the firewall. We have to stop the firewall to continue to the next process.

Commands:
systemctl stop firewalld
systemctl disable firewalld

Disable the Firewall

Step 5: Change Password for Oracle

To change the password for user oracle. We use the command passwd.

Change Password for Oracle

Even if we get a BAD PASSWORD error that is fine. The password is accepted. From now we need to use the user oracle. Oracle user is the super user for the oracle database. We need to remember the password.

Change Password for Oracle

More Information about Prerequisites:

There might be a few people who need to understand more about installing packages of Linux. This information targets those people. We have seen in step 2 that there is a manual setup. We have seen installing packages for the oracle databases through single commands using automatic setup. There is another method of doing the above. We call it a manual setup. Manual setup is where we need to install packages individually.

In the Automatic setup, we used the command yum install -y oracle-database-preinstall-19c. This command is based on a website ORACLE-BASE – Oracle DBA and development articles, scripts, HOWTOs, and forums (8i, 9i, 10g, 11g, 12c, 13c, 18c, 19c, 21c). On this website, there are many other versions other than 19c to download. (https://oracle-base.com)

More Information about Prerequisites

There is highlighted part 13c,18c,19c,21c. If you click on 19c the article appears which has all the oracle databases configured for oracle Linux versions.

More Information about Prerequisites

Go ahead and click on oracle database 19c- Installations. You can see the below details. It has different oracle Linux versions but we have the versions till OL8 (Oracle Linux 8).

More Information about Prerequisites

We will be using Oracle Linux 7 to get the oracle packages installed. In the below image you can two methods Automatic setup and Manual setup.

More Information about Prerequisites

We have already installed packages through automatic setup. Let’s try to understand how Manual setup works. Below is the command we used for the automatic setup that we performed in step 2.

Prerequisites Required for Installing Oracle Database

For manual setup, we can use the below steps.

Step1: Type the command “vi /etc/sysctl.conf”. After opening the file, you need to add the below lines to the sysctl.conf file and save the file.

Prerequisites Required for Installing Oracle Database

Step2: After saving the file you need to run the below commands to change the kernel parameters.

Prerequisites Required for Installing Oracle Database

Step3: After making changes to kernel parameters you need to execute the below commands individually which installs a lot of packages.

Prerequisites Required for Installing Oracle Database

Step4: Finally, you need to add users and groups individually to the Linux. We have seen these groups in id oracle in step 2(automatic setup)

Prerequisites Required for Installing Oracle Database

OS Configuration

We will try to do some OS Configuration. There are some environmental variables we have to set up in the operating system so that the oracle users can function properly. These variables should be edited in a file called .bash_profile.

What is bash_profile?

Bash_profile is a configuration file that defines tasks that the shell executes for every user who is logged in. Each user in Linux operating system has an individual bash profile. We can write some commands in this bash profile and whenever the user is logged in to the Linux the commands will execute. So, we will create some commands in the bash_profile.

Before doing this, we need to understand some oracle variables. Below are some of the oracle variables.

What is bash_profile?

Note: ORACLE_SID is a unique name for an Oracle database instance on a specific host

  1. ORACLE_BASE: This specifies the base of the oracle directory. This is the location where the oracle exists and all the oracle folders will be here.
  2. ORACLE_HOME: This specifies the directory which contains the oracle software. We use this oracle home for the oracle produces. You need to distinguish between the oracle base and the oracle home. The base is the base for oracle. The home is specified for specific product. If you have multiple products, you will have multiple oracle homes present in the oracle base. Directory: $ORACLE_BASE/product/19.0.0/dbhome_1
  3. ORACLE_SID: This specifies the oracle system identifier. We have used jayadb as oracle sid. ORACLE_SID is the unique name for the oracle database. The database name will represent the oracle_sid.
  4. ORACLE_UNQNAME: This specifies the operating system environment variable that holds the database’s unique name value i.e jayadb.

Note: In a single instance database all the below names are configured with only one database name.

oracle_sid= instance_name= oracle_unqname=db_name=jayadb

We have a single server machine. We have one database instance connecting to one database. In this case of a single database instance ORACLE_SID=INSTANCE NAME=jayadb. DB_name=ORACLE_UNQNAME=jayadb. In a single instance, configuration keeps the SID, instance name, database name, unqname same as jayadb. We will be discussing this further.

OS Configuration

We need to execute the command vi /home/oracle/.bash_profile and need to add parameters. Below are the parameters we need to add to the bash_profile. I am using the same parameters.

OS Configuration

Maybe you need to change the hostname and database. We have already discussed ORACLE_SID, ORACLE_BASE, and ORACLE_HOME.ORACLE_UNQNAME, ORACLE_HOSTNAME. Now we have TMP (/tmp). This is the temp directory. We use this to store the temporary files. PATH is used to help Linux to find out where is the exact folder. When we use SQL Plus, we need to enter complete path details.

We need to copy all these commands to the bash profile. Log in to the Linux machine as an oracle user and open the terminal. Paste the below command.

Command: vi /home/oracle/.bash_profile

Command: vi /home/oracle/.bash_profile

After clicking enter you will get the bash_profile page. Press the ESCAPE button and then A to edit the bash profile. Go to the end of export PATH. Now paste the above commands mentioned in the box.

Command: vi /home/oracle/.bash_profile

Save using the ESCAPE button and wq (write and quit). In order to make these changes effective, we need to log out and log in again as an oracle user. We will find a little example of this. Let us try with echo $ORACLE_HOME. If we execute this command, it will not show any directory. Here is the output.

Command: vi /home/oracle/.bash_profile

Now we will log out and log in as an oracle user.

Prerequisites for Installing Oracle Database

Now let us try to run the same command and see the output.

Prerequisites for Installing Oracle Database

We have changed the bash_profile. There is one more setting that needs to do. We need to provide access to the shared folder for oracle. Before that let’s try to access the shared folder. It should ask for the password.

Prerequisites for Installing Oracle Database

You can see it is asking for the password. Because the oracle user doesn’t have permission to access the shared folder. In order to resolve this open terminal. Connect as the root user.

Prerequisites for Installing Oracle Database

After connecting as root use the following command to give access to the shared folder.

Command: usermod -a -G vboxsf oracle

Prerequisites for Installing Oracle Database

After executing the commands check whether the group is assigned to the oracle user or not. But you need to log out and log in again to the oracle user to access the shared folder.

Command: id oracle

In the next article, I am going to discuss Downloading and Installing Oracle Database. Here, in this article, I try to explain the Prerequisites Required for Installing Oracle Database and I hope you enjoy this Prerequisite Required for Installing Oracle Database article.

2 thoughts on “Prerequisites For Installing Oracle Database”

  1. Not able to install oracle 19c package in oracle linux 9.0.
    getting this error
    No match for argument: oracle-database-preinstall-19c
    Error: Unable to find a match: oracle-database-preinstall-19c
    please give me solution

Leave a Reply

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