Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
467 views

Installing and Creating An Oracle Database 19c On Linux 7 With ASM

This tutorial demonstrates how to install Oracle Database 19c on Linux 7 using ASM (Automatic Storage Management). The key steps include: 1. Creating virtual hard disks for ASM storage and making the server IP address static 2. Installing Oracle Grid Infrastructure and necessary packages 3. Creating ASM disk groups and installing the Oracle database software and sample database

Uploaded by

Samuel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
467 views

Installing and Creating An Oracle Database 19c On Linux 7 With ASM

This tutorial demonstrates how to install Oracle Database 19c on Linux 7 using ASM (Automatic Storage Management). The key steps include: 1. Creating virtual hard disks for ASM storage and making the server IP address static 2. Installing Oracle Grid Infrastructure and necessary packages 3. Creating ASM disk groups and installing the Oracle database software and sample database

Uploaded by

Samuel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Installing and Creating an Oracle Database 19c with ASM P a g e |1

Tutorial:

Installing and Creating an Oracle Database 19c on Linux 7 with ASM

By Ahmed Baraka

Tutorial Overview
In this tutorial, we will demonstrated the procedure to create an Oracle database 19c on Linux 7 with
ASM.

In high level, you will perform the following:


• Change the Settings of the Appliance srv1

• Create Virtual Hardisks (to be used by ASM)

• Make the machine IP address static

• Configure Putty to connect to srv1

• Set up the environment variables for the OS Accounts: grid and oracle

• Install ASM Packages and Create ASM disk volumes

• Change the kernel parameter values to the recommended values

• Install more packages

• Install Oracle Grid Infrastructure Software (Oracle Restart)

• Create ASM Disk Groups

• Install Oracle database software and create the sample database

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e |2

Required Resources

• A PC with a free 8GB in its memory. This means the RAM memory in your PC should be at least
12GB.

• At least 50GB free disk space.

• The PC is connected to the Internet

Installation Architecture

The tutorial builds a system the same as the following architecture diagram:

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e |3

Required Software and Packages

To implement this tutorial, you must have the following:

• Oracle VirtualBox, version 6. This tutorial was implemented on VirtualBox 6.0.22 for Windows. It
can be obtained from the following link.

• Oracle Virtualbox appliance with a fresh installation of Oracle Linux 7.x. You can download a
pre-built one with Oracle Linux 7.8 from here.
Alternatively, you can create one from scratch. The procedure to create an VM machine with Linux
7.x is explained in many articles in the Internet. Just Google it!

• Oracle Grid Infrastructure 19c installation files for Linux x86-64. This can be downloaded from
Oracle site. Search the Internet for “oracle grid infrastructure 19c download”. At the time of this
writing, its link is here. This tutorial was implemented using Oracle Grid Infrastructure 19c (version
19.3).

Note: download the zip file, not the rpm file.

• Oracle Database 19c installation files for Linux x86-64. This can be downloaded from Oracle site.
Search the Internet for “Oracle Database 19c installation files for Linux x86-64”. At the time of this
writing, its link is here. This tutorial was implemented using Oracle Database 19c ( version 19.3)
for Linux x86-64.

Note: download the zip file, not the rpm file.

• Putty: which is a utility that provides a command line prompt to connect to a Linux server from
Windows.

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e |4

Tutorial Steps

A. Changing the Settings of the Appliance srv1


In the following steps, you will prepare the appliance srv1 for the tutorial. The tutorial steps assume
that you have the appliance opened in the VirtualBox window.

1. In VirtualBox Manager, open the "Settings" of srv1, click on "Shared Folders" link in the right-
hand pane. Add shared folder by pressing "plus" icon. Then select path to the location of the
oracle software installation folder, and mark the checkbox "Auto-mount". You can change the
"Folder Name", if you want to.

This folder will be used to easily exchange files between the hosting PC and Linux in the VM
machine. In the rest of this tutorial document, this folder will be referred to as the staging
folder.

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e |5

2. Make sure the Network adapter type Bridged Adapter and its name is the same as the network
card of your PC. This makes your VM appliance appears in your network as a separate host and
will be assigned an IP address based on your network configuration.

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e |6

B. Creating Virtual Hardisks for ASM


In OracleVirtualBox manager window, perform the following steps on srv1 to create two ASM disks:
OCRDISK1 (12 GB) and DATADISK1 (40GB)

3. In the Oracle VirtualBox manager window, perform the following steps:

a. Open the settings of srv1

b. Click on Storage then Ad “hard disk“ button

c. Select VDI option

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e |7

d. Select Dynamically allocated

e. Set the OCR disk file name and its size.

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e |8

f. Perform the same steps again to create the DATA disk, of size 40 GB. You should end up with
having two disks as follows:

g. Optionally, set a description for the appliance and change its name to “Oracle 19c DB+ASM”

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e |9

C. Making the IP Address Static


In the following steps, you will make the IP address assigned to srv1 static. We need to make this
step because we want to make sure that the machine will always have the same IP address when it is
rebooted.

4. Start srv1

5. Login to the VirtualBox window of srv1 as root

6. Open a terminal window, issue ifconfig command, and obtain the current IP address assigned to
the machine. It is the IP address assigned to the NIC enp0s3

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 10

7. Open Settings window: Applications -> System Tools -> Settings

8. Open Network settings

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 11

9. Click on IPv4 tab, select the Manual option, then enter the IP address and DNS information.
Then click on Apply button.

10. In the Terminal window, ping the IP address to make sure that the changes are successful.

11. Edit the /etc/hosts file and add the hostname and the IP address to it.
vi /etc/hosts
192.168.1.127 srv1.localdomain srv1

12. Verify that the changes are registered in the NIC configuration file.
cat /etc/sysconfig/network-scripts/ifcfg-enp0s3

13. Ping srv1 to make sure the changes were successful.


ping srv1

14. In the hosting PC, open a command line window and make sure you can ping the IP address of
srv1.
Note: Make sure the firewall in your PC allows communication with Oracle VirtualBox.
C:\> ping 192.168.1.127

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 12

D. Configuring Putty
In the following steps, you will configure Putty to connect to srv1

15. Open Putty then enter the IP address of srv1 in the Host Name field.

16. Click on Connection then set the “Seconds between keepalives” to 9.

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 13

17. Save the configuration as srv1 then open the session.

18. Login as root in the Putty session.

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 14

E. Setting up Environment Variables for OS Accounts: grid and oracle


In the following steps, you will configure the OS variables for the software owner accounts. oracle is
the software owner of the database software and grid is the software owner of the Grid Clusterware
software.

19. In the Putty session, switch current user to oracle and make a backup copy of the current bash
profile file:
su - oracle
mv ~/.bash_profile ~/.bash_profile_bkp

20. Open the .bash_profile file with the vi editor


vi ~/.bash_profile

21. Add the following to it.


# .bash_profile

# OS User: oracle
# Application: Oracle Database Software Owner
# Version: Oracle 19c
# ---------------------------------------------------
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE


ORACLE_SID=oradb; export ORACLE_SID
ORACLE_HOME=$ORACLE_BASE/product/19.0.0/db_1; export ORACLE_HOME

NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT


TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN

PATH=$PATH:$HOME/.local/bin:$HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/local/bin
PATH=.:${PATH}:$ORACLE_HOME/bin
export PATH

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=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
export TEMP=/tmp
export TMPDIR=/tmp
umask 022

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 15

22. Switch current user back to root then run the following code to create required groups, grid
user and modify the accounts.
su -
groupadd asmadmin
groupadd oinstall
groupadd asmdba
usermod -g oinstall oracle
usermod -a -G asmdba oracle
useradd -u 54323 -g oinstall -G asmadmin,asmdba grid

passwd grid

23. Add oracle and grid accounts to vboxsf group.


The vboxsf group was created by VirtualBox Guest Additions and it allows its members to access
the shared folder (staging folder) in the hosting machine.
usermod -a -G vboxsf oracle
usermod -a -G vboxsf grid

24. Create Oracle Clusterware home directories:


mkdir -p /u01/app/oracle/product/19.0.0/db_1
mkdir -p /u01/app/grid
mkdir -p /u01/app/19.0.0/grid
chown -R grid:oinstall /u01
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01

25. Switch to grid user and modify its bash profile as follows:
su - grid
mv ~/.bash_profile ~/.bash_profile_bkp

vi ~/.bash_profile

# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
ORACLE_SID=+ASM; export ORACLE_SID
ORACLE_BASE=/u01/app/grid; export ORACLE_BASE
ORACLE_HOME=/u01/app/19.0.0/grid; export ORACLE_HOME

ORACLE_TERM=xterm; export ORACLE_TERM


TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/local/bin
export PATH
export TEMP=/tmp
export TMPDIR=/tmp
umask 022

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 16

F. Installing ASM Packages and Creating ASM Disk Volumes

In the following steps, you will install ASM packages then create ASM disk volumes.

26. Change the current user to root user


su -

27. Install Oracle ASMLib package


yum install oracleasm-support

# the following command will take a few minutes to finish:


yum install kmod-oracleasm

28. Configure and load the ASM kernel module. Respond to the command as illustrated by the code
in red color.
oracleasm configure -i

Configuring the Oracle ASM library driver.


This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: grid
Default group to own the driver interface []: oinstall
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done

29. Load the oracleasm kernel module:


/usr/sbin/oracleasm init

30. List the disks as seen by the OS. You should see the disks created in the VirtualBox and attached
to the appliance.
fdisk -l | grep "Disk /dev/sd"

31. Use fdisk to create partitions in the disk.


Do the following for the disks sdb and sdc
fdisk <device file>
then press: n, p, 1, ENTER, ENTER, w – to apply changes

Following is the output done on sdb:


[root@srv1 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xd2973f79.
Changes will remain in memory only, until you decide to write them.

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 17

After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to


switch off the mode (command 'c') and change display units to
sectors (command 'u').

Command (m for help): n


Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-261, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-261, default 261):
Using default value 261

Command (m for help): w


The partition table has been altered!

Calling ioctl() to re-read partition table.


Syncing disks.

32. Verify that the partitions are created.


fdisk -l | grep "/dev/s"

33. Create the ASM disks


oracleasm createdisk OCRDISK1 /dev/sdb1
oracleasm createdisk DATADISK1 /dev/sdc1
oracleasm listdisks

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 18

G. Changing Kernel Parameter Values

In the following step, you will change the kernel parameter values to the values recommended by
Oracle.

34. Create the following file then add the code that follows to it.

vi /etc/sysctl.d/97-oracle-database-sysctl.conf

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

35. Change the current values of the kernel parameters:


/sbin/sysctl --system

36. Reboot srv1

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 19

H. Install More Packages

In the following step, you will install further packages in srv1 that are required by Oracle Grid
Infrastructure and database software.

37. Open Putty and login to srv1 as root

38. Run the following code to install further packages required by Oracle software.
yum install ksh
yum install libaio-devel.x86_64

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 20

I. Installing Oracle Grid Infrastructure Software (Oracle Restart)

In the following steps, you will install Oracle Grid Infrastructure software in srv1. The installation
procedure automatically creates and start the Clusterware services.

39. Copy the Oracle Grid Infrastructure software installation file to the staging folder.
At the time of this writing, the installation file name downloaded from Oracle site is
LINUX.X64_193000_grid_home.zip

40. Extract the installation file into the Oracle Grid Infrastructure software home directory
su - grid
unzip /media/sf_staging/LINUX.X64_193000_grid_home.zip -d $ORACLE_HOME

41. Instal the cvuqdisk in srv1 as root


The package cvuqdisk must be installed before installing the Clusterware software
# exit to return back to the root shell:
exit

cd /u01/app/19.0.0/grid/cv/rpm/
CVUQDISK_GRP=oinstall; export CVUQDISK_GRP
rpm -iv cvuqdisk-1.0.10-1.rpm

42. Login to the VirtualBox window of srv1 as grid.

43. Open a terminal window, change the current directory to the Grid Infrastructure software home
directory and run the gridSetup.sh script.
cd $ORACLE_HOME
./gridSetup.sh

44. Respond to the Installer windows as follows:

Window Action

Configuration Option
Select the following option:

“Configure Oracle Grid Infrastructure for a Standalone


Server (Oracle Restart)”

Create ASM Disk Group 1. Click on Change Discovery Path button

2. Enter the Discovery Path as follows:


/dev/oracleasm/disks/*

3. Fill in the fields as follows:


Disk Group Name: OCRDISK

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 21

Redundancy: External
Select Disks: OCRDISK1

ASM Password Enter the password

Management Option Make sure the Checkbox is unselected

Operating System Make sure the following are the selected values:
Groups
OSASM: asmadmin
OSDBA: asmdba

Installation Location Oracle Base and Oracle Grid Home should automatically point to
the values of their corresponding variables.
Note: Observe the grid home is not under the Oracle grid base
home.

Create Inventory It should automatically point to /u01/app/oraInventory

Root Script Execution Mark the checkbox “Automatically run configuration scripts”
and enter the root password

Prerequisite Checks All the Prerequisite Checks should pass except the memory. It
complains the available memory is 7.5. We can ignore this
warning.
Select Ignore All checkbox then click on Next button.
Click Yes on the confirmation dialog box.
Note: If you see other warnings, you have to resolve them
before you proceed.

Install Product When the installation reaches to nearly 11%, it will display a
confirmation message. Click on Yes button.

45. Check CRS services status:


su - grid
crsctl status resource -t

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 22

J. Creating ASM Disk Groups

In the following steps, you will create the Diskgroup that will be used by Oracle database to store its
datafiles.

Note: In real life scenario, we might create more than one disk group. For example, one for the data
files and one for the FRA.

46. In the VirtualBox window, initiate ASM Configuration Assistant


asmca

47. Create the disk group DATADISK by responding to the Assistant as follows:

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 23

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 24

K. Installing Oracle Database Software and Creating the Database

In the following steps, you will install Oracle database software in srv1 and create the database.

48. Copy the Oracle database software installation file to the staging folder.
At the time of this writing, the installation file name downloaded from Oracle site is
LINUX.X64_193000_db_home.zip

49. In the Putty session, change the current user to oracle then extract the installation file into the
Oracle database software home directory
su - oracle
unzip /media/sf_staging/LINUX.X64_193000_db_home.zip -d $ORACLE_HOME

50. Logout from the VirtualBox window and login to it again as oracle

51. Open a terminal window, change the current directory to the Oracle database home directory and
run the runInstaller script.
cd $ORACLE_HOME
./runInstaller

52. Respond to the Installer windows as follows:

Window Action

Configuration Option Select the following option:

“Create and Configure a single instance database.”

System Class Select the following option:

“Server Class”

Database Edition Select the following option:

“Enterprise Edition”

Installation Location Keep the default value

Configuration Type Select the following option:


General Purpose

Database Identifiers Global Database Name: oradb.localdomain


Oracle SID: oradb
Pluggable Database Name: pdb1

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 25

Configuration Options Do not mark the AMM checkbox


Memory: 5120 MB
Character set: Use Unicode (AL32UTF8)
Sample Schemas: (optional) Mark the checkbox "Install
sample schema in the database"

Database Storage Make sure ASM is selected

Management Options Make sure the checkbox is not marked.

Recovery Option Mark the checkbox Enable Recovery


Make sure ASM is selected

ASM Diskgroup Select DATADISK

Schema Password Set passwords for the accounts

Operating System Select the “oinstall” group for all the options, except the
Groups OSOPER keep it blank.

Root Script Execution Mark the checkbox “Automatically run configuration scripts”
and enter the root password

Prerequisite Checks All the Prerequisite Checks should pass.

Summary Click on Install button

Install Product When the installation reaches to nearly 12%, if will display a
confirmation message. Click on Yes button.

Finish click on Close button

53. After the installation and database creation are finished, verify the database is up and running by
logging to it as sysdba
sqlplus / as sysdba

54. Check the status of the database (can be run as oracle or as grid)
srvctl status database -d oradb

55. Check if a connection entry to oradb is added to the tnsnames.ora file


The tnsnames.ora file was not even created.
ls $TNS_ADMIN/tnsnames.ora

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 26

56. In the VirtualBox window of srv1, start the Firefox browser and open the EM Express using the
following URL
The browser returns the error “Secure Connection Failed”. This error is generated because the
listener runs as grid user and this user does not have write access to XDB wallet. You will fix this
issue in the next tutorial section.

https://srv1:5500/em

Note: Following is a reference for EM Express known issues and how to resolve them:
Doc ID 1604062.1 : Troubleshooting Why EM Express is not Working

57. In the Putty session, run the following command to grant permission on the XDB wallet to the
gird user:
XDB wallet folder can be obtained from the output of the lsnrctl status
setfacl -R -m u:grid:rwx /u01/app/oracle/product/19.0.0/db_1/admin/oradb/xdb_wallet

58. Try opening the EM Express on the browser. Accept the warning displayed by the browser. Enter
the sys username, its password, leave the container name blank then click on Login button.

59. Explore the EM Express. When you are done, close the browser.

60. Restart the machine. Then make sure the database is automatically started up after the VM is
rebooted.

A tutorial edited by Ahmed Baraka


Installing and Creating an Oracle Database 19c with ASM P a g e | 27

Summary

• We can build up an Oracle database 19c with ASM on a VirtualBox machine.


• In high level, the procedure goes through the following stages:
o Decide about the storage size and architecture
o Prepare the machines and the operating system
o Install Oracle Grid Infrastructure (Oracle Restart)
o Install Oracle database software and create Oracle database

Note: The appliance created by me in this tutorial can be downloaded from the following link:
http://www.ahmedbaraka.com/public/download/

A tutorial edited by Ahmed Baraka

You might also like