Oracle 11g RAC to RAC ADG鎼缓锛堜竴锛夐噰鐢╮man澶囦唤鎭㈠鏂瑰紡
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle 11g RAC to RAC ADG鎼缓锛堜竴锛夐噰鐢╮man澶囦唤鎭㈠鏂瑰紡相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/HERE' title='HERE'>HERE row 瑙e喅 blog end opened 淇敼瀵嗙爜 瀹夎 瑙勫垝
锛堜竴锛夊熀纭€鐜
涓诲簱 | 澶囧簱 | |
鎿嶄綔绯荤粺 | RedHat6.7 | RedHat6.7 |
鏈嶅姟鍣ㄥ悕绉?/td> | primarydb1 primarydb2 | standbydb1 standbydb2 |
IP鍦板潃瑙勫垝 | 192.168.10.31 primarydb1 10.10.10.31 primarydb1-priv | 192.168.10.41 standbydb1 10.10.10.41 standbydb1-priv |
------------------------ | ------------------------------ | --------------------------------------- |
鏁版嵁搴撶増鏈?/td> | 11.2.0.4 | 11.2.0.4 |
db_name | testdb | testdb |
db_unique_name | testdb | testdbdg |
instance_name | testdb1 testdb2 | testdbdg1 testdbdg2 |
service_name | testdb | testdbdg |
鏁版嵁搴撳畨瑁呮儏鍐?/td> | 瀹夎GI+鏁版嵁搴撹蒋浠?鍒涘缓鏁版嵁搴?/td> | 瀹夎GI+鏁版嵁搴撹蒋浠?锛堜笉鐢ㄥ垱寤烘暟鎹簱锛?/td> |
鍦ㄩ厤缃甦ataguard涔嬪墠锛屼富搴撳凡缁忓畨瑁呬簡GI+鏁版嵁搴撹蒋浠?鍒涘缓浜嗘暟鎹簱锛屽搴撲篃宸茬粡瀹夎浜咷I+鏁版嵁搴撹蒋浠讹紝澶囧簱涓嶉渶瑕佷娇鐢╠bca寤哄簱銆?/p>
锛堜簩锛変富搴撻厤缃?/strong>
锛?.1锛夐厤缃綊妗o紝涓诲簱闇€瑕佽繍琛屽湪褰掓。妯″紡涓?/p>
--鏌ョ湅鏄惁寮€鍚綊妗?/span> archive log list
濡傛灉娌℃湁寮€鍚綊妗o紝闇€瑕佸紑鍚紝鏂规硶濡備笅锛?/p>
--step1: 璁剧疆褰掓。鏃ュ織鏂囦欢瀛樻斁鍦板潃 alter system set log_archive_dest_1=鈥?/span>LOCATION=+ARCH鈥?/span> ; --step2: 鍏抽棴鏁版嵁搴擄紝2涓妭鐐归兘鍏抽棴 shutdown immediate --step3: 閲嶅惎鑺傜偣1鍒癿ount鐘舵€?/span> startup mount --step4: 寮€鍚綊妗?/span> alter syetem archivelog --step5: 鎵撳紑鏁版嵁搴?/span> alter database open --step6: 纭褰掓。鐘舵€?/span> archive log list --鏈€濂戒娇鐢╝lter system switch logfile鍒囨崲鏃ュ織锛岀‘璁ゆ棩蹇楀凡缁忓瓨鍒板綊妗d綅缃?/span> --step7锛氭墦寮€鍙﹀涓€涓妭鐐?/span> startup open;
锛?.2锛変富搴撳惎鐢ㄥ己鍒惰褰曟棩蹇?/p>
--寮€鍚暟鎹簱寮哄埗璁板綍鏃ュ織鍔熻兘 alter database force logging --鏌ョ湅寮哄埗璁板綍鏃ュ織鍔熻兘鏄惁寮€鍚?/span> select force_logging from v$database;
(2.3)涓诲簱缃戠粶閰嶇疆
锛?.3.1锛夐潤鎬佺洃鍚厤缃?/p>
涓诲簱鍙互浣跨敤鍔ㄦ€佺洃鍚紝涔熷彲浠ヤ娇鐢ㄩ潤鎬佺洃鍚紝杩欓噷鏂板垱寤轰竴涓洃鍚琇ISTENER_ADG锛岀洃鍚柊鐨勭鍙?522銆備互涓嬫搷浣滀娇鐢╣rid鐢ㄦ埛鎵ц
step1:鍦ㄨ妭鐐?鎵ц娣诲姞鐩戝惉鍛戒护
srvctl add listener -l LISTENER_ADG -o $ORACLE_HOME -p "TCP:1522"
step2:鍚姩鐩戝惉
srvctl start listener -l LISTENER_ADG
step3:淇敼鐩戝惉閰嶇疆鏂囦欢锛屽姞鍏ラ潤鎬佹敞鍐屼俊鎭紝2涓妭鐐归兘闇€瑕佷慨鏀癸紝杩欓噷浠ヨ妭鐐?涓轰緥
[grid@primarydb1 ~]$ vim /u01/app/11.2.0/grid/network/admin/listener.ora
LISTENER_ADG=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_ADG)))) # line added by Agent LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_ADG=ON # line added by Agent #娣诲姞浠ヤ笅淇℃伅 SID_LIST_LISTENER_ADG = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = testdb) (ORACLE_HOME = /u01/app/11.2.0/grid) #濉啓鐨勬槸grid_home (SID_NAME=testdb1) #濡傛灉鏄妭鐐?锛岄渶鏀逛负SID_NAME=testdb2 ) )
step4锛氶噸鍚洃鍚紝涓€涓妭鐐规墽琛?/p>
srvctl stop listener -l LISTENER_ADG
srvctl start listener -l LISTENER_ADG
锛?.3.2锛塼ns閰嶇疆锛屼富搴?涓妭鐐归兘娣诲姞
[oracle@primarydb1 ~]$ cd /u01/app/oracle/product/11.2.0/db_1/network/admin/ [oracle@primarydb1 admin]$ ls samples shrept.lst tnsnames.ora [oracle@primarydb1 admin]$ vim tnsnames.ora
tnstestdb = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.33)(PORT = 1522)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.34)(PORT = 1522))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = testdb) ) ) tnstestdbdg = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.43)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.44)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = testdbdg) ) )
(2.4)涓诲簱鍙傛暟閰嶇疆
alter system set db_unique_name = 鈥?/span>testdb鈥?/span> scope=spfile; alter system set log_archive_config=鈥?/span>DG_CONFIG=(testdb,testdbdg)鈥?/span>; alter system set log_archive_dest_2=鈥?/span>SERVICE=tnstestdbdg LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=testdbdg鈥?/span>; alter system set log_archive_dest_state_1 = "enable"; alter system set log_archive_dest_state_2 = "enable"; alter system set db_file_name_convert=鈥?/span>+DATA/testdbdg鈥?/span>,鈥?/span>+DATA/testdb鈥?/span> scope=spfile; alter system set log_file_name_convert=鈥?/span>+DATA/testdbdg鈥?/span>,鈥?/span>+DATA/testdb鈥?/span> scope=spfile; alter system set standby_file_management=auto; alter system set fal_client=鈥?/span>tnstestdb鈥?/span>; alter system set fal_server=鈥?/span>tnstestdbdg鈥?/span>;
鍥犱负鏈夌殑鍙傛暟閲嶅惎鎵嶄細鐢熸晥锛坰cope=spfile锛夛紝鍥犳鏀瑰畬鍙傛暟闇€瑕侀噸鍚?/p>
[grid@primarydb1 ~]$ srvctl stop database -d testdb
[grid@primarydb1 ~]$ srvctl start database -d testdb
(2.5)娣诲姞standby online redo log
standby redo log鐨勫ぇ灏忎笌redo log澶у皬鐩稿悓銆傜粍鏁颁负姣斿湪绾挎棩蹇楀涓€缁勩€?/p>
鏌ョ湅鍦ㄧ嚎鏃ュ織缁勬暟淇℃伅
SQL> select a."GROUP#",a."THREAD#",a."BYTES",a."MEMBERS" from v$log a, v$logfile b where a."GROUP#" = b."GROUP#" order by group#; GROUP# THREAD# BYTES MEMBERS ---------- ---------- ---------- ---------- 1 1 52428800 1 2 1 52428800 1 3 2 52428800 1 4 2 52428800 1
--thread1 alter database add standby logfile thread 1 group 11 (鈥?/span>+DATA鈥?/span>) size 50M; alter database add standby logfile thread 1 group 12 (鈥?/span>+DATA鈥?/span>) size 50M; alter database add standby logfile thread 1 group 13 (鈥?/span>+DATA鈥?/span>) size 50M; --thread2 alter database add standby logfile thread 2 group 14 (鈥?/span>+DATA鈥?/span>) size 50M; alter database add standby logfile thread 2 group 15 (鈥?/span>+DATA鈥?/span>) size 50M; alter database add standby logfile thread 2 group 16 (鈥?/span>+DATA鈥?/span>) size 50M;
锛?.6锛夊皢涓诲簱鐨勫瘑鐮佹枃浠舵嫹璐濆埌澶囧簱
鎷疯礉涓诲簱瀵嗙爜鏂囦欢鍒板搴擄紝鍦ㄨ妭鐐?鎵ц
[oracle@primarydb1 dbs]$ pwd /u01/app/oracle/product/11.2.0/db_1/dbs # 鎷疯礉瀵嗙爜鏂囦欢鍒板搴撹妭鐐? [oracle@primarydb1 dbs]$ scp orapwtestdb1 oracle@192.168.10.41:`pwd` # 鎷疯礉瀵嗙爜鏂囦欢鍒板搴撹妭鐐? [oracle@primarydb1 dbs]$ scp orapwtestdb1 oracle@192.168.10.42:`pwd`
锛?.7锛夊皢涓诲簱鐨勫弬鏁版枃浠舵嫹璐濆埌澶囧簱
SQL> create pfile=鈥?/span>/home/oracle/pfile_20190818鈥?/span> from spfile;
SQL> exit
Disconnected from 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
[oracle@primarydb1 ~]$ scp pfile_20190818 oracle@192.168.10.41:`pwd`
oracle@192.168.10.41鈥?/span>s password:
pfile_20190818 100% 1859 1.8KB/s 00:00
锛堜笁锛夊搴撻厤缃?/strong>
(3.1)淇敼瀵嗙爜鏂囦欢
linux鐜涓紝瀵嗙爜鏂囦欢鍛藉悕鏍煎紡涓猴細orapwd$sid锛屽洜姝ら渶瑕佷慨鏀瑰瘑鐮佹枃浠剁殑鍚嶅瓧
澶囧簱鑺傜偣1锛?/p>
[oracle@standbydb1 dbs]$ pwd /u01/app/oracle/product/11.2.0/db_1/dbs [oracle@standbydb1 dbs]$ mv orapwtestdb1 orapwtestdbdg1
澶囧簱鑺傜偣2锛?/p>
[oracle@standbydb2 dbs]$ pwd /u01/app/oracle/product/11.2.0/db_1/dbs [oracle@standbydb2 dbs]$ mv orapwtestdb1 orapwtestdbdg2
锛?.2锛変慨鏀瑰弬鏁版枃浠?/p>
鏈€缁堝弬鏁版枃浠跺涓嬶細
*.audit_file_dest=鈥?/span>/u01/app/oracle/admin/testdbdg/adump鈥?/span>
*.audit_trail=鈥?/span>db鈥?/span>
*.cluster_database=true
*.compatible=鈥?/span>11.2.0.4.0鈥?/span>
*.control_files=鈥?/span>+DATA/testdb/controlfile/current.266.1016639457鈥?/span>
*.db_block_size=8192
*.db_create_file_dest=鈥?/span>+DATA鈥?/span>
*.db_domain=鈥樷€?/span>
*.db_file_name_convert=鈥?/span>+DATA/testdb鈥?/span>,鈥?/span>+DATA/testdbdg鈥?/span>
*.db_name=鈥?/span>testdb鈥?/span>
*.db_unique_name=鈥?/span>testdbdg鈥?/span>
*.diagnostic_dest=鈥?/span>/u01/app/oracle鈥?/span>
*.fal_client=鈥?/span>tnstestdbdg鈥?/span>
*.fal_server=鈥?/span>tnstestdb鈥?/span>
testdbdg1.instance_number=1
testdbdg2.instance_number=2
*.log_archive_config=鈥?/span>DG_CONFIG=(testdb,testdbdg)鈥?/span>
*.log_archive_dest_1=鈥?/span>LOCATION=+ARCH鈥?/span>
*.log_archive_dest_2=鈥?/span>SERVICE=tnstestdb LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=testdb鈥?/span>
*.log_archive_dest_state_1=鈥?/span>enable鈥?/span>
*.log_archive_dest_state_2=鈥?/span>enable鈥?/span>
*.log_file_name_convert=鈥?/span>+DATA/testdb鈥?/span>,鈥?/span>+DATA/testdbdg鈥?/span>
*.remote_login_passwordfile=鈥?/span>exclusive鈥?/span>
*.standby_file_management=鈥?/span>AUTO鈥?/span>
testdb1.thread=1
testdb2.thread=2
testdb1.undo_tablespace=鈥?/span>UNDOTBS2鈥?/span>
testdb2.undo_tablespace=鈥?/span>UNDOTBS1鈥?/span>
su - oracle # 2涓妭鐐归兘瑕佸垱寤? mkdir -p mkidr -p /u01/app/oracle/admin/testdbdg/adump
锛?.3锛夊搴撶綉缁滈厤缃?/p>
锛?.3.1锛夐潤鎬佺洃鍚厤缃?/p>
杩欓噷鏂板垱寤轰竴涓洃鍚琇ISTENER_ADG锛岀洃鍚柊鐨勭鍙?522銆備互涓嬫搷浣滀娇鐢╣rid鐢ㄦ埛鎵ц
step1:鍦ㄨ妭鐐?鎵ц娣诲姞鐩戝惉鍛戒护
srvctl add listener -l LISTENER_ADG -o $ORACLE_HOME -p "TCP:1522"
srvctl start listener -l LISTENER_ADG
[grid@standbydb1 ~]$ vim /u01/app/11.2.0/grid/network/admin/listener.ora LISTENER_ADG=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_ADG)))) # line added by Agent LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_ADG=ON # line added by Agent SID_LIST_LISTENER_ADG = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = testdbdg) (ORACLE_HOME = /u01/app/11.2.0/grid) (SID_NAME=testdbdg1) ) )
step4锛氶噸鍚洃鍚紝涓€涓妭鐐规墽琛?/p>
srvctl stop listener -l LISTENER_ADG
srvctl start listener -l LISTENER_ADG
锛?.3.2锛塼ns閰嶇疆锛屽搴?涓妭鐐归兘娣诲姞
[oracle@primarydb1 ~]$ cd /u01/app/oracle/product/11.2.0/db_1/network/admin/ [oracle@primarydb1 admin]$ ls samples shrept.lst tnsnames.ora [oracle@primarydb1 admin]$ vim tnsnames.ora
# 鍦╰nsnames.ora鏂囦欢涓坊鍔犲涓嬪唴瀹?/span>
tnstestdb = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.33)(PORT = 1522)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.34)(PORT = 1522))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = testdb) ) ) tnstestdbdg = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.43)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.44)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = testdbdg) ) )
(3.4)鍚姩澶囧簱鍒皀omount鐘舵€?/p>
[oracle@standbydb1 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Mon Aug 19 04:14:04 2019 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to an idle instance. SQL> startup nomount pfile=鈥?/span>/home/oracle/pfile_20190818鈥?/span>; ORACLE instance started. Total System Global Area 313196544 bytes Fixed Size 2252744 bytes Variable Size 255852600 bytes Database Buffers 50331648 bytes Redo Buffers 4759552 bytes SQL>
娉ㄦ剰锛氬啀灏嗗搴撳惎鍔ㄥ埌nomount鐘舵€佸悗锛岀悊璁轰笂锛屽彲浠ヤ粠涓诲簱閫氳繃sqlplus杩炴帴鍒板搴擄紝鍚屾牱涔熷彲浠ュ湪澶囧簱閫氳繃sqlplus杩炴帴鍒颁富搴擄紝杩欓噷寤鸿娴嬭瘯涓诲簱澶囧簱涔嬮棿缃戠粶鐨勮繛閫氭€с€傚湪涓诲簱涓庡搴撲笂鎵ц
tnsping tnstestdb tnsping tnstestdbdg sqlplus sys/Oracle123@tnstestdb sqlplus sys/Oracle123@tnstestdbdg
纭繚鎵€鏈夊懡浠ら兘鑳芥墽琛屾垚鍔熴€?/p>
锛?.5锛夊皢鏁版嵁搴撴敞鍐屽埌闆嗙兢涓紝鎵嶈兘澶熶娇鐢ˋSM
鍦ㄨ妭鐐?鐨刼racle鐢ㄦ埛涓嬫墽琛岋細
[oracle@standbydb1 db_1]$ srvctl add database -d testdbdg -o /u01/app/oracle/product/11.2.0/db_1 [oracle@standbydb1 db_1]$ srvctl add instance -d testdbdg -i testdbdg1 -n standbydb1 [oracle@standbydb1 db_1]$ srvctl add instance -d testdbdg -i testdbdg2 -n standbydb2
锛堝洓锛変富搴撳浠?/strong>
rman target / RMAN> run allocate channel c1 type disk; allocate channel c2 type disk; sql鈥?/span> alter system archive log current鈥?/span>; backup database format 鈥?/span>/databaseBackup/full_db_%U鈥?/span>; sql鈥?/span> alter system archive log current鈥?/span>; backup archivelog all format 鈥?/span>/databaseBackup/archlog_%U鈥?/span>; backup current controlfile format 鈥?/span>/databaseBackup/controlfile_%U鈥?/span>; backup spfile format 鈥?/span>/backup/rmanbak/spfile_%U鈥?/span>; release channel c1; release channel c2;
灏嗗浠戒紶鍒板搴撴湇鍔″櫒锛?/p>
[oracle@primarydb1 /]$ cd databaseBackup/ [oracle@primarydb1 databaseBackup]$ ls archlog_0au9imjq_1_1 archlog_0cu9imnk_1_1 full_db_06u9imbr_1_1 full_db_08u9imhs_1_1 spfile_0gu9imtt_1_1 archlog_0bu9imju_1_1 controlfile_0du9imrd_1_1 full_db_07u9imbr_1_1 full_db_09u9imhv_1_1 [oracle@primarydb1 databaseBackup]$ scp * oracle@192.168.10.41:/databaseBackup/
锛堜簲锛夊搴撹繕鍘?/strong>
锛?.1锛塺estore鎺у埗鏂囦欢
[oracle@standbydb1 ~]$ rman target / Recovery Manager: Release 11.2.0.4.0 - Production on Mon Aug 19 06:47:00 2019 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: TESTDB (not mounted) RMAN> restore standby controlfile from 鈥?/span>/databaseBackup/controlfile_0du9imrd_1_1鈥?/span>; Starting restore at 19-AUG-19 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=292 instance=testdbdg1 device type=DISK channel ORA_DISK_1: restoring control file channel ORA_DISK_1: restore complete, elapsed time: 00:00:08 output file name=+DATA/testdbdg/controlfile/current.268.1016664445 Finished restore at 19-AUG-19
澶囨敞锛氬湪鎭㈠鎺у埗鏂囦欢鏃讹紝閬囧埌閿欒锛?/p>
瑙e喅鏂规硶锛?a href="https://jingyan.baidu.com/album/9faa7231c13269473c28cb33.html?picindex=9">https://jingyan.baidu.com/album/9faa7231c13269473c28cb33.html?picindex=9
锛?.2锛変慨澶嶆暟鎹簱
鍦ㄥ惎鍔ㄥ埌mount鐘舵€佹椂鎶ヤ簡2涓敊璇細
鎶ラ敊1锛氬垵濮嬪寲鍙傛暟鏂囦欢鎵句笉鍒?/p>
瑙e喅鏂规硶锛氬鍒秔file鍒扮粰瀹氫綅缃?br>[oracle@standbydb1 bin]$ cp /home/oracle/pfile_20190818 /u01/app/oracle/product/11.2.0/db_1/dbs/inittestdbdg1.ora
鎶ラ敊2锛氭帶鍒舵枃浠舵壘涓嶅埌
瑙e喅鏂规硶锛?/p>
1.閫氳繃asmcmd鎵惧埌鎺у埗鏂囦欢鐨勪綅缃紱
ASMCMD> pwd +data/testdbdg/CONTROLFILE ASMCMD> ls current.256.1016666437
2.淇敼鍒濆鍖栧弬鏁版枃浠朵腑
[oracle@standbydb1 ~]$ vim /u01/app/oracle/product/11.2.0/db_1/dbs/inittestdbdg1.ora
...
*.control_files=鈥?data/testdbdg/CONTROLFILE/current.256.1016666437鈥?/pre>...
閲嶆柊鍚姩鏁版嵁搴撳埌mount鐘舵€?/p>
[oracle@standbydb1 dbs]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Mon Aug 19 07:08:15 2019 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to an idle instance. SQL> startup mount; ORACLE instance started. Total System Global Area 313196544 bytes Fixed Size 2252744 bytes Variable Size 255852600 bytes Database Buffers 50331648 bytes Redo Buffers 4759552 bytes Database mounted.
寮€濮嬩慨澶嶆暟鎹簱
RMAN> restore database; Starting restore at 19-AUG-19 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=14 instance=testdbdg1 device type=DISK channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00001 to +DATA/testdbdg/datafile/system.268.1016639305 channel ORA_DISK_1: restoring datafile 00004 to +DATA/testdbdg/datafile/users.267.1016639305 channel ORA_DISK_1: reading from backup piece /databaseBackup/full_db_06u9imbr_1_1 channel ORA_DISK_1: piece handle=/databaseBackup/full_db_06u9imbr_1_1 tag=TAG20190819T035434 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:08:19 channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00002 to +DATA/testdbdg/datafile/sysaux.260.1016639305 channel ORA_DISK_1: restoring datafile 00003 to +DATA/testdbdg/datafile/undotbs1.263.1016639305 channel ORA_DISK_1: restoring datafile 00005 to +DATA/testdbdg/datafile/undotbs2.264.1016639859 channel ORA_DISK_1: reading from backup piece /databaseBackup/full_db_07u9imbr_1_1 channel ORA_DISK_1: piece handle=/databaseBackup/full_db_07u9imbr_1_1 tag=TAG20190819T035434 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:56 Finished restore at 19-AUG-19
锛堝叚锛夋墦寮€澶囧簱
鎵撳紑澶囧簱
SQL> alter database open ;
Database altered.
鏌ョ湅鏁版嵁搴撶姸鎬侊細
SQL> select name,db_unique_name,open_mode from v$database; NAME DB_UNIQUE_NAME OPEN_MODE --------- ------------------------------ -------------------- TESTDB testdbdg READ ONLY
寮€濮嬫暟鎹簱瀹炴椂鏃ュ織搴旂敤,鍦ㄥ紑鍚箣鍓嶏紝闇€瑕佺‘璁tandby redo logfile鏄惁宸茬粡鍒涘缓锛岃繖閲屽凡缁忎粠涓诲簱鎭㈠杩囨潵锛屾晠涓嶉渶瑕佸垱寤?
SQL> alter database recover managed standby database using current logfile disconnect; Database altered.
鍦ㄦ墽琛岃璇彞鍚庯紝鏁版嵁搴撲細鑷姩鍘诲悓姝ヤ富搴撴柊鐢熸垚鐨勬棩蹇楋紝鍙互鎵撳紑涓诲簱涓庡搴撶殑鍛婅鏃ュ織锛屾煡鐪嬫暟鎹簱鍚屾鐘舵€併€?/p>
锛堜竷锛夊惎鍔ㄥ彟澶栦竴涓妭鐐?/strong>
锛?.1锛夐鍏堜娇鐢╬file鐢熸垚spfile
SQL> create spfile=鈥?/span>+DATA/testdbdg/spfiletestdbdg.ora鈥?/span> from pfile=鈥?/span>/u01/app/oracle/product/11.2.0/db_1/dbs/inittestdbdg1.ora鈥?/span>; File created.
鍏抽棴鑺傜偣1锛屼慨鏀筽file鍙傛暟锛?/p>
SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. #鑺傜偣1 [oracle@standbydb1 ~]$ cd /u01/app/oracle/product/11.2.0/db_1/dbs/ [oracle@standbydb1 dbs]$ vim inittestdbdg1.ora # 浠呬繚鐣欎竴琛屽弬鏁帮紝鎸囧悜spfile spfile=鈥?/span>+DATA/testdbdg/spfiletestdbdg.ora鈥?/span> #鑺傜偣2 [oracle@standbydb1 ~]$ cd /u01/app/oracle/product/11.2.0/db_1/dbs/ [oracle@standbydb1 dbs]$ vim inittestdbdg2.ora # 浠呬繚鐣欎竴琛屽弬鏁帮紝鎸囧悜spfile spfile=鈥?/span>+DATA/testdbdg/spfiletestdbdg.ora鈥?/span>
锛?.2锛夊惎鍔ㄨ妭鐐?/p>
棣栧厛鏌ョ湅鏁版嵁搴撶姸鎬侊細
[grid@standbydb1 ~]$ crsctl status res -t -------------------------------------------------------------------------------- ... ora.testdbdg.db 1 OFFLINE OFFLINE Instance Shutdown 2 OFFLINE OFFLINE ...
鎵撳紑鑺傜偣1锛?/p>
[oracle@standbydb1 dbs]$ sqlplus / as sysdba SQL> startup --寮€鍚疄鏃舵棩蹇楀簲鐢?/span> SQL> alter database recover managed standby database using current logfile disconnect;
鎵撳紑鑺傜偣2锛?/p>
[oracle@standbydb2 dbs]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Thu Aug 22 06:07:55 2019 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 313196544 bytes Fixed Size 2252744 bytes Variable Size 255852600 bytes Database Buffers 50331648 bytes Redo Buffers 4759552 bytes Database mounted. Database opened.
鍐嶆纭鏁版嵁搴撶殑鐘舵€?宸茬粡姝e父鍚姩锛?/p>
[grid@standbydb1 ~]$ crsctl status res -t -------------------------------------------------------------------------------- ... ora.testdbdg.db 1 ONLINE ONLINE standbydb1 Open,Readonly 2 ONLINE ONLINE standbydb2 Open,Readonly ...
鏌ョ湅澶囧簱鐨勬暟鎹簱鐘舵€侊細
涓诲簱锛?/p>
SQL> select name,db_unique_name,open_mode,database_role from v$database; NAME DB_UNIQUE_NAME OPEN_MODE DATABASE_ROLE --------- ------------------------------ -------------------- ---------------- TESTDB testdb READ WRITE PRIMARY
澶囧簱锛?/p>
SQL> select name,db_unique_name,open_mode,database_role from v$database; NAME DB_UNIQUE_NAME OPEN_MODE DATABASE_ROLE --------- ------------------------------ -------------------- ---------------- TESTDB testdbdg READ ONLY WITH APPLY PHYSICAL STANDBY
锛堝叓锛夋祴璇曟暟鎹悓姝ユ儏鍐?/strong>
锛?锛変富搴撳垱寤鸿〃锛屾彃鍏ユ暟鎹細
SQL> create table test02 (id number , name varchar(20)); Table created. SQL> insert into test02 values(1,鈥?/span>lijiaman鈥?/span>); 1 row created. SQL> commit; Commit complete.
SQL> select * from test02;
ID NAME
---------- --------------------
1 lijiaman
澶囧簱鏌ョ湅锛?/p>
SQL> select * from test02; ID NAME ---------- -------------------- 1 lijiaman
鏁版嵁宸插悓姝ャ€?/p>
锛?锛変富搴撳垹闄よ〃锛岃〃杩涘叆浜嗗洖鏀剁珯锛?1gR2鐨刣ataguard涓嶉渶瑕佸叧闂洖鏀剁珯銆?/p>
SQL> drop table test02; Table dropped. SQL> select * from tab; TNAME TABTYPE CLUSTERID ------------------------------ ------- ---------- BIN$kKkJUDt4hvrgUyAKqMC61w==$0 TABLE
鍙戠幇澶囧簱琛ㄤ篃杩涘叆浜嗗洖鏀剁珯
SQL> select * from tab; TNAME TABTYPE CLUSTERID ------------------------------ ------- ---------- BIN$kKkJUDt4hvrgUyAKqMC61w==$0 TABLE
鍚屾牱锛屼富搴撴墽琛岄棯鍥炲垹闄わ紝灏唖ales琛ㄤ粠鍥炴敹绔欐仮澶嶅洖鏉ワ紝澶囧簱涔熶細鎵ц鐩稿悓鐨勬搷浣溿€?/p>
涓诲簱鎵ц闂洖鍒犻櫎鎭㈠宸茬粡鍒犻櫎鐨則est02琛?/p>
SQL> flashback table test02 to before drop; Flashback complete. SQL> select * from tab; TNAME TABTYPE CLUSTERID ------------------------------ ------- ---------- TEST02 TABLE
澶囧簱涔熶細鑷姩鎭㈠宸茬粡鍒犻櫎鐨則est02琛?/p>
SQL> select * from tab; TNAME TABTYPE CLUSTERID ------------------------------ ------- ---------- TEST02 TABLE
鏁版嵁鍚屾娴嬭瘯鏃犲紓甯搞€?br>
锛堜節锛夊瓨鍦ㄧ殑闂
瀛樺湪鐨勯棶棰?锛氬搴撲娇鐢╯can-ip鏃犳硶杩炴帴锛?/p>
閰嶇疆淇℃伅锛歩p192.168.10.40 port:1521 service:testdbdg
闇€瑕佽缃垵濮嬪寲鍙傛暟锛歳emote_listener
SQL> alter system set remote_listener=鈥?/span>standbydb-scan:1521鈥?/span>
銆愬畬銆?/p>
以上是关于Oracle 11g RAC to RAC ADG鎼缓锛堜竴锛夐噰鐢╮man澶囦唤鎭㈠鏂瑰紡的主要内容,如果未能解决你的问题,请参考以下文章