How to install Oracle 18 C on CentOS 7 in Silent Mode
For my environment, I use sever below- CPU 8 cores Intel Xeon
- RAM 16 GB
- SSD 500 GB
- CentOS 7
Prepare Linux Environment
First, is editing the hostname. we can editing hostname by editing two files /etc/hostname and /etc/host.Editing Hostname
#vi /etc/hosts
for my machine, I'll name my host as oracle.itstikk.pro, so we edit /etc/hosts as below
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
192.168.56.107 oracle.itstikk.pro oracle
next is edit /etc/hostname file. in my case, my host's name is oracle.itstikk.pro, so I edited my file as below192.168.56.107 oracle.itstikk.pro oracle
#vi /etc/hostname
oracle.itstikk.pro
oracle.itstikk.pro
Create Groups and user for Oracle Database installation
In order to install oracle database on LINUX, you need to create required user groups and users. The Required user group includes onistall, dba, oper. Additionally, for some special role like backup, etc, you may need some special group for instance, backupdba, dgdba, kmdba, asmdba, asmoper, asmadmin, racdba. Under root user privileges, add groups in your server.Install Oracle 18C
#groupadd oinstall
#groupadd dba
#groupadd oper
#groupadd backupdab
#groupadd dgdba
#groupadd kmdba
#groupadd asmdba
#groupadd asmoper
#groupadd asmadmin
#groupadd racdba
#groupadd dba
#groupadd oper
#groupadd backupdab
#groupadd dgdba
#groupadd kmdba
#groupadd asmdba
#groupadd asmoper
#groupadd asmadmin
#groupadd racdba
After Creating necessary group, we will create oracle user which belongs to those groups.
#adduser -g oinstall -G dba, oper, backupdba, dgdba, kmdba, asmdba, asmoper, \
asmadmin, racdba oracle
Next, we need to set password for oracle user we just created.asmadmin, racdba oracle
#passwd oracle
Set up CentOS environment to be ready for install Oracle Database
You need to install required packages for Oracle database, start by update CentOS.
#yum -y update
Install required packages
# yum install -y binutils.x86_64 \
compat-libcap1.x86_64 \
gcc.x86_64 \
gcc-c++.x86_64 \
glibc.i686 \
glibc.x86_64 \
glibc-devel.i686 \
glibc-devel.x86_64 \
ksh compat-libstdc++-33 \
libaio.i686 libaio.x86_64 \
libaio-devel.i686 \
libaio-devel.x86_64 \
libgcc.i686 \
libgcc.x86_64 libstdc++.i686 \
libstdc++.x86_64 \
libstdc++-devel.i686 \
libstdc++-devel.x86_64 \
libXi.i686 libXi.x86_64 \
libXtst.i686 libXtst.x86_64 \
make.x86_64 sysstat.x86_64
zip unzip
compat-libcap1.x86_64 \
gcc.x86_64 \
gcc-c++.x86_64 \
glibc.i686 \
glibc.x86_64 \
glibc-devel.i686 \
glibc-devel.x86_64 \
ksh compat-libstdc++-33 \
libaio.i686 libaio.x86_64 \
libaio-devel.i686 \
libaio-devel.x86_64 \
libgcc.i686 \
libgcc.x86_64 libstdc++.i686 \
libstdc++.x86_64 \
libstdc++-devel.i686 \
libstdc++-devel.x86_64 \
libXi.i686 libXi.x86_64 \
libXtst.i686 libXtst.x86_64 \
make.x86_64 sysstat.x86_64
zip unzip
Next is to add kernel parameter by edit /etc/sysctl.conf file
#vi /etc/sysctl.conf
Add below in the end of the file
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 8329226240
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 = 1048586
After you added all of kernel parameter to the file, execute below command to apply change to the file.
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 8329226240
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 = 1048586
#sysctl -p
#sysctl -a
Now, set the limits for oracle in /etc/security/limits.conf file.
#sysctl -a
#vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
Set up security
In order to access oracle database instance from outside, you need to configure firewall to open connection port and Selinux.First, to open connection port.
#firewall-cmd --permanent --add-port=1521/tcp
#firewall-cm --reload
For Selinux, you need to edit /etc/selinux/config file#firewall-cm --reload
#vi /etc/selinux/config
And set SELINUX to Permissive
SELINUX=Permissive
Create Oracle Database install directory
#mkdir -p /u01/app/oracle/product/18.0.0/dbhome_1
#mkdir -p /u02/oradata
#chown -R oracle:oinstall /u01 /u02
#chmod -R 775 /u01 /u02
Set up Environment Variable for oracle user#mkdir -p /u02/oradata
#chown -R oracle:oinstall /u01 /u02
#chmod -R 775 /u01 /u02
#su - oracle
$vi .bash_profile
Add below by the end of the file.$vi .bash_profile
export TMP=/tmp
export TMPDIR=\$TMP
export ORACLE_HOSTNAME=oracle.itstikk.pro
export ORACLE_UNQNAME=cdb1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/18.0.0/dbhome_1
export ORA_INVENTORY=/u01/app/oraInventory
export ORACLE_SID=cdb1
export PDB_NAME=pdb1
export DATA_DIR=/u02/oradata
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export PATH=/usr/sbin:/usr/local/bin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
Apply change to the .bash_profile file asexport TMPDIR=\$TMP
export ORACLE_HOSTNAME=oracle.itstikk.pro
export ORACLE_UNQNAME=cdb1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/18.0.0/dbhome_1
export ORA_INVENTORY=/u01/app/oraInventory
export ORACLE_SID=cdb1
export PDB_NAME=pdb1
export DATA_DIR=/u02/oradata
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export PATH=/usr/sbin:/usr/local/bin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
$source .bash_profile
After finish adding environment variable, you need to download oracle database and copy file to $ORACLE_HOME, you can download oracle from here.
$cp LINUX.X64_180000_db_home.zip $ORACLE_HOME
Now, move to the $ORACLE_HOME and unzip the oracle database's zip file.
$cd $ORACLE_HOME
$unzip LINUX.X64_180000_db_home.zip $ORACLE_HOME
$unzip LINUX.X64_180000_db_home.zip $ORACLE_HOME
Install Oracle database on silent mode. Create Database Instance
If you don't have access to GUI, you can install Oracle database under 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=trueAfter installation finished, you need to below script as root privilege
#bash /u01/app/oraInventory/orainstRoot.sh
#bash /u01/app/oracle/product/18.0.0/dbhome_1/root.sh
Create Database Instance by DBCA
Before you could create database instance, you need to start listener service.
$lsnrctl start
Now, create your database instance by using DBCA in 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 \ -automaticMemoryManagement false \ -totalMemory 2000 \ -storageType FS \ -datafileDestination "${DATA_DIR}" \ -redoLogFileSize 50 \ -emConfiguration NONE \ -ignorePreReqsAfter the process is completed, you need to edit the "/etc/oratab" file setting the restart flag for each instance to 'Y'.
#vi /etc/oratab
cdb1:/u01/app/oracle/product/18.0.0/db_1:Y
Next, enable Oracle Managed Files (OMF) and make sure the PDB starts when the instance starts.
cdb1:/u01/app/oracle/product/18.0.0/db_1:Y
$sqlplus / as sysdba
>alter system set db_create_file_dest='${DATA_DIR}';
>alter pluggable database ${PDB_NAME} save state;
>exit;
>alter system set db_create_file_dest='${DATA_DIR}';
>alter pluggable database ${PDB_NAME} save state;
>exit;
Create User and Connect to Database
Next is to create user which will connect to the database.
$sqlplus / as sysdba
>alter session set "_ORACLE_SCRIPT"=true;
>create user user01 identified by Oracle18C#;
>grant connect, resource user01;
>grant all privileges to user01;
>grant unlimited tablestace to user01;
>exit;
>alter session set "_ORACLE_SCRIPT"=true;
>create user user01 identified by Oracle18C#;
>grant connect, resource user01;
>grant all privileges to user01;
>grant unlimited tablestace to user01;
>exit;
Now, you are ready to connect to database instance.
Reference
You can find more resource from links below. I also learn how to install from these links.
No comments:
Post a Comment