RAC 12.1 靜默安裝手冊--linux7.5
此篇相當於是我的安裝記錄,也是我的安裝手冊
以前總是裝庫總是零零散散的,word,官方文件搜來搜去,還是寫成txt,還是txt好!
1.
#vi /etc/sysconfig/network --linux6上
#NETWORKING=yes
#HOSTNAME=test12c1
vi /etc/hostname linux7上
hostname test12c1
vi /etc/hosts
10.174.26.194 test12c1
10.174.26.195 test12c2
192.168.100.10 test12c1-priv
192.168.100.11 test12c2-priv
10.174.26.196 test12c1-vip
10.174.26.197 test12c2-vip
10.174.26.198 test12c-scan
2.
[[email protected] ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
vi /etc/selinux/config
SELINUX=disabled
3.
yum install -y \
binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33.i686 \
gcc gcc-c++ glibc glibc.i686 glibc-devel glibc-devel.i686 ksh \
libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel libstdc++-devel.i686 \
libaio libaio.i686 libaio-devel libaio-devel.i686 \
libXext libXext.i686 libXtst libXtst.i686 libX11 libX11.i686 \
libXau libXau.i686 libxcb libxcb.i686 libXi libXi.i686 \
make sysstat nfs-utils \
ftp \
elfutils-libelf-devel \
4.
groupadd -g 501 dba
groupadd -g 502 oinstall
groupadd -g 503 asmadmin
groupadd -g 504 asmdba
groupadd -g 505 asmoper
--usermod -a -G asmoper grid
useradd -g oinstall -G dba,asmdba oracle
useradd -g oinstall -G dba,asmadmin,asmdba,asmoper grid
echo "oracle"|passwd --stdin oracle
echo "grid"|passwd --stdin grid
mkdir -p /oracle/app/oracle
mkdir -p /oracle/app/12.1/grid
mkdir -p /oracle/app/grid
mkdir -p /oracle/app/oraInventory
chown -R oracle:oinstall /oracle
chown -R grid:oinstall /oracle/app/12.1
chown -R grid:oinstall /oracle/app/grid
chown -R grid:oinstall /oracle/app/oraInventory
chmod -R 775 /oracle
unzip p*
5.
.bash_profile
oracle:
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export TMP TMPDIR
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LANG=en_US
export NLS_LANG=american_america.ZHS16GBK
export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
export ORACLE_SID=stu12c01
grid:
umask 022
export ORACLE_BASE=/oracle/app/grid
export ORACLE_HOME=/oracle/app/12.1
export GRID_HOME=$ORACLE_HOME
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LANG=en_US
export ORACLE_SID=+ASM1
export NLS_LANG=american_america.ZHS16GBK
export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
alias rm='rm -i'
6.
最佳實踐
--limits memlock應該比實際記憶體更大,單位kb
vi /etc/security/limit.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 4096
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 4096
grid hard nofile 65536
grid soft stack 32768
grid hard stack 32768
/etc/pam.d/login
session required pam_limits.so
/etc/profile
if [ $USER = "oracle" ] || [ $USER = "grid" ] || [ $USER = "root" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
7.
kernel.shmmax = 15461882265 --記憶體的 90%,比共享記憶體大,比實體記憶體小
kernel.shmall = 3774873 ----getconf PAGESIZE獲取記憶體頁大小, 15461882265/4096=3774873
gd-- kernel.shmmni = 4096
gd-- net.ipv4.ip_local_port_range= 9000 65500
gd-- net.core.rmem_default= 262144
gd-- net.core.rmem_max= 4194304
gd-- net.core.wmem_default= 262144
gd-- net.core.wmem_max= 1048576
kernel.sem= 250 32000 100 128
gd-- fs.file-max= 6815744
gd-- fs.aio-max-nr=4194304
vm.nr_hugepages = 8192 --大頁,記憶體較大時設定大頁會提高資料庫的效能,16g的庫就不設定了
--檢查大頁數量 grep -i huge /proc/meminfo
sysctl -p
8.
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub test12c2
ssh-copy-id -i ~/.ssh/id_rsa.pub test12c1
ssh test12c1 date;ssh test12c2 date
9.
/etc/ntpd.conf
server 127.127.1.0
fudge 127.127.1.0 stratum 11
driftfile /var/lib/ntp/drift
broadcatdelay 0.008
/etc/ntpd.conf
server 10.174.26.194 prefer
driftfile /var/lib/ntp/drift
broadcastdelay 0.008
systemctl ntpd restart
[[email protected] ~]# ntpstat
synchronised to local net at stratum 12
time correct to within 7948 ms
polling server every 64 s
10.未使用multipath,這裡忽略
[[email protected] ~]# rpm -qa |grep device-mapper
device-mapper-libs-1.02.146-4.el7.x86_64
device-mapper-multipath-libs-0.4.9-119.el7.x86_64
device-mapper-persistent-data-0.7.3-3.el7.x86_64
device-mapper-event-libs-1.02.146-4.el7.x86_64
device-mapper-1.02.146-4.el7.x86_64
device-mapper-multipath-0.4.9-119.el7.x86_64
device-mapper-event-1.02.146-4.el7.x86_64
mpathconf --enable --with_multipathd y
systemctl restart multipathd
11.
--rhel7已不可用 KERNEL=="sd*",BUS=="scsi",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$name",RESULT=="36000c29ef8ec01e9d79731bb9afa661f",NAME="/dev/asmdata1",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c29ef8ec01e9d79731bb9afa661f", RUN+="/bin/sh -c 'mknod /dev/asmdata01 b $major $minor; chown grid:asmadmin /dev/asmdata01; chmod 0660 /dev/asmdata01'"
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c290d73dc2b7cd69012f2f94b343", RUN+="/bin/sh -c 'mknod /dev/asmdata02 b $major $minor; chown grid:asmadmin /dev/asmdata02; chmod 0660 /dev/asmdata02'"
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c29aad913b63c1ce01b43adcd164", RUN+="/bin/sh -c 'mknod /dev/asmdata03 b $major $minor; chown grid:asmadmin /dev/asmdata03; chmod 0660 /dev/asmdata03'"
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c29a71776e88600815cac39961ed", RUN+="/bin/sh -c 'mknod /dev/asmvote01 b $major $minor; chown grid:asmadmin /dev/asmvote01; chmod 0660 /dev/asmvote01'"
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c298f16db97f888eecb6094318f8", RUN+="/bin/sh -c 'mknod /dev/asmvote02 b $major $minor; chown grid:asmadmin /dev/asmvote02; chmod 0660 /dev/asmvote02'"
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c2938b1a50299d4bc77a966ed743", RUN+="/bin/sh -c 'mknod /dev/asmvote03 b $major $minor; chown grid:asmadmin /dev/asmvote03; chmod 0660 /dev/asmvote03'"
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c296501bb41132a34ddf95e338f8", RUN+="/bin/sh -c 'mknod /dev/asmvote04 b $major $minor; chown grid:asmadmin /dev/asmvote04; chmod 0660 /dev/asmvote04'"
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c2907ec0c78fd5bf51f0603a2317", RUN+="/bin/sh -c 'mknod /dev/asmvote05 b $major $minor; chown grid:asmadmin /dev/asmvote05; chmod 0660 /dev/asmvote05'"
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c29575bfd0c92c44985540f5407b", RUN+="/bin/sh -c 'mknod /dev/asmvote06 b $major $minor; chown grid:asmadmin /dev/asmvote06; chmod 0660 /dev/asmvote06'"
/sbin/udevadm trigger --type=devices --action=change
/sbin/udevadm control --reload
ls -lrt /dev/asm*
12.
oracle.install.option=CRS_CONFIG --CRS_SWONLY只會在本地安裝軟體,在執行root.sh的時候會多幾步
ORACLE_BASE=/oracle/app/grid
ORACLE_HOME=/oracle/app/12.1/grid
INVENTORY_LOCATION=/oracle/app/oraInventory
oracle.install.asm.OSDBA=asmdba
oracle.install.asm.OSOPER=asmadmin
oracle.install.asm.OSASM=asmoper --12c中3個組必須不同
oracle.install.crs.config.gpnp.scanPort=1521
oracle.install.crs.config.ClusterType=STANDARD
oracle.install.crs.config.clusterName=test-cluster
oracle.install.crs.config.gpnp.configureGNS=false
oracle.install.crs.config.clusterNodes=test12c1:test12c1-vip,test12c2:test12c2-vip
oracle.install.crs.config.networkInterfaceList=ens192:10.174.26.0:1,ens224:192.168.100.0:2,virbr0:192.168.122.0:3
oracle.install.crs.config.storageOption=LOCAL_ASM_STORAGE --不明白CLIENT_ASM_STORAGE什麼意思
oracle.install.crs.config.useIPMI=false
oracle.install.asm.SYSASMPassword=Oracle1234
oracle.install.asm.diskGroup.name=votedg
oracle.install.asm.diskGroup.redundancy=NORMAL
oracle.install.asm.diskGroup.AUSize=1 --每個磁碟組可以設定不同的au,data可以調大一些
oracle.install.asm.diskGroup.disks=/dev/asmvote01,/dev/asmvote02,/dev/asmvote03,/dev/asmvote04,/dev/asmvote05,/dev/asmvote06
oracle.install.asm.monitorPassword=Oracle1234 --必須大於8位的複雜密碼
oracle.install.asm.diskGroup.diskDiscoveryString=/dev/asm*
oracle.install.config.managementOption=NONE
grid:
./runcluvfy.sh stage -pre crsinst -n test12c1,test12c2 -fixup -verbose
grid:
nohup ./runInstaller -responseFile /oracle/soft/grid/response/grid_install.rsp -silent -ignorePrereq -showProgress &
root:
/oracle/app/oraInventory/orainstRoot.sh
/oracle/app/12.1/grid/root.sh
**********************************deinstall crs*********************************************************
perl /oracle/app/12.1/crs/install/rootcrs.pl -deconfig -force
/oracle/app/12.1/grid/crs/install/roothas.pl -deconfig -verbose -force
rm -rf $INVENTORY
rm -rf $ORACLE_BASE
rm -rf $ORACLE_HOME
rm -rf /etc/ora*
rm -rf /tmp/*
rm -rf /usr/local/bin/dbhome
rm -rf /usr/local/bin/oraenv
rm -rf /usr/local/bin/coraenv
chown -R oracle:oinstall /oracle
chown -R grid:oinstall /oracle/app/12.1
chown -R grid:oinstall /oracle/app/grid
chown -R grid:oinstall /oracle/app/oraInventory
chmod -R 775 /oracle
dd if=/dev/zero count=10 bs=512 of=/dev/asmvote01
dd if=/dev/zero count=10 bs=512 of=/dev/asmvote02
dd if=/dev/zero count=10 bs=512 of=/dev/asmvote03
dd if=/dev/zero count=10 bs=512 of=/dev/asmvote04
dd if=/dev/zero count=10 bs=512 of=/dev/asmvote05
dd if=/dev/zero count=10 bs=512 of=/dev/asmvote06
dd if=/dev/zero count=10 bs=512 of=/dev/asmdata01
dd if=/dev/zero count=10 bs=512 of=/dev/asmdata02
dd if=/dev/zero count=10 bs=512 of=/dev/asmdata03
**********************************************************************************************
*************************************create diskgroup datadg*****************************************
--create dg後要在各個asm例項檢視disk狀態
create diskgroup datadg external redundancy disk '/dev/asmdata01','/dev/asmdata02','/dev/asmdata03';
drop diskgroup datadg;
dd if=/dev/zero count=10 bs=512 of=/dev/asmdata01
dd if=/dev/zero count=10 bs=512 of=/dev/asmdata02
dd if=/dev/zero count=10 bs=512 of=/dev/asmdata03
*******************************************oracle dbsoft install*********************************************
oracle:
unzip oraclesoft
db_install.rsp :
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/oracle/app/oracle/oraInventory
ORACLE_HOME=/oracle/app/oracle/product/12.1/dbhome_1
ORACLE_BASE=/oracle/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.BACKUPDBA_GROUP=oinstall
oracle.install.db.DGDBA_GROUP=oinstall
oracle.install.db.KMDBA_GROUP=oinstall
oracle.install.db.rac.configurationType=ADMIN_MANAGED
oracle.install.db.CLUSTER_NODES=test12c1,test12c2
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=stu12c
oracle.install.db.config.starterdb.SID=stu12c1,stu12c2
oracle.install.db.ConfigureAsContainerDB=true --cdb
oracle.install.db.config.PDBName= --可以暫時不寫,建好庫後在create pdb
oracle.install.db.config.starterdb.characterSet=ZHS16GBK
oracle.install.db.config.starterdb.memoryOption=true --amm為true,否為false
oracle.install.db.config.starterdb.memoryLimit=6553 --16g*40%*1024 單位m --沒用,dbca的時候才設定大小
oracle.install.db.config.starterdb.password.ALL=Oracle1234
oracle.install.db.config.starterdb.password.PDBADMIN=Oracle1234
oracle.install.db.config.starterdb.managementOption=DEFAULT
oracle.install.db.config.starterdb.enableRecovery=false
oracle.install.db.config.starterdb.storageType=ASM_STORAGE
oracle.install.db.config.asm.diskGroup=DATADG
DECLINE_SECURITY_UPDATES=true --需要設定true(預設是false)
grid:
./runcluvfy.sh stage -pre dbinst -n test12c1,test12c2 -fixup -verbose
oracle:
nohup ./runInstaller -responseFile /oracle/soft/database/response/db_install.rsp -silent -ignorePrereq -showProgress &
*************************************oracle db install**************************************
監聽:lsnrctl status發現有監聽了,監聽了asm例項,可不用敲下面的命令
grid:netca -silent -responsefile /grid/app/11.2.0/grid/assistants/netca/netca.rsp
dbca:
--non pdb
dbca -silent -createDatabase -templateName General_Purpose.dbc -initparams db_create_file_dest='+datadg' -sysPassword Oracle1234 -systemPassword Oracle1234 -asmsnmpPassword Oracle1234 -diskGroupName 'DATADG' -initparams db_create_online_log_dest_1='+datadg' -gdbname studydb -sid studydb -responseFile NO_VALUE -characterSet ZHS16GBK -nationalCharacterSet AL16UTF16 -memoryPercentage 30 -emConfiguration NONE -storageType ASM -nodeinfo ntracd01,ntracd02
--靜默刪庫
dbca -silent -deleteDatabase -sourcedb stu12c
--建立pdb模式的庫
dbca -silent -createDatabase -templateName General_Purpose.dbc -createAsContainerDatabase true -initparams db_create_file_dest='+votedg' -initparams db_create_online_log_dest_1='+votedg' -initparams audit_trail=NONE -initparams processes=600 -nodelist test12c1,test12c2 -databaseConfType rac -sysPassword Oracle1234 -systemPassword Oracle1234 -gdbname stu12c -sid stu12c -responseFile NO_VALUE -characterSet AL16UTF16 -nationalCharacterSet ZHS16GBK -totalMemory 6553 -emConfiguration none -storageType ASM -diskGroupName VOTEDG