Oracle-静默安装12C RAC
1. 环境准备
1.1 配置hosts文件
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 | 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 系统依赖包
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 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参数
01 02 03 04 05 06 07 08 09 10 11 12 13 | # 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
01 02 03 04 05 | 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 关闭防火墙
01 02 03 04 | if [[ "$(ps -ef |grep -v grep|grep -ci firewalld)" = "1" ]]; then systemctl stop firewalld systemctl disable firewalld fi |
1.6 配置系统内核参数
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 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服务
01 02 03 04 05 06 | 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 创建用户&用户组
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 | # 创建用户组 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 创建软件目录
01 02 03 04 05 06 07 | 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 编辑用户环境变量
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 | # 以节点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 配置用户资源限制
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 | 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 配置
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #!/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
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 | 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
01 02 03 04 | cp /etc/sysconfig/network /etc/sysconfig/network_ $( date +%Y%m%d) cat >> /etc/sysconfig/network << EOF NOZEROCONF= yes EOF |
1.15 关闭 transparent_hugepage
01 02 03 04 05 06 07 08 09 10 11 12 13 | 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服务器
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | 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
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # 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 配置共享存储
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 | # 获取配置命令 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互相
01 02 03 04 05 06 07 08 09 10 11 12 13 | 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 依赖检查
01 02 03 04 | # 节点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软件
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # 仅需在节点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管理资料库
01 02 | su - grid /oracle/app/12 .2.0 /grid/gridSetup .sh -executeConfigTools -responseFile ${ORACLE_HOME} /install/response/gridsetup .rsp -silent |
2.6 创建ASM Diskgroup
01 02 | 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 软件
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 | # 只需在节点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 创建实例
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 | # 只需在任一节点运行即可 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启动
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # 命令配置启动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> |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)