Oracle Linux Install Oracle 18C RAC

安装环境为Oracle Linux 7.1,Oracle版本为18C,下面是RAC环境的IP配置

ip地址          主机名                   类型     解析方式 
10.10.10.171  18c1                    public   DNS或etc/hosts 
10.10.10.172  18c2                    public   DNS或etc/hosts 
88.88.87.1    18c1-priv               private  DNS或etc/hosts 
88.88.87.2    18c2-priv               private  DNS或etc/hosts 
10.10.10.175  18c1-vip                virtual  DNS或etc/hosts 
10.10.10.176  18c2-vip                virtual  DNS或etc/hosts
10.10.10.177  jycs-scan               scan     DNS或etc/hosts
10.10.10.178  jycs-scan               scan     DNS或etc/hosts
10.10.10.179  jycs-scan               scan     DNS或etc/hosts

[root@localhost soft]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.10.10.171 18c1
10.10.10.172 18c2
88.88.87.1 18c1-priv
88.88.87.2 18c2-priv
10.10.10.175 18c1-vip
10.10.10.176 18c2-vip

10.10.10.177 jycs-scan
10.10.10.178 jycs-scan
10.10.10.179 jycs-scan

[root@localhost ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.10.10.171 18c1
10.10.10.172 18c2
88.88.87.1 18c1-priv
88.88.87.2 18c2-priv
10.10.10.175 18c1-vip
10.10.10.176 18c2-vip

10.10.10.177 jycs-scan
10.10.10.178 jycs-scan
10.10.10.179 jycs-scan

创建用户组

[root@jytest1 ~]# groupadd -g 1006 asmadmin
[root@jytest1 ~]# groupadd -g 1007 asmdba
[root@jytest1 ~]# groupadd -g 1008 asmoper
[root@jytest1 ~]# groupadd -g 1009 dba
[root@jytest1 ~]# groupadd -g 1010 oper
[root@jytest1 ~]# groupadd -g 1011 oinstall
[root@jytest1 ~]# groupadd -g 1012 backupdba
[root@jytest1 ~]# groupadd -g 1013 dgdba
[root@jytest1 ~]# groupadd -g 1014 kmdba
[root@jytest1 ~]# groupadd -g 1015 racdba


[root@jytest2 ~]# groupadd -g 1006 asmadmin
[root@jytest2 ~]# groupadd -g 1007 asmdba
[root@jytest2 ~]# groupadd -g 1008 asmoper
[root@jytest2 ~]# groupadd -g 1009 dba
[root@jytest2 ~]# groupadd -g 1010 oper
[root@jytest2 ~]# groupadd -g 1011 oinstall
[root@jytest2 ~]# groupadd -g 1012 backupdba
[root@jytest2 ~]# groupadd -g 1013 dgdba
[root@jytest2 ~]# groupadd -g 1014 kmdba
[root@jytest2 ~]# groupadd -g 1015 racdba

创建用户
[root@jytest1 ~]#useradd -u 1001 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper,asmadmin oracle
[root@jytest1 ~]#useradd -u 1002 -g oinstall -G asmadmin,asmdba,asmoper,dba grid

[root@jytest2 ~]#useradd -u 1001 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper,asmadmin oracle
[root@jytest2 ~]#useradd -u 1002 -g oinstall -G asmadmin,asmdba,asmoper,dba grid

[root@jytest1 /]# passwd grid
Changing password for user grid.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
You have new mail in /var/spool/mail/root
[root@jytest1 /]# passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.

[root@jytest2 /]# passwd grid
Changing password for user grid.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@jytest2 /]# passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.

配置ASM所需磁盘,编辑/etc/udev/rules.d/99-my-asmdevices.rules配置文件

[root@18c1 rules.d]# vi /etc/udev/rules.d/99-my-asmdevices.rules
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block",  PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",  RESULT=="36000c29b61b89a10988ac7ee8d332517", RUN+="/bin/sh -c 'mknod /dev/asmdisk01 b  $major $minor; chown grid:asmadmin /dev/asmdisk01; chmod 0660 /dev/asmdisk01'"

KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block",  PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",  RESULT=="36000c29dfb622388fc0d35385109c4e9", RUN+="/bin/sh -c 'mknod /dev/asmdisk02 b  $major $minor; chown grid:asmadmin /dev/asmdisk02; chmod 0660 /dev/asmdisk02'"

[root@18c2 rules.d]# vi /etc/udev/rules.d/99-my-asmdevices.rules
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block",  PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",  RESULT=="36000c29b61b89a10988ac7ee8d332517", RUN+="/bin/sh -c 'mknod /dev/asmdisk01 b  $major $minor; chown grid:asmadmin /dev/asmdisk01; chmod 0660 /dev/asmdisk01'"

KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block",  PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",  RESULT=="36000c29dfb622388fc0d35385109c4e9", RUN+="/bin/sh -c 'mknod /dev/asmdisk02 b  $major $minor; chown grid:asmadmin /dev/asmdisk02; chmod 0660 /dev/asmdisk02'"
[root@18c1 rules.d]#  /sbin/udevadm trigger --type=devices --action=change
[root@18c2 ~]#  /sbin/udevadm trigger --type=devices --action=change

[root@18c1 rules.d]#  ls -lrt /dev/asm*
brw-rw----. 1 grid asmadmin 8, 32 Mar 16 17:00 /dev/asmdisk01
brw-rw----. 1 grid asmadmin 8, 32 Mar 16 17:01 /dev/asmdisk02

[root@18c2 ~]#  ls -lrt /dev/asm*
brw-rw----. 1 grid asmadmin 8, 16 Mar 16 17:00 /dev/asmdisk01
brw-rw----. 1 grid asmadmin 8, 32 Mar 16 17:02 /dev/asmdisk02

以root用户创建“Oracle inventory 目录”

[root@18c1 rules.d]# mkdir -p /u01/app/oraInventory
[root@18c1 rules.d]# chown -R grid:oinstall /u01/app/oraInventory
[root@18c1 rules.d]# chmod -R 775 /u01/app/oraInventory

[root@18c2 ~]# mkdir -p /u01/app/oraInventory
[root@18c2 ~]# chown -R grid:oinstall /u01/app/oraInventory
[root@18c2 ~]# chmod -R 775 /u01/app/oraInventory

以root用户创建“Grid Infrastructure BASE 目录”

[root@18c1 rules.d]# mkdir -p /u01/app/grid
[root@18c1 rules.d]# chown -R grid:oinstall /u01/app/grid
[root@18c1 rules.d]# chmod -R 775 /u01/app/grid

[root@18c2 ~]# mkdir -p /u01/app/grid
[root@18c2 ~]# chown -R grid:oinstall /u01/app/grid
[root@18c2 ~]# chmod -R 775 /u01/app/grid

以root用户创建“Grid Infrastructure Home 目录”

[root@18c1 rules.d]# mkdir -p /u01/app/18.0.0/grid
[root@18c1 rules.d]# chown -R grid:oinstall /u01/app/18.0.0/grid
[root@18c1 rules.d]# chmod -R 775 /u01/app/18.0.0/grid

[root@18c2 ~]# mkdir -p /u01/app/18.0.0/grid
[root@18c2 ~]# chown -R grid:oinstall /u01/app/18.0.0/grid
[root@18c2 ~]# chmod -R 775 /u01/app/18.0.0/grid

以root用户创建“Oracle Base 目录”

[root@18c1 rules.d]#  mkdir -p /u01/app/oracle
[root@18c1 rules.d]#  chown -R oracle:oinstall /u01/app/oracle
[root@18c1 rules.d]# chmod -R 775 /u01/app/oracle

[root@18c2 ~]#  mkdir -p /u01/app/oracle
[root@18c2 ~]#  chown -R oracle:oinstall /u01/app/oracle
[root@18c2 ~]# chmod -R 775 /u01/app/oracle

以root用户创建“Oracle RDBMS Home 目录”

[root@18c1 rules.d]# mkdir -p /u01/app/oracle/18.0.0/db
[root@18c1 rules.d]# chown -R oracle:oinstall /u01/app/oracle/18.0.0/db
[root@18c1 rules.d]# chmod -R 775 /u01/app/oracle/18.0.0/db

[root@18c2 ~]# mkdir -p /u01/app/oracle/18.0.0/db
[root@18c2 ~]# chown -R oracle:oinstall /u01/app/oracle/18.0.0/db
[root@18c2 ~]# chmod -R 775 /u01/app/oracle/18.0.0/db

创建一个tmp目录

[root@18c1 /]# mkdir /u01/tmp
[root@18c1 /]# chmod a+wr /u01/tmp

[root@18c2 ~]# mkdir /u01/tmp
[root@18c2 ~]# chmod a+wr /u01/tmp

设置环境变量

[root@jytest1 ~]# su - grid

[grid@18c1 ~]$ vi .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

TEMP=/u01/tmp
TMPDIR=/u01/tmp
export TEMP TMPDIR
export LD_ASSUME_KERNEL=3.8.13
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/18.0.0/grid
export ORACLE_SID=+ASM1
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export LD_LIBRARY_PATH
export PATH=$PATH:$ORACLE_HOME/bin
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib
export CLASSPATH
umask=022
[root@jytest2 ~]# su - grid
[grid@18c2 ~]$ vi .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

TEMP=/u01/tmp
TMPDIR=/u01/tmp
export TEMP TMPDIR
export LD_ASSUME_KERNEL=3.8.13
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/18.0.0/grid
export ORACLE_SID=+ASM2
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export LD_LIBRARY_PATH
export PATH=$PATH:$ORACLE_HOME/bin
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib
export CLASSPATH
umask=022

[root@18c1 /]# su - oracle
[oracle@18c1 ~]$ vi .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH


TEMP=/u01/tmp
TMPDIR=/u01/tmp
export TEMP TMPDIR
export LD_ASSUME_KERNEL=3.8.13
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/18.0.0/db
export ORACLE_SID=jycs1
export ORACLE_UNQNAME=jycs
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export LD_LIBRARY_PATH
export PATH=$PATH:$ORACLE_HOME/bin
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib
export CLASSPATH
umask=022

[root@18c2 ~]# su - oracle
[oracle@18c2 ~]$ vi .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

TEMP=/u01/tmp
TMPDIR=/u01/tmp
export TEMP TMPDIR
export LD_ASSUME_KERNEL=3.8.13
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/18.0.0/db
export ORACLE_SID=jycs2
export ORACLE_UNQNAME=jycs
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export LD_LIBRARY_PATH
export PATH=$PATH:$ORACLE_HOME/bin
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib
export CLASSPATH
umask=022

修改内核参数编辑/etc/sysctl.conf文件

[root@18c1 /]# vi /etc/sysctl.conf
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304



[root@18c1 /]# sysctl -p
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304

[root@18c2 ~]# vi /etc/sysctl.conf
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304

~
[root@18c2 ~]# sysctl -p
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304

修改oarcle参数的shell限制,在所有节点的/etc/security/limits.conf文件中添加以下参数

grid soft nproc 2047
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

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle soft memlock 3145728
oracle hard memlock 3145728

修改shell的默认参数文件,在所有节点的/etc/profile文件中添加以下内容:

if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi


if [ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

对C shell(csh or tcsh) 在所有节点的/etc/csh.login文件中增加以下代码

if ( $USER == "oracle" ) then
limit maxproc 16384
limit descriptors 65536
endif

if ( $USER == "grid" ) then
limit maxproc 16384
limit descriptors 65536
endif

解压GI安装压缩包:

[grid@jytest1 soft]cd /soft/
[grid@18c1 soft]$ unzip LINUX.X64_180000_grid_home.zip -d /u01/app/18.0.0/grid

这里使用xshell与xmanager来执行安装

[root@18c1 ~]# xhost +
access control disabled, clients can connect from any host
[root@18c1 ~]# su - grid
Last login: Mon Mar 16 17:36:02 CST 2020 on pts/1
[grid@18c1 ~]$ cd /u01/app/18.0.0/grid
[grid@18c1 grid]$ export DISPLAY=10.138.130.242:0.0
[grid@18c1 grid]$ ./gridSetup.sh























以root用户分别在两个节点上执行以下脚本,先在主节点执行。

[root@18c1 /]# ./u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.

[root@18c2 /]# ./u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.


[root@18c1 /]# ./u01/app/18.0.0/grid/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= grid
    ORACLE_HOME=  /u01/app/18.0.0/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]: 
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Relinking oracle with rac_on option
Using configuration parameter file: /u01/app/18.0.0/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u01/app/grid/crsdata/18c1/crsconfig/rootcrs_18c1_2020-03-16_07-10-52PM.log
2020/03/16 19:11:26 CLSRSC-594: Executing installation step 1 of 20: 'SetupTFA'.
2020/03/16 19:11:26 CLSRSC-4001: Installing Oracle Trace File Analyzer (TFA) Collector.
2020/03/16 19:12:15 CLSRSC-4002: Successfully installed Oracle Trace File Analyzer (TFA) Collector.
2020/03/16 19:12:15 CLSRSC-594: Executing installation step 2 of 20: 'ValidateEnv'.
2020/03/16 19:12:15 CLSRSC-363: User ignored prerequisites during installation
2020/03/16 19:12:15 CLSRSC-594: Executing installation step 3 of 20: 'CheckFirstNode'.
2020/03/16 19:12:19 CLSRSC-594: Executing installation step 4 of 20: 'GenSiteGUIDs'.
2020/03/16 19:12:24 CLSRSC-594: Executing installation step 5 of 20: 'SaveParamFile'.
2020/03/16 19:12:41 CLSRSC-594: Executing installation step 6 of 20: 'SetupOSD'.
2020/03/16 19:12:41 CLSRSC-594: Executing installation step 7 of 20: 'CheckCRSConfig'.
2020/03/16 19:12:41 CLSRSC-594: Executing installation step 8 of 20: 'SetupLocalGPNP'.
2020/03/16 19:13:25 CLSRSC-594: Executing installation step 9 of 20: 'CreateRootCert'.
2020/03/16 19:13:35 CLSRSC-594: Executing installation step 10 of 20: 'ConfigOLR'.
2020/03/16 19:13:58 CLSRSC-594: Executing installation step 11 of 20: 'ConfigCHMOS'.
2020/03/16 19:13:58 CLSRSC-594: Executing installation step 12 of 20: 'CreateOHASD'.
2020/03/16 19:14:13 CLSRSC-594: Executing installation step 13 of 20: 'ConfigOHASD'.
2020/03/16 19:14:14 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
2020/03/16 19:15:02 CLSRSC-594: Executing installation step 14 of 20: 'InstallAFD'.
2020/03/16 19:16:10 CLSRSC-594: Executing installation step 15 of 20: 'InstallACFS'.
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on '18c1'
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on '18c1' has completed
CRS-4133: Oracle High Availability Services has been stopped.
CRS-4123: Oracle High Availability Services has been started.
2020/03/16 19:16:55 CLSRSC-594: Executing installation step 16 of 20: 'InstallKA'.
2020/03/16 19:17:10 CLSRSC-594: Executing installation step 17 of 20: 'InitConfig'.
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on '18c1'
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on '18c1' has completed
CRS-4133: Oracle High Availability Services has been stopped.
CRS-4123: Oracle High Availability Services has been started.
CRS-2672: Attempting to start 'ora.driver.afd' on '18c1'
CRS-2672: Attempting to start 'ora.evmd' on '18c1'
CRS-2672: Attempting to start 'ora.mdnsd' on '18c1'
CRS-2676: Start of 'ora.driver.afd' on '18c1' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on '18c1'
CRS-2676: Start of 'ora.cssdmonitor' on '18c1' succeeded
CRS-2676: Start of 'ora.mdnsd' on '18c1' succeeded
CRS-2676: Start of 'ora.evmd' on '18c1' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on '18c1'
CRS-2676: Start of 'ora.gpnpd' on '18c1' succeeded
CRS-2672: Attempting to start 'ora.gipcd' on '18c1'
CRS-2676: Start of 'ora.gipcd' on '18c1' succeeded
CRS-2672: Attempting to start 'ora.cssd' on '18c1'
CRS-2672: Attempting to start 'ora.diskmon' on '18c1'
CRS-2676: Start of 'ora.diskmon' on '18c1' succeeded
CRS-2676: Start of 'ora.cssd' on '18c1' succeeded

[INFO] [DBT-30161] Disk label(s) created successfully. Check /u01/app/grid/cfgtoollogs/asmca/asmca-200316PM071759.log for details.
[INFO] [DBT-30001] Disk groups created successfully. Check /u01/app/grid/cfgtoollogs/asmca/asmca-200316PM071759.log for details.


2020/03/16 19:19:59 CLSRSC-482: Running command: '/u01/app/18.0.0/grid/bin/ocrconfig -upgrade grid oinstall'
CRS-2672: Attempting to start 'ora.crf' on '18c1'
CRS-2672: Attempting to start 'ora.storage' on '18c1'
CRS-2676: Start of 'ora.storage' on '18c1' succeeded
CRS-2676: Start of 'ora.crf' on '18c1' succeeded
CRS-2672: Attempting to start 'ora.crsd' on '18c1'
CRS-2676: Start of 'ora.crsd' on '18c1' succeeded
CRS-4256: Updating the profile
Successful addition of voting disk b1f6f23bbaef4ff2bf3cdfdec8a72881.
Successfully replaced voting disk group with +CRS.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   b1f6f23bbaef4ff2bf3cdfdec8a72881 (AFD:CRS1) [CRS]
Located 1 voting disk(s).
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on '18c1'
CRS-2673: Attempting to stop 'ora.crsd' on '18c1'
CRS-2677: Stop of 'ora.crsd' on '18c1' succeeded
CRS-2673: Attempting to stop 'ora.storage' on '18c1'
CRS-2673: Attempting to stop 'ora.crf' on '18c1'
CRS-2673: Attempting to stop 'ora.drivers.acfs' on '18c1'
CRS-2673: Attempting to stop 'ora.mdnsd' on '18c1'
CRS-2677: Stop of 'ora.crf' on '18c1' succeeded
CRS-2677: Stop of 'ora.storage' on '18c1' succeeded
CRS-2673: Attempting to stop 'ora.asm' on '18c1'
CRS-2677: Stop of 'ora.drivers.acfs' on '18c1' succeeded
CRS-2677: Stop of 'ora.mdnsd' on '18c1' succeeded
CRS-2677: Stop of 'ora.asm' on '18c1' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on '18c1'
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on '18c1' succeeded
CRS-2673: Attempting to stop 'ora.ctssd' on '18c1'
CRS-2673: Attempting to stop 'ora.evmd' on '18c1'
CRS-2677: Stop of 'ora.ctssd' on '18c1' succeeded
CRS-2677: Stop of 'ora.evmd' on '18c1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on '18c1'
CRS-2677: Stop of 'ora.cssd' on '18c1' succeeded
CRS-2673: Attempting to stop 'ora.driver.afd' on '18c1'
CRS-2673: Attempting to stop 'ora.gipcd' on '18c1'
CRS-2673: Attempting to stop 'ora.gpnpd' on '18c1'
CRS-2677: Stop of 'ora.driver.afd' on '18c1' succeeded
CRS-2677: Stop of 'ora.gpnpd' on '18c1' succeeded
CRS-2677: Stop of 'ora.gipcd' on '18c1' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on '18c1' has completed
CRS-4133: Oracle High Availability Services has been stopped.
2020/03/16 19:22:35 CLSRSC-594: Executing installation step 18 of 20: 'StartCluster'.
CRS-4123: Starting Oracle High Availability Services-managed resources
CRS-2672: Attempting to start 'ora.evmd' on '18c1'
CRS-2672: Attempting to start 'ora.mdnsd' on '18c1'
CRS-2676: Start of 'ora.mdnsd' on '18c1' succeeded
CRS-2676: Start of 'ora.evmd' on '18c1' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on '18c1'
CRS-2676: Start of 'ora.gpnpd' on '18c1' succeeded
CRS-2672: Attempting to start 'ora.gipcd' on '18c1'
CRS-2676: Start of 'ora.gipcd' on '18c1' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on '18c1'
CRS-2676: Start of 'ora.cssdmonitor' on '18c1' succeeded
CRS-2672: Attempting to start 'ora.crf' on '18c1'
CRS-2672: Attempting to start 'ora.cssd' on '18c1'
CRS-2672: Attempting to start 'ora.diskmon' on '18c1'
CRS-2676: Start of 'ora.diskmon' on '18c1' succeeded
CRS-2676: Start of 'ora.crf' on '18c1' succeeded
CRS-2676: Start of 'ora.cssd' on '18c1' succeeded
CRS-2672: Attempting to start 'ora.cluster_interconnect.haip' on '18c1'
CRS-2672: Attempting to start 'ora.ctssd' on '18c1'
CRS-2676: Start of 'ora.ctssd' on '18c1' succeeded
CRS-2676: Start of 'ora.cluster_interconnect.haip' on '18c1' succeeded
CRS-2672: Attempting to start 'ora.asm' on '18c1'
CRS-2676: Start of 'ora.asm' on '18c1' succeeded
CRS-2672: Attempting to start 'ora.storage' on '18c1'
CRS-2676: Start of 'ora.storage' on '18c1' succeeded
CRS-2672: Attempting to start 'ora.crsd' on '18c1'
CRS-2676: Start of 'ora.crsd' on '18c1' succeeded
CRS-6023: Starting Oracle Cluster Ready Services-managed resources
CRS-6017: Processing resource auto-start for servers: 18c1
CRS-6016: Resource auto-start has completed for server 18c1
CRS-6024: Completed start of Oracle Cluster Ready Services-managed resources
CRS-4123: Oracle High Availability Services has been started.
2020/03/16 19:24:23 CLSRSC-343: Successfully started Oracle Clusterware stack
2020/03/16 19:24:23 CLSRSC-594: Executing installation step 19 of 20: 'ConfigNode'.
CRS-2672: Attempting to start 'ora.ASMNET1LSNR_ASM.lsnr' on '18c1'
CRS-2676: Start of 'ora.ASMNET1LSNR_ASM.lsnr' on '18c1' succeeded
CRS-2672: Attempting to start 'ora.asm' on '18c1'
CRS-2676: Start of 'ora.asm' on '18c1' succeeded
CRS-2672: Attempting to start 'ora.CRS.dg' on '18c1'
CRS-2676: Start of 'ora.CRS.dg' on '18c1' succeeded
2020/03/16 19:27:00 CLSRSC-594: Executing installation step 20 of 20: 'PostConfig'.
2020/03/16 19:29:03 CLSRSC-325: Configure Oracle Grid Infrastructure for a Cluster ... succeeded 

[root@18c2 /]# ./u01/app/18.0.0/grid/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= grid
    ORACLE_HOME=  /u01/app/18.0.0/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]: 
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Relinking oracle with rac_on option
Using configuration parameter file: /u01/app/18.0.0/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u01/app/grid/crsdata/18c2/crsconfig/rootcrs_18c2_2020-03-16_07-30-27PM.log
2020/03/16 19:30:47 CLSRSC-594: Executing installation step 1 of 20: 'SetupTFA'.
2020/03/16 19:30:47 CLSRSC-4001: Installing Oracle Trace File Analyzer (TFA) Collector.
2020/03/16 19:32:12 CLSRSC-4002: Successfully installed Oracle Trace File Analyzer (TFA) Collector.
2020/03/16 19:32:12 CLSRSC-594: Executing installation step 2 of 20: 'ValidateEnv'.
2020/03/16 19:32:12 CLSRSC-363: User ignored prerequisites during installation
2020/03/16 19:32:12 CLSRSC-594: Executing installation step 3 of 20: 'CheckFirstNode'.
2020/03/16 19:32:15 CLSRSC-594: Executing installation step 4 of 20: 'GenSiteGUIDs'.
2020/03/16 19:32:15 CLSRSC-594: Executing installation step 5 of 20: 'SaveParamFile'.
2020/03/16 19:32:19 CLSRSC-594: Executing installation step 6 of 20: 'SetupOSD'.
2020/03/16 19:32:20 CLSRSC-594: Executing installation step 7 of 20: 'CheckCRSConfig'.
2020/03/16 19:32:20 CLSRSC-594: Executing installation step 8 of 20: 'SetupLocalGPNP'.
2020/03/16 19:32:22 CLSRSC-594: Executing installation step 9 of 20: 'CreateRootCert'.
2020/03/16 19:32:22 CLSRSC-594: Executing installation step 10 of 20: 'ConfigOLR'.
2020/03/16 19:32:27 CLSRSC-594: Executing installation step 11 of 20: 'ConfigCHMOS'.
2020/03/16 19:32:27 CLSRSC-594: Executing installation step 12 of 20: 'CreateOHASD'.
2020/03/16 19:32:29 CLSRSC-594: Executing installation step 13 of 20: 'ConfigOHASD'.
2020/03/16 19:32:29 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
2020/03/16 19:33:05 CLSRSC-594: Executing installation step 14 of 20: 'InstallAFD'.
2020/03/16 19:33:58 CLSRSC-594: Executing installation step 15 of 20: 'InstallACFS'.
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on '18c2'
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on '18c2' has completed
CRS-4133: Oracle High Availability Services has been stopped.
CRS-4123: Oracle High Availability Services has been started.
2020/03/16 19:34:31 CLSRSC-594: Executing installation step 16 of 20: 'InstallKA'.
2020/03/16 19:34:33 CLSRSC-594: Executing installation step 17 of 20: 'InitConfig'.
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on '18c2'
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on '18c2' has completed
CRS-4133: Oracle High Availability Services has been stopped.
CRS-4123: Oracle High Availability Services has been started.
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on '18c2'
CRS-2673: Attempting to stop 'ora.drivers.acfs' on '18c2'
CRS-2677: Stop of 'ora.drivers.acfs' on '18c2' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on '18c2' has completed
CRS-4133: Oracle High Availability Services has been stopped.
2020/03/16 19:35:14 CLSRSC-594: Executing installation step 18 of 20: 'StartCluster'.
CRS-4123: Starting Oracle High Availability Services-managed resources
CRS-2672: Attempting to start 'ora.mdnsd' on '18c2'
CRS-2672: Attempting to start 'ora.evmd' on '18c2'
CRS-2676: Start of 'ora.mdnsd' on '18c2' succeeded
CRS-2676: Start of 'ora.evmd' on '18c2' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on '18c2'
CRS-2676: Start of 'ora.gpnpd' on '18c2' succeeded
CRS-2672: Attempting to start 'ora.gipcd' on '18c2'
CRS-2676: Start of 'ora.gipcd' on '18c2' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on '18c2'
CRS-2676: Start of 'ora.cssdmonitor' on '18c2' succeeded
CRS-2672: Attempting to start 'ora.crf' on '18c2'
CRS-2672: Attempting to start 'ora.cssd' on '18c2'
CRS-2672: Attempting to start 'ora.diskmon' on '18c2'
CRS-2676: Start of 'ora.diskmon' on '18c2' succeeded
CRS-2676: Start of 'ora.crf' on '18c2' succeeded
CRS-2676: Start of 'ora.cssd' on '18c2' succeeded
CRS-2672: Attempting to start 'ora.cluster_interconnect.haip' on '18c2'
CRS-2672: Attempting to start 'ora.ctssd' on '18c2'
CRS-2676: Start of 'ora.ctssd' on '18c2' succeeded
CRS-2672: Attempting to start 'ora.crsd' on '18c2'
CRS-2676: Start of 'ora.crsd' on '18c2' succeeded
CRS-2676: Start of 'ora.cluster_interconnect.haip' on '18c2' succeeded
CRS-2672: Attempting to start 'ora.asm' on '18c2'
CRS-2676: Start of 'ora.asm' on '18c2' succeeded
CRS-6017: Processing resource auto-start for servers: 18c2
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on '18c1'
CRS-2672: Attempting to start 'ora.ASMNET1LSNR_ASM.lsnr' on '18c2'
CRS-2672: Attempting to start 'ora.ons' on '18c2'
CRS-2677: Stop of 'ora.LISTENER_SCAN1.lsnr' on '18c1' succeeded
CRS-2673: Attempting to stop 'ora.scan1.vip' on '18c1'
CRS-2677: Stop of 'ora.scan1.vip' on '18c1' succeeded
CRS-2672: Attempting to start 'ora.scan1.vip' on '18c2'
CRS-2676: Start of 'ora.scan1.vip' on '18c2' succeeded
CRS-2672: Attempting to start 'ora.LISTENER_SCAN1.lsnr' on '18c2'
CRS-2676: Start of 'ora.ASMNET1LSNR_ASM.lsnr' on '18c2' succeeded
CRS-2672: Attempting to start 'ora.asm' on '18c2'
CRS-2676: Start of 'ora.ons' on '18c2' succeeded
CRS-2676: Start of 'ora.LISTENER_SCAN1.lsnr' on '18c2' succeeded
CRS-2676: Start of 'ora.asm' on '18c2' succeeded
CRS-2672: Attempting to start 'ora.proxy_advm' on '18c1'
CRS-2672: Attempting to start 'ora.proxy_advm' on '18c2'
CRS-2676: Start of 'ora.proxy_advm' on '18c1' succeeded
CRS-2676: Start of 'ora.proxy_advm' on '18c2' succeeded
CRS-6016: Resource auto-start has completed for server 18c2
CRS-6024: Completed start of Oracle Cluster Ready Services-managed resources
CRS-4123: Oracle High Availability Services has been started.
2020/03/16 19:38:09 CLSRSC-343: Successfully started Oracle Clusterware stack
2020/03/16 19:38:09 CLSRSC-594: Executing installation step 19 of 20: 'ConfigNode'.
2020/03/16 19:38:34 CLSRSC-594: Executing installation step 20 of 20: 'PostConfig'.
2020/03/16 19:39:07 CLSRSC-325: Configure Oracle Grid Infrastructure for a Cluster ... succeeded

检查集群信息

[root@18c1 /]# su - grid
Last login: Mon Mar 16 19:40:16 CST 2020
[grid@18c1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr
               ONLINE  ONLINE       18c1                     STABLE
               ONLINE  ONLINE       18c2                     STABLE
ora.CRS.GHCHKPT.advm
               OFFLINE OFFLINE      18c1                     STABLE
               OFFLINE OFFLINE      18c2                     STABLE
ora.CRS.dg
               ONLINE  ONLINE       18c1                     STABLE
               ONLINE  ONLINE       18c2                     STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       18c1                     STABLE
               ONLINE  ONLINE       18c2                     STABLE
ora.crs.ghchkpt.acfs
               OFFLINE OFFLINE      18c1                     volume /opt/oracle/r
                                                             hp_images/chkbase is
                                                             unmounted,STABLE
               OFFLINE OFFLINE      18c2                     STABLE
ora.helper
               OFFLINE OFFLINE      18c1                     STABLE
               OFFLINE OFFLINE      18c2                     IDLE,STABLE
ora.net1.network
               ONLINE  ONLINE       18c1                     STABLE
               ONLINE  ONLINE       18c2                     STABLE
ora.ons
               ONLINE  ONLINE       18c1                     STABLE
               ONLINE  ONLINE       18c2                     STABLE
ora.proxy_advm
               ONLINE  ONLINE       18c1                     STABLE
               ONLINE  ONLINE       18c2                     STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.18c1.vip
      1        ONLINE  ONLINE       18c1                     STABLE
ora.18c2.vip
      1        ONLINE  ONLINE       18c2                     STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       18c2                     STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       18c1                     STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       18c1                     STABLE
ora.MGMTLSNR
      1        OFFLINE OFFLINE                               STABLE
ora.asm
      1        ONLINE  ONLINE       18c1                     Started,STABLE
      2        ONLINE  ONLINE       18c2                     Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       18c1                     STABLE
ora.qosmserver
      1        ONLINE  ONLINE       18c1                     STABLE
ora.rhpserver
      1        OFFLINE OFFLINE                               STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       18c2                     STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       18c1                     STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       18c1                     STABLE
--------------------------------------------------------------------------------


安装数据库软件

[oracle@18c1 soft]$ unzip LINUX.X64_180000_db_home.zip -d /u01/app/oracle/18.0.0/db 

[root@18c1 ~]# xhost +
access control disabled, clients can connect from any host
[root@18c1 ~]# su - oracle
Last login: Mon Mar 16 17:20:14 CST 2020 on pts/0
[oracle@18c1 ~]$ cd  $ORACLE_HOME
[oracle@18c1  db]$ export DISPLAY=10.138.130.242:0.0
[oracle@18c1 db]$ ./runInstaller 











以 root用户在所有节点上执行以下脚本,先在主节点执行

[root@18c1 /]# ./u01/app/oracle/18.0.0/db/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/18.0.0/db

Enter the full pathname of the local bin directory: [/usr/local/bin]: 
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.

[root@18c2 /]# ./u01/app/oracle/18.0.0/db/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/18.0.0/db

Enter the full pathname of the local bin directory: [/usr/local/bin]: 
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.

创建数据库jycs

[oracle@jytest1 database]$ dbca
















检查数据库配置信息

[grid@18c2 18.0.0]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr
               ONLINE  ONLINE       18c1                     STABLE
               ONLINE  ONLINE       18c2                     STABLE
ora.CRS.GHCHKPT.advm
               OFFLINE OFFLINE      18c1                     STABLE
               OFFLINE OFFLINE      18c2                     STABLE
ora.CRS.dg
               ONLINE  ONLINE       18c1                     STABLE
               ONLINE  ONLINE       18c2                     STABLE
ora.DATA.dg
               ONLINE  ONLINE       18c1                     STABLE
               ONLINE  ONLINE       18c2                     STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       18c1                     STABLE
               ONLINE  ONLINE       18c2                     STABLE
ora.chad
               ONLINE  ONLINE       18c1                     STABLE
               ONLINE  ONLINE       18c2                     STABLE
ora.crs.ghchkpt.acfs
               OFFLINE OFFLINE      18c1                     STABLE
               OFFLINE OFFLINE      18c2                     STABLE
ora.helper
               OFFLINE OFFLINE      18c1                     IDLE,STABLE
               OFFLINE OFFLINE      18c2                     IDLE,STABLE
ora.net1.network
               ONLINE  ONLINE       18c1                     STABLE
               ONLINE  ONLINE       18c2                     STABLE
ora.ons
               ONLINE  ONLINE       18c1                     STABLE
               ONLINE  ONLINE       18c2                     STABLE
ora.proxy_advm
               ONLINE  ONLINE       18c1                     STABLE
               ONLINE  ONLINE       18c2                     STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.18c1.vip
      1        ONLINE  ONLINE       18c1                     STABLE
ora.18c2.vip
      1        ONLINE  ONLINE       18c2                     STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       18c2                     STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       18c1                     STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       18c1                     STABLE
ora.MGMTLSNR
      1        ONLINE  ONLINE       18c1                     169.254.11.99 88.88.
                                                             87.1,STABLE
ora.asm
      1        ONLINE  ONLINE       18c1                     Started,STABLE
      2        ONLINE  ONLINE       18c2                     Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       18c1                     STABLE
ora.jycs.db
      1        ONLINE  ONLINE       18c1                     Open,HOME=/u01/app/o
                                                             racle/18.0.0/db,STAB
                                                             LE
      2        ONLINE  ONLINE       18c2                     Open,HOME=/u01/app/o
                                                             racle/18.0.0/db,STAB
                                                             LE
ora.mgmtdb
      1        ONLINE  ONLINE       18c1                     Open,STABLE
ora.qosmserver
      1        ONLINE  ONLINE       18c1                     STABLE
ora.rhpserver
      1        OFFLINE OFFLINE                               STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       18c2                     STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       18c1                     STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       18c1                     STABLE
--------------------------------------------------------------------------------

到此18C RAC for Oracle Linux 7.1的安装完成!

Oracle 12c 使用SQL*Plus来创建与移动应用程序Seeds

可以使用多种方法来创建应用程序seeds,包括使用CDB seed,克隆现有的PDB或Non-CDB,与附加一个卸载的PDB。也可以从应用程序容器中删除应用程序seeds。

为了在应用程序容器中创建新的应用程序seed,可以执行带有as seed子句的create pluggable database语句。可以使用应用程序种子为应用程序提供一个应用程序容器。通常在应用程序seed创建之前应用程序容器的应用程序被安装在应用程序root中。在应用程序seed创建之后它将与应用程序root进行同步,因此应用程序被安装在应用程序seed中。当创建应用程序seed之后,使用应用程序seed创建的任何PDB都安装应用程序。当应用程序root中的应用程序被升级或打补丁后,应用程序seed必须使用应用程序root进行同步来应用这些改变。

通过执行带有as seed子句的create pluggable database语句来创建应用程序seed。

一个应用程序容器可以有零或一个应用程序seed。当使用as seed子句创建应程序seed时,不用指定它的名字。应用程序seed名字总是以application_container_name$SEED命名,其中application_container_name是应用程序seed的应用程序容器的名字。例如,在salesact应用程序容器中的应用程序seed它的名字必须是salesact$SEED。

当创建一个新的应用程序seed时,必须为在create pluggable database语句中为应用程序容器指定管理员。这个语句将在应用程序容器中创建一个本地用户的管理员,并且被授予pdb_dba角色。

创建应用程序seed的所需要满足的条件:
.CDB必须存在

.CDB必须处于读写模式

.应用程序seed所属的应用程序容器必须处于读写模式

.当前用户必须是一个公共用户,应用程序seed所属的应用程序root是当前容器

.当前用户有create pluggable database系统权限

.在应用程序容器中对于包含应用程序的应用程序seed,应用程序必须安装在应用程序root

创建应用程序seed
可以通过执行带有as seed子句的create pluggable database语句来创建应用程序。应用程序容器中的应用程序seed类似于CDB中的seed。一个应用程序seed能用来快速与简单的创建满足应用程序容器要求的应用程序PDB。创建应用程序seed的操作如下:
1.在SQL*Plus中,确保当前容器是应用程序root。

2.执行带有as seed子句的create pluggable database语句来创建应用程序seed。根据需要还可以指定其它子句。在创建完应用程序seed后,它处于mounted模式,状态为new。可以通过查询v$pdbs视图的open_mode列来检查应用程序seed的打开模式。可以通过查询cdb_pdbs或者dba_pdbs视图的status列来查看应用程序seed的状态。还会为应用程序seed创建缺省的服务名。服务名与应用程序seed同名并且可以被用来访问应用程序seed。

3.以读写模式来打开新的应用程序seed

4.为了将新应用程序seed集成到应用程序容器中必须以读写模式来打开新的应用程序seed。如果试图以只读模式来打开新的应用程序seed将会返回错误信息。在应用程序seed以读写模式打开后,它的状态将为normal。

5.执行一个或多个以下操作:
5.a 如果使用CDB seed中创建应用程序seed,那么将容器切换到应用程序seed,并且执行带有sync子句的alter pluggable database语句来同步应用程序seed。同步使用应用程序root来实例化应用程序seed中的一个或多个应用程序root的应用程序。

5.b 如果使用应用程序root中创建应用程序seed,那么将容器切换到应用程序seed,然后执行pdb_to_apppdb.sql脚本来将应用程序root转换为应用程序PDB。

当通过克隆一个应用程序PDB来创建应用程序seed时这些操作不需要执行。

6.关闭应用程序seed,然后以只读模式来打开它。

7.备份应用程序seed。

使用CDB seed来创建应用程序seed
这个例子假设满足以下条件:
.应用程序seed将被创建在名为salesact的应用程序容器中。

.对应用程序seed不使用存储限制,因此不指定storage子句。

.应用程序seed不创建缺省表空间。

.不指定path_prefix子句。

.不指定file_name_convert与create_file_dest子句。可以对CDB启用OMF或设置pdb_file_name_convert初始化参数。与CDB相关的文件将会基于OMF配置或参数设置被复制到新目录中。

.在目标目录中没有与新temp文件同名的文件存在,将会创建新的temp文件,因此不用指定tempfile reuse子句。

.不需要预先定义Oracle角色被授予给pdb_dba角色。

执行的语句如下:
先切换到应用程序容器salesact中

SQL> alter session set container=salesact;

Session altered.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT                                                                                                                         READ WRITE

执行语句来使用CDB seed来在应用程序容器salesact中创建应用程序seed,并打开应用程序seed。

SQL> create pluggable database as seed admin user actseedadm identified by "xxzx7817600";

Pluggable database created.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT                                                                                                                         READ WRITE
SALESACT$SEED                                                                                                                    MOUNTED

SQL> alter pluggable database salesact$seed open;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT                                                                                                                         READ WRITE
SALESACT$SEED                                                                                                                    READ WRITE

切换容器到应用程序seed(salesact$SEED)中,使用应用程序root中的所有应用程序来同步应用程序seed。

SQL> alter session set container=salesact$seed;

Session altered.

SQL>  select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT$SEED                                                                                                                    READ WRITE

SQL> alter pluggable database application all sync;

Pluggable database altered.

关闭应用程序seed(salesact$seed),然后以只读模式来打开应用程序seed。

SQL> alter pluggable database close immediate;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT$SEED                                                                                                                    MOUNTED

SQL> alter pluggable database  open read only;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT$SEED                                                                                                                    READ ONLY

因为应用程序容器名为salesact,所以应用程序seed名为salesact$seed。在创建应用程序seed时一起创建了一个本地管理用户并且被授予了pdb_dba公共角色。如果这个用户在创建应用程序seed时没有授予管理权限,那么使用sys与system公共用户来管理应用程序seed。当创建应用程序seed时,将使用应用程序root来同步应用程序seed。因此应用程序seed将包含安装在应用程序root中的应用程序与应用程序公共对象它们是这些应用程序的一部分。当使用应用程序seed来创建新的应用程序PDB时,应用程序PDB也会包含这些安装的应用程序与应用程序公共对象。

使用应用程序PDB创建应用程序seed
这个例子假设满足以下条件:
.在应用程序容器salesact中创建了应用程序seed。

.将在应用程序PBD(salesapppdb)所在的应用程序容器中创建应用程序seed。

.对应用程序seed不使用存储限制,因此不指定storage子句。

.应用程序seed不包含缺省表空间。

.不指定path_prefix子句。

.不指定file_name_convert与create_file_dest子句。可以启用OMF或设置pdb_file_name_convert初始化参数。与应用程序root相关的文件会基于OMF的配置或初始化参数设置被复制到新目录中。

.在目标目录中没有与新temp文件同名的文件存在,因此不需要使用tempfile reuse子句。

切换容器到应用程序容器(salesact),并执行以下命令来创建应用程序seed。

SQL> create pluggable database as seed from salesapppdb;

Pluggable database created.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT                                                                                                                         READ WRITE
SALESAPPPDB                                                                                                                      READ WRITE
SALESACT$SEED                                                                                                                    MOUNTED

然后打开应用程序seed,再关闭应用程序seed,最后再以只读方式打开应用程序seed。

SQL> alter pluggable database salesact$seed open;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT                                                                                                                         READ WRITE
SALESAPPPDB                                                                                                                      READ WRITE
SALESACT$SEED                                                                                                                    READ WRITE

SQL> alter pluggable database salesact$seed close immediate;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT                                                                                                                         READ WRITE
SALESAPPPDB                                                                                                                      READ WRITE
SALESACT$SEED                                                                                                                    MOUNTED

SQL> alter pluggable database salesact$seed open read only;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT                                                                                                                         READ WRITE
SALESAPPPDB                                                                                                                      READ WRITE
SALESACT$SEED                                                                                                                    READ ONLY

因为应用程序容器名为salesact,所以应用程序seed名字默认为salesact$seed。应用程序seed是使用应用程序pdb而创建的,因此应用程序seed就包含了安装在应用程序root中的应用程序与应用程序公共对象,它们是这些应用程序的一部分。当使用应用程序seed来创建新的应用程序pdb时,应用程序pdb也会包含安装的应用程序与应用程序公共对象。

使用应用程序root来创建应用程序seed
这个例子假设满足以下条件:
.应用程序seed将创建在应用程序容器(salesact)中。应用程序seed使用对应用程序容器的root进行克隆进行创建。

.对应用程序seed不使用存储限制,因此不使用storage子句。

.应用程序seed不包含缺省表空间。

.不使用path_prefix子句。

.不使用file_name_convert与create_file_dest子句。可以启用OMF或设置pdb_file_name_convert初始化参数。基于OMF配置或初始化参数的设置与应用程序root相关的文件会被复制到新目录中。

.在目标目录中没有与新temp文件同名的文件存在,因此不需要使用tempfile reuse子句。

切换到应用程序容器(salesact)中,执行下面的命令来创建应用程序seed。

SQL> create pluggable database as seed from salesact;

Pluggable database created.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT                                                                                                                         READ WRITE
SALESACT$SEED                                                                                                                    MOUNTED
SALESAPPPDB                                                                                                                      READ WRITE

打开应用程序seed,切换容器到应用程序seed,然后执行pdb_to_apppdb.sql脚本将应用程序root转换为应用程序pdb。

SQL> alter pluggable database salesact$seed open;

Warning: PDB altered with errors.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT                                                                                                                         READ WRITE
SALESACT$SEED                                                                                                                    READ WRITE
SALESAPPPDB                                                                                                                      READ WRITE

SQL> alter session set container=salesact$seed;

Session altered.

SQL> @$ORACLE_HOME/rdbms/admin/pdb_to_apppdb.sql

...
SQL> BEGIN
  2    execute immediate '&open_sql &restricted_state';
  3  EXCEPTION
  4    WHEN OTHERS THEN
  5    BEGIN
  6      IF (sqlcode <> -900) THEN
  7        RAISE;
  8      END IF;
  9    END;
 10  END;
 11  /

PL/SQL procedure successfully completed.

SQL> 
SQL> WHENEVER SQLERROR CONTINUE;



SQL> alter pluggable database close immediate instances=all;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT$SEED                                                                                                                    MOUNTED

1 row selected.

SQL> alter pluggable database open read only instances=all;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT$SEED                                                                                                                    READ ONLY

1 row selected.

因为应用程序容器名为salesact,所以应用程序seed名为salesact$seed。应用程序seed是使用应用程序root进行创建的。因此应用程序seed包含安装在应用程序root中的应用程序与应用程序公共对象,它们是这些应用程序的一部分。当使用应用程序seed来创建新应用程序PDB时,应用程序pdb也会包含安装的应用程序与应用程序公共对象。

从应用程序容器中拔出应用程序seed
拔出应用程序seed就是断开应用程序seed与应用程序容器的关联。当不再需要应用程序seed时可以将其删除。拔出应用程序seed类似于拔出PDB。为了拔出应用程序seed,连接到它的应用程序root并使用alter pluggable database语句来指定生成xml文件或.pdb文件。当指定xml文件后,在卸载完成后生成的xml文件会包含描述应用程序seed的元数据。

SQL> alter pluggable database salesact$seed close immediate instances=all;

Pluggable database altered.



SQL>  select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT                                                                                                                         READ WRITE
SALESACT$SEED                                                                                                                    MOUNTED
SALESAPPPDB                                                                                                                      READ WRITE

3 rows selected.



SQL> alter pluggable database salesact$seed unplug into '/tts/plug/salesact_seed.xml';

Pluggable database altered.

删除应用程序seed
当不再需要应用程序seed时,可以执行drop pluggable database语句来删除。当删除应用程序seed时,CDB的控制文件会被修改来删除与被删除应用程序seed的所有相关信息,但是归档重做日志与备份不会被删除,但可以使用RMAN来删除它们。

SQL> drop pluggable database salesapppdb including datafiles;

Pluggable database dropped.

创建应用程序PDB
可以在应用程序root容器中执行create pluggable database语句来创建应用程序PDB。创建应用程序pdb与在CDB root中创建PDB都是使用相同的SQL语句。当在应用程序root中执行create pluggable database语句时新创建的PDB为应用程序PDB。SQL语句必须在应用程序root中执行并且对应用程序root中所定义的应用程序数据库有显式依赖性。创建应用程序PDB的操作如下:

1.在SQL*Plus中,确保当前容器为应用程序root

2.执行create pluggable database语句。在应用程序PDB完成创建之后,它处于mounted模式并且状态为NEW。可以通过查询v$pdbs视图的open_mode列来查看应用程序pdb的打开模式,可以通过查询cdb_pdbs或dba_pdbs视图的status列来查看应用程序pdb的状态。对于新创建的应用程序PDB也会创建一个缺省的服务名,服务名与应用程序PDB同名并且可以被用来访问应用程序PDB。

3.以读写模式来打开应用程序PDB

4.为了将新的应用程序PDB集成到应用程序容器必须以读写模式来打开新的应用程序PDB。如果试图以只读模式来打开应用程序PDB将会返回错误信息。在应用程序PDB以读写模式打开后它的状态将变为NORMAL。

5.切换容器为应用程序PDB

6.执行alter pluggable database … sync来同步应用程序PDB。同步使用应用程序PDB来实例化应用程序PDB中的一个或多个应用程序root中的应用程序。

7.关闭应用程序PDB,然后以只读模式打开。

8.备份应用程序PDB。

SQL> alter session set container=salesact;

Session altered.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT                                                                                                                         READ WRITE

1 row selected.



SQL> create pluggable database salesapppdb admin user salesapppdbadm identified by "xxzx7817600";

Pluggable database created.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT                                                                                                                         READ WRITE
SALESAPPPDB                                                                                                                      MOUNTED

2 rows selected.

SQL> alter pluggable database salesapppdb open read write instances=all;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESACT                                                                                                                         READ WRITE
SALESAPPPDB                                                                                                                      READ WRITE

2 rows selected.

SQL> alter session set container=salesapppdb;

Session altered.


SQL> alter pluggable database application all sync; 

Pluggable database altered.

SQL> alter pluggable database salesapppdb close immediate instances=all;

Pluggable database altered.

SQL>  select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESAPPPDB                                                                                                                      MOUNTED

1 row selected.

SQL> alter pluggable database salesapppdb open read only instances=all;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
SALESAPPPDB                                                                                                                      READ ONLY

1 row selected.

Oracle 12c使用SQL*Plus来创建与删除应用程序容器

可以使用不同方式来创建应用程序容器,比如使用CDB seed,克隆现有的PDB或Non-CDB,插入一个被拔出的PDB,也可以从CDB中删除应用程序容器。

创建应用程序容器
可以使用create pluggable database语句来在CDB中创建应用程序容器。当执行create pluggable database语句时指定as application container子句可以创建一个新的应用程序容器。应用程序容器由应用程序root与用来存储一个或多个应用程序数据的一组应用程序PDB组成。应用程序PDB可以被附加到应用程序root中,并且可以选择快速地创建应用程序seed与简单地创建新的应用程序PDB。应用程序PDB与应用程序root可以共享应用程序公共对象。

有三种类型的应用程序公共对象:
.元数据链接应用程序公共对象存储特定对象的元数据,比如表。 因此容器可以共享有相同结构没有相同数据的应用程序公共对象。

.数据链接应用程序公共对象只在应用程序root中定义一次并且在应用程序PDB的上下文中共享只读对象。

.扩展数据链接应用程序公共对象在应用程序root中存储共享数据但也允许应用程序PDB来将数据添加到对象中。添加的数据是本地数据它对于每个应用程序PDB来说是唯一的。

通过执行creatae pluggable database as application container子句可以创建应用程序容器。也可以使用以下技术来创建应用程序容器:
.使用CDB seed
.克隆现有的PDB或Non-CDB
.迁移PDB
.插入被拔出的PDB

当当前容器是CDB的root并且在执行create pluggable database语句时指定了as application container子句时,将创建应用程序容器。

迁移现有的应用程序为应用程序容器
可以通过使用现有的PDB来创建应用程序容器。当迁移现有应用程序为一个应用程序容器时必须完成额外的任务。要附加的PDB必须包含应用程序数据库对象,包含它们的数据,并且对于应用程序所访问的相关数据库对象必须执行dbms_pdb中的过程。当应用程序公共用户,角色或profiles存放在应用程序root中,对与应用程序相关的数据库对象必须执行dbms_pdb包。在应用程序迁移为应用程序容器后,可以在应用程序容器中创建应用程序PDB,并且可以使用现有的PDB来创建应用程序PDB。

创建应用程序容器的准备
在创建应用程序容器之前必须完达到以下条件:
.CDB必须存在

.CDB必须处于读写模式

.当前容器如果是CDB的root,那么当前用户必须是一个公共用户

.当前用户必须有create pluggable database系统权限

.对于每个应用程序容器必须要决定一个唯一的应用程序容器名字。每个应用程序容器名字必须对于单个CDB中的所有容器来说是唯一的,并且每个应用程序容器名字必须在特定监听所监听的所有CDB范围内是唯一的。应用程序容器名字用来区分CDB中的应用程序容器。应用程序容器名字遵守与服务名一样的规则,它是大小写敏感的。

.如果在使用物理备库的Data Guard配置中创建应用程序容器,那么在创建应用程序容器之前必须完成额外的任务。

.如果使用PDB将现有的应用程序迁移成应用程序容器,那么它必须能够通过克隆PDB来创建应用程序root,迁移PDB到应用程序root中,或者将PDB插入到应用程序root中。

创建应用程序容器
可以执行create pluggable database … as application container语句来创建应用程序容器。创建应用程序容器的操作如下:
1.在SQL*Plus中,确保当前容器为CDB的root。

2.执行create pluggable database … as application container语句。如果需要还可以指定其它子句。在创建应用程序容器后,它处于mounted模式,并且它的状态为NEW。可以查询v$pdbs视图的open_mode列来查看应用程序容器的打开模式。可以通过查询cdb_pdbs或dba_pdbs视图来查看应用程序状态。并且会对应用程序容器创建一个新的缺省服务。这个服务与应用程序容器有相同的名字,并且可以被用来访问应用程序容器。

3.以读写模式来打开新的应用程序容器。为了将新应用程序容器集成到CDB中必须以读写模式来打开新的应用程序容器。如果你试图以只读模式来打开应用程序容器将会返回错误住处。在应用程序容器以读写模式打开后,它的状态将会变为NORMAL。

4.备份应用程序容器

使用CDB Seed来创建应用程序容器
这个例子假设满足以下条件:
.对应用程序容器没有使用存储限制。因此不指定storage子句。

.应用程序容器不创建缺省表空间

.不指定path_prefix子句

.不指定file_name_convert与create_file_dest子句。可以启用OMF或设置pdb_file_name_convert参数。与CDB Seed相关的文件基于OMF配置或参数设置将会被复制到新目录中。

.在目标目录中如果没有与新temp文件同名的文件存储,将会创建新temp文件,因此不指定tempfile reuse子句。

.没有预先定义的Oracle角色需要被授予给PDB_DBA角色。

SQL> create pluggable database salesact as application container admin user salesadm identified by "xxzx";

Pluggable database created.


SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
PDB$SEED                                                                                                                         READ ONLY
JYPDB                                                                                                                            READ WRITE
ORCLPDB                                                                                                                          READ WRITE
SALESACT                                                                                                                         MOUNTED


SQL> alter pluggable database salesact open read write;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
PDB$SEED                                                                                                                         READ ONLY
JYPDB                                                                                                                            READ WRITE
ORCLPDB                                                                                                                          MOUNTED
SALESACT                                                                                                                         READ WRITE

通过克隆本地PDB来创建应用程序容器
这个例子假设满足以下条件:
.不指定path_prefix子句

.指定file_name_convert子句来指定复制文件所存放的目录。在这个例子中,文件从
+DATA/JY/58E7574E7926075EE053AC828A0AA4C9/DATAFILE/与+DATA/JY/58E7574E7926075EE053AC828A0AA4C9/TEMPFILE/目录中复制到+test/jy/hract目录中。不指定create_file_dest子句,并且也不使用OMF或pdb_file_name_conver参数。

.对于应用程序root使用存储限制。因此需要指定storage子句。这里指定属于应用程序root的所有表空间大小不能超过6G。这种存储限制不会应用到附加到应用程序root中的应用程序PDB。

.在目标目录中没有与新temp文件同名的文件存在,所以将会创建新的temp文件。因此不用指定tempfile reuse子句。

SQL> create pluggable database hract as application container from jypdb
  2  file_name_convert = ('+DATA/JY/58E7574E7926075EE053AC828A0AA4C9/DATAFILE/system.297.954436417', '+test/jy/hract/system01.dbf',
  3                       '+DATA/JY/58E7574E7926075EE053AC828A0AA4C9/DATAFILE/sysaux.276.954436419','+test/jy/hract/sysaux01.dbf',
  4                       '+DATA/JY/58E7574E7926075EE053AC828A0AA4C9/DATAFILE/undotbs1.296.954436417','+test/jy/hract/undotsb1.dbf',
  5                       '+DATA/JY/58E7574E7926075EE053AC828A0AA4C9/DATAFILE/undo_2.274.954436487','+test/jy/hract/undo_2.dbf',
  6                       '+DATA/JY/58E7574E7926075EE053AC828A0AA4C9/TEMPFILE/temp.275.954436435','+test/jy/hract/temp01.dbf'
  7                       )
  8  storage (maxsize 6g);

Pluggable database created.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
PDB$SEED                                                                                                                         READ ONLY
HRACT                                                                                                                            MOUNTED
JYPDB                                                                                                                            READ WRITE
SALESACT                                                                                                                         READ WRITE

通过插入被拔出的PDB来创建应用程序容器
这个例子假设满足以下条件:
.新应用程序容器不是基于已经被用来创建PDB或应用程序容器的同一个被拔出的PDB而进行创建。因此不用指定as clone子句。

.不指定path_prefix子句

.xml元数据文件没有精确地描述文件的当前目录,因此需要指定source_file_name_convert或source_file_directory子句。在这个例子中XML文件指示文件在+DATA/JY/DATAFILE/,但实际文件是存储在+DATA/JY/58E7574E7926075EE053AC828A0AA4C9/DATAFILE/与+DATA/JY/58E7574E7926075EE053AC828A0AA4C9/TEMPFILE/目录中,指定source_file_name_convert子句。

.文件存储在正确目录中,因此不指定nocopy子句。

.对应用程序容器使用存储限制,因此指定storage子句。指定应用程序容器的所有表空间大小不超过4G。

.在目标目录中有与新temp文件同名的文件存在,为了创建新的temp文件。因此指定tempfile reuse子句。

SQL> create pluggable database payrollact as application container using '/tts/plug/jypdb.xml'
  2  source_file_name_convert = ('+DATA/JY/58E7574E7926075EE053AC828A0AA4C9/DATAFILE/', '+DATA/JY/58E7574E7926075EE053AC828A0AA4C9/DATAFILE/',
  3                              '+DATA/JY/58E7574E7926075EE053AC828A0AA4C9/TEMPFILE/','+DATA/JY/58E7574E7926075EE053AC828A0AA4C9/TEMPFILE/'
  4                              )
  5  nocopy
  6  storage (maxsize 4g)
  7  tempfile reuse;

Pluggable database created.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
PDB$SEED                                                                                                                         READ ONLY
PAYROLLACT                                                                                                                       MOUNTED

SQL> alter pluggable database payrollact open read write;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
PDB$SEED                                                                                                                         READ ONLY
PAYROLLACT                                                                                                                       READ WRITE

从CDB中拔出应用程序容器
为了拔出应用程序容器必须满足以下条件:
.当前用户必须有sysdba或sysoper管理权限

.应用程序容器必须至少打开过一次

.应用程序容器不能包含任何应用程序PDB

.应用程序容器不能包含任何应用程序Seed

SQL> alter pluggable database payrollact unplug into '/tts/plug/payrollact.xml';

Pluggable database altered.

删除应用程序容器
可以使用drop pluggable database语句来删除应用程序容器。当想要将一个应用程序容器从一个CDB中移动到另一个CDB中或不再需要这个应用程序容器时可以将其删除。

删除应用程序容器与删除PDB是很类似的。当删除应用程序容器时,CDB的控制文件会被修改来删除与被删除应用程序容器相关的信息。与应用程序容器相关的归档重做日志与备份不会被删除,但可以使用RMAN来删除它们。

当删除应用程序容器时,可以使用下面的子句来保留或删除数据文件:
. keep datafiles,缺省值,保留数据文件,即使指定了keep datafiles子句应用程序容器的temp文件仍然会被删除,因为temp文件不再需要。

.including datafiles,删除数据文件。如果应用程序容器是使用snapshot copy子句创建的,那么当删除应用程序容器时必须指定including datafiles子句。

要删除应用程序容器必须满足以下条件:
.应用程序容器必须处于mounted状态或者unplugged状态。

.当前用户必须有sysdba或sysoper管理权限。

.应用程序容器不能包含任何应用程序PDB。

.应用程序容器不能包含任何应用程序Seed。

当删除应用程序容器时保留数据文件

drop pluggable database payrollact keep datafiles;

当删除应用程序容器时并且删除数据文件

drop pluggable database payrollact including  datafiles;

Oracle 12c 使用Non-CDB来创建PDB

可以移动Non-CDB来变为一个PDB。可以使用以下方式来完成这个任务:
.通过克隆Non-CDB来创建PDB。从Oracle 12.1.0.2开始,可以通过克隆Non-CDB来创建PDB。这种方法是创建PDB最简单的一种方法,但它需要从Non-CDB中把文件复制到新目录中。

.使用dbms_pdb包来生成XML元数据文件,XML元数据文件用来描述Non-CDB的数据文件可以用来将其附加到CDB中。这种方法比克隆Non-CDB要执行更多的步骤,但它能让你不用移动Non-CDB的文件来创建PDB。为了使用这种技术 ,Non-CDB必须是Oracle 12C的Non-CDB。如果当前的Non-CDB使用Oracle 12C之前的版本,那么你必须将Non-CDB升级到Oracle 12C。

.使用Oracle Data Pump导出/导入
可以使用Data Pump从Non-CDB中导出数据然后导入到PDB中。当你执行导入时,在用户名后要指定PDB的连接标识符。例如,如果PDB的连接标识符为hrpdb,那么在执行导入进执行以下命令:
imdp username@hrpdb ….如果Non-CDB的版本为11.2.0.3或之后的版本,那么可以使用完全传输导出/导入来移动数据。当将版本为11.2.0.3或之后的11g版本的Non-CDB迁移到Oracle 12C,那么在导出时需要将version参数设置为12.0.0.0.0或更高版本。如果Non-CDB的版本为11.2.0.3之前的版本,那么可以使用传输表空间来移动数据或者执行完全数据库导出\导入。

.使用goldengate复制
可以使用goldengate从Non-CDB中复制数据到PDB中。

对Non-CDB执行dbms_pdb包
可以使用dbms_pdb包来为Non-CDB生成XML元数据文件来将其附加到CDB中。使用dbms_pdb包移动Non-CDB为PDB的操作如下:
1.如果CDB不存在先创建CDB

2.确保Non-CDB处于事务一致状态并将它置于只读状态

[oracle@jytest1 ~]$ export ORACLE_SID=orcl1
[oracle@jytest1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Thu Sep 7 00:38:31 2017

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup mount
ORACLE instance started.

Total System Global Area 4294967296 bytes
Fixed Size                  8628936 bytes
Variable Size            2583692600 bytes
Database Buffers         1694498816 bytes
Redo Buffers                8146944 bytes
Database mounted.
SQL> alter database open read only;

Database altered.


[oracle@jytest2 ~]$ export ORACLE_SID=orcl2
[oracle@jytest2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Thu Sep 7 00:38:31 2017

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup mount
ORACLE instance started.

Total System Global Area 4294967296 bytes
Fixed Size                  8628936 bytes
Variable Size            2583692600 bytes
Database Buffers         1694498816 bytes
Redo Buffers                8146944 bytes
Database mounted.
SQL> alter database open read only;

Database altered.

3.连接到Non-CDB,并执行dbms_pdb.describe过程来创建描述Non-CDB的XML元数据文件。执行该过程的用户必须有sysdba权限。

SQL> exec dbms_pdb.describe(pdb_descr_file=>'/cdb_pdb/orcl.xml');

PL/SQL procedure successfully completed.


[oracle@jytest2 cdb_pdb]$ ls -lrt
total 8
-rw-r--r-- 1 oracle asmadmin 6963 Sep  7 00:18 orcl.xml

4.执行dbms_pdb.check_plug_compatibility过程来判断是否Non-CDB与目标CDB兼容。当执行这个过程时设置以下参数:
-pdb_descr_file:设置XML元数据文件的完整路径。
-pdb_name:指定新PDB名字,如果这个参数被忽略,那么将使用XML元数据文件中的PDB名字。

SQL> set serveroutput on
  1  declare
  2  compatible constant varchar2(3) :=
  3  case dbms_pdb.check_plug_compatibility(
  4  pdb_descr_file => '/cdb_pdb/orcl.xml',
  5  pdb_name => 'orclpdb')
  6  when true then 'yes'
  7  else 'no'
  8  end;
  9  begin
 10  dbms_output.put_line(compatible);
 11  end;
 12  /
yes

PL/SQL procedure successfully completed.

如果输出为yes,那么Non-CDB是兼容的,并且可以继续下一步操作。如果输出为no,那么Non-CDB与目标CDB不兼容,并且可以检查pdb_plug_in_violations视图来检查为什么不兼容。所有的违反条目在继续操作之前必须被修复。例如,任何版本或补丁不匹配可以通过执行升级或打补丁来解决。在修复这个违反条目后,再次执行dbms_pdb.check_plug_compatibility来确保Non-CDB与目标CDB兼容。

5.关闭Non-CDB

[grid@jytest1 ~]$ srvctl stop database -db orcl

6.插入Non-CDB

SQL> create pluggable database orclpdb using '/cdb_pdb/orcl.xml'
  2  copy
  3  file_name_convert = ('+DATA/orcl/datafile/', '+data/jy/orclpdb/','+DATA/orcl/tempfile/','+data/jy/orclpdb/');

Pluggable database created.


SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
PDB$SEED                                                                                                                         READ ONLY
JYPDB                                                                                                                            READ WRITE
ORCLPDB                                                                                                                          MOUNTED

ASMCMD [+data/jy/orclpdb] > ls -lt
Type      Redund  Striped  Time             Sys  Name
DATAFILE  UNPROT  COARSE   SEP 07 00:00:00  N    usertbs01.dbf => +DATA/jy/4D913A1436E25EE2E053AB828A0AF7B8/DATAFILE/USERTBS.278.954031319
DATAFILE  UNPROT  COARSE   SEP 07 00:00:00  N    users01.dbf => +DATA/jy/4D913A1436E25EE2E053AB828A0AF7B8/DATAFILE/USERS.302.954031321
DATAFILE  UNPROT  COARSE   SEP 07 00:00:00  N    undotbs01.dbf => +DATA/jy/4D913A1436E25EE2E053AB828A0AF7B8/DATAFILE/UNDOTBS1.273.954031321
TEMPFILE  UNPROT  COARSE   SEP 07 00:00:00  N    temp01.dbf => +DATA/jy/4D913A1436E25EE2E053AB828A0AF7B8/TEMPFILE/TEMPTS1.315.954031465
DATAFILE  UNPROT  COARSE   SEP 07 00:00:00  N    system01.dbf => +DATA/jy/4D913A1436E25EE2E053AB828A0AF7B8/DATAFILE/SYSTEM.303.954031321
DATAFILE  UNPROT  COARSE   SEP 07 00:00:00  N    sysaux01.dbf => +DATA/jy/4D913A1436E25EE2E053AB828A0AF7B8/DATAFILE/SYSAUX.295.954031321

如果这里没有任何错误,那么现在不打开新PDB。

7.执行$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql脚本,这个脚本必须在第一次打开新PDB之前执行。如果PDB不是由Non-CDB创建而来,那么就不需要执行这个脚本。为了执行noncdb_to_pdb.sql脚本,完成以下操作:
a.访问PDB,当前用户必须有sysdba权限,并且权限必须是公共或本地授予给PDB。最好使用as sysdba进行连接。

b.执行noncdb_to_pdb.sql脚本:

SQL>@$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql

8.以读写模式打开新PDB

SQL> alter pluggable database orclpdb open read write;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                             OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
PDB$SEED                                                                                                                         READ ONLY
JYPDB                                                                                                                            READ WRITE
ORCLPDB                                                                                                                          READ WRITE

9.备份PDB
到此使用Non-CDB来创建PDB的操作就完成了。

Oracle 12CR2 dbca -silent -createDatabase

在Oracle Linux 7.1,数据库为Oracle 12cr2中使用dbca静默方式创建数据库的语法如下:

[oracle@jytest1 ~]$ dbca -silent -createDatabase help
help
        -createDatabase - Command to Create a database.
                -responseFile | (-gdbName,-templateName)
                -responseFile - 
                -gdbName 
                -templateName 
                [-characterSet ]
                [-createAsContainerDatabase ]
                        [-numberOfPDBs ]
                        [-pdbAdminPassword ]
                        [-pdbName ]
                        [-pdbOptions ]
                        [-pdbStorageMAXSizeInMB ]
                        [-pdbStorageMAXTempSizeInMB ]
                        [-useLocalUndoForPDBs   Specify false to disable local undo tablespace for PDBs.]
                [-createListener ]
                [-customScripts ]
                [-databaseConfigType ]
                        [-RACOneNodeServiceName ]
                [-databaseType ]
                [-datafileDestination ]
                [-datafileJarLocation ]
                [-dbOptions ]
                [-dvConfiguration  Specify true to configure and enable database vault.]
                        -dvUserName 
                        -dvUserPassword 
                        [-dvAccountManagerName ]
                        [-dvAccountManagerPassword ]
                [-emConfiguration ]
                        [-dbsnmpPassword ]
                        [-emExpressPort ]
                        [-emPassword ]
                        [-emUser ]
                        [-omsHost ]
                        [-omsPort ]
                [-enableArchive  Specify true to enable archive>]
                        [-archiveLogDest ]
                        [-archiveLogMode ]
                [-initParams ]
                        [-initParamsEscapeChar ]
                [-listeners ]
                [-memoryMgmtType ]
                [-memoryPercentage | -totalMemory]
                [-memoryPercentage ]
                [-totalMemory ]
                [-nationalCharacterSet ]
                [-nodelist ]
                [-olsConfiguration  Specify true to configure and enable Oracle Label Security.]
                        [-configureWithOID This flag configures Oracle Label Security with OID.]
                [-oracleHomeUserName ]
                [-oracleHomeUserPassword ]
                [-policyManaged | -adminManaged]
                [-policyManaged ]
                        -serverPoolName 
                        [-createServerPool ]
                                [-cardinality ]
                                [-force ]
                                [-pqCardinality ]
                                [-pqPoolName ]
                        [-pqPoolName ]
                [-adminManaged ]
                [-recoveryAreaDestination ]
                        [-recoveryAreaSize ]
                [-redoLogFileSize ]
                [-registerWithDirService ]
                        -dirServiceUserName 
                        [-databaseCN ]
                        [-dirServicePassword ]
                        [-walletPassword ]
                [-runCVUChecks <specify "true" in order to run Cluster Verification Utility checks periodically for RAC databases.>]
                [-sampleSchema ]
                [-sid ]
                [-storageType < FS | ASM >]
                        -datafileDestination 
                        [-asmsnmpPassword ]
                [-sysPassword ]
                [-systemPassword ]
                [-useOMF  Specify true to use Oracle-Managed Files.]
                [-useWalletForDBCredentials  Specify true to load database credentials from wallet]
                        -dbCredentialsWalletLocation 
                        [-dbCredentialsWalletPassword ]
                [-variables ]
                [-variablesFile ]

使用dbca -silent方式来创建RAC数据库jycs,节点信息为jytest1,jytest2,磁盘组为test

[oracle@jytest1 ~]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbName jycs -sid jycs -createAsContainerDatabase true -numberOfPDBs 1 -pdbName jycspdb -sysPassword xxzx7817600 -systemPassword xxzx7817600 -datafileDestination 'test/' -redoLogFileSize 50 -recoveryAreaDestination 'test/' -storageType -responseFile NO_VALUE  -characterset ZHS16GBK -nationalCharacterSet AL16UTF16 -initParams log_archive_dest_1='location=+test/'  -sampleSchema true -automaticMemoryManagement false -totalMemory 1024 -databaseType MULTIPURPOSE -nodeinfo jytest1,jytest2
[FATAL] [DBT-06007] The specified location (FRA Location) is invalid.
   CAUSE: The specified location is not found on the system or is detected to be a file.

上面报错的原因是因为如果使用ASM磁盘组来存储数据文件时,指定磁盘组名称时,其格式为+diskgroup_name,而在11g中为diskgroup_name

修磁盘组格式后再次执行

[oracle@jytest1 ~]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbName jycs -sid jycs -createAsContainerDatabase true -numberOfPDBs 1 -pdbName jycspdb -sysPassword xxzx7817600 -systemPassword xxzx7817600 -datafileDestination '+test/' -redoLogFileSize 50 -recoveryAreaDestination '+test/' -storageType ASM    -characterset ZHS16GBK -nationalCharacterSet AL16UTF16 -initParams log_archive_dest_1='location=+test/'  -sampleSchema true -automaticMemoryManagement false -totalMemory 1024 -databaseType MULTIPURPOSE -nodeinfo jytest1,jytest2 
Enter PDBADMIN User Password: 

[WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards.
   CAUSE: 
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit 

[0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
   ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards.
   CAUSE: 
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit 

[0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
   ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'PDBADMIN' password entered does not conform to the Oracle recommended standards.
   CAUSE: 
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit 

[0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
   ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-09102] Target environment does not meet some optional requirements.
   CAUSE: Some of the optional prerequisites are not met. See logs for details. /u01/app/oracle/cfgtoollogs/dbca/trace.log_2017-04-26_09-55-10-AM
   ACTION: Find the appropriate configuration from the log file or from the installation guide to meet the prerequisites and fix this manually.
Copying database files
DBCA Operation failed.
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/jycs/jycs.log" for further details.

查看具体错误原因,说是检查磁盘组test是否注册到集群中

[root@jytest1 ~]# cat /u01/app/oracle/cfgtoollogs/dbca/jycs/jycs0.log
[ 2017-04-26 10:21:55.793 CST ] Copying database files
[ 2017-04-26 10:21:55.942 CST ] PRCR-1070 : Failed to check if resource ora.TEST/.dg is registered
CRS-5161 : The entity name contains invalid characters.

检查集群资源可以看到磁盘组test状态正常,两个节点都为online状态,而由于12c中的语法多了listeners参数,所以猜测是由于没有指定监听程序的原因

[grid@jytest1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.CRS.dg
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.DATA.dg
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.TEST.dg
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.chad
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.net1.network
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.ons
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.proxy_advm
               OFFLINE OFFLINE      jytest1                  STABLE
               OFFLINE OFFLINE      jytest2                  STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       jytest2                  STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       jytest1                  STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       jytest1                  STABLE
ora.MGMTLSNR
      1        ONLINE  ONLINE       jytest1                  169.254.123.145 88.8
                                                             8.88.1,STABLE
ora.asm
      1        ONLINE  ONLINE       jytest1                  Started,STABLE
      2        ONLINE  ONLINE       jytest2                  Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       jytest1                  STABLE
ora.jy.db
      1        ONLINE  ONLINE       jytest1                  Open,HOME=/u01/app/o
                                                             racle/product/12.2.0
                                                             /db,STABLE
      2        ONLINE  ONLINE       jytest2                  Open,HOME=/u01/app/o
                                                             racle/product/12.2.0
                                                             /db,STABLE
ora.jytest1.vip
      1        ONLINE  ONLINE       jytest1                  STABLE
ora.jytest2.vip
      1        ONLINE  ONLINE       jytest2                  STABLE
ora.mgmtdb
      1        ONLINE  ONLINE       jytest1                  Open,STABLE
ora.orcl.db
      1        ONLINE  ONLINE       jytest1                  Open,HOME=/u01/app/o
                                                             racle/product/12.2.0
                                                             /db/,STABLE
      2        ONLINE  ONLINE       jytest2                  Open,HOME=/u01/app/o
                                                             racle/product/12.2.0
                                                             /db/,STABLE
ora.qosmserver
      1        ONLINE  ONLINE       jytest1                  STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       jytest2                  STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       jytest1                  STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       jytest1                  STABLE
--------------------------------------------------------------------------------

增加listeners参数后再次执行

[oracle@jytest1 ~]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbName jycs -sid jycs -databaseConfigType RAC -createAsContainerDatabase true -numberOfPDBs 1 -pdbName jycspdb -sysPassword xxzx7817600 -systemPassword xxzx7817600  -redoLogFileSize 50   -storageType ASM -datafileDestination '+test/' -
asmsnmpPassword xxzx7817600   -characterset ZHS16GBK -nationalCharacterSet AL16UTF16 -initParams log_archive_dest_1='location=+TEST/',sga_target=1G,sga_max_size=1G  -sampleSchema true  -listeners ASMNET1LSNR_ASM,LISTENER,LISTENER_SCAN1 -automaticMemoryManagement false -totalMemory 2048 -databaseType MULTIPURPOSE -nodeinfo jytest1,jytest2 
Enter PDBADMIN User Password: 

[WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards.
   CAUSE: 
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit 

[0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
   ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards.
   CAUSE: 
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit 

[0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
   ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'PDBADMIN' password entered does not conform to the Oracle recommended standards.
   CAUSE: 
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit 

[0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
   ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-09102] Target environment does not meet some optional requirements.
   CAUSE: Some of the optional prerequisites are not met. See logs for details. /u01/app/oracle/cfgtoollogs/dbca/trace.log_2017-04-26_12-34-00-PM
   ACTION: Find the appropriate configuration from the log file or from the installation guide to meet the prerequisites and fix this manually.
Copying database files
1% complete
11% complete
21% complete
Creating and starting Oracle instance
23% complete
25% complete
26% complete
27% complete
30% complete
33% complete
34% complete
35% complete
Creating cluster database views
37% complete
50% complete
Completing Database Creation
51% complete
53% complete
55% complete
57% complete
Creating Pluggable Databases
61% complete
78% complete
Executing Post Configuration Actions
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/jycs/jycs3.log" for further details.

数据库创建成功,检查是否将数据库jycs注册到集群中,从下面的结果可以看到已经注册了

[grid@jytest1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.CRS.dg
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.DATA.dg
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.TEST.dg
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.chad
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.net1.network
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.ons
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.proxy_advm
               OFFLINE OFFLINE      jytest1                  STABLE
               OFFLINE OFFLINE      jytest2                  STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       jytest2                  STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       jytest1                  STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       jytest1                  STABLE
ora.MGMTLSNR
      1        ONLINE  ONLINE       jytest1                  169.254.123.145 88.8
                                                             8.88.1,STABLE
ora.asm
      1        ONLINE  ONLINE       jytest1                  Started,STABLE
      2        ONLINE  ONLINE       jytest2                  Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       jytest1                  STABLE
ora.jy.db
      1        ONLINE  ONLINE       jytest1                  Open,HOME=/u01/app/o
                                                             racle/product/12.2.0
                                                             /db,STABLE
      2        ONLINE  ONLINE       jytest2                  Open,HOME=/u01/app/o
                                                             racle/product/12.2.0
                                                             /db,STABLE
ora.jycs.db
      1        ONLINE  ONLINE       jytest1                  Open,HOME=/u01/app/o
                                                             racle/product/12.2.0
                                                             /db,STABLE
      2        ONLINE  ONLINE       jytest2                  Open,HOME=/u01/app/o
                                                             racle/product/12.2.0
                                                             /db,STABLE
ora.jytest1.vip
      1        ONLINE  ONLINE       jytest1                  STABLE
ora.jytest2.vip
      1        ONLINE  ONLINE       jytest2                  STABLE
ora.mgmtdb
      1        ONLINE  ONLINE       jytest1                  Open,STABLE
ora.orcl.db
      1        OFFLINE OFFLINE                               Instance Shutdown,ST
                                                             ABLE
      2        OFFLINE OFFLINE                               Instance Shutdown,ST
                                                             ABLE
ora.qosmserver
      1        ONLINE  ONLINE       jytest1                  STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       jytest2                  STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       jytest1                  STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       jytest1                  STABLE
--------------------------------------------------------------------------------

小结:
12c中使用dbca -silent方式来创建数据库之前的版本相比,增加了listeners参数,减少了指定ASM磁盘组的diskGroupName参数,并且指定磁盘组名称时需要指定+号,之前版本不需要指定+号。当然还增加了许多其它参数,有兴趣的可以测试一下。

Proudly powered by WordPress | Indrajeet by Sus Hill.