Jul 28, 2018

Steps to Create Oracle Database 18c


Machine : Oracle VirtualBox
OS           : RHEL 6.9
[oracle@nk2b ~]$ lsb_release -a
LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 6.9 (Santiago)
Release:        6.9
Codename:       Santiago
RAM     : 8gb
Storage  : 100gb
18c Database Software : V978967-01.zip

The "/etc/hosts" file must contain a fully qualified name for the server – As ROOT User
## Public
12.3.21.120       nk2b.sblib.com          nk2b

Update /etc/fstab with /dev/shm details – As ROOT User
tmpfs         /dev/shm            tmpfs   rw,exec,size=8G         0 0

The following packages are listed as required, including the 32-bit version of some of the packages. Many of the packages should be installed already – As ROOT User
modify "/etc/yum.conf" and add "multilib_policy=all", so that we can install packages of both architecture (32bit & 64bit)

yum install bc.x86_64 -y
yum install binutils.x86_64 -y
yum install compat-libcap1.x86_64 -y
yum install compat-libstdc++-33.x86_64 -y
yum install compat-libstdc++-33.i686 -y
yum install e2fsprogs.x86_64 -y
yum install e2fsprogs-libs.x86_64 -y
yum install glibc.i686 -y
yum install glibc.x86_64 -y
yum install glibc-devel.i686 -y
yum install glibc-devel.x86_64 -y
yum install ksh .x86_64 -y
yum install libaio.x86_64 -y
yum install libaio.i686 -y
yum install libaio-devel.x86_64 -y
yum install libaio-devel.i686 -y
yum install libX11.i686 -y
yum install libX11.x86_64 -y
yum install libXau.i686 -y
yum install libXau.x86_64 -y
yum install libXi.i686 -y
yum install libXi.x86_64 -y
yum install libXtst.i686 -y
yum install libXtst.x86_64 -y
yum install libgcc.i686 -y
yum install libgcc.x86_64 -y
yum install libstdc++.i686 -y
yum install libstdc++.x86_64 -y
yum install libstdc++-devel.i686 -y
yum install libstdc++-devel.x86_64 -y
yum install libxcb.i686 -y
yum install libxcb.x86_64 -y
yum install make.x86_64 -y
yum install net-tools.x86_64 -y ## (for Oracle RAC and Oracle Clusterware)
yum install nfs-utils.x86_64 -y ## (for Oracle ACFS)
yum install smartmontools.x86_64 -y
yum install sysstat.x86_64 -y
yum install unixODBC.x86_64 -y
yum install unixODBC-devel.x86_64 -y
yum install kmod-oracleasm -y ############ (for Oracle ASM)
yum install redhat-lsb.x86_64 -y                  
yum install redhat-lsb-core.x86_64 -y

Add below lines to /etc/security/limits.conf file – As ROOT User
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

Add the following lines to the "/etc/sysctl.conf" file – As ROOT User

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
kernel.panic_on_oops = 1

Disable Transparent HugePages – As ROOT User
# cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
[always] never

For Oracle Linux 6 or earlier releases, add the following entry to the kernel boot line in the /etc/grub.conf file:
transparent_hugepage=never

For example:
title Red Hat Enterprise Linux 6 (2.6.32-696.20.1.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-696.20.1.el6.x86_64 ro root=/dev/mapper/vg_nk2b-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_nk2b/lv_swap rd_NO_MD SYSFONT=latarcyrheb-sun16 rd_LVM_LV=vg_nk2b/lv_root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet transparent_hugepage=never
        initrd /initramfs-2.6.32-696.20.1.el6.x86_64.img

Create the new groups and users – As ROOT User
groupadd -g 101 dba
groupadd -g 102 oper
useradd -m -u 101 -g dba -G oper -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle

Set the password for the “oracle” user – As ROOT User
passwd oracle

Grant SUDO priviledge to ORACLE user (OPTIONAL) – As ROOT User
visudo

Add below line:-
%dba    ALL=(ALL)       NOPASSWD: ALL

Set secure Linux to permissive by editing the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows. -- REBOOT SERVER – As ROOT User
SELINUX=disabled

Disable firewall – As ROOT User
# service iptables status
# service iptables stop
# service iptables status

# chkconfig  iptables --list
# chkconfig  iptables off
# chkconfig  iptables --list

Create the directories in which the Oracle software will be installed – As ROOT User
# mkdir -p /d01/app/oracle/product/1830 /stage /oradata
# chown -R oracle:dba /d01 /stage /oradata
# chmod -R 775 /d01 /stage /oradata

Copy 18c database zip file to /stage location – As ROOT User
# scp root@nk45a:/software/ V978967-01.zip oracle@nk2b:/stage/

Add the following lines at the end of the "/home/oracle/.bash_profile" file. – As ORACLE User
# ---------------------------------------------------
# .bash_profile
# ---------------------------------------------------
# OS User:      oracle
# Application:  Oracle Database Software Owner
# Version:      Oracle 18 Release 3
# ---------------------------------------------------

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
      . ~/.bashrc
fi

alias ls="ls -FA"

# ---------------------------------------------------
# ORACLE_SID
# ---------------------------------------------------
# Specifies the Oracle system identifier (SID) for
# the Oracle instance running on this node.
# Each RAC node must have a unique ORACLE_SID.
# (i.e. orcl1, orcl2,...)
# ---------------------------------------------------
ORACLE_SID=z1; export ORACLE_SID

# ---------------------------------------------------
# ORACLE_UNQNAME
# ---------------------------------------------------
# In previous releases of Oracle Database, you were
# required to set environment variables for
# ORACLE_HOME and ORACLE_SID to start, stop, and
# check the status of Enterprise Manager. With
# Oracle Database 11g Release 2 (11.2) and later, you
# need to set the environment variables ORACLE_HOME
# and ORACLE_UNQNAME to use Enterprise Manager.
# Set ORACLE_UNQNAME equal to the database unique
# name.
# ---------------------------------------------------
ORACLE_UNQNAME=z1; export ORACLE_UNQNAME

# ---------------------------------------------------
# JAVA_HOME
# ---------------------------------------------------
# Specifies the directory of the Java SDK and Runtime
# Environment.
# ---------------------------------------------------
JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64; export JAVA_HOME

# ---------------------------------------------------
# ORACLE_BASE
# ---------------------------------------------------
# Specifies the base of the Oracle directory structure
# for Optimal Flexible Architecture (OFA) compliant
# database software installations.
# ---------------------------------------------------
ORACLE_BASE=/d01/app/oracle; export ORACLE_BASE

# ---------------------------------------------------
# ORACLE_HOME
# ---------------------------------------------------
# Specifies the directory containing the Oracle
# Database software.
# ---------------------------------------------------
ORACLE_HOME=$ORACLE_BASE/product/1830; export ORACLE_HOME

# ---------------------------------------------------
# ORACLE_PATH
# ---------------------------------------------------
# Specifies the search path for files used by Oracle
# applications such as SQL*Plus. If the full path to
# the file is not specified, or if the file is not
# in the current directory, the Oracle application
# uses ORACLE_PATH to locate the file.
# This variable is used by SQL*Plus, Forms and Menu.
# ---------------------------------------------------
ORACLE_PATH=/home/oracle/scripts:$ORACLE_HOME/rdbms/admin; export ORACLE_PATH

# ---------------------------------------------------
# SQLPATH
# ---------------------------------------------------
# Specifies the directory or list of directories that
# SQL*Plus searches for a login.sql file.
# ---------------------------------------------------
SQLPATH=/home/oracle/scripts; export SQLPATH

# ---------------------------------------------------
# ORACLE_TERM
# ---------------------------------------------------
# Defines a terminal definition. If not set, it
# defaults to the value of your TERM environment
# variable. Used by all character mode products.
# ---------------------------------------------------
ORACLE_TERM=xterm; export ORACLE_TERM

# ---------------------------------------------------
# NLS_DATE_FORMAT
# ---------------------------------------------------
# Specifies the default date format to use with the
# TO_CHAR and TO_DATE functions. The default value of
# this parameter is determined by NLS_TERRITORY. The
# value of this parameter can be any valid date
# format mask, and the value must be surrounded by
# double quotation marks. For example:
#
#         NLS_DATE_FORMAT = "MM/DD/YYYY"
#
# ---------------------------------------------------
NLS_DATE_FORMAT="MON-DD-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT

# ---------------------------------------------------
# TNS_ADMIN
# ---------------------------------------------------
# Specifies the directory containing the Oracle Net
# Services configuration files like listener.ora,
# tnsnames.ora, and sqlnet.ora.
# ---------------------------------------------------
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN

# ---------------------------------------------------
# ORA_NLS11
# ---------------------------------------------------
# Specifies the directory where the language,
# territory, character set, and linguistic definition
# files are stored.
# ---------------------------------------------------
ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11

# ---------------------------------------------------
# PATH
# ---------------------------------------------------
# Used by the shell to locate executable programs;
# must include the $ORACLE_HOME/bin directory.
# ---------------------------------------------------
PATH=.:${JAVA_HOME}/bin:$JAVA_HOME/db/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=${PATH}:/u01/app/oracle/dba_scripts/bin
export PATH

# ---------------------------------------------------
# LD_LIBRARY_PATH
# ---------------------------------------------------
# Specifies the list of directories that the shared
# library loader searches to locate shared object
# libraries at runtime.
# ---------------------------------------------------
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
# ---------------------------------------------------
# Specifies the directory or list of directories that
# contain compiled Java classes.
# ---------------------------------------------------
CLASSPATH=$ORACLE_HOME/jdbc/lib/ojdbc6.jar
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/oc4j/ant/lib/ant.jar
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/oc4j/ant/lib/ant-launcher.jar
CLASSPATH=${CLASSPATH}:$JAVA_HOME/db/lib/derby.jar
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH

# ---------------------------------------------------
# THREADS_FLAG
# ---------------------------------------------------
# All the tools in the JDK use green threads as a
# default. To specify that native threads should be
# used, set the THREADS_FLAG environment variable to
# "native". You can revert to the use of green
# threads by setting THREADS_FLAG to the value
# "green".
# ---------------------------------------------------
THREADS_FLAG=native; export THREADS_FLAG

# ---------------------------------------------------
# TEMP, TMP, and TMPDIR
# ---------------------------------------------------
# Specify the default directories for temporary
# files; if set, tools that create temporary files
# create them in one of these directories.
# ---------------------------------------------------
export TEMP=/tmp
export TMPDIR=/tmp

# ---------------------------------------------------
# UMASK
# ---------------------------------------------------
# Set the default file mode creation mask
# (umask) to 022 to ensure that the user performing
# the Oracle software installation creates files
# with 644 permissions.
# ---------------------------------------------------
umask 022

Unzip database software on $ORACLE_HOME location – As ORACLE User
$ unzip /stage/V978967-01.zip -d /d01/app/oracle/product/1830

Install cvuqdisk – Need to specify correct path – As ROOT User
# export CVUQDISK_GRP=dba
# rpm -ivh /d01/app/oracle/product/1830/cv/rpm/cvuqdisk-1.0.10-1.rpm
Preparing...                ########################################### [100%]
   1:cvuqdisk               ########################################### [100%]

Execute “runInstaller” to start Database Installation – As ORACLE User
$ xhost +
access control disabled, clients can connect from any host
$ cd $ORACLE_HOME
$ ./runInstaller

Follow the on-screen instruction to complete Software Installation
# /d01/app/oraInventory/orainstRoot.sh
Changing permissions of /d01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /d01/app/oraInventory to dba.
The execution of the script is complete.

# /d01/app/oracle/product/1830/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /d01/app/oracle/product/1830

Enter the full pathname of the local bin directory: [/usr/local/bin]:
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...

Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Do you want to setup Oracle Trace File Analyzer (TFA) now ? yes|[no] :
yes
Installing Oracle Trace File Analyzer (TFA).
Log File: /d01/app/oracle/product/1830/install/root_nk2b.sblib.com_2018-07-25_22-15-09-428130978.log
Finished installing Oracle Trace File Analyzer (TFA)

Once Software Installation completed Initiate Database Creation Process:

$ dbca








No comments:

Post a Comment