【DATAGUARD】實體dg的failover切換(六)
<a href="http://s3.51cto.com/wyfs02/M01/70/49/wKioL1W14cmzjJc1AAF4JOTo9cY057.jpg"></a>
各位技術愛好者,看完本文後,你可以掌握如下的技能,也可以學到一些其它你所不知道的知識,~O(∩_∩)O~:
① 實體dg的failover切換演練過程
② 實體dg管理和維護的一些sql
③ 利用duplicate搭建實體dg
④
注意:本篇BLOG中代碼部分需要特别關注的地方我都用***背景和紅色字型來表示,比如下邊的例子中,thread 1的最大歸檔日志号為33,thread 2的最大歸檔日志号為43是需要特别關注的地方。
List of Archived Logs in backup set 11
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ------------------- ---------- ---------
1 32 1621589 2015-05-29 11:09:52 1625242 2015-05-29 11:15:48
1 33 1625242 2015-05-29 11:15:48 1625293 2015-05-29 11:15:58
2 42 1613951 2015-05-29 10:41:18 1625245 2015-05-29 11:15:49
2 43 1625245 2015-05-29 11:15:49 1625253 2015-05-29 11:15:53
本文如有錯誤或不完善的地方請大家多多指正,ITPUB留言或QQ皆可,您的批評指正是我寫作的最大動力。
項目
主庫
dg庫
db 類型
單執行個體
db version
11.2.0.3
db 存儲
FS type
ORACLE_SID
oradg11g
oradgphy
db_name
主機IP位址:
192.168.59.130
OS版本及kernel版本
RHEL6.5 64位,2.6.32-504.16.2.el6.x86_64
OS hostname
rhel6_lhr
1.角色
Oracle 資料庫中含有兩種角色。
使用者角色:定義了一組權限的集合,該角色可以配置設定給使用者,也可以配置設定給其他角色。
資料庫角色:在備庫中資料庫扮演什麼樣的角色,primary還是standby。
v$database.DATABASE_ROLE辨別了資料庫的運作角色。
處于備庫環境中,資料庫有兩種類型:phsical standby、logical standby。
2.角色管理服務
一個資料庫運作在如下互相排斥的角色中。
Primary role:一個資料庫運作在primary role,那麼log transport services傳遞重做日志到備庫。
Standby role:一個資料庫運作在standby role,那麼log apply services應用歸檔日志到備庫。
角色管理服務允許使用者動态地在主、備庫中進行角色切換。
使用者可以使用角色管理服務,進行主、備庫的計劃中的角色切換,這個叫switchover,或者是非計劃中的角色切換,叫failover。
3.Switchover&Failover
切換是在主資料庫與其備資料庫之間進行角色反轉,切換確定不丢失資料。這是對于主系統計劃維護的典型操作。在切換期間,主資料庫轉換到備角色,備資料庫轉換到主角色。轉換發生不需要重建任何資料庫。
(1)Switchover
用到的場景:計劃中的角色轉換或使用者作業系統和硬體的維護等。
(2)Failover
故障轉移是當主資料庫不可用時執行的。故障轉移隻有在主資料庫災難故障的情況下執行,并且故障轉移導緻備資料庫轉換到主角色。用到的場景:非計劃中的角色切換,一般在緊急情況下使用。根據保護模式的不同,可能會沒有或者很少的資料損失。
(3)角色轉換決策樹
角色轉換(switchover&failover)的最終目的是盡快地使主庫線上,而同時盡量減少資料損失或者是實作無資料損失。盡量選擇當機時間最短,同時資料損失最小的政策。總之在失敗切換前,應該先考慮修複主資料庫或者進行無資料損失的角色轉換。
即使使用無資料損失的備庫方案,修複主庫可能會比切換到備庫更快點。如果修複了主庫,那麼就不需要修改用戶端的連接配接。但是如果修複工作導緻了任何的資料損失,那麼可能需要重新建立所有的備用資料庫。
通常情況下,最合适切換的備庫為已經應用了最多的歸檔日志的備用資料庫。
① 主庫和實體dg的failover切換
② 還原為最初始的狀态
注:failover切換後原來的主庫将不可用,必須重新搭建,是以該實驗請慎重選擇。
一.4.2.1 在主庫端模拟資料庫意外當機
[oracle@rhel6_lhr oradg11g]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on 星期日 7月 26 21:26:20 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
連接配接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
21:26:20 SQL>
21:26:29 SQL> select name, LOG_MODE, OPEN_MODE, database_role, SWITCHOVER_STATUS, db_unique_name from v$database;
NAME LOG_MODE OPEN_MODE DATABASE_ROLE SWITCHOVER_STATUS DB_UNIQUE_NAME
--------- ------------ -------------------- ---------------- -------------------- ------------------------------
ORADG11G ARCHIVELOG READ WRITE PRIMARY TO STANDBY oradg11g
已用時間: 00: 00: 00.01
21:26:37 SQL> alter system switch logfile;
系統已更改。
21:27:31 SQL> create table test as select * from dba_objects;
表已建立。
已用時間: 00: 00: 00.50
21:27:38 SQL> insert into test select * from test;
已建立 75250 行。
已用時間: 00: 00: 00.51
21:27:56 SQL> insert into test select * from test;
已建立 150500 行。
已用時間: 00: 00: 02.62
21:28:00 SQL> commit;
送出完成。
已用時間: 00: 00: 00.00
21:28:06 SQL> insert into test select * from test;
已建立 301000 行。
已用時間: 00: 00: 12.41
21:28:21 SQL> commit;
21:28:27 SQL> insert into test select * from test;
已建立 602000 行。
已用時間: 00: 00: 22.63
21:29:08 SQL> commit;
已用時間: 00: 00: 01.29
21:29:12 SQL> shutdown abort;
ORACLE 例程已經關閉。
21:29:14 SQL>
備庫查詢:
20:45:30 SQL> select count(1) from test;
COUNT(1)
----------
1204000
已用時間: 00: 00: 00.05
21:29:42 SQL> select thread#, low_sequence#, high_sequence# from v$archive_gap;
未標明行
已用時間: 00: 00: 00.02
21:31:23 SQL>
如果沒有發現明顯的gap現象,說明此次的failover不會有資料損失情況。在standby端,要進行關閉apply和結束應用動作。
一.4.2.2 備庫直接切換
21:31:23 SQL> alter database recover managed standby database cancel;
資料庫已更改。
已用時間: 00: 00: 01.01
21:33:46 SQL> alter database recover managed standby database finish;
已用時間: 00: 00: 00.31
21:33:52 SQL> select name, LOG_MODE, OPEN_MODE, database_role, SWITCHOVER_STATUS, db_unique_name from v$database;
ORADG11G ARCHIVELOG READ ONLY PHYSICAL STANDBY TO PRIMARY oradgphy
21:34:16 SQL> alter database commit to switchover to primary with session shutdown;
已用時間: 00: 00: 00.07
21:36:16 SQL>
21:36:16 SQL> select name, LOG_MODE, OPEN_MODE, database_role, SWITCHOVER_STATUS, db_unique_name from v$database;
ORADG11G ARCHIVELOG MOUNTED PRIMARY NOT ALLOWED oradgphy
21:38:18 SQL> alter database open;
已用時間: 00: 00: 00.30
21:38:42 SQL> select name, LOG_MODE, OPEN_MODE, database_role, SWITCHOVER_STATUS, db_unique_name from v$database;
ORADG11G ARCHIVELOG READ WRITE PRIMARY RESOLVABLE GAP oradgphy
21:38:49 SQL>
切換成功。切換之後,我們觀察這個過程的日志情況。
alert日志:
alter database recover managed standby database cancel
Sun Jul 26 21:33:45 2015
MRP0: Background Media Recovery cancelled with status 16037
Errors in file /u01/app/oracle/diag/rdbms/oradgphy/oradgphy/trace/oradgphy_pr00_45791.trc:
ORA-16037: user requested cancel of managed recovery operation
Managed Standby Recovery not using Real Time Apply
Recovery interrupted!
Recovered data files to a consistent state at change 1874535
Sun Jul 26 21:33:46 2015
MRP0: Background Media Recovery process shutdown (oradgphy)
Managed Standby Recovery Canceled (oradgphy)
Completed: alter database recover managed standby database cancel
alter database recover managed standby database finish
Attempt to do a Terminal Recovery (oradgphy)
Media Recovery Start: Managed Standby Recovery (oradgphy)
started logmerger process
Sun Jul 26 21:33:52 2015
Parallel Media Recovery started with 2 slaves
Begin: Standby Redo Logfile archival
End: Standby Redo Logfile archival
Terminal Recovery timestamp is '07/26/2015 21:33:52'
Terminal Recovery: applying standby redo logs.
Terminal Recovery: thread 1 seq# 183 redo required
Terminal Recovery:
Recovery of Online Redo Log: Thread 1 Group 4 Seq 183 Reading mem 0
Mem# 0: /u01/app/oracle/oradata/oradgphy/standby_redo04.log
Identified End-Of-Redo (failover) for thread 1 sequence 183 at SCN 0xffff.ffffffff
Incomplete Recovery applied until change 1874536 time 07/26/2015 21:29:12
Media Recovery Complete (oradgphy)
Terminal Recovery: successful completion
ARCH: Archival stopped, error occurred. Will continue retrying
ORACLE Instance oradgphy - Archival Error
ORA-16014: log 4 sequence# 183 not archived, no available destinations
ORA-00312: online log 4 thread 1: '/u01/app/oracle/oradata/oradgphy/standby_redo04.log'
Forcing ARSCN to IRSCN for TR 0:1874536
Attempt to set limbo arscn 0:1874536 irscn 0:1874536
Resetting standby activation ID 1413582769 (0x54418fb1)
Completed: alter database recover managed standby database finish
Sun Jul 26 21:36:16 2015
alter database commit to switchover to primary with session shutdown
ALTER DATABASE SWITCHOVER TO PRIMARY (oradgphy)
Maximum wait for role transition is 15 minutes.
All dispatchers and shared servers shutdown
CLOSE: killing server sessions.
CLOSE: all sessions shutdown successfully.
SMON: disabling cache recovery
Backup controlfile written to trace file /u01/app/oracle/diag/rdbms/oradgphy/oradgphy/trace/oradgphy_ora_45673.trc
Standby terminal recovery start SCN: 1874535
RESETLOGS after incomplete recovery UNTIL CHANGE 1874536
Online log /u01/app/oracle/oradata/oradgphy/redo01.log: Thread 1 Group 1 was previously cleared
Online log /u01/app/oracle/oradata/oradgphy/redo02.log: Thread 1 Group 2 was previously cleared
Online log /u01/app/oracle/oradata/oradgphy/redo03.log: Thread 1 Group 3 was previously cleared
Standby became primary SCN: 1874534
Setting recovery target incarnation to 3
AUDIT_TRAIL initialization parameter is changed back to its original value as specified in the parameter file.
Switchover: Complete - Database mounted as primary
Completed: alter database commit to switchover to primary with session shutdown
Sun Jul 26 21:36:45 2015
idle dispatcher 'D000' terminated, pid = (17, 1)
Sun Jul 26 21:36:54 2015
ARC0: Becoming the 'no SRL' ARCH
Sun Jul 26 21:36:55 2015
ARC1: Becoming the 'no SRL' ARCH
一.4.2.3 切換後的測試
21:38:49 SQL> alter system switch logfile;
21:40:59 SQL> delete from test where rownum<=10000;
已删除10000行。
已用時間: 00: 00: 00.13
21:41:31 SQL> commit;
21:42:27 SQL> set line 9999
21:42:49 SQL> col DEST_NAME format a20
21:42:49 SQL> col DESTINATION format a20
21:42:49 SQL> col GAP_STATUS format a10
21:42:49 SQL> col DB_UNIQUE_NAME format a10
21:42:49 SQL> col error format a10
21:42:49 SQL> SELECT al.thread#,
21:42:50 2 ads.dest_id,
21:42:50 3 ads.DEST_NAME,
21:42:50 4 (SELECT ad.TARGET
21:42:50 5 FROM v$archive_dest AD
21:42:50 6 WHERE AD.DEST_ID = ADS.DEST_ID) TARGET,
21:42:50 7 ADS.DATABASE_MODE,
21:42:50 8 ads.STATUS,
21:42:50 9 ads.error,
21:42:50 10 ads.TYPE,
21:42:50 11 ads.RECOVERY_MODE,
21:42:50 12 ads.DB_UNIQUE_NAME,
21:42:50 13 ads.DESTINATION,
21:42:50 14 ads.GAP_STATUS,
21:42:50 15 (SELECT MAX(sequence#) FROM v$log na WHERE na.thread# = al.thread#) "Current Sequence",
21:42:50 16 MAX(sequence#) "Last Archived",
21:42:50 17 MAX(decode(al.APPLIED, 'YES', sequence#)) APPLIED_SEQ#
21:42:50 18 FROM (SELECT *
21:42:50 19 FROM v$archived_log V
21:42:50 20 WHERE V.resetlogs_change# =
21:42:50 21 (SELECT d.RESETLOGS_CHANGE# FROM v$database d)) al,
21:42:50 22 v$archive_dest_status ads
21:42:50 23 WHERE al.dest_id(+) = ads.dest_id
21:42:50 24 AND ads.STATUS != 'INACTIVE'
21:42:50 25 GROUP BY al.thread#,
21:42:50 26 ads.dest_id,
21:42:50 27 ads.DEST_NAME,
21:42:50 28 ads.STATUS,
21:42:50 29 ads.error,
21:42:50 30 ads.TYPE,
21:42:50 31 ADS.DATABASE_MODE,
21:42:50 32 ads.RECOVERY_MODE,
21:42:50 33 ads.DB_UNIQUE_NAME,
21:42:50 34 ads.DESTINATION,
21:42:50 35 ads.GAP_STATUS
21:42:50 36 ORDER BY al.thread#,
21:42:50 37 ads.dest_id;
THREAD# DEST_ID DEST_NAME TARGET DATABASE_MODE STATUS ERROR TYPE RECOVERY_MODE DB_UNIQUE_ DESTINATION GAP_STATUS Current Sequence Last Archived APPLIED_SEQ#
---------- ---------- -------------------- ------- --------------- --------- ---------- -------------- ----------------------- ---------- -------------------- ---------- ---------------- ------------- ------------
1 1 LOG_ARCHIVE_DEST_1 PRIMARY OPEN VALID LOCAL IDLE oradgphy 4 3
2 LOG_ARCHIVE_DEST_2 STANDBY UNKNOWN ERROR ORA-01034: UNKNOWN IDLE oradg11g tns_oradg11g RESOLVABLE
ORACLE GAP
不可用
21:42:50 SQL>
此時,failover過程成功。
一.4.2.4 原主庫修複後,開機
21:52:00 SQL> startup
ORACLE 例程已經啟動。
Total System Global Area 208769024 bytes
Fixed Size 2226936 bytes
Variable Size 146801928 bytes
Database Buffers 54525952 bytes
Redo Buffers 5214208 bytes
資料庫裝載完畢。
資料庫已經打開。
21:52:15 SQL> alter database commit to switchover to physical standby with session shutdown;
alter database commit to switchover to physical standby with session shutdown
*
第 1 行出現錯誤:
ORA-16416: 沒有可行的 Physical Standby 切換目标
已用時間: 00: 00: 02.06
21:52:24 SQL> select name, LOG_MODE, OPEN_MODE, database_role, SWITCHOVER_STATUS, db_unique_name from v$database;
ORADG11G ARCHIVELOG READ WRITE PRIMARY FAILED DESTINATION oradg11g
21:52:31 SQL>
現在原來的主庫被修複後,整個DataGuara架構已經被破壞了,是以必須把原來的主庫删除後建構成新的備庫,重新恢複DataGuard的環境,最後可以根據需要是否進行switchover切換來調整環境。
一.4.2.5 在源主庫上重新搭建實體dg
SQL*Plus: Release 11.2.0.3.0 Production on 星期日 7月 26 21:59:40 2015
21:59:40 SQL> alter database close;
已用時間: 00: 00: 02.17
22:00:01 SQL> alter system enable restricted session;
22:00:05 SQL> drop database;
資料庫已删除。
從 Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options 斷開
已用時間: 00: 00: 08.50
22:00:31 SQL> exit
[oracle@rhel6_lhr oradg11g]$ cd $ORACLE_HOME/dbs
[oracle@rhel6_lhr dbs]$ rm -rf spfileoradg11g.ora
[oracle@rhel6_lhr dbs]$ ll spfileoradg11g.ora
ls: cannot access spfileoradg11g.ora: No such file or directory
[oracle@rhel6_lhr dbs]$ more initoradg
initoradg11g.ora initoradglg.ora initoradgphy.ora initoradgss.ora
[oracle@rhel6_lhr dbs]$ more initoradg11g.ora
db_name='oradg11g'
[oracle@rhel6_lhr dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on 星期日 7月 26 22:02:20 2015
已連接配接到空閑例程。
22:02:20 SQL> startup nomount;
Total System Global Area 250560512 bytes
Fixed Size 2227256 bytes
Variable Size 192938952 bytes
Database Buffers 50331648 bytes
Redo Buffers 5062656 bytes
22:02:25 SQL> exit
[oracle@rhel6_lhr dbs]$
oracle@rhel6_lhr dbs]$ rman target sys/lhr@tns_oradgphy auxiliary sys/lhr@tns_oradg11g
恢複管理器: Release 11.2.0.3.0 - Production on 星期日 7月 26 22:04:17 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
已連接配接到目标資料庫: ORADG11G (DBID=1403587593)
已連接配接到輔助資料庫: ORADG11G (未裝載)
RMAN> duplicate target database
2> for standby nofilenamecheck
3> from active database
4> DORECOVER
5> spfile
6> set db_unique_name='oradg11g'
7> set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST db_unique_name=oradg11g valid_for=(ALL_LOGFILES,ALL_ROLES)'
8> set log_archive_dest_2='SERVICE=tns_oradgphy LGWR ASYNC db_unique_name=oradgphy valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)'
9> set log_archive_dest_3='SERVICE=tns_oradglg LGWR ASYNC db_unique_name=oradglg valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)'
10> set log_archive_dest_4='SERVICE=tns_oradgss LGWR ASYNC db_unique_name=oradgss valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)'
11> set log_archive_dest_state_1='ENABLE'
12> set log_archive_dest_state_2='ENABLE'
13> set log_archive_dest_state_3='defer'
14> set log_archive_dest_state_4='defer'
15> set standby_file_management='AUTO'
16> set fal_client='oradg11g'
17> set fal_server='oradgphy'
18> set control_files='/u01/app/oracle/oradata/oradg11g/control01.ctl','/u01/app/oracle/flash_recovery_area/oradg11g/control02.ctl'
19> set db_file_name_convert='oradgphy','oradg11g'
20> set log_file_name_convert='oradgphy','oradg11g'
21> set memory_target='200M'
22> set audit_file_dest='/u01/app/oracle/admin/oradg11g/adump'
23> ;
啟動 Duplicate Db 于 2015-07-26 22:04:34
使用目标資料庫控制檔案替代恢複目錄
配置設定的通道: ORA_AUX_DISK_1
通道 ORA_AUX_DISK_1: SID=171 裝置類型=DISK
記憶體腳本的内容:
{
backup as copy reuse
targetfile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapworadgphy' auxiliary format
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapworadg11g' targetfile
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfileoradgphy.ora' auxiliary format
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfileoradg11g.ora' ;
sql clone "alter system set spfile= ''/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfileoradg11g.ora''";
}
正在執行記憶體腳本
啟動 backup 于 2015-07-26 22:04:34
配置設定的通道: ORA_DISK_1
通道 ORA_DISK_1: SID=145 裝置類型=DISK
完成 backup 于 2015-07-26 22:04:37
sql 語句: alter system set spfile= ''/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfileoradg11g.ora''
sql clone "alter system set db_unique_name =
''oradg11g'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_1 =
''LOCATION=USE_DB_RECOVERY_FILE_DEST db_unique_name=oradg11g valid_for=(ALL_LOGFILES,ALL_ROLES)'' comment=
sql clone "alter system set log_archive_dest_2 =
''SERVICE=tns_oradgphy LGWR ASYNC db_unique_name=oradgphy valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)'' comment=
sql clone "alter system set log_archive_dest_3 =
''SERVICE=tns_oradglg LGWR ASYNC db_unique_name=oradglg valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)'' comment=
sql clone "alter system set log_archive_dest_4 =
''SERVICE=tns_oradgss LGWR ASYNC db_unique_name=oradgss valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)'' comment=
sql clone "alter system set log_archive_dest_state_1 =
''ENABLE'' comment=
sql clone "alter system set log_archive_dest_state_2 =
sql clone "alter system set log_archive_dest_state_3 =
''defer'' comment=
sql clone "alter system set log_archive_dest_state_4 =
sql clone "alter system set standby_file_management =
''AUTO'' comment=
sql clone "alter system set fal_client =
sql clone "alter system set fal_server =
''oradgphy'' comment=
sql clone "alter system set control_files =
''/u01/app/oracle/oradata/oradg11g/control01.ctl'', ''/u01/app/oracle/flash_recovery_area/oradg11g/control02.ctl'' comment=
sql clone "alter system set db_file_name_convert =
''oradgphy'', ''oradg11g'' comment=
sql clone "alter system set log_file_name_convert =
sql clone "alter system set memory_target =
200M comment=
sql clone "alter system set audit_file_dest =
''/u01/app/oracle/admin/oradg11g/adump'' comment=
shutdown clone immediate;
startup clone nomount;
sql 語句: alter system set db_unique_name = ''oradg11g'' comment= '''' scope=spfile
sql 語句: alter system set log_archive_dest_1 = ''LOCATION=USE_DB_RECOVERY_FILE_DEST db_unique_name=oradg11g valid_for=(ALL_LOGFILES,ALL_ROLES)'' comment= '''' scope=spfile
sql 語句: alter system set log_archive_dest_2 = ''SERVICE=tns_oradgphy LGWR ASYNC db_unique_name=oradgphy valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)'' comment= '''' scope=spfile
sql 語句: alter system set log_archive_dest_3 = ''SERVICE=tns_oradglg LGWR ASYNC db_unique_name=oradglg valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)'' comment= '''' scope=spfile
sql 語句: alter system set log_archive_dest_4 = ''SERVICE=tns_oradgss LGWR ASYNC db_unique_name=oradgss valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)'' comment= '''' scope=spfile
sql 語句: alter system set log_archive_dest_state_1 = ''ENABLE'' comment= '''' scope=spfile
sql 語句: alter system set log_archive_dest_state_2 = ''ENABLE'' comment= '''' scope=spfile
sql 語句: alter system set log_archive_dest_state_3 = ''defer'' comment= '''' scope=spfile
sql 語句: alter system set log_archive_dest_state_4 = ''defer'' comment= '''' scope=spfile
sql 語句: alter system set standby_file_management = ''AUTO'' comment= '''' scope=spfile
sql 語句: alter system set fal_client = ''oradg11g'' comment= '''' scope=spfile
sql 語句: alter system set fal_server = ''oradgphy'' comment= '''' scope=spfile
sql 語句: alter system set control_files = ''/u01/app/oracle/oradata/oradg11g/control01.ctl'', ''/u01/app/oracle/flash_recovery_area/oradg11g/control02.ctl'' comment= '''' scope=spfile
sql 語句: alter system set db_file_name_convert = ''oradgphy'', ''oradg11g'' comment= '''' scope=spfile
sql 語句: alter system set log_file_name_convert = ''oradgphy'', ''oradg11g'' comment= '''' scope=spfile
sql 語句: alter system set memory_target = 200M comment= '''' scope=spfile
sql 語句: alter system set audit_file_dest = ''/u01/app/oracle/admin/oradg11g/adump'' comment= '''' scope=spfile
Oracle 執行個體已關閉
已連接配接到輔助資料庫 (未啟動)
Oracle 執行個體已啟動
系統全局區域總計 208769024 位元組
Fixed Size 2226936 位元組
Variable Size 113247496 位元組
Database Buffers 88080384 位元組
Redo Buffers 5214208 位元組
backup as copy current controlfile for standby auxiliary format '/u01/app/oracle/oradata/oradg11g/control01.ctl';
restore clone controlfile to '/u01/app/oracle/flash_recovery_area/oradg11g/control02.ctl' from
'/u01/app/oracle/oradata/oradg11g/control01.ctl';
啟動 backup 于 2015-07-26 22:04:44
使用通道 ORA_DISK_1
通道 ORA_DISK_1: 啟動資料檔案副本
複制備用控制檔案
輸出檔案名=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_oradgphy.f 标記=TAG20150726T220444 RECID=11 STAMP=886111485
通道 ORA_DISK_1: 資料檔案複制完畢, 經過時間: 00:00:01
完成 backup 于 2015-07-26 22:04:45
啟動 restore 于 2015-07-26 22:04:45
通道 ORA_AUX_DISK_1: SID=134 裝置類型=DISK
通道 ORA_AUX_DISK_1: 已複制控制檔案副本
完成 restore 于 2015-07-26 22:04:47
sql clone 'alter database mount standby database';
sql 語句: alter database mount standby database
set newname for tempfile 1 to
"/u01/app/oracle/oradata/oradg11g/temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/u01/app/oracle/oradata/oradg11g/system01.dbf";
set newname for datafile 2 to
"/u01/app/oracle/oradata/oradg11g/sysaux01.dbf";
set newname for datafile 3 to
"/u01/app/oracle/oradata/oradg11g/undotbs01.dbf";
set newname for datafile 4 to
"/u01/app/oracle/oradata/oradg11g/users01.dbf";
set newname for datafile 5 to
"/u01/app/oracle/oradata/oradg11g/example01.dbf";
set newname for datafile 6 to
"/u01/app/oracle/oradata/oradg11g/logmnrtbs1.dbf";
datafile 1 auxiliary format
"/u01/app/oracle/oradata/oradg11g/system01.dbf" datafile
2 auxiliary format
"/u01/app/oracle/oradata/oradg11g/sysaux01.dbf" datafile
3 auxiliary format
"/u01/app/oracle/oradata/oradg11g/undotbs01.dbf" datafile
4 auxiliary format
"/u01/app/oracle/oradata/oradg11g/users01.dbf" datafile
5 auxiliary format
"/u01/app/oracle/oradata/oradg11g/example01.dbf" datafile
6 auxiliary format
"/u01/app/oracle/oradata/oradg11g/logmnrtbs1.dbf" ;
sql 'alter system archive log current';
正在執行指令: SET NEWNAME
臨時檔案 1 在控制檔案中已重命名為 /u01/app/oracle/oradata/oradg11g/temp01.dbf
啟動 backup 于 2015-07-26 22:04:52
輸入資料檔案: 檔案号=00001 名稱=/u01/app/oracle/oradata/oradgphy/system01.dbf
輸出檔案名=/u01/app/oracle/oradata/oradg11g/system01.dbf 标記=TAG20150726T220452
通道 ORA_DISK_1: 資料檔案複制完畢, 經過時間: 00:00:25
輸入資料檔案: 檔案号=00002 名稱=/u01/app/oracle/oradata/oradgphy/sysaux01.dbf
輸出檔案名=/u01/app/oracle/oradata/oradg11g/sysaux01.dbf 标記=TAG20150726T220452
通道 ORA_DISK_1: 資料檔案複制完畢, 經過時間: 00:00:15
輸入資料檔案: 檔案号=00005 名稱=/u01/app/oracle/oradata/oradgphy/example01.dbf
輸出檔案名=/u01/app/oracle/oradata/oradg11g/example01.dbf 标記=TAG20150726T220452
通道 ORA_DISK_1: 資料檔案複制完畢, 經過時間: 00:00:07
輸入資料檔案: 檔案号=00006 名稱=/u01/app/oracle/oradata/oradgphy/logmnrtbs1.dbf
輸出檔案名=/u01/app/oracle/oradata/oradg11g/logmnrtbs1.dbf 标記=TAG20150726T220452
通道 ORA_DISK_1: 資料檔案複制完畢, 經過時間: 00:00:03
輸入資料檔案: 檔案号=00003 名稱=/u01/app/oracle/oradata/oradgphy/undotbs01.dbf
輸出檔案名=/u01/app/oracle/oradata/oradg11g/undotbs01.dbf 标記=TAG20150726T220452
輸入資料檔案: 檔案号=00004 名稱=/u01/app/oracle/oradata/oradgphy/users01.dbf
輸出檔案名=/u01/app/oracle/oradata/oradg11g/users01.dbf 标記=TAG20150726T220452
完成 backup 于 2015-07-26 22:05:47
sql 語句: alter system archive log current
archivelog like "/u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_07_26/o1_mf_1_4_bv9t9vtg_.arc" auxiliary format
"/u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_4_%u_.arc" ;
catalog clone recovery area;
switch clone datafile all;
啟動 backup 于 2015-07-26 22:05:47
通道 ORA_DISK_1: 正在開始複制歸檔日志
輸入歸檔日志線程=1 序列=4 RECID=205 STAMP=886111547
輸出檔案名=/u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_4_11qd1v9s_.arc RECID=0 STAMP=0
通道 ORA_DISK_1: 歸檔日志複制完成, 經過時間: 00:00:01
完成 backup 于 2015-07-26 22:05:49
搜尋恢複區中的所有檔案
資料庫未知檔案的清單
=====================================
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_13/o1_mf_1_101_blphvhp6_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_08/o1_mf_1_94_bl9w2pcn_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_08/o1_mf_1_83_bl91pfk8_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_08/o1_mf_1_82_bl91gpm1_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_08/o1_mf_1_92_bl9w2htt_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_08/o1_mf_1_91_bl9w2cpb_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_08/o1_mf_1_86_bl91r2j5_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_08/o1_mf_1_84_bl91r03h_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_08/o1_mf_1_87_bl91r46j_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_08/o1_mf_1_89_bl944htj_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_08/o1_mf_1_96_bl9w7ym1_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_08/o1_mf_1_90_bl944mbj_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_08/o1_mf_1_88_bl944f8q_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_08/o1_mf_1_95_bl9w6x2l_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_08/o1_mf_1_85_bl91r1n9_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_08/o1_mf_1_93_bl9w2nqd_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_18_bkwnm191_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_8_bkwmq00d_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_7_bkwmhpjf_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_14_bkwn5m3n_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_28_bkwr591w_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_15_bkwn5onz_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_23_bkwp1926_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_6_bkwmho6g_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_10_bkwmts9r_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_29_bkwr5d1c_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_16_bkwnll4b_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_27_bkwr5820_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_12_bkwn2kg5_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_21_bkwp14lm_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_19_bkwnyrd9_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_20_bkwp12lg_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_5_bkwmhm1w_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_9_bkwms0xq_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_11_bkwn1m0k_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_22_bkwp18j4_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_25_bkwr53xb_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_24_bkwr51nw_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_26_bkwr5792_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_13_bkwn5jjr_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_03/o1_mf_1_17_bkwnltkg_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_12/o1_mf_1_100_blmt7y70_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_12/o1_mf_1_99_blmt7qw3_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_18/o1_mf_1_105_bm3b08sr_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_18/o1_mf_1_106_bm3b09br_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_18/o1_mf_1_108_bm46tv7x_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_18/o1_mf_1_107_bm3cr8c8_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_22/o1_mf_1_112_bmgqwv55_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_22/o1_mf_1_111_bmgqwr6x_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_52_bl6lzfrl_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_55_bl6m5bmw_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_41_bl6ksxpc_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_42_bl6kt79v_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_81_bl78wx8z_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_76_bl6zdp5q_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_59_bl6psk7g_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_78_bl70ggr3_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_38_bl6jxyv7_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_60_bl6rsyr5_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_66_bl6txphk_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_49_bl6lzbf9_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_58_bl6pphgd_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_69_bl6vsrjo_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_77_bl6zjwor_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_65_bl6tvoy4_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_67_bl6v0qpo_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_39_bl6kc33t_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_44_bl6ktcns_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_70_bl6w7xdb_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_43_bl6ktbhb_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_46_bl6lgrvk_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_51_bl6lzdv0_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_50_bl6lzcyk_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_74_bl6xszqy_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_64_bl6tq9wk_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_79_bl756jv6_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_53_bl6lzgjo_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_62_bl6s6n5b_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_73_bl6xsw3n_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_40_bl6kjq6t_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_75_bl6y75kr_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_45_bl6kzrco_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_63_bl6tg3n5_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_56_bl6m91dj_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_57_bl6pnhgz_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_68_bl6v2g09_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_72_bl6x12lr_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_80_bl75fxqq_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_47_bl6lmn9x_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_61_bl6ryph7_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_71_bl6wwf5z_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_54_bl6lzh6p_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_07/o1_mf_1_48_bl6lz8ml_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_16/o1_mf_1_102_blyzlgl4_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_10/o1_mf_1_98_blgfvnl1_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_10/o1_mf_1_97_blgfvjsq_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_05/o1_mf_1_33_bl1sgljq_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_05/o1_mf_1_34_bl1t30n7_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_05/o1_mf_1_37_bl1tm3wp_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_05/o1_mf_1_32_bl1sghl1_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_05/o1_mf_1_35_bl1t82c7_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_05/o1_mf_1_31_bl1r7lvx_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_05/o1_mf_1_30_bl1r2khh_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_05/o1_mf_1_36_bl1tfkwh_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_17/o1_mf_1_104_bm0sphhn_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_17/o1_mf_1_103_bm0spdc0_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_19/o1_mf_1_109_bm6c1gkg_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_04_19/o1_mf_1_110_bm6vnvn8_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_162_bv9lv9dh_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_140_bv9f7bto_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_128_bv9bx6q6_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_159_bv9lv1lc_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_150_bv9l2tf8_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_175_bv9np57g_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_174_bv9njntv_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_123_bv8tk683_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_163_bv9lvb3z_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_125_bv8tlqbg_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_149_bv9l2tg6_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_124_bv8tln9j_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_119_bv8tfqjl_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_143_bv9g0kcy_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_153_bv9l3yvc_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_126_bv9bjbtc_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_115_bv8l7zwj_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_186_bv9sjh4n_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_127_bv9bjfyx_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_176_bv9np9s1_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_182_bv9r54gy_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_139_bv9dntg5_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_152_bv9l3vjz_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_4_bv9d1fw8_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_183_bv9sf8gz_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_161_bv9lv8m7_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_178_bv9nsfr4_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_4_11qd1v9s_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_157_bv9lplmh_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_158_bv9lqynz_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_169_bv9mo6vz_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_173_bv9njhh7_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_167_bv9mo4gs_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_170_bv9mo7ol_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_187_bv9sjhkw_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_164_bv9lvbtq_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_141_bv9f7z0g_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_120_bv8tfqjb_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_1_bv9d1foq_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_113_bv8k3g8d_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_130_bv9cn3l6_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_122_bv8tk1hh_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_129_bv9bxd7k_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_171_bv9nfm1o_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_188_bv9sjphl_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_148_bv9l2tfo_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_166_bv9mo2o1_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_114_bv8k3l2v_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_168_bv9mo6vs_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_121_bv8tdl7m_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_160_bv9lv7l7_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_146_bv9hpfhc_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_138_bv9dnqfx_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_116_bv8ly4j0_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_180_bv9r3b5v_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_154_bv9l5ko5_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_3_bv9d1fkm_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_144_bv9g11md_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_155_bv9ldn80_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_118_bv8rwvmt_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_147_0pqd1l03_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_184_bv9sf9yd_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_156_bv9ldr9q_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_185_bv9shl4j_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_172_bv9nfnyf_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_181_bv9r4l18_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_165_bv9lvfkz_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_2_bv9cn3kt_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_151_bv9l2xfj_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_145_0hqd1kbq_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_179_bv9r1cp8_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_117_bv8rwqbv_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_177_bv9ns9rj_.arc
檔案名: /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_5_bv9d3yjl_.arc
正在編制檔案目錄...
目錄編制完畢
已列入目錄的檔案的清單
=======================
資料檔案 1 已轉換成資料檔案副本
輸入資料檔案副本 RECID=11 STAMP=886111550 檔案名=/u01/app/oracle/oradata/oradg11g/system01.dbf
資料檔案 2 已轉換成資料檔案副本
輸入資料檔案副本 RECID=12 STAMP=886111550 檔案名=/u01/app/oracle/oradata/oradg11g/sysaux01.dbf
資料檔案 3 已轉換成資料檔案副本
輸入資料檔案副本 RECID=13 STAMP=886111550 檔案名=/u01/app/oracle/oradata/oradg11g/undotbs01.dbf
資料檔案 4 已轉換成資料檔案副本
輸入資料檔案副本 RECID=14 STAMP=886111550 檔案名=/u01/app/oracle/oradata/oradg11g/users01.dbf
資料檔案 5 已轉換成資料檔案副本
輸入資料檔案副本 RECID=15 STAMP=886111550 檔案名=/u01/app/oracle/oradata/oradg11g/example01.dbf
資料檔案 6 已轉換成資料檔案副本
輸入資料檔案副本 RECID=16 STAMP=886111550 檔案名=/u01/app/oracle/oradata/oradg11g/logmnrtbs1.dbf
set until scn 1877456;
recover
standby
clone database
delete archivelog
;
正在執行指令: SET until clause
啟動 recover 于 2015-07-26 22:05:50
使用通道 ORA_AUX_DISK_1
正在開始媒體的恢複
線程 1 序列 4 的歸檔日志已作為檔案 /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_4_11qd1v9s_.arc 存在于磁盤上
歸檔日志檔案名=/u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_07_26/o1_mf_1_4_11qd1v9s_.arc 線程=1 序列=4
媒體恢複完成, 用時: 00:00:00
完成 recover 于 2015-07-26 22:05:51
完成 Duplicate Db 于 2015-07-26 22:06:01
RMAN>
SQL*Plus: Release 11.2.0.3.0 Production on 星期日 7月 26 22:07:32 2015
22:07:32 SQL>
22:07:33 SQL> select dbid,name,current_scn,protection_mode,database_role,force_logging,open_mode,switchover_status from v$database;
DBID NAME CURRENT_SCN PROTECTION_MODE DATABASE_ROLE FOR OPEN_MODE SWITCHOVER_STATUS
---------- --------- ----------- -------------------- ---------------- --- -------------------- --------------------
1403587593 ORADG11G 1877455 MAXIMUM PERFORMANCE PHYSICAL STANDBY YES MOUNTED NOT ALLOWED
22:07:34 SQL> alter database open;
22:07:45 SQL> alter database recover managed standby database using current logfile disconnect;
已用時間: 00: 00: 06.02
22:07:56 SQL> 22:07:56 SQL>
22:08:03 SQL> select dbid,name,current_scn,protection_mode,database_role,force_logging,open_mode,switchover_status from v$database;
1403587593 ORADG11G 1877455 MAXIMUM PERFORMANCE PHYSICAL STANDBY YES MOUNTED NOT ALLOWED
校驗:
22:10:49 SQL> show parameter unique_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string oradgphy
22:10:55 SQL> select count(1) from test;
1194000
22:11:01 SQL> delete from test where rownum<=9400;
已删除9400行。
22:11:45 SQL> commit;
22:11:48 SQL> select count(1) from test;
1184600
已用時間: 00: 00: 00.06
22:12:10 SQL> conn sys/lhr@tns_oradg11g as sysdba
已連接配接。
22:12:14 SQL> select count(1) from test;
22:12:17 SQL>
一.4.2.6 重新做switchover操作還原成最初的環境
23:16:58 SQL> show parameter unique_name
23:17:31 SQL> select name, LOG_MODE, OPEN_MODE, database_role, SWITCHOVER_STATUS, db_unique_name from v$database;
ORADG11G ARCHIVELOG READ WRITE PRIMARY TO STANDBY oradgphy
23:17:52 SQL> alter database commit to switchover to physical standby with session shutdown;
已用時間: 00: 00: 04.83
23:18:15 SQL>
23:19:27 SQL>
23:19:27 SQL> select name, LOG_MODE, OPEN_MODE, database_role, SWITCHOVER_STATUS, db_unique_name from v$database;
ORADG11G ARCHIVELOG READ WRITE PHYSICAL STANDBY RECOVERY NEEDED oradgphy
23:19:45 SQL> select name, LOG_MODE, OPEN_MODE, database_role, SWITCHOVER_STATUS, db_unique_name from v$database;
ORADG11G ARCHIVELOG READ WRITE PHYSICAL STANDBY RECOVERY NEEDED oradgphy
23:21:48 SQL> startup mount;
ORA-01081: 無法啟動已在運作的 ORACLE - 請先将其關閉
23:21:57 SQL> shutdown abort;
23:22:28 SQL> startup mount;
Total System Global Area 242171904 bytes
Variable Size 197133256 bytes
Database Buffers 37748736 bytes
23:22:51 SQL> select name, LOG_MODE, OPEN_MODE, database_role, SWITCHOVER_STATUS, db_unique_name from v$database;
ORADG11G ARCHIVELOG MOUNTED PHYSICAL STANDBY RECOVERY NEEDED oradgphy
23:22:53 SQL> select name, LOG_MODE, OPEN_MODE, database_role, SWITCHOVER_STATUS, db_unique_name from v$database;
源主庫:
23:22:35 SQL> select name, LOG_MODE, OPEN_MODE, database_role, SWITCHOVER_STATUS, db_unique_name from v$database;
ORADG11G ARCHIVELOG READ ONLY WITH APPLY PHYSICAL STANDBY TO PRIMARY oradg11g
23:22:36 SQL> alter database commit to switchover to primary with session shutdown;
已用時間: 00: 00: 03.08
23:24:06 SQL> alter database open;
已用時間: 00: 00: 00.41
23:24:13 SQL> select name, LOG_MODE, OPEN_MODE, database_role, SWITCHOVER_STATUS, db_unique_name from v$database;
已用時間: 00: 00: 00.42
備庫:
23:24:21 SQL> alter database open;
23:24:31 SQL> alter database recover managed standby database using current logfile disconnect;
至此所有的實驗完畢,資料庫也已經還原到最初的狀态了。
3、結論
Failover是Dataguard的一個重要功能特性。經過Failover,我們認為Primary站點其實已經不能作為HA架構成員了。重新讓Primary加入進去的方法有三個:一個是利用RMAN備份将Primary恢複到failover之前,重新進行日志彌補、角色切換;第二個方法是利用Flashback Database政策,将資料庫恢複到failover之前的時間點;第三個是删除Primary資料庫,重新利用新Primary搭建standby。
進行Dataguard switchover和failover是非常常見的運維需求,在實際場景下,我們盡可能選擇穩妥完全的政策進行操作,SQL指令還是我們比較好的選擇,多操作幾次就熟悉了。
...........................................................................................................................................................................................
本文作者:小麥苗,隻專注于資料庫的技術,更注重技術的運用
QQ:642808185 若加QQ請注明你所正在讀的文章标題
創作時間地點:2015-07-26 09:00~ 2015-07-27 19:00 于唐鎮金唐較高價的電梯大廈宿舍
<版權所有,文章允許轉載,但須以連結方式注明源位址,否則追究法律責任!>
本文轉自lhrbest 51CTO部落格,原文連結:http://blog.51cto.com/lhrbest/1678766,如需轉載請自行聯系原作者