@clisdodo
2019-11-12T09:48:14.000000Z
字数 4749
阅读 1635
aliyun
CentOS7.3
Oracle12c
Silent
AskScuti:搭建类 0-1-4 Oracle 12cR2 单实例 FS(阿里云)
编辑 /etc/hosts
文件
echo "172.18.18.18 iZj6cc97x841tbj4bkl043Z" >> /etc/hosts
echo "export LANG=en_US" >> ~/.bash_profile
dd if=/dev/zero of=/home/swap bs=1M count=4096
mkswap /home/swap
swapon /home/swap
编辑 /etc/fstab
文件
/home/swap swap swap default 0 0
/usr/sbin/groupadd -g 65431 oinstall
/usr/sbin/groupadd -g 65432 dba
/usr/sbin/groupadd -g 65433 oper
useradd -u 61001 -g oinstall -G dba,oper -m oracle
passwd oracle
mkdir /u01
mkdir -p /u01/app/oracle/product/12.2.0/dbhome_1
mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01
chmod -R 775 /u01
yum -y install autoconf
yum -y install automake
yum -y install binutils
yum -y install binutils-devel
yum -y install bison
yum -y install cpp
yum -y install dos2unix
yum -y install ftp
yum -y install gcc
yum -y install gcc-c++
yum -y install lrzsz
yum -y install python-devel
yum -y install compat-libcap1
yum -y install compat-libstdc++-33
yum -y install compat-libstdc++-33.i686
yum -y install glibc-*
yum -y install glibc-*.i686
yum -y install libXpm-*.i686
yum -y install libXext
yum -y install libXext.i686
yum -y install libXtst
yum -y install libXtst.i686
yum -y install libX11
yum -y install libX11.i686
yum -y install libXau
yum -y install libXau.i686
yum -y install libxcb
yum -y install libxcb.i686
yum -y install libXi
yum -y install libXi.i686
yum -y install libstdc++.i686
yum -y install libstdc++-devel
yum -y install libstdc++-devel.i686
yum -y install libaio
yum -y install libaio.i686
yum -y install libaio-devel
yum -y install libaio-devel.i686
yum -y install ksh
yum -y install libXp
yum -y install libaio-devel
yum -y install numactl
yum -y install numactl-devel
yum -y install make -y
yum -y install sysstat -y
yum -y install unixODBC
yum -y install unixODBC-devel
yum -y install elfutils-libelf-devel
yum -y install redhat-lsb-core
yum -y install unzip
编辑 /etc/security/limits.conf
文件,内存大于8G需配置大内存页。
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 16384
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
#oracle hard memlock 8192000
#oracle soft memlock 8192000
echo "session required pam_limits.so" >> /etc/pam.d/login
编辑 /etc/sysctl.conf
文件,注意 kernel.shmmax
和 kernel.shmall
相关设置,如设置不合理,建库将出现 ORA-27102
错误。例如:物理内存64G,可设置 kernel.shmmax=64*1024*1024*1024*0.9
,kernel.shmall=kernel.shmmax/kernel.shmmni
#ORACLE SETTING
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 1210612736
kernel.shmall = 295560
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
kernel.panic_on_oops = 1
#vm.nr_hugepages = 2500
sysctl -p
systemctl status firewalld.service
systemctl stop firewalld.service
systemctl disable firewalld.service
su - oracle
vim .bash_profile
PS1="[`whoami`@`hostname`:"'$PWD]$'
export PS1
export TMP=/tmp
export LANG=en_US
export TMPDIR=$TMP
export ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1; export ORACLE_SID
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1; export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;export NLS_LANG
PATH=.:$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin; export PATH
THREADS_FLAG=native; export THREADS_FLAG
umask=022
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
cd /soft
unzip linuxx64_12201_database.zip
chown -R oracle:oinstall /soft
chmod -R 775 /soft
cd /soft/database/response/
mv db_install.rsp db_install.rsp.bak
vim db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oper
oracle.install.db.OSBACKUPDBA_GROUP=dba
oracle.install.db.OSDGDBA_GROUP=dba
oracle.install.db.OSKMDBA_GROUP=dba
oracle.install.db.OSRACDBA_GROUP=dba
chmod 775 db_install.rsp
su - oracle
cd /soft/database
./runInstaller -silent -force -noconfig -responseFile /soft/database/response/db_install.rsp
As a root user, execute the following script(s):
1. /u01/app/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/12.2.0/dbhome_1/root.sh
采用默认响应配置文件 /soft/database/response/netca.rsp
,端口1521
netca -silent -responseFile /soft/database/response/netca.rsp
dbca -silent -createDatabase -templateName General_Purpose.dbc \
-gdbname cdb1 \
-sid cdb1 \
-databaseConfigType SI \
-createAsContainerDatabase TRUE \
-numberOfPDBs 1 \
-pdbName pdb1 \
-useLocalUndoForPDBs TRUE \
-pdbAdminPassword oracle \
-sysPassword oracle \
-systemPassword oracle \
-emConfiguration LOCAL \
-characterSet AL32UTF8 \
-memoryPercentage 30