Oracle 11204 RAC for Centos6.8 靜默安裝(silent install)

目錄

1、準備工作

1.1、配置本地YUM源

1.2、安裝依賴包

1.3、關閉DNS 

1.4、配置主機名與HOSTS 

1.5、配置BOND網卡 

1.6、關閉防火牆與selinux與NTP

1.7、準備其它條件 

1.8、創建用戶組 

1.9、創建軟件安裝目錄和數據庫目錄

1.10、配置環境變量 

 1.11、配置共享磁盤

1.13、安裝cvuqdisk

1.14、配置互信 

2、安裝集羣軟件 

2.1、檢查文件

2.2、準備響應文件

 2.3、安裝集羣軟件

2.4、執行root腳本

3、安裝數據庫軟件

3.1、準備響應文件

3.2、安裝數據庫軟件

3.3、執行root腳本

4、創建ASM磁盤組

5、創建數據庫

5.1準備響應文件

5.2、創建數據庫

5.3、刪除數據庫



1、準備工作

1.1、配置本地YUM源

mount -t auto /dev/cdrom  /mnt

rm -rf /etc/yum.repos.d/

mkdir -p /etc/yum.repos.d/


cat >> /etc/yum.repos.d/CentOS-Media.repo<<EOF
# CentOS-Media.repo
#
#  This repo can be used with mounted DVD media, verify the mount point for
#  CentOS-7.  You can use this repo and yum to install items directly off the
#  DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
#  yum --enablerepo=c7-media [command]
#  
# or for ONLY the media repo, do this:
#
#  yum --disablerepo=\* --enablerepo=c7-media [command]

[c7-media]
name=CentOS-$releasever - Media
baseurl=file:///mnt/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
EOF


yum clean all
yum makecache

1.2、安裝依賴包

yum -y install compat-libcap1 binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-devel glibc-common glibc-headers ksh libaio libaio-devel libgcc libstdc++ make sysstat unixODBC unixODBC-devel unzip

1.3、關閉DNS 

cat>/etc/resolv.conf<<EOF
# Generated by NetworkManager
domain localdomain
search localdomain
#nameserver 
EOF

1.4、配置主機名與HOSTS 

cat>/etc/sysconfig/network<<EOF
NETWORKING=yes
HOSTNAME=rac1
EOF

cat>>/etc/hosts<<EOF
# rac1
192.168.33.10  rac1
192.168.33.11  rac1-vip
19.21.68.10 rac1-priv
# rac2
192.168.33.12  rac2
192.168.33.13  rac2-vip
19.21.68.11 rac2-priv
# scan-ip
192.168.33.14 scan-vip
EOF

1.5、配置BOND網卡 


#!/bin/bash
service NetworkManager stop
chkconfig NetworkManager off

cat >/etc/sysconfig/network-scripts/ifcfg-bond0<<EOF1
BOOTPROTO=static
DEVICE=bond0
IPADDR=192.168.33.10
PREFIX=255.255.255.0
GATEWAY=192.168.33.1
USERCTL=no
ONBOOT=yes
EOF1
cat >/etc/sysconfig/network-scripts/ifcfg-eth0<<EOF2
DEVICE=eth0
PREFIX=24
BOOTPROTO=static
MASTER=bond0
SLAVE=yes
ONBOOT=yes
EOF2
cat >/etc/sysconfig/network-scripts/ifcfg-eth2<<EOF3
DEVICE=eth2
PREFIX=24
BOOTPROTO=static
MASTER=bond0
SLAVE=yes
ONBOOT=yes
EOF3




cat >/etc/sysconfig/network-scripts/ifcfg-bond1<<EOF1
BOOTPROTO=static
DEVICE=bond1
IPADDR=19.21.68.10
PREFIX=255.255.255.0
USERCTL=no
ONBOOT=yes
EOF1
cat >/etc/sysconfig/network-scripts/ifcfg-eth1<<EOF2
DEVICE=eth1
PREFIX=24
BOOTPROTO=static
MASTER=bond1
SLAVE=yes
ONBOOT=yes
EOF2
cat >/etc/sysconfig/network-scripts/ifcfg-eth3<<EOF3
DEVICE=eth3
PREFIX=24
BOOTPROTO=static
MASTER=bond1
SLAVE=yes
ONBOOT=yes
EOF3

#配置bond模式1主備方式
cat >/etc/modprobe.d/bonding.conf<<EOF4
alias bond0 bonding
alias bond1 bonding
options bond0 miimon=100 mode=1 primary=eth0
options bond1 miimon=100 mode=1 primary=eth1
EOF4
echo "ifenslave bond0 eth0 eth2">>/etc/rc.d/rc.local
echo "ifenslave bond1 eth1 eth2">>/etc/rc.d/rc.local

echo "/etc/init.d/network restart">>/etc/rc.d/rc.local
chmod 550 /etc/rc.d/rc.local
chmod 550 /etc/rc.local


reboot

 cat /proc/net/bonding/bond0
 cat /proc/net/bonding/bond1

 

1.6、關閉防火牆與selinux與NTP

service iptables stop
chkconfig iptables off

sed -i 's/=enforcing/=disabled/g' /etc/selinux/config
setenforce 0
getenforce

#關閉ntp
mv /etc/ntp.conf /etc/ntp.conf.bak

 

1.7、準備其它條件 

cat >> /etc/sysctl.conf <<EOF
fs.file-max = 6815744  
kernel.sem = 250 32000 100 128  
kernel.shmmni = 4096  
kernel.shmall = 1073741824  
kernel.shmmax = 6597069766656
kernel.panic_on_oops = 1  
net.core.rmem_default = 262144  
net.core.rmem_max = 4194304  
net.core.wmem_default = 262144  
net.core.wmem_max = 1048576  
#net.ipv4.conf.eth3.rp_filter = 2       
#net.ipv4.conf.eth2.rp_filter = 2
#net.ipv4.conf.eth0.rp_filter = 1  
fs.aio-max-nr = 1048576  
net.ipv4.ip_local_port_range = 9000 65500 
EOF

cat >> /etc/security/limits.conf <<EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 65536
oracle hard nofile 65536

grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 65536
grid hard nofile 65536
EOF

cat >> /etc/pam.d/login <<EOF
session required /lib/security/pam_limits.so
EOF

cat >> /etc/profile <<EOF
if [ \$USER = "oracle" ] || [ \$USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
EOF

cat >> /etc/csh.login <<EOF
if ( \$USER == "oracle" ) then
 limit maxproc 16384
 limit descriptors 65536
 umask 022
endif
EOF

1.8、創建用戶組 

groupadd -g 1001 oinstall
groupadd -g 1002 dba
groupadd -g 1003 asmadmin
groupadd -g 1004 asmdba
groupadd -g 1005 asmoper
groupadd -g 1006 oper

useradd -u 1001 -g oinstall -G dba,asmadmin,asmdba,asmoper,oper grid
useradd -u 1002 -g oinstall -G dba,asmdba,oper oracle

id oracle
a=1
echo oracle:$a|chpasswd

id grid
a=1
echo grid:$a|chpasswd

1.9、創建軟件安裝目錄和數據庫目錄

mkdir -p /u01/app/grid/
mkdir -p /u01/app/11.2.0/grid
mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1
chown -R grid:oinstall /u01
chown -R oracle:oinstall /u01/app/oracle/
chmod -R 775 /u01

1.10、配置環境變量 

 

cat >>/home/grid/.bash_profile<<EOF
export PATH
export ORACLE_BASE=/u01/app/grid
export ORACLE_SID=+ASM1
export ORACLE_HOME=/u01/app/11.2.0/grid
export PATH=\$ORACLE_HOME/bin:\$PATH
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:\$LD_LIBRARY_PATH
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
EOF



cat >>/home/oracle/.bash_profile<<EOF
export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=orcl1
export ORACLE_HOME=\$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=\$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:\$LD_LIBRARY_PATH
EOF
su - oracle
mkdir -p $ORACLE_HOME
exit
su - grid
mkdir -p $ORACLE_HOME
exit

 1.11、配置共享磁盤

[root@rac1 Packages]# scsi_id -g -u /dev/sdb
330000000019fc1e0
[root@rac1 Packages]# scsi_id -g -u /dev/sdc
330000000eeafaaf9


cat>/etc/multipath.conf<<EOF
multipaths {
        multipath {
                wwid 330000000eeafaaf9
                alias crs1
        }
        multipath {
                wwid 330000000019fc1e0
                alias data1
         }
}
EOF

multipath -ll


[root@rac1 mapper]# dmsetup ls |grep crs
crs1    (253:4)
[root@rac1 mapper]# dmsetup ls |grep data
data1   (253:3)


cat>/etc/udev/rules.d/12-dm-permissions.rules<<EOF
ENV{DM_NAME}=="crs1", OWNER:="grid", GROUP:="asmadmin", MODE:="660"
ENV{DM_NAME}=="data1", OWNER:="grid", GROUP:="asmadmin", MODE:="660"
EOF

start_udev




1.13、安裝cvuqdisk

[root@rac1 rpm]# rpm -ivh /u01/grid/rpm/cvuqdisk-1.0.9-1.rpm 
Preparing...                ########################################### [100%]
Using default group oinstall to install package
   1:cvuqdisk               ########################################### [100%]

1.14、配置互信 

grid:
cd /home/grid
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa




ssh-keygen -t dsa
 
 
 
cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys
ssh rac1 date;ssh rac2 date;ssh rac1-priv date;ssh rac2-priv date
 

 
 
 
oracle:
cd /home/oracle
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa

ssh-keygen -t dsa
 
 
 
cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys
ssh rac1 date;ssh rac2 date;ssh rac1-priv date;ssh rac2-priv date
 

 
 

2、安裝集羣軟件 

2.1、檢查文件

./runcluvfy.sh stage -pre crsinst -n rac1,rac2 -verbose >/home/grid/grid_check.log


cat /home/grid/grid_check.log 

/etc/resolv.conf 報錯可以忽略

2.2、準備響應文件

cat>/home/grid/grid_install.rsp<<EOF
oracle.install.responseFileVersion=/home/grid/rspfmt_crsinstall_response_schema_v11_2_0
ORACLE_HOSTNAME=rac1
INVENTORY_LOCATION=/u01/app/oraInventory
SELECTED_LANGUAGES=en,zh_CN
oracle.install.option=CRS_CONFIG
ORACLE_BASE=/u01/app/grid
ORACLE_HOME=/u01/app/11.2.0/grid
oracle.install.asm.OSDBA=asmdba
oracle.install.asm.OSOPER=asmoper
oracle.install.asm.OSASM=asmadmin
oracle.install.crs.config.gpnp.scanName=scan-vip
oracle.install.crs.config.gpnp.scanPort=1521
oracle.install.crs.config.clusterName=cluster
oracle.install.crs.config.gpnp.configureGNS=false
oracle.install.crs.config.gpnp.gnsSubDomain=
oracle.install.crs.config.gpnp.gnsVIPAddress=
oracle.install.crs.config.autoConfigureClusterNodeVIP=false
oracle.install.crs.config.clusterNodes=rac1:rac1-vip,rac2:rac2-vip
oracle.install.crs.config.networkInterfaceList=bond0:192.168.33.0:1,bond1:19.21.68.0:2
oracle.install.crs.config.storageOption=ASM_STORAGE
oracle.install.crs.config.sharedFileSystemStorage.diskDriveMapping=
oracle.install.crs.config.sharedFileSystemStorage.votingDiskLocations=
oracle.install.crs.config.sharedFileSystemStorage.votingDiskRedundancy=EXTERNAL
oracle.install.crs.config.sharedFileSystemStorage.ocrLocations=
oracle.install.crs.config.sharedFileSystemStorage.ocrRedundancy=EXTERNAL
oracle.install.crs.config.useIPMI=false
oracle.install.crs.config.ipmi.bmcUsername=
oracle.install.crs.config.ipmi.bmcPassword=
oracle.install.asm.SYSASMPassword=Oracle123
oracle.install.asm.diskGroup.name=OCRDG
oracle.install.asm.diskGroup.redundancy=EXTERNAL
oracle.install.asm.diskGroup.AUSize=1
oracle.install.asm.diskGroup.disks=/dev/mapper/crs1
oracle.install.asm.diskGroup.diskDiscoveryString=/dev/mapper/*
oracle.install.asm.monitorPassword=Oracle123
oracle.install.crs.upgrade.clusterNodes=
oracle.installer.autoupdates.option=SKIP_UPDATES
oracle.installer.autoupdates.downloadUpdatesLoc=
AUTOUPDATES_MYORACLESUPPORT_USERNAME=
AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
PROXY_HOST=
PROXY_PORT=0
PROXY_USER=
PROXY_PWD=
PROXY_REALM=
EOF

 2.3、安裝集羣軟件

./runInstaller -ignorePrereq -silent -force -responseFile /home/grid/grid_install.rsp -showProgress
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 39313 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 4239 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2020-04-13_09-32-16PM. Please wait ...
 You can find the log of this install session at:
 /u01/app/oraInventory/logs/installActions2020-04-13_09-32-16PM.log

Prepare in progress.
..................................................   9% Done.

Prepare successful.

Copy files in progress.
..................................................   15% Done.
..................................................   20% Done.
..................................................   25% Done.
..................................................   30% Done.
..................................................   35% Done.
..................................................   40% Done.
..................................................   45% Done.
........................................
Copy files successful.

Link binaries in progress.

Link binaries successful.
..................................................   62% Done.

Setup files in progress.

Setup files successful.
..................................................   76% Done.

Perform remote operations in progress.
..................................................   89% Done.

Perform remote operations successful.
The installation of Oracle Grid Infrastructure 11g was successful.
Please check '/u01/app/oraInventory/logs/silentInstall2020-04-13_09-32-16PM.log' for more details.
..................................................   94% Done.

Execute Root Scripts in progress.

As a root user, execute the following script(s):
        1. /u01/app/oraInventory/orainstRoot.sh
        2. /u01/app/11.2.0/grid/root.sh

Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes: 
[rac1, rac2]
Execute /u01/app/11.2.0/grid/root.sh on the following nodes: 
[rac1, rac2]

..................................................   100% Done.

Execute Root Scripts successful.
As install user, execute the following script to complete the configuration.
        1. /u01/app/11.2.0/grid/cfgtoollogs/configToolAllCommands RESPONSE_FILE=<response_file>

        Note:
        1. This script must be run on the same host from where installer was run. 
        2. This script needs a small password properties file for configuration assistants that require passwords (refer to install guide documentation).


Successfully Setup Software.

2.4、執行root腳本

As a root user, execute the following script(s):
        1. /u01/app/oraInventory/orainstRoot.sh
        2. /u01/app/11.2.0/grid/root.sh

Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes: 
[rac1, rac2]
Execute /u01/app/11.2.0/grid/root.sh on the following nodes: 
[rac1, rac2]

完成配置
/u01/app/11.2.0/grid/cfgtoollogs/configToolAllCommands 

[grid@rac1 grid]$ /u01/app/11.2.0/grid/cfgtoollogs/configToolAllCommands RESPONSE_FILE=/u01/soft/grid/grid_install.rsp
Setting the invPtrLoc to /u01/app/11.2.0/grid/oraInst.loc

perform - mode is starting for action: configure


perform - mode finished for action: configure

You can see the log file: /u01/app/11.2.0/grid/cfgtoollogs/oui/configActions2020-04-13_09-55-52-PM.log
[grid@rac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.OCRDG.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.asm
               ONLINE  ONLINE       rac1                     Started             
               ONLINE  ONLINE       rac2                     Started             
ora.gsd
               OFFLINE OFFLINE      rac1                                         
               OFFLINE OFFLINE      rac2                                         
ora.net1.network
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.ons
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac1                                         
ora.cvu
      1        ONLINE  ONLINE       rac1                                         
ora.oc4j
      1        ONLINE  ONLINE       rac1                                         
ora.rac1.vip
      1        ONLINE  ONLINE       rac1                                         
ora.rac2.vip
      1        ONLINE  ONLINE       rac2                                         
ora.scan1.vip
      1        ONLINE  ONLINE       rac1      

3、安裝數據庫軟件

3.1、準備響應文件

cat>/home/oracle/db_install.rsp<<EOF
oracle.install.responseFileVersion=/home/oracle/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=rac1
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.EEOptionsSelection=false
oracle.install.db.optionalComponents=
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oper
oracle.install.db.CLUSTER_NODES=rac1,rac2
oracle.install.db.isRACOneInstall=false
oracle.install.db.racOneServiceName=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl1
oracle.install.db.config.starterdb.characterSet=AL32UTF8 
oracle.install.db.config.starterdb.memoryOption=false
oracle.install.db.config.starterdb.memoryLimit=
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=false
oracle.install.db.config.starterdb.password.ALL=Oracle123
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=Oracle123
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
PROXY_REALM=
COLLECTOR_SUPPORTHUB_URL=
oracle.installer.autoupdates.option=SKIP_UPDATES
AUTOUPDATES_MYORACLESUPPORT_USERNAME=
AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
EOF

3.2、安裝數據庫軟件

./runInstaller -ignorePrereq -silent -force -responseFile /home/oracle/db_install.rsp  -showProgress

[oracle@rac1 database]$ ./runInstaller -ignorePrereq -silent -force -responseFile /home/oracle/db_install.rsp  -showProgress
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 32835 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 4238 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2020-04-13_09-58-20PM. Please wait ...[oracle@rac1 database]$ [WARNING] [INS-35342] The specified group for Database Operator (OSOPER) may not be defined in the system.
   CAUSE: The OS group you specified as the OSOPER group may not be configured on the server, or in the Network Information Service (NIS).
   ACTION: Check the group name you selected, and specify a different group, or create the group on the server or in the Network Information Service.
You can find the log of this install session at:
 /u01/app/oraInventory/logs/installActions2020-04-13_09-58-20PM.log

Prepare in progress.
..................................................   9% Done.

Prepare successful.

Copy files in progress.
..................................................   14% Done.
..................................................   19% Done.
..................................................   25% Done.
..................................................   30% Done.
..................................................   36% Done.
..................................................   41% Done.
..................................................   46% Done.
..................................................   51% Done.
..................................................   56% Done.

Copy files successful.
..........
Link binaries in progress.

Link binaries successful.
..................................................   77% Done.

Setup files in progress.
..................................................   94% Done.

Setup files successful.
The installation of Oracle Database 11g was successful.
Please check '/u01/app/oraInventory/logs/silentInstall2020-04-13_09-58-20PM.log' for more details.

Execute Root Scripts in progress.

As a root user, execute the following script(s):
        1. /u01/app/oracle/product/11.2.0/dbhome_1/root.sh

Execute /u01/app/oracle/product/11.2.0/dbhome_1/root.sh on the following nodes: 
[rac1, rac2]

..................................................   100% Done.

Execute Root Scripts successful.
Successfully Setup Software.

3.3、執行root腳本

Execute /u01/app/oracle/product/11.2.0/dbhome_1/root.sh on the following nodes: 
[rac1, rac2]

4、創建ASM磁盤組

CREATE DISKGROUP DATADG external REDUNDANCY disk '/dev/mapper/data1' ATTRIBUTE 'au_size'='1M', 'compatible.asm' = '11.2';


[grid@rac1 mapper]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.4.0 Production on Mon Apr 13 21:59:55 2020

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> CREATE DISKGROUP DATADG external REDUNDANCY disk '/dev/mapper/data1' ATTRIBUTE 'au_size'='1M', 'compatible.asm' = '11.2';

Diskgroup created.



[grid@rac2 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.4.0 Production on Mon Apr 13 22:03:01 2020

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> alter diskgroup datadg mount;

Diskgroup altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
[grid@rac2 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATADG.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.OCRDG.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.asm
               ONLINE  ONLINE       rac1                     Started             
               ONLINE  ONLINE       rac2                     Started             
ora.gsd
               OFFLINE OFFLINE      rac1                                         
               OFFLINE OFFLINE      rac2                                         
ora.net1.network
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.ons
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac1                                         
ora.cvu
      1        ONLINE  ONLINE       rac1                                         
ora.oc4j
      1        ONLINE  ONLINE       rac1                                         
ora.rac1.vip
      1        ONLINE  ONLINE       rac1                                         
ora.rac2.vip
      1        ONLINE  ONLINE       rac2                                         
ora.scan1.vip
      1        ONLINE  ONLINE       rac1                                         
[grid@rac2 ~]$ 

5、創建數據庫

5.1準備響應文件

cat >/home/oracle/rac_dbca.rsp<<EOF
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "orcl"
DB_UNIQUE_NAME = "orcl"
SID = "orcl"  
NODELIST=rac1,rac2
TEMPLATENAME = "General_Purpose.dbc"
SYSPASSWORD = "Oracle123"
SYSTEMPASSWORD = "Oracle123"
DATAFILEDESTINATION = "+datadg"
RECOVERYAREADESTINATION= "+datadg"
STORAGETYPE=ASM
DISKGROUPNAME=DATADG
CHARACTERSET = "ZHS16GBK"
NATIONALCHARACTERSET= "UTF8"
DB_BLOCK_SIZE=8192
TOTALMEMORY = "1024" 
EOF

5.2、創建數據庫

dbca -silent -responseFile /home/oracle/rac_dbca.rsp

[oracle@rac1 orcl]$ dbca -silent -responseFile /home/oracle/rac_dbca.rsp
Cleaning up failed steps
4% complete
Copying database files
5% complete
6% complete
7% complete
13% complete
19% complete
24% complete
30% complete
33% complete
Creating and starting Oracle instance
35% complete
39% complete
43% complete
46% complete
47% complete
48% complete
50% complete
52% complete
Creating cluster database views
54% complete
71% complete
Completing Database Creation
74% complete
77% complete
85% complete
94% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl0.log" for further details.

5.3、刪除數據庫

[oracle@rac1 orcl]$ dbca -silent -deleteDatabase -sourceDB orcl
Connecting to database
9% complete
14% complete
19% complete
23% complete
28% complete
33% complete
38% complete
47% complete
Updating network configuration files
48% complete
52% complete
Deleting instances and datafiles
66% complete
80% complete
95% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl.log" for further details.

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章