Oracle-靜默安裝12C RAC



1. 環境准備

1.1 配置hosts文件

cp /etc/hosts /etc/hosts_$(date +%Y%d%m)
cat > /etc/hosts << EOF
127.0.0.1 loopback localhost.localdomain localhost
 
# Public
192.168.10.166 orc1.example.com orc1
192.168.10.167 orc2.example.com orc2
 
# Private
172.168.0.156 orc1-priv.example.com orc1-priv
172.168.0.157 orc2-priv.example.com orc2-priv
 
# Virtual
192.168.10.168 orc1-vip.example.com orc1-vip
192.168.10.169 orc2-vip.example.com orc2-vip
 
# SCAN
#192.168.10.170 orc12c-scan
#192.168.10.171 orc12c-scan
#192.168.10.172 orc12c-scan
EOF

1.2 系統依賴包

cat > /tmp/db_req_rpm.txt << EOF
binutils
compat-libcap1
compat-libstdc++-33
compat-libstdc++-33.i686
gcc
gcc-c++
glibc.i686
glibc
glibc-devel
glibc-devel.i686
ksh
libgcc.i686
libgcc
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
unixODBC
unixODBC.i686
unixODBC-devel
unixODBC-devel.i686
libdmx
xorg-x11-utils
xorg-x11-xauth
libXv
libXt
libXmu
libXxf86misc
libXxf86dga
LibXxf86vm
device-mapper-multipath
zlib
zlib-devel.i686
zlib-devel
unzip
nfs-utils
smartmontools
xorg-x11-server-utils
psmisc
EOF
 
# 配置yum
cat > /etc/yum.repos.d/rhel7.repo << EOF
[rhel-Packages]
name=Red Hat Enterprise Linux \$releasever - \$basearch - Source
baseurl=file:///mnt
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
EOF
 
# 掛載系統鏡像
mount /dev/sr0 /mnt
 
# 檢查及安裝
if [[ -f "/mnt/RPM-GPG-KEY-redhat-release" ]]; then
    yum -y install $(awk '{print $1}' /tmp/db_req_rpm.txt) >> /tmp/db_req_rpm_install.log
fi

1.3 屏蔽RemoveIPC參數

# rhel 7.2 BUG Doc ID 2081410.1
if [[ -f "/etc/systemd/logind.conf" ]]; then
    cp /etc/systemd/logind.conf /etc/systemd/logind.conf_$(date +%Y%m%d)
    sed -i "/#RemoveIPC=no/c\#RemoveIPC=no\nRemoveIPC=no" /etc/systemd/logind.conf
else
    cat > /etc/systemd/logind.conf << EOF
RemoveIPC=no
EOF
fi
 
# 重啟服務器或重啟systemd-logind
systemctl daemon-reload
systemctl restart systemd-logind

1.4 關閉selinux

if [[ "$(getenforce)" != "disable" ]]; then
    cp /etc/selinux/config /etc/selinux/config_$(date +%Y%m%d)
    setenforce 0
    sed -i "/^SELINUX=enforcing/c\#SELINUX=enforcing\nSELINUX=disable" /etc/selinux/config
fi

1.5 關閉防火牆

if [[ "$(ps -ef |grep -v grep|grep -ci firewalld)" = "1" ]]; then
    systemctl stop firewalld
    systemctl disable firewalld
fi

1.6 配置系統內核參數

cp /etc/sysctl.conf /etc/sysctl.conf_$(date +%Y%m%d)
cat > /etc/sysctl.conf << EOF
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
vm.swappiness = 1
vm.dirty_background_ratio = 3
vm.dirty_ratio = 80
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
kernel.shmmax = 4398046511104
kernel.shmall = 1073741824
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 = 1048576
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.panic_on_oops = 1
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
kernel.panic_on_oops = 1
EOF

# 激活參數
/sbin/sysctl -p
/sbin/sysctl --system

1.7 關閉avahi-daemon服務

if [[ -f "/etc/systemd/system/dbus-org.freedesktop.Avahi.service" ]]; then
    systemctl stop avahi-dnsconfd
    systemctl stop avahi-daemon
    systemctl disable avahi-dnsconfd
    systemctl disable avahi-daemon
fi

1.8 創建用戶&用戶組

# 創建用戶組
groupadd --gid 54321 oinstall
groupadd --gid 54322 dba
groupadd --gid 54323 asmdba
groupadd --gid 54324 asmoper
groupadd --gid 54325 asmadmin
groupadd --gid 54326 oper
groupadd --gid 54327 backupdba
groupadd --gid 54328 dgdba
groupadd --gid 54329 kmdba
groupadd --gid 54330 racdba
 
# 創建用戶
useradd --uid 54321 --gid oinstall --groups dba,oper,asmdba,asmoper,backupdba,dgdba,kmdba,racdba --comment "Oracle Software Owner" oracle
useradd --uid 54322 --gid oinstall --groups dba,asmadmin,asmdba,asmoper --comment "Grid Infrastructure Owner" grid
 
# 設置用戶密碼
OS_PASS=123456
echo "${OS_PASS}"|passwd --stdin oracle
echo "${OS_PASS}"|passwd --stdin grid

1.9 創建軟件目錄

mkdir -p /ups/oracle/grid
mkdir -p /ups/oracle/12.2/grid
mkdir -p /ups/oracle/oraInventory
chown -R grid:oinstall /ups/oracle
mkdir -p /ups/oracle/database
chown oracle:oinstall /ups/oracle/database
chmod -R 775 /ups/oracle

1.10 編輯用戶環境變量

# 以節點1為例,其他節點依據實際修改ORACLE_SID
su - grid
vi ~/.bash_profile
export ORACLE_SID=+ASM1
export ORACLE_BASE=/ups/oracle/grid
export ORACLE_HOME=/ups/oracle/12.2/grid
export PATH=${PATH}:${ORACLE_HOME}/bin:${ORACLE_HOME}/OPatch
umask 022
 
su - oracle
vi ~/.bash_profile
export ORACLE_SID=orcl1
export ORACLE_BASE=/ups/oracle/database
export ORACLE_HOME=${ORACLE_BASE}/product/12.2/db_1
export GRID_HOME=/ups/oracle/12.2/grid
export LD_LIBRARY_PATH=${ORACLE_HOME}/lib
export PATH=${PATH}:${ORACLE_HOME}/bin:${ORACLE_HOME}/OPatch:${GRID_HOME}/bin:${HOME}/dba
export TNS_ADMIN=${GRID_HOME}/network/admin
umask 022

1.11 配置用戶資源限制

cat > /etc/security/limits.d/99-grid-oracle-limits.conf << EOF
oracle soft nproc 16384 #Ora bug 15971421
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
# setting for memlock hard limit is maximum of 128GB on x86_64 or 3GB on x86 OR 90 % of RAM
oracle soft memlock 3145728 # current size is 3GB
oracle hard memlock 3145728 #<value-provided-by-script>
grid soft nproc 16384 #Ora bug 15971421
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
grid hard stack 32768
grid soft memlock 3145728
grid hard memlock 3145728
EOF

1.12 huge page 配置

#!/bin/bash
KERN=`uname -r | awk -F. '{ printf("%d.%d\n",$1,$2); }'`
# Find out the HugePage size
HPG_SZ=`grep Hugepagesize /proc/meminfo | awk '{print $2}'`
# Start from 1 pages to be on the safe side and guarantee 1 free HugePage
NUM_PG=1
# Cumulative number of pages required to handle the running shared memory segments
for SEG_BYTES in `ipcs -m | awk '{print $5}' | grep "[0-9][0-9]*"`
do
MIN_PG=`echo "$SEG_BYTES/($HPG_SZ*1024)" | bc -q`
if [ $MIN_PG -gt 0 ]; then
NUM_PG=`echo "$NUM_PG+$MIN_PG+1" | bc -q`
fi
done
# Finish with results
case $KERN in
'2.4') HUGETLB_POOL=`echo "$NUM_PG*$HPG_SZ/1024" | bc -q`;
echo "Recommended setting: vm.hugetlb_pool = $HUGETLB_POOL" ;;
'2.6') MEM_LOCK=`echo "$NUM_PG*$HPG_SZ" | bc -q`;
echo "Recommended setting within the kernel boot command line: hugepages = $NUM_PG"
echo "Recommended setting within /etc/security/limits.d/99-grid-oraclelimits.conf: oracle soft memlock $MEM_LOCK"
echo "Recommended setting within /etc/security/limits.d/99-grid-oraclelimits.conf: oracle hard memlock $MEM_LOCK" ;;
'3.10') MEM_LOCK=`echo "$NUM_PG*$HPG_SZ" | bc -q`;
echo "Recommended setting within the kernel boot command line: hugepages = $NUM_PG"
echo "Recommended setting within /etc/security/limits.d/99-grid-oraclelimits.conf: oracle soft memlock $MEM_LOCK"
echo "Recommended setting within /etc/security/limits.d/99-grid-oraclelimits.conf: oracle hard memlock $MEM_LOCK" ;;
*) echo "Unrecognized kernel version $KERN. Exiting." ;;
esac

1.13 配置profile

cat > /etc/profile.d/oracle-grid.sh << EOF
#Setting the appropriate ulimits for oracle and grid user
if [ \$USER = "oracle" ]; then
    if [ \$SHELL = "/bin/ksh" ]; then
        ulimit -u 16384
        ulimit -n 65536
    else
        ulimit -u 16384 -n 65536
    fi
fi
if [ \$USER = "grid" ]; then
    if [ \$SHELL = "/bin/ksh" ]; then
        ulimit -u 16384
        ulimit -n 65536
    else
        ulimit -u 16384 -n 65536
    fi
fi
EOF

1.14 配置network of nozeroconf

cp /etc/sysconfig/network /etc/sysconfig/network_$(date +%Y%m%d)
cat >> /etc/sysconfig/network << EOF
NOZEROCONF=yes
EOF

1.15 關閉 transparent_hugepage

cp /etc/default/grub /etc/default/grub_$(date +%Y%m%d)
cat > /etc/default/grub << EOF
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="\$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
# GRUB_CMDLINE_LINUX="rd.lvm.lv=rootvg/lvroot rd.lvm.lv=rootvg/lvswap rhgb quiet"
GRUB_CMDLINE_LINUX="rd.lvm.lv=rootvg/lvroot rd.lvm.lv=rootvg/lvswap quiet transparent_hugepage=never"
GRUB_DISABLE_RECOVERY="true"
EOF
 
grub2-mkconfig -o /boot/grub2/grub.cfg

1.16 配置時間同步--這里選用節點替代NTP服務器

1)時區
--查看當前時區
# timedatectl status
--修改時區
# timedatectl set-timezone Asia/ShangHai
 
2)配置
# 安裝
yum install chrony -y
 
systemctl start chronyd
systemctl enable chronyd
systemctl status chronyd
 
systemctl stop chronyd
systemctl disable chronyd
 
# 添加同步服務器
cp /etc/chrony.conf /etc/chrony.conf_$(date +%Y%m%d)
server 192.168.10.166 iburst
 
# 檢查狀態
[root@orcl2 ~]# chronyc sources -v
210 Number of sources = 1
 
  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^? orcl1.example.com             0   6     0   10y     +0ns[   +0ns] +/-    0ns
[root@orcl2 ~]# chronyc sourcestats -v
210 Number of sources = 1
                             .- Number of sample points in measurement set.
                            /    .- Number of residual runs with same sign.
                           |    /    .- Length of measurement set (time).
                           |   |    /      .- Est. clock freq error (ppm).
                           |   |   |      /           .- Est. error in freq.
                           |   |   |     |           /         .- Est. offset.
                           |   |   |     |          |          |   On the -.
                           |   |   |     |          |          |   samples. \
                           |   |   |     |          |          |             |
Name/IP Address            NP  NR  Span  Frequency  Freq Skew  Offset  Std Dev
==============================================================================
orcl1.example.com           0   0     0     +0.000   2000.000     +0ns  4000ms
[root@orcl2 ~]#

1.17 配置dns

# yum 安裝
yum -y install unbound
yum install -y bind-utils
 
# 配置配置文件/etc/unbound/unbound.conf
vi /etc/unbound/unbound.conf
……
38 # interface: 0.0.0.0
39 interface: 0.0.0.0
……
//找到38行,復制去掉注釋行,打開監聽全網功能。
177         # access-control: 0.0.0.0/0 refuse
178         access-control: 192.168.10.0/24 allow
179         # access-control: 127.0.0.0/8 allow
// 找到配置文件/etc/unbound/unbound.conf的第177行,缺省為注釋行,且內容為拒絕訪問。復制本行內容到下面一行,去掉注釋“#“,改refuse為allow。然后保存退出,重啟服務即可。
155         # do-ip6: yes
156          do-ip6: no
//找到155行內容,在其下復制一行並去除注釋,改yes為no,重啟服務即可去除對Ipv6的監聽
 
# 創建解析文件
[root@orc1 ~]# cat
cat > /etc/unbound/local.d/example.conf << EOF
local-zone: "example.com." static
local-data: "example.com. 86400 IN SOA ns.example.com. root 1 1D 1H 1W 1H"
local-data: "ns.example.com.            IN A 192.168.10.166"
local-data: "orc1.example.com.            IN A 192.168.10.166"
local-data: "orc12c-scan.example.com. IN A 192.168.10.170"
local-data: "orc12c-scan.example.com. IN A 192.168.10.171"
local-data: "orc12c-scan.example.com. IN A 192.168.10.172"
local-data-ptr: "192.168.10.170 orc12c-scan.example.com."
local-data-ptr: "192.168.10.171 orc12c-scan.example.com."
local-data-ptr: "192.168.10.172 orc12c-scan.example.com."
EOF
 
# 啟動服務及檢查
systemctl start unbound
systemctl restart unbound
systemctl status unbound
netstat -tunlp |grep unbound

1.18 配置共享存儲

# 獲取配置命令
for i in c d e f g
do
echo "KERNEL==\"sd?\",SUBSYSTEM==\"block\", PROGRAM==\"/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\",RESULT==\"`/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", SYMLINK+=\"asm-disk$i\",OWNER=\"grid\", GROUP=\"asmadmin\",MODE=\"0660\"" >>/etc/udev/rules.d/99-oracle-asmdevices.rules
done
 
# 將上面結果寫入文件,例如:
cat > /etc/udev/rules.d/99-oracle-asmdevices.rules << EOF
ENV{DM_NAME}=="asm_crs1", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="mapper/\$env{DM_NAME}"
ENV{DM_NAME}=="asm_crs2", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="mapper/\$env{DM_NAME}"
ENV{DM_NAME}=="asm_crs3", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="mapper/\$env{DM_NAME}"
ENV{DM_NAME}=="asm_mgmt1", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="mapper/\$env{DM_NAME}"
ENV{DM_NAME}=="asm_data1", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="mapper/\$env{DM_NAME}"
EOF
 
# 重啟生效
/sbin/udevadm trigger --type=devices --action=change

1.19 配置ssh互相

ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
cat ~/.ssh/*.pub >> ~/.ssh/authorized_keys
ssh -o stricthostkeychecking=no 192.168.0.12  cat  ~/.ssh/*.pub >> ~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys 192.168.0.12:~/.ssh/authorized_keys
 
# 檢查確認
ssh -o stricthostkeychecking=no orc1.example.com date
ssh -o stricthostkeychecking=no orc2.example.com date
ssh -o stricthostkeychecking=no orc1-priv.example.com date
ssh -o stricthostkeychecking=no orc2-priv.example.com date
ssh -o stricthostkeychecking=no orc1 date
ssh -o stricthostkeychecking=no orc2 date


2. 軟件部署

2.1 軟件解壓(即節點1)

# 任選一台主機運行
unzip -q /ups/soft/linuxx64_12201_grid_home.zip -d /ups/oracle/12.2/grid

2.2 安裝cvuqdisk

cd /ups/oracle/12.2/grid/cv/rpm
rpm -ivh cvuqdisk-1.0.10-1.rpm

# 傳遞剩余得所有節點並安裝
scp /ups/oracle/12.2/grid/cv/rpm/cvuqdisk-1.0.10-1.rpm orc2:/tmp/
ssh -o stricthostkeychecking=no orc2
rpm -ivh /tmp/cvuqdisk-1.0.10-1.rpm

2.3 依賴檢查

# 節點1
su - grid
cd /ups/oracle/12.2/grid/
./runcluvfy.sh stage -pre crsinst -n orc1,orc2 -fixup -verbose > ~/grid_env_check.txt
 

2.4 安裝GI軟件

# 僅需在節點1運行
su  - grid
cd /ups/oracle/12.2/grid/
${ORACLE_HOME}/gridSetup.sh -ignorePrereq -waitforcompletion -silent \
-responseFile ${ORACLE_HOME}/install/response/gridsetup.rsp \
INVENTORY_LOCATION=/ups/oracle/oraInventory \
SELECTED_LANGUAGES=en,en_US,zh_CN \
oracle.install.option=CRS_CONFIG \
ORACLE_HOME=/ups/oracle/12.2/grid \
oracle.install.asm.OSDBA=asmdba \
oracle.install.asm.OSOPER=asmoper \
oracle.install.asm.OSASM=asmadmin \
oracle.install.crs.config.gpnp.scanName=orcl-scan \
oracle.install.crs.config.gpnp.scanPort=1522 \
oracle.install.crs.config.ClusterConfiguration=STANDALONE \
oracle.install.crs.config.configureAsExtendedCluster=false \
oracle.install.crs.config.clusterName=orcl-cluster \
oracle.install.crs.config.gpnp.configureGNS=false \
oracle.install.crs.config.autoConfigureClusterNodeVIP=false \
oracle.install.crs.config.clusterNodes=orcl1:orcl1-vip:HUB,orcl2:orcl2-vip:HUB \
oracle.install.crs.config.networkInterfaceList=bond0:192.168.10.0:1,bond1:172.168.0.0:5 \
oracle.install.asm.configureGIMRDataDG=true \
oracle.install.crs.config.storageOption=FLEX_ASM_STORAGE \
oracle.install.crs.config.useIPMI=false \
oracle.install.asm.storageOption=ASM \
oracle.install.asm.SYSASMPassword=p#ssw0rd123 \
oracle.install.asm.diskGroup.name=CRSDG \
oracle.install.asm.diskGroup.redundancy=NORMAL \
oracle.install.asm.diskGroup.AUSize=4 \
oracle.install.asm.diskGroup.disksWithFailureGroupNames=/dev/mapper/asm_crs3,,/dev/mapper/asm_crs2,,/dev/mapper/asm_crs1, \
oracle.install.asm.diskGroup.disks=/dev/mapper/asm_crs3,/dev/mapper/asm_crs2,/dev/mapper/asm_crs1 \
oracle.install.asm.diskGroup.diskDiscoveryString=/dev/mapper/* \
oracle.install.asm.monitorPassword=p#ssw0rd123 \
oracle.install.asm.gimrDG.name=MGMT \
oracle.install.asm.gimrDG.redundancy=EXTERNAL \
oracle.install.asm.gimrDG.AUSize=4 \
oracle.install.asm.gimrDG.disks=/dev/mapper/asm_mgmt \
oracle.install.asm.configureAFD=false \
oracle.install.crs.configureRHPS=false \
oracle.install.crs.config.ignoreDownNodes=false \
oracle.install.config.managementOption=NONE \
oracle.install.crs.rootconfig.executeRootScript=false

2.5 創建MGMT管理資料庫

su - grid
/oracle/app/12.2.0/grid/gridSetup.sh -executeConfigTools -responseFile ${ORACLE_HOME}/install/response/gridsetup.rsp -silent

2.6 創建ASM Diskgroup

su - grid
asmca -silent -sysAsmPassword password -createDiskGroup -diskString '/dev/mapper/*' -diskGroupName DATA -diskList '/dev/mapper/asm_data' -redundancy EXTERNAL -au_size 4

2.7 安裝database 軟件

# 只需在節點1執行,其它節點自動傳遞軟件
${ORACLE_HOME}/runInstaller -ignorePrereq -waitforcompletion -silent  \
        -responseFile ${ORACLE_HOME}/install/response/db_install.rsp   \
        oracle.install.option=INSTALL_DB_SWONLY                        \
        ORACLE_HOSTNAME=orc11                                      \
        UNIX_GROUP_NAME=oinstall                                    \
        INVENTORY_LOCATION=/ups/oracle/oraInventory                     \
        SELECTED_LANGUAGES=en,en_US,zh_CN                               \
        ORACLE_HOME=/ups/oracle/database/product/12.2/db_1              \
        ORACLE_BASE=/ups/oracle/database                                \
        oracle.install.db.InstallEdition=EE                   \
        oracle.install.db.OSDBA_GROUP=dba}                          \
        oracle.install.db.OSOPER_GROUP=oper                        \
        oracle.install.db.OSBACKUPDBA_GROUP=backupdba              \
        oracle.install.db.OSDGDBA_GROUP=dgdba                      \
        oracle.install.db.OSKMDBA_GROUP=kmdba                      \
        oracle.install.db.OSRACDBA_GROUP=racdba                    \
        SECURITY_UPDATES_VIA_MYORACLESUPPORT=false                 \
        DECLINE_SECURITY_UPDATES=true \
        oracle.install.db.CLUSTER_NODES=orcl1,orcl2 \
        oracle.install.db.config.starterdb.type=GENERAL_PURPOSE \

2.8 dbca 創建實例

# 只需在任一節點運行即可
dbca -silent -ignorePreReqs -createDatabase                             \
         -databaseConfigType RAC                          \
         -datafileJarLocation ${ORACLE_HOME}/assistants/dbca/templates/ \
         -templateName General_Purpose.dbc                                 \
         -gdbname o12c -sid o12c -responseFile NO_VALUE     \
         -characterSet AL32UTF8                                  \
         -sysPassword p#ssw0rd                                      \
         -systemPassword p#ssw0rd                                   \
         -databaseType MULTIPURPOSE                                       \
         -automaticMemoryManagement false                               \
         -memoryPercentage 40                                \
         -storageType ASM                                   \
         -datafileDestination +DATA                             \
         -recoveryAreaDestination NONE                                  \
         -redoLogFileSize 1024                           \
         -emConfiguration NONE                                          \
         -createAsContainerDatabase true                            \
         -nodelist orcl1,orcl2 -asmsnmpPassword p#ssw0rd           \
         -useOMF true 


3. 安裝后配置

3.1 配置PDB啟動

# 命令配置啟動pdb隨cdb啟動
alter pluggable database [pdbname] save state;
alter pluggable database ORCLPDB save state;
-- 結果檢查
set lines 168 pages 999
col CON_NAME for a18
col INSTANCE_NAME for a18
col RESTRICTED for a12
select con_id,CON_NAME,INSTANCE_NAME,STATE,RESTRICTED from dba_pdb_saved_states;
 
    CON_ID CON_NAME           INSTANCE_NAME      STATE          RESTRICTED
---------- ------------------ ------------------ -------------- ------------
         3 ORCLPDB            orcl2              OPEN           NO
         3 ORCLPDB            orcl1              OPEN           NO
 
SQL>
 
# 禁用pdb隨cdb啟動
alter pluggable database ORCLPDB discard state  ;
 
SQL> alter pluggable database ORCLPDB discard state;
 
Pluggable database altered.
 
SQL> select con_id,CON_NAME,INSTANCE_NAME,STATE,RESTRICTED from dba_pdb_saved_states;
 
    CON_ID CON_NAME           INSTANCE_NAME      STATE          RESTRICTED
---------- ------------------ ------------------ -------------- ------------
         3 ORCLPDB            orcl2              OPEN           NO
 
SQL> alter pluggable database ORCLPDB save state;
 
Pluggable database altered.
 
SQL> select con_id,CON_NAME,INSTANCE_NAME,STATE,RESTRICTED from dba_pdb_saved_states;
 
    CON_ID CON_NAME           INSTANCE_NAME      STATE          RESTRICTED
---------- ------------------ ------------------ -------------- ------------
         3 ORCLPDB            orcl2              OPEN           NO
         3 ORCLPDB            orcl1              OPEN           NO
 
SQL>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM