[关闭]
@clisdodo 2019-11-12T09:48:14.000000Z 字数 4749 阅读 1635

Oracle 12cR2 单实例文件系统搭建(阿里云)

aliyun CentOS7.3 Oracle12c Silent


AskScuti:搭建类 0-1-4 Oracle 12cR2 单实例 FS(阿里云)

主机名及IP

编辑 /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

RPM包

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.shmmaxkernel.shmall 相关设置,如设置不合理,建库将出现 ORA-27102 错误。例如:物理内存64G,可设置 kernel.shmmax=64*1024*1024*1024*0.9kernel.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
  1. PS1="[`whoami`@`hostname`:"'$PWD]$'
  2. export PS1
  3. export TMP=/tmp
  4. export LANG=en_US
  5. export TMPDIR=$TMP
  6. export ORACLE_UNQNAME=cdb1
  7. ORACLE_SID=cdb1; export ORACLE_SID
  8. ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
  9. ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1; export ORACLE_HOME
  10. ORACLE_TERM=xterm; export ORACLE_TERM
  11. NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
  12. NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;export NLS_LANG
  13. PATH=.:$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin; export PATH
  14. THREADS_FLAG=native; export THREADS_FLAG
  15. umask=022
  16. if [ $USER = "oracle" ]; then
  17. if [ $SHELL = "/bin/ksh" ]; then
  18. ulimit -p 16384
  19. ulimit -n 65536
  20. else
  21. ulimit -u 16384 -n 65536
  22. fi
  23. umask 022
  24. fi

解压授权

cd /soft
unzip linuxx64_12201_database.zip
chown -R oracle:oinstall /soft
chmod -R 775 /soft

Oracle 软件安装

编辑响应文件

cd /soft/database/response/
mv db_install.rsp db_install.rsp.bak
vim db_install.rsp
  1. oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0
  2. oracle.install.option=INSTALL_DB_SWONLY
  3. UNIX_GROUP_NAME=oinstall
  4. INVENTORY_LOCATION=/u01/app/oraInventory
  5. ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1
  6. ORACLE_BASE=/u01/app/oracle
  7. oracle.install.db.InstallEdition=EE
  8. oracle.install.db.OSDBA_GROUP=dba
  9. oracle.install.db.OSOPER_GROUP=oper
  10. oracle.install.db.OSBACKUPDBA_GROUP=dba
  11. oracle.install.db.OSDGDBA_GROUP=dba
  12. oracle.install.db.OSKMDBA_GROUP=dba
  13. oracle.install.db.OSRACDBA_GROUP=dba

静默安装

chmod 775 db_install.rsp
  1. su - oracle
  2. cd /soft/database
  3. ./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

创建数据库

  1. dbca -silent -createDatabase -templateName General_Purpose.dbc \
  2. -gdbname cdb1 \
  3. -sid cdb1 \
  4. -databaseConfigType SI \
  5. -createAsContainerDatabase TRUE \
  6. -numberOfPDBs 1 \
  7. -pdbName pdb1 \
  8. -useLocalUndoForPDBs TRUE \
  9. -pdbAdminPassword oracle \
  10. -sysPassword oracle \
  11. -systemPassword oracle \
  12. -emConfiguration LOCAL \
  13. -characterSet AL32UTF8 \
  14. -memoryPercentage 30
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注