在青雲上部署oracle rac全過程

datapeng發表於2018-04-09
一 準備

1.1 伺服器基本資訊

節點

Cpu

記憶體

OS

db01

8cores

16G

Oracle Linux Server release 6.6 (x86_64)

db02

8cores

16G

Oracle Linux Server release 6.6 (x86_64)

 

[root@db02 software]# cat /etc/issue

Oracle Linux Server release 6.6

Kernel \r on an \m

[root@db02 software]# uname -a

Linux db02 3.8.13-55.1.2.el6uek.x86_64 #2 SMP Thu Dec 18 00:15:51 PST 2014 x86_64 x86_64 x86_64 GNU/Linux

1.2 軟體資訊

Db11.2.0.4 p13390677_112040_Linux-x86-64_1of7.zip

p13390677_112040_Linux-x86-64_2of7.zip

grid       p13390677_112040_Linux-x86-64_3of7.zip 

安裝介質存放在/u01/software

p13390677_112040_Linux-x86-64_1of7.zipp13390677_112040_Linux-x86-64_2of7.zip解壓生成datebase目錄;

p13390677_112040_Linux-x86-64_3of7.zip 解壓生成grid目錄

1.3 本地盤配置

500GB的本地盤建立檔案系統掛載到/u01目錄下面,並修改/etc/fstab,讓開機自動掛載/u01檔案系統。

[root@db01 ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/vda1        20G  3.0G   16G  16% /

tmpfs           8.0G  132M  7.9G   2% /dev/shm

/dev/vdc1       493G   23G  445G   5% /u01

二 基礎配置

基礎配置需要在兩個節點都要操作的。

2.1 網路配置

節點

Hostname

Type  

IP Address

Interface

Resolved by

db01

db01

Public IP

192.168.0.2

eth1

HOST FILE

 

db01-vip

Virtual IP

192.168.0.102

 

HOST FILE

 

db01-priv

Private IP

192.168.101.2

eth0

HOST FILE

db02

db02

Public IP

192.168.0.3

eth1

HOST FILE

 

db02-vip

Virtual IP

192.168.0.103

 

HOST FILE

 

db02-priv

Private IP

192.168.101.3

eth0

HOST FILE

 

db-scan

SCAN IP

192.168.0.100

 

HOST FILE

2.1.1 Host檔案

#Public

192.168.0.2 db01

192.168.0.3 db02

#Virtual

192.168.0.102  db01-vip

192.168.0.103  db02-vip

#Private

192.168.101.2  db01-priv

192.168.101.3  db02-priv

#SCAN

192.168.0.100  db-scan

2.1.2 網路配置檔案

節點1

[root@db01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

HWADDR=52:54:46:A6:94:40

TYPE=Ethernet

BOOTPROTO=none

IPADDR=192.168.101.2

PREFIX=24

DEFROUTE=yes

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

NAME=eth0

UUID=d790a693-882a-4b5e-bc9f-44ac2706c5b7

ONBOOT=yes

[root@db01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

TYPE=Ethernet

IPADDR=192.168.0.2

NETMASK=255.255.255.0

GATEWAY=192.168.0.1

DEFROUTE=yes

NAME=eth1

ONBOOT=yes

HWADDR=52:54:a1:2a:34:3f

[root@db01 ~]#

節點2

[root@db02 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

HWADDR=52:54:72:2C:50:63

TYPE=Ethernet

BOOTPROTO=none

IPADDR=192.168.101.3

PREFIX=24

DEFROUTE=yes

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

NAME=eth0

UUID=5c37a16a-e9ac-4cf6-a244-c4d0faa592db

ONBOOT=yes

DEVICE=eth0

[root@db02 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

HWADDR=52:54:b0:c6:97:26

TYPE=Ethernet

IPADDR=192.168.0.3

NETMASK=255.255.255.0

GATEWAY=192.168.0.1

DEFROUTE=yes

NAME=eth1

ONBOOT=yes

兩個節點都要操作:

關閉networkmanager

[root@i-zq8ytr3k network-scripts]# chkconfig NetworkManager --list

NetworkManager  0:off   1:off   2:on    3:on    4:on    5:on    6:off

[root@i-zq8ytr3k network-scripts]# chkconfig NetworkManager off

[root@i-zq8ytr3k network-scripts]# chkconfig NetworkManager --list

NetworkManager  0:off   1:off   2:off   3:off   4:off   5:off   6:off

重啟網路:

service network restart

關閉防火牆

service iptables stop

chkconfig iptables off

關閉selinux

修改:/etc/selinux/config 內容改為:SELINUX=disabled

setenforce  0

2.2 建立使用者

兩個節點都要操作:

groupadd -g 500 dba

 groupadd -g 501 oinstall

 groupadd -g 502 asmadmin

 useradd -g oinstall -u 500 oracle

 useradd -g oinstall -u 501 grid

 usermod -G dba  oracle

 usermod -G dba  grid

 usermod -aG asmadmin  grid

[root@db02 software]# id oracle

uid=500(oracle) gid=501(oinstall) =501(oinstall),500(dba)

[root@db02 software]# id grid

uid=501(grid) gid=501(oinstall) =501(oinstall),500(dba),502(asmadmin)

[root@db01 ~]# id oracle

uid=500(oracle) gid=501(oinstall) groups=501(oinstall),500(dba)

[root@db01 ~]# id grid

uid=501(grid) gid=501(oinstall) groups=501(oinstall),500(dba),502(asmadmin)

[root@db01 ~]#

2.2.1 設定profile

後續要將oracle的環境變數ORACLE_SID分別改為oadb1 oadb2

節點1

Oracle使用者

[oracle@db01 ~]$ cat .bash_profile

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi

# User specific environment and startup programs

 

PATH=$PATH:$HOME/bin

export PATH

TMP=/tmp; export TMP   

TMPDIR=$TMP; export TMPDIR

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE   

ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME   

ORACLE_SID=db1; export ORACLE_SID   

ORACLE_TERM=xterm; export ORACLE_TERM

PATH=/usr/sbin:$PATH; export PATH

PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

grid使用者:

[grid@db01 ~]$ cat .bash_profile

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

TMP=/tmp; export TMP   

TMPDIR=$TMP; export TMPDIR

ORACLE_SID=+ASM1; export ORACLE_SID   

ORACLE_BASE=/u01/app/grid; export ORACLE_BASE

ORACLE_HOME=/u01/app/11.2.0/grid/product/db_1; export ORACLE_HOME

NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT

THREADS_FLAG=native; export THREADS_FLAG

PATH=$ORACLE_HOME/bin:$PATH; export PATHTHREADS_FLAG=native; export THREADS_FLAG

PATH=$ORACLE_HOME/bin:$PATH; export PATH

節點2

Oracle使用者:

[oracle@db02 ~]$ cat .bash_profile

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

 

export PATH

TMP=/tmp; export TMP   

TMPDIR=$TMP; export TMPDIR

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE   

ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME   

ORACLE_SID=db2; export ORACLE_SID   

ORACLE_TERM=xterm; export ORACLE_TERM

PATH=/usr/sbin:$PATH; export PATH

PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

Grid使用者:

[grid@db02 ~]$ cat .bash_profile

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

TMP=/tmp; export TMP   

TMPDIR=$TMP; export TMPDIR

ORACLE_SID=+ASM2; export ORACLE_SID   

ORACLE_BASE=/u01/app/grid; export ORACLE_BASE

ORACLE_HOME=/u01/app/11.2.0/grid/product/db_1; export ORACLE_HOME

NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT

THREADS_FLAG=native; export THREADS_FLAG

PATH=$ORACLE_HOME/bin:$PATH; export PATHTHREADS_FLAG=native; export THREADS_FLAG

PATH=$ORACLE_HOME/bin:$PATH; export PATH

2.3 配置路徑

兩臺伺服器都要配置:

mkdir -p /u01/app

 chown -R root:oinstall  /u01/app

 mkdir  -p  /u01/app/11.2.0/ 

 mkdir  -p  /u01/app/grid/ 

 mkdir  -p  /u01/app/oracle/

 chown  -R  grid:oinstall /u01/app/11.2.0

 chown  -R  grid:oinstall /u01/app/grid

 chown  -R  oracle:oinstall /u01/app/oracle

2.4 安裝rpm

配置本地映象

iso檔案掛載

mount -t iso9660 -o loop /u01/software/V52218-01-OEL-6.6.iso /u01/software/mnt

重新命名之前的檔案

Mv /etc/yum.repos.d/public-yum-ol6.repo  /etc/yum.repos.d/public-yum-ol6.repo_bak

[root@db02 ~]# cat /etc/yum.repos.d/public-yum-ol6.repo

[Server]

name=Oracle Linux $releasever Beta - $basearch - Server

baseurl=file:///u01/software/mnt

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle

安裝rpm

yum install gcc compat-libstdc++-33 elfutils-libelf-devel gcc-c++ libaio-devel libstdc++-devel ksh  -y

後續根據實際情況也許需要安裝一些新的包,都可以在/u01/software/mnt/Packages中找到

2.5 sysctl.conf檔案

修改/etc/sysctl.conf

新加

##add by oracle

kernel.shmmax = 4294967295

kernel.shmall = 2097152

kernel.shmmni = 4096

kernel.sem = 1100 32000 100 128

fs.file-max = 6815744

net.ipv4.ip_local_port_range = 9000 65000

net.core.rmem_default = 1048576

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576

vm.min_free_kbytes= 1048576

fs.aio-max-nr= 1048576

設定生效:

/sbin/sysctl -p

2.6 limit檔案

/etc/security/limits.conf 新增:

#add by oracle

oracle  hard nofile 65536

oracle   soft nofile 4096

oracle   hard nproc 16384

oracle   soft nproc 2047

grid hard nofile 65536

grid soft nofile 1024

grid hard nproc 16384

grid soft nproc 2047

2.7共享盤安裝

在雲平臺上分配共享儲存之後,最好在介面上設定可以訪問共享儲存的客戶端,本次設定的是:iqn.2014-12.com.qingcloud:e594a0ee9b82

iqn.2014-12.com.qingcloud:5ba958139a1

1 安裝工具包

yum install -y iscsi-initiator-utils

2 根據字首生成客戶端id

iscsi-iname -p iqn.2014-12.com.qingcloud

結果:

[root@db02 ~]# iscsi-iname -p iqn.2014-12.com.qingcloud

iqn.2014-12.com.qingcloud:e594a0ee9b82

[root@db01 ~]# iscsi-iname -p iqn.2014-12.com.qingcloud

iqn.2014-12.com.qingcloud:5ba958139a1

3 修改配置檔案

/etc/iscsi/initiatorname.iscsi  修改為下面的資訊(名稱是介面上看到的)

節點1:

[root@db01 ~]# cat /etc/iscsi/initiatorname.iscsi

InitiatorName=iqn.2014-12.com.qingcloud:5ba958139a1

節點2

[root@db02 ~]# cat /etc/iscsi/initiatorname.iscsi

InitiatorName=iqn.2014-12.com.qingcloud:e594a0ee9b82

4 客戶端發現(兩個伺服器都要配置)

[root@db01 iscsi]# iscsiadm -m discovery -t st -p  192.168.0.8

Starting iscsid:                                           [  OK  ]

192.168.0.8:3260,1 iqn.2014-12.com.qingcloud.s2:sn.data

[root@i-zq8ytr3k iscsi]# iscsiadm -m node

192.168.0.8:3260,1 iqn.2014-12.com.qingcloud.s2:sn.data

5 註冊(兩個伺服器都要配置)

[root@db01 iscsi]# iscsiadm -m node -T  iqn.2014-12.com.qingcloud.s2:sn.data  -p  192.168.0.8 --login

Logging in to [iface: default, target: iqn.2014-12.com.qingcloud.s2:sn.data, portal: 192.168.0.8,3260] (multiple)

Login to [iface: default, target: iqn.2014-12.com.qingcloud.s2:sn.data, portal: 192.168.0.8,3260] successful.

6 檢視結果

[root@db02 ~]# lsblk

NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

sda      8:0    0   10G  0 disk

sdb      8:16   0  500G  0 disk

sdc      8:32   0   10G  0 disk

sdd      8:48   0   10G  0 disk

vda    251:0    0   20G  0 disk

`-vda1 251:1    0   20G  0 part /

vdb    251:16   0   16G  0 disk [SWAP]

vdc    251:32   0  500G  0 disk

`-vdc1 251:33   0  500G  0 part /u01

[root@db01 ~]# lsblk

NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

sda      8:0    0   10G  0 disk

sdb      8:16   0  500G  0 disk

sdc      8:32   0   10G  0 disk

sdd      8:48   0   10G  0 disk

vda    251:0    0   20G  0 disk

`-vda1 251:1    0   20G  0 part /

vdb    251:16   0   16G  0 disk [SWAP]

vdc    251:32   0  500G  0 disk

`-vdc1 251:33   0  500G  0 part /u01

7 配置開啟自動啟動識別

iscsiadm -m node -T  iqn.2014-12.com.qingcloud.s2:sn.data  -p  192.168.0.8 --op update -n node.startup -v automatic

8 配置asm能識別的盤

echo "options=--whitelisted --replace-whitespace">/etc/scsi_id.config

rm -f /etc/udev/rules.d/99-oracle-asmdevices.rules

i=1

id=''

for x in a b c d

  do

    id=`scsi_id --whitelisted --replace-whitespace --device=/dev/sd$x`

    echo "KERNEL==\"sd*\", SUBSYSTEM==\"block\", PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\", RESULT==\"$id\", NAME=\"asm-disk$i\",  OWNER=\"grid\",  GROUP=\"asmadmin\", MODE=\"0660\"">>/etc/udev/rules.d/99-oracle-asmdevices.rules

    let i++

  done

  /sbin/start_udev

最後檔案生成的/etc/udev/rules.d/99-oracle-asmdevices.rules檔案是:

[root@db01 ~]# cat /etc/udev/rules.d/99-oracle-asmdevices.rules

KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36001405745529a22afc4f8fb1a685e36", NAME="asm-disk1",  OWNER="grid",  GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36001405e371bbbb031b4547b5fe217d1", NAME="asm-disk2",  OWNER="grid",  GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36001405ff11eeac99ac40f69e34a3ec5", NAME="asm-disk3",  OWNER="grid",  GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="3600140517aafddef37c4305a3e6930ee", NAME="asm-disk4",  OWNER="grid",  GROUP="asmadmin", MODE="0660"

檢視生成的裝置符號

[root@db01 ~]# ll /dev/asm*

brw-rw---- 1 grid asmadmin 8,  0 Mar 23 19:12 /dev/asm-disk1

brw-rw---- 1 grid asmadmin 8, 16 Mar 23 19:12 /dev/asm-disk2

brw-rw---- 1 grid asmadmin 8, 32 Mar 23 19:12 /dev/asm-disk3

brw-rw---- 1 grid asmadmin 8, 48 Mar 23 19:12 /dev/asm-disk4

[root@db02 ~]# ll /dev/asm*

brw-rw---- 1 grid asmadmin 8,  0 Mar 23 19:12 /dev/asm-disk1

brw-rw---- 1 grid asmadmin 8, 16 Mar 23 19:12 /dev/asm-disk2

brw-rw---- 1 grid asmadmin 8, 32 Mar 23 19:12 /dev/asm-disk3

brw-rw---- 1 grid asmadmin 8, 48 Mar 23 19:12 /dev/asm-disk4

其中asm-disk2 500GB,用作資料。另外310GB的盤用作叢集vote disk

2.8 關閉ntp

Service ntpd stop

Chkconfig ntpd off

2.9 配置作業系統使用者互信

修改ssh配置檔案:/etc/ssh/ssh_config,註釋下面兩行

        #StrictHostKeyChecking no

        #UserKnownHostsFile /dev/null

Oracle grid使用者都要操作

mkdir ~/.ssh

 chmod 700 ~/.ssh

 ssh-keygen -t rsa

 ssh-keygen -t dsa

在節點1

$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

$ ssh db02 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

$ ssh db02 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

$ scp ~/.ssh/authorized_keys db02:~/.ssh/authorized_keys

之後分別使用gridoracle使用者在兩個節點都執行:

Ssh db01

ssh db02

ssh db01-priv

ssh db02-priv

按照提示輸入yes,不輸入密碼能正常登陸表示正常

三 預檢查

節點1,使用grid使用者,切換至目錄:

/u01/software/u01,執行命令:

./runcluvfy.sh stage -pre crsinst -n db01,db02  -fixup -verbose

結果如下,按照需求再安裝rpm,讓failed成功:

[grid@db01 grid]$  ./runcluvfy.sh stage -pre crsinst -n db01,db02  -fixup -verbose

四 圖形化安裝

為避免網路中途掉線,所有圖形化均在web控制檯上分別使用gridoracle使用者登陸db01進行操作。

4.1 安裝grid軟體

使用grid使用者登陸db01,切換至目錄:

/u01/software/grid

執行./runInstaller

選擇大小為10G/dev/asm-disk1, /dev/asm-disk3,/dev/asm-disk4

這裡需要點選“change discovery path”,設定路徑為/dev/asm*

在進行環境檢查時,會報錯

這個警告在青雲平臺也有說明:

註解 grid安裝環境檢查指令碼在Oracle Linux 6上面的一個bug導致錯誤”PRVF-9802”無法解決,具體原因請見 Debug Cluvfy error ERROR: PRVF-9802

勾選忽略這個警告。

彈出指令碼分別使用root在兩個伺服器執行:

/u01/app/oraInventory/orainstRoot.sh

/u01/app/11.2.0/grid/product/db_1/root.sh

第二個指令碼執行會比較好時間,大概20分鐘。

4.1.1執行指令碼

節點1

[root@db01 ~]# /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@db01 ~]# /u01/app/11.2.0/grid/product/db_1/root.sh

[root@db01 ~]# su - grid

[grid@db01 ~]$ crs_stat -t

Name           Type           Target    State     Host       

------------------------------------------------------------

ora.CRS.dg     ora....up.type ONLINE    ONLINE    db01       

ora....N1.lsnr ora....er.type ONLINE    ONLINE    db01       

ora.asm        ora.asm.type   ONLINE    ONLINE    db01       

ora.cvu        ora.cvu.type   ONLINE    ONLINE    db01       

ora....SM1.asm application    ONLINE    ONLINE    db01       

ora.db01.gsd   application    OFFLINE   OFFLINE              

ora.db01.ons   application    ONLINE    ONLINE    db01       

ora.db01.vip   ora....t1.type ONLINE    ONLINE    db01       

ora.gsd        ora.gsd.type   OFFLINE   OFFLINE              

ora....network ora....rk.type ONLINE    ONLINE    db01       

ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    db01       

ora.ons        ora.ons.type   ONLINE    ONLINE    db01       

ora.scan1.vip  ora....ip.type ONLINE    ONLINE    db01

節點2

[root@db02 ~]#  /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@db02 ~]# /u01/app/11.2.0/grid/product/db_1/root.sh

[root@db02 ~]# su - grid

[grid@db02 ~]$ crs_stat -t

4.2 建立asm磁碟組

4.3 安裝oracle軟體

Oracle使用者登陸,切換至目錄:

/u01/software/database

執行./runInstaller

Root登陸兩臺機器分別執行指令碼:

[root@db01 ~]# /u01/app/oracle/product/11.2.0/db_1/root.sh

Performing root user operation for Oracle 11g

 

The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /u01/app/oracle/product/11.2.0/db_1

 

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.

Finished product-specific root actions.

五 其他

5.1 start_udev重啟自動執行

檢視start_udev是否開機自動執行,修改/etc/rc.d/rc.sysinit檔案

新增:/sbin/start_udev

5.2 Ocr備份

[root@db01 ~]# /u01/app/11.2.0/grid/product/db_1/bin/ocrconfig -manualbackup

 

db02     2018/03/23 19:29:16     /u01/app/11.2.0/grid/product/db_1/cdata/db-cluster/backup_20180323_192916.ocr

 

[root@db02 rc.d]# cp  /u01/app/11.2.0/grid/product/db_1/cdata/db-cluster/backup_20180323_192916.ocr /root/orc-bak-20180323.ocr

 

/root/orc-bak-20180323.ocr 為複製生成的檔案。

 

5.3 Asm後設資料備份

Grid使用者執行asmcmd

ASMCMD> md_backup /home/grid/oradgbackup20180323

Disk group metadata to be backed up: CRS

Disk group metadata to be backed up: DATA

Current alias directory path: db-cluster/OCRFILE

Current alias directory path: db-cluster

Current alias directory path: db-cluster/ASMPARAMETERFILE

Current alias directory path: OADB

Current alias directory path: OADB/ARCHIVELOG/2018_03_23

Current alias directory path: OADB/TEMPFILE

Current alias directory path: OADB/ARCHIVELOG

Current alias directory path: OADB/ONLINELOG

Current alias directory path: OADB/CONTROLFILE

Current alias directory path: OADB/PARAMETERFILE

Current alias directory path: OADB/DATAFILE

 

 

六 例項測試

Last login: Fri Mar 23 19:37:05 2018 from 172.18.19.194

[root@db01 ~]# su - oracle

[oracle@db01 ~]$ sqlplus system/Oracle_sys123@192.168.0.100:1521/oadb

SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 23 19:42:53 2018

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 Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

SQL> create table test0323 as select * from dual;

Table created.

SQL> select * from test0323 ;

D

-

X

SQL> drop table test0323 ;

Table dropped.

SQL>

可以正常進行建立刪除操作。

TNS

oadb =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.100)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = oadb)

    )

  )

可使用上述TNS配置連線資料庫。

備註:

Db01節點資料庫的SIDoadb1

Db02節點資料庫的SIDoadb2

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29371470/viewspace-2152689/,如需轉載,請註明出處,否則將追究法律責任。

相關文章