Oracle RAC 重建 OCR 和 Voting disk
OCR 和 Voting disk 對RAC 來說是非常重要的。 OCR記錄節點成員的配置資訊,如database、ASM、instance、listener、VIP等CRS資源的配置資訊。Voting disk記錄節點成員資訊,如包含哪些節點成員、節點的新增刪除資訊記錄。在日常維護中需要對他們進行備份。當然OCR 也會自動備份。 當OCR或者Voting disk 出現問題時,有備份的話就使用備份來恢復。 當沒有備份的話就只能重建了。
官方有關OCR 和 Voting disk重建的文件參考:
How to Recreate OCR / Voting Disk Accidentally Deleted [ID 399482.1]
OCR 和Voting disk 的備份與恢復參考:
Oracle 10g RAC OCR 和 VotingDisk 的備份與恢復
http://space.itpub.net/?uid-15880878-action-viewspace-itemid-723023
先對Voting disk 和OCR做一個備份。
[root@rac1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.orcl.db application ONLINE ONLINE rac2
ora....oltp.cs application ONLINE ONLINE rac2
ora....cl1.srv application ONLINE ONLINE rac1
ora....cl2.srv application ONLINE ONLINE rac2
ora....l1.inst application ONLINE ONLINE rac1
ora....l2.inst application ONLINE ONLINE rac2
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
[root@rac1 bin]# ./crsctl query css votedisk
0. 0 /dev/raw/raw3
1. 0 /dev/raw/raw4
2. 0 /dev/raw/raw5
located 3 votedisk(s)
[root@rac1 bin]# dd if=/dev/raw/raw3 f=/u01/votingdisk.bak
401562+0 records in
401562+0 records out
205599744 bytes (206 MB) copied, 1685.53 seconds, 122 kB/s
[root@rac1 u01]# cd /u01/app/oracle/product/crs/bin/
[root@rac1 bin]# ./ocrconfig -export /u01/ocr.bak
[root@rac1 bin]# ll /u01
total 202132
drwxrwxrwx 3 oracle oinstall 4096 Nov 30 17:08 app
-rwxr-xr-x 1 oracle oinstall 1043097 Nov 30 18:59 clsfmt.bin
-rw-r--r-- 1 root root 103141 Dec 2 08:38 ocr.bak
-rwxr-xr-x 1 oracle oinstall 5542 Nov 30 19:00 srvctl
-rw-r--r-- 1 root root 205599744 Dec 2 08:45 votingdisk.bak
重建具體操作如下:
1. 停止所有節點的CRS
[root@rac1 bin]# ./crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
2. 備份每個節點的Clusterware Home
[root@rac1 bin]# cd /u01/app/oracle/product/
[root@rac1 product]# ls
10.2.0 crs
[root@rac1 product]# cp crs crs_back
3. 在所有節點執行
[root@rac1 install]# pwd
/u01/app/oracle/product/crs/install
[root@rac1 install]# ./rootdelete.sh
Shutting down Oracle Cluster Ready Services (CRS):
Stopping resources.
Error while stopping resources. Possible cause: CRSD is down.
Stopping CSSD.
Unable to communicate with the CSS daemon.
Shutdown has begun. The daemons should exit soon.
Checking to see if Oracle CRS stack is down...
Oracle CRS stack is not running.
Oracle CRS stack is down now.
Removing script. for Oracle Cluster Ready services
Updating ocr file for downgrade
Cleaning up SCR settings in '/etc/oracle/scls_scr'
4. 在執行安裝的節點執行
因為我是在rac1節點上執行安裝的, 所以也在該節點執行該命令。 只需要在該節點執行就可以了。
[root@rac1 install]# sh /u01/app/oracle/product/crs/install/rootdeinstall.sh
Removing contents from OCR mirror device
2560+0 records in
2560+0 records out
10485760 bytes (10 MB) copied, 108.972 seconds, 96.2 kB/s
Removing contents from OCR device
2560+0 records in
2560+0 records out
10485760 bytes (10 MB) copied, 89.2502 seconds, 117 kB/s
5. 檢查CRS程式,如果沒有返回值,繼續下一步
[root@rac1 install]# ps -e | grep -i 'ocs[s]d'
[root@rac1 install]# ps -e | grep -i 'cr[s]d.bin'
[root@rac1 install]# ps -e | grep -i 'ev[m]d.bin'
6. 在安裝節點(第4步中的節點)執行
[root@rac1 crs]# /u01/app/oracle/product/crs/root.sh --注意,是root使用者。
WARNING: directory '/u01/app/oracle/product' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
Checking to see if Oracle CRS stack is already configured
Setting the permissions on OCR backup directory
Setting up NS directories
Oracle Cluster Registry configuration upgraded successfully
WARNING: directory '/u01/app/oracle/product' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
assigning default hostname rac1 for node 1.
assigning default hostname rac2 for node 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node
node 1: rac1 rac1-priv rac1
node 2: rac2 rac2-priv rac2
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Now formatting voting device: /dev/raw/raw3
Now formatting voting device: /dev/raw/raw4
Now formatting voting device: /dev/raw/raw5
Format of 3 voting devices complete.
Startup will be queued to init within 90 seconds.
Adding daemons to inittab
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
rac1
CSS is inactive on these nodes.
rac2
Local node checking complete.
Run root.sh on remaining nodes to start CRS daemons.
7. 在剩下的節點執行
[root@rac2 crs]# /u01/app/oracle/product/crs/root.sh
WARNING: directory '/u01/app/oracle/product' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
Checking to see if Oracle CRS stack is already configured
Setting the permissions on OCR backup directory
Setting up NS directories
Oracle Cluster Registry configuration upgraded successfully
WARNING: directory '/u01/app/oracle/product' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
assigning default hostname rac1 for node 1.
assigning default hostname rac2 for node 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node
node 1: rac1 rac1-priv rac1
node 2: rac2 rac2-priv rac2
clscfg: Arguments check out successfully.
NO KEYS WERE WRITTEN. Supply -force parameter to override.
-force is destructive and will destroy any previous cluster
configuration.
Oracle Cluster Registry for cluster has already been initialized
Startup will be queued to init within 90 seconds.
Adding daemons to inittab
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
rac1
rac2
CSS is active on all nodes.
Waiting for the Oracle CRSD and EVMD to start
Waiting for the Oracle CRSD and EVMD to start
Waiting for the Oracle CRSD and EVMD to start
Waiting for the Oracle CRSD and EVMD to start
Waiting for the Oracle CRSD and EVMD to start
Waiting for the Oracle CRSD and EVMD to start
Waiting for the Oracle CRSD and EVMD to start
Oracle CRS stack installed and running under init(1M)
Running vipca(silent) for configuring nodeapps
Error 0(Native: listNetInterfaces:[3])
[Error 0(Native: listNetInterfaces:[3])]
這裡報錯了。 root.sh 在最後一個節點執行時會呼叫vipca命令。 這裡因為網路介面沒有配置好。 所以執行失敗了。 我們配置一下介面,在Xmanager裡,用root使用者,手工執行vipca命令即可。
[root@rac1 bin]# ./oifcfg getif -- 沒有返回介面資訊
[root@rac1 bin]# ./oifcfg iflist
eth1 192.168.6.0
virbr0 192.168.122.0
eth0 192.168.6.0
[root@rac1 bin]# ./oifcfg setif -global eth0/192.168.6.0:public -- 注意IP 最後是0
[root@rac1 bin]# ./oifcfg setif -global eth1/192.168.6.0:cluster_interconnect
[root@rac1 bin]# ./oifcfg getif -- 驗證配置
eth0 192.168.6.0 global public
eth1 192.168.6.0 global cluster_interconnect
[root@rac1 bin]#
配置玩後,隨便在一個節點用root使用者執行一下vipca命令就可以了。 這個是有視窗的。 需要X 支援。所有用X manager。 其他工具也可以。 能執行就可以了。 執行完後nodeapps的VIP,ONS,GSD就建立完成了。
[root@rac1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
8. 配置監聽 (netca)
重建Listener會將監聽器資訊寫入OCR)
[oracle@rac1 ~]$ mv $TNS_ADMIN/listener.ora /tmp/listener.ora.original
[oracle@rac2 ~]$ mv $TNS_ADMIN/listener.ora /tmp/listener.ora.original
然後在X Manager裡,用oracle使用者執行netca命令。 這個也是視覺化的視窗。
[root@rac1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
9. 配置ONS (racgons)
10g 下使用:
[oracle@rac1 bin]$ pwd
/u01/app/oracle/product/crs/bin
[oracle@rac1 bin]$ racgons add_config rac1:6251 rac2:6251
11g 使用:
[oracle@rac1 bin]$ onsconfig add_config rac1:6251 rac2:6251
驗證配置:
[oracle@rac1 bin]$ onsctl ping
Number of onsconfiguration retrieved, numcfg = 2
onscfg[0]
{node = rac1, port = 6251}
Adding remote host rac1:6251
onscfg[1]
{node = rac2, port = 6251}
Adding remote host rac2:6251
ons is running ...
如果沒有啟動,用 onsctl start 啟動一下即可。
10. 新增其他資源到OCR
注意, 註冊用的名字和要之前安裝的一樣。 區分大小寫。
ASM
語法:srvctl add asm -n
[oracle@rac1 bin]$ echo $ORACLE_HOME
/u01/app/oracle/product/10.2.0/db_1
[oracle@rac1 bin]$ srvctl add asm -n rac1 -i +ASM1 -o $ORACLE_HOME
[oracle@rac1 bin]$ srvctl add asm -n rac2 -i +ASM2 -o /u01/app/oracle/product/10.2.0/db_1
DATABASE
語法:srvctl add database -d
[oracle@rac1 bin]$ srvctl add database -d orcl -o /u01/app/oracle/product/10.2.0/db_1
INSTANCE
語法:srvctl add instance -d
[oracle@rac1 bin]$ srvctl add instance -d orcl -i orcl1 -n rac1
[oracle@rac1 bin]$ srvctl add instance -d orcl -i orcl2 -n rac2
SERVICE
語法:srvctl add service -d
-r preferred_list 是首先使用的例項的列表,還可是用-a 表示備用例項
TAF_policy可設定為NONE,BASIC,PRECONNECT
[oracle@rac1 bin]$ srvctl add service -d orcl -s oltp -r orcl1,orcl2 -P BASIC
新增完了我們來檢視一下:
[oracle@rac1 bin]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.orcl.db application OFFLINE OFFLINE
ora....oltp.cs application OFFLINE OFFLINE
ora....cl1.srv application OFFLINE OFFLINE
ora....cl2.srv application OFFLINE OFFLINE
ora....l1.inst application OFFLINE OFFLINE
ora....l2.inst application OFFLINE OFFLINE
ora....SM1.asm application OFFLINE OFFLINE
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application OFFLINE OFFLINE
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
11. 啟動資源和檢查
[oracle@rac1 bin]$ srvctl start asm -n rac1
[oracle@rac1 bin]$ srvctl start asm -n rac2
[oracle@rac1 bin]$ srvctl start database -d orcl
[oracle@rac1 bin]$ srvctl start service -d orcl
[root@rac1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.orcl.db application ONLINE ONLINE rac1
ora....oltp.cs application ONLINE ONLINE rac2
ora....cl1.srv application ONLINE ONLINE rac1
ora....cl2.srv application ONLINE ONLINE rac2
ora....l1.inst application ONLINE ONLINE rac1
ora....l2.inst application ONLINE ONLINE rac2
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
[oracle@rac1 bin]$ cluvfy stage -post crsinst -n rac1,rac2
Performing post-checks for cluster services setup
Checking node reachability...
Node reachability check passed from node "rac1".
Checking user equivalence...
User equivalence check passed for user "oracle".
Checking Cluster manager integrity...
Checking CSS daemon...
Daemon status check passed for "CSS daemon".
Cluster manager integrity check passed.
Checking cluster integrity...
Cluster integrity check passed
Checking OCR integrity...
Checking the absence of a non-clustered configuration...
All nodes free of non-clustered, local-only configurations.
Uniqueness check for OCR device passed.
Checking the version of OCR...
OCR of correct Version "2" exists.
Checking data integrity of OCR...
Data integrity check for OCR passed.
OCR integrity check passed.
Checking CRS integrity...
Checking daemon liveness...
Liveness check passed for "CRS daemon".
Checking daemon liveness...
Liveness check passed for "CSS daemon".
Checking daemon liveness...
Liveness check passed for "EVM daemon".
Checking CRS health...
CRS health check passed.
CRS integrity check passed.
Checking node application existence...
Checking existence of VIP node application (required)
Check passed.
Checking existence of ONS node application (optional)
Check passed.
Checking existence of GSD node application (optional)
Check passed.
Post-check for cluster services setup was successful.
[oracle@rac1 bin]$
重建結束。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15880878/viewspace-723029/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 11G開始voting disk自動備份到OCR了,也就是說voting disk資訊合併到OCR中了
- oracle重建ocrOracle
- Oracle叢集軟體管理-OCR和Voting Files管理Oracle
- Oracle 12c rac ocr和votedisk管理Oracle
- 【ASM】Oracle RAC css啟動報錯"Duplicate voting file found"ASMOracleCSS
- Oracle RAC 遷移替換 OCR 盤Oracle
- Oracle Database 12c RAC損壞ocr和votedisk恢復實驗OracleDatabase
- RAC_OCR管理
- Oracle 21C管理Voting FilesOracle
- RAC備份恢復之Voting備份與恢復
- Oracle 21C OCR和OLR管理Oracle
- [20210326]Disk file operations IO與RAC.txt
- 重建共享(db或asm)密碼檔案 in Oracle 19c RAC-20220209ASM密碼Oracle
- oracle RACOracle
- oracle重建索引(一)Oracle索引
- oracle重建索引(三)Oracle索引
- oracle DBA 角色重建Oracle
- oracle重建索引(二)Oracle索引
- Oracle RAC Cache Fusion 系列十七:Oracle RAC DRMOracle
- HowTo Restore RMAN Disk backups of RAC Database to Single Instance On Another NoRESTDatabase
- Oracle 11.2 DataGuard RAC To RAC搭建Oracle
- ORA-15020:discoverd duplicate ASM disk "XXX_CJCDB_OCR_0002"ASM
- Oracle RAC CacheFusion 系列十五:Oracle RAC CRServer Part TwoOracleServer
- ORACLE RAC clusterwareOracle
- Oracle RAC Cache Fusion系列十八:Oracle RAC Statisticsand Wait EventsOracleAI
- Oracle RAC DRM介紹和關閉DRMOracle
- oracle遷移OCR盤Oracle
- Oracle RAC Cache Fusion 系列十四:Oracle RAC CR Server Part OneOracleServer
- Oracle RAC Cache Fusion 系列十:Oracle RAC Enqueues And Lock Part 1OracleENQ
- 【RAC】Oracle RAC如何修改心跳網路Oracle
- Oracle RAC Wait EventsOracleAI
- oracle rac 增加磁碟Oracle
- Oracle叢集(RAC)時間同步(ntp和CTSS)Oracle
- 【RAC】Oracle rac 如何修改公網及vipOracle
- Oracle RAC Cache Fusion 系列九:Oracle RAC 分散式資源管理(二)Oracle分散式
- Oracle RAC Cache Fusion 系列八:Oracle RAC 分散式資源管理(一)Oracle分散式
- Oracle RAC+DG搭建Oracle
- Oracle RAC更新補丁Oracle
- Oracle RAC新增節點Oracle