0% found this document useful (0 votes)
102 views5 pages

Oracle 18c Installation Script Guide

The document outlines the steps for setting up an Oracle database environment, including creating user groups, adding a user, installing necessary packages, and configuring system parameters. It also details the creation of directories for Oracle installation, setting environment variables in the user's profile, and configuring the listener and tnsnames files. Finally, it provides a script for managing the Oracle service with start, stop, and status functions.

Uploaded by

echo chen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views5 pages

Oracle 18c Installation Script Guide

The document outlines the steps for setting up an Oracle database environment, including creating user groups, adding a user, installing necessary packages, and configuring system parameters. It also details the creation of directories for Oracle installation, setting environment variables in the user's profile, and configuring the listener and tnsnames files. Finally, it provides a script for managing the Oracle service with start, stop, and status functions.

Uploaded by

echo chen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

groupadd -g 54321 oinstall

groupadd -g 54322 dba


groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin
groupadd -g 54330 racdba

useradd -u 54321 -g oinstall \


-G dba,oper,backupdba,dgdba,kmdba,racdba oracle

passwd oracle
#Ab123456

rpm -qa compat-libcap1


rpm -qa glibc
rpm -qa glibc-devel

rpm -qa ksh


rpm -qa libaio-devel
rpm -qa libaio
rpm -qa libX11

rpm -qa libXau


rpm -qa libXi
rpm -qa libXtst

rpm -qa libgcc


rpm -qa libstdc++
rpm -qa libstdc++-devel
rpm -qa libxcb

rpm -qa make


rpm -qa nfs-utils
rpm -qa smartmontools
rpm -qa net-tools

yum install compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm -y


rpm -qa compat-libstdc++-33

vi /etc/[Link]
# kernel parameters for 12gR2 installation
[Link]-max = 6815744
[Link] = 250 32000 100 128
[Link] = 4096
[Link] = 1073741824
[Link] = 4398046511104
[Link].rmem_default = 262144
[Link].rmem_max = 4194304
[Link].wmem_default = 262144
[Link].wmem_max = 1048576
[Link]-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
kernel.panic_on_oops=1
# Apply kernel parameters
/sbin/sysctl -p

vi /etc/security/[Link]
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle soft memlock 3145728
oracle hard memlock 3145728

mkdir -p /Oracle18c/product/18.0.0/dbhome_1
mkdir -p /oradata
mkdir -p /mesdata
mkdir -p /orabak
mkdir -p /oraInventory
mkdir -p /archive
mkdir -p /Oracle18c/flash_recovery_area/cdb1

chown oracle:oinstall -R /Oracle18c/product/18.0.0/dbhome_1


chown oracle:oinstall -R /oradata
chown oracle:oinstall -R /mesdata
chown oracle:oinstall -R /orabak
chown oracle:oinstall -R /oraInventory
chown oracle:oinstall -R /archive
chown oracle:oinstall -R /Oracle18c/flash_recovery_area
chown oracle:oinstall -R /home/oracle

vi /home/oracle/.bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=cimesdb
export ORACLE_UNQNAME=MES
export ORACLE_BASE=/Oracle18c
export ORACLE_HOME=$ORACLE_BASE/product/18.0.0/dbhome_1
export ORACLE_SID=MES

export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

export NLS_LANG=AMERICAN_AMERICA.AL32UTF8

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

if [ $USER = "oracle" ]; then


if [ $SHELL = "/bin/ksh" ]; then
ulimit -u 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

envo

source .bash_profile

cp -rp LINUX.X64_180000_db_home.zip /Oracle18c/product/18.0.0/dbhome_1


cd /Oracle18c/product/18.0.0/dbhome_1
unzip LINUX.X64_180000_db_home.zip

chown oracle:oinstall -R /Oracle18c

cd $ORACLE_HOME/network/admin/
vi [Link]
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = cimesdb)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /Oracle18c/product/18.0.0/dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = MES)
(ORACLE_HOME =/Oracle18c/product/18.0.0/dbhome_1)
(SID_NAME = MES)
)
(SID_DESC =
(GLOBAL_DBNAME = WRP)
(ORACLE_HOME =/Oracle18c/product/18.0.0/dbhome_1)
(SID_NAME = WRP)
)

# 修正 IP 和 server_name
vi [Link]
WRP =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = cimesdb)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = WRP)
)
)

LISTENER_WRP =
(ADDRESS = (PROTOCOL = TCP)(HOST = cimesdb)(PORT = 1521))

MES =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = cimesdb)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = MES)
)
)

LISTENER_MES =
(ADDRESS = (PROTOCOL = TCP)(HOST = cimesdb)(PORT = 1521))

export ORACLE_SID=MES
sqlplus sys/Ab123456@MES as sysdba
show parameter db_name;

vi /etc/init.d/orasv
#!/bin/bash

start() {
su - oracle -c 'export ORACLE_SID=MES;
/Oracle18c/product/18.0.0/dbhome_1/bin/dbstart'
su - oracle -c 'export ORACLE_SID=WRP;
/Oracle18c/product/18.0.0/dbhome_1/bin/dbstart'
RETVAL=$?
}

stop() {
su - oracle -c 'export ORACLE_SID=MES;
/Oracle18c/product/18.0.0/dbhome_1/bin/dbshut'
su - oracle -c 'export ORACLE_SID=WRP;
/Oracle18c/product/18.0.0/dbhome_1/bin/dbshut'
RETVAL=$?
}

status() {

oraps=`ps -ef|grep "ora_smon"|grep -v grep|wc -l`

if [ $oraps -lt 2 ] ; then


RETVAL=1
echo "Oracle Process not found!"
else
RETVAL=0
echo "Oracle Service OK!"
fi

echo $RETVAL
return $RETVAL
}

case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
stop
start
;;
*)
echo "Usage: orasv {start|stop|status}"
exit 1
;;
esac

exit $RETVAL

sudo chmod +x /etc/init.d/orasv

You might also like