11g 邏輯備庫簡單故障處理
模擬同步失敗
備庫建立唯一性索引
SQL> create unique index idx_scott_t_1 on scott.t(user_id);
Index created.
Index created.
主庫插入重複資料
SQL> insert into scott.t select * from scott.t;
36 rows created.
SQL> commit;
Commit complete.
備庫自動停止同步
Mon Sep 29 17:22:32 2014
LOGSTDBY: SQL Apply about to stop with ORA-1
LOGSTDBY: SQL Apply finished logging error information
LOGSTDBY Apply process AS02 server id=2 pid=41 OS id=2535 stopped
Errors in file /u01/app/oracle/diag/rdbms/orcl2/orcl/trace/orcl_as02_2535.trc:
ORA-00001: unique constraint (SYS.IDX_SCOTT_T_1) violated
Mon Sep 29 17:22:36 2014
Errors in file /u01/app/oracle/diag/rdbms/orcl2/orcl/trace/orcl_lsp0_2507.trc:
ORA-26808: Apply process AS02 died unexpectedly.
ORA-00001: unique constraint (SYS.IDX_SCOTT_T_1) violated
Mon Sep 29 17:22:36 2014
LOGSTDBY Analyzer process AS00 server id=0 pid=39 OS id=2531 stopped
Mon Sep 29 17:22:36 2014
LOGSTDBY Apply process AS01 server id=1 pid=40 OS id=2533 stopped
Mon Sep 29 17:22:36 2014
LOGSTDBY Apply process AS03 server id=3 pid=42 OS id=2537 stopped
Mon Sep 29 17:22:36 2014
LOGSTDBY Apply process AS04 server id=4 pid=43 OS id=2539 stopped
Mon Sep 29 17:22:36 2014
LOGSTDBY Apply process AS05 server id=5 pid=44 OS id=2541 stopped
Mon Sep 29 17:22:40 2014
LOGMINER: session#=1 (Logical_Standby$), preparer MS02 pid=36 OS id=2518 sid=46 stopped
Mon Sep 29 17:22:40 2014
LOGMINER: session#=1 (Logical_Standby$), reader MS00 pid=34 OS id=2514 sid=44 stopped
Mon Sep 29 17:22:40 2014
LOGMINER: session#=1 (Logical_Standby$), builder MS01 pid=35 OS id=2516 sid=34 stopped
LOGSTDBY status: ORA-16222: automatic Logical Standby retry of last action
LOGMINER: Parameters summary for session# = 1
LOGMINER: Number of processes = 3, Transaction Chunk Size = 201
LOGMINER: Memory Size = 30M, Checkpoint interval = 150M
LOGMINER: SpillScn 1114702, ResetLogScn 995548
LOGMINER: summary for session# = 1
LOGMINER: StartScn: 0 (0x0000.00000000)
LOGMINER: EndScn: 0 (0x0000.00000000)
LOGMINER: HighConsumedScn: 1114646 (0x0000.00110216)
LOGMINER: session_flag: 0x1
LOGMINER: Read buffers: 16
Mon Sep 29 17:22:43 2014
LOGMINER: session#=1 (Logical_Standby$), reader MS00 pid=34 OS id=2554 sid=34 started
Mon Sep 29 17:22:43 2014
LOGMINER: session#=1 (Logical_Standby$), builder MS01 pid=35 OS id=2556 sid=44 started
Mon Sep 29 17:22:43 2014
LOGMINER: session#=1 (Logical_Standby$), preparer MS02 pid=36 OS id=2558 sid=45 started
LOGMINER: Turning ON Log Auto Delete
Mon Sep 29 17:22:45 2014
LOGSTDBY Analyzer process AS00 started with server id=0 pid=40 OS id=2560
Mon Sep 29 17:22:45 2014
LOGSTDBY Apply process AS01 started with server id=1 pid=41 OS id=2562
Mon Sep 29 17:22:45 2014
LOGSTDBY Apply process AS04 started with server id=4 pid=44 OS id=2568
Mon Sep 29 17:22:45 2014
Mon Sep 29 17:22:45 2014
LOGSTDBY Apply process AS05 started with server id=5 pid=45 OS id=2570
Mon Sep 29 17:22:45 2014
LOGSTDBY Apply process AS03 started with server id=3 pid=43 OS id=2566
LOGSTDBY Apply process AS02 started with server id=2 pid=42 OS id=2564
LOGMINER: Begin mining logfile for session 1 thread 1 sequence 42, /u01/app/oracle/fast_recovery_area/ORCL2/onlinelog/o1_mf_4_b2l8vov0_.log
LOGSTDBY: SQL Apply about to stop with ORA-1
LOGSTDBY: SQL Apply finished logging error information
LOGSTDBY Apply process AS01 server id=1 pid=41 OS id=2562 stopped
Errors in file /u01/app/oracle/diag/rdbms/orcl2/orcl/trace/orcl_lsp0_2507.trc:
ORA-26808: Apply process AS01 died unexpectedly.
ORA-00001: unique constraint (SYS.IDX_SCOTT_T_1) violated
LOGSTDBY Analyzer process AS00 server id=0 pid=40 OS id=2560 stopped
LOGSTDBY Apply process AS02 server id=2 pid=42 OS id=2564 stopped
LOGSTDBY Apply process AS03 server id=3 pid=43 OS id=2566 stopped
LOGSTDBY Apply process AS04 server id=4 pid=44 OS id=2568 stopped
LOGSTDBY Apply process AS05 server id=5 pid=45 OS id=2570 stopped
Errors in file /u01/app/oracle/diag/rdbms/orcl2/orcl/trace/orcl_as01_2562.trc:
ORA-00001: unique constraint (SYS.IDX_SCOTT_T_1) violated
LOGMINER: session#=1 (Logical_Standby$), reader MS00 pid=34 OS id=2554 sid=34 stopped
LOGMINER: session#=1 (Logical_Standby$), preparer MS02 pid=36 OS id=2558 sid=45 stopped
LOGMINER: session#=1 (Logical_Standby$), builder MS01 pid=35 OS id=2556 sid=44 stopped
LOGSTDBY: SQL Apply about to stop with ORA-1
LOGSTDBY: SQL Apply finished logging error information
LOGSTDBY Apply process AS02 server id=2 pid=41 OS id=2535 stopped
Errors in file /u01/app/oracle/diag/rdbms/orcl2/orcl/trace/orcl_as02_2535.trc:
ORA-00001: unique constraint (SYS.IDX_SCOTT_T_1) violated
Mon Sep 29 17:22:36 2014
Errors in file /u01/app/oracle/diag/rdbms/orcl2/orcl/trace/orcl_lsp0_2507.trc:
ORA-26808: Apply process AS02 died unexpectedly.
ORA-00001: unique constraint (SYS.IDX_SCOTT_T_1) violated
Mon Sep 29 17:22:36 2014
LOGSTDBY Analyzer process AS00 server id=0 pid=39 OS id=2531 stopped
Mon Sep 29 17:22:36 2014
LOGSTDBY Apply process AS01 server id=1 pid=40 OS id=2533 stopped
Mon Sep 29 17:22:36 2014
LOGSTDBY Apply process AS03 server id=3 pid=42 OS id=2537 stopped
Mon Sep 29 17:22:36 2014
LOGSTDBY Apply process AS04 server id=4 pid=43 OS id=2539 stopped
Mon Sep 29 17:22:36 2014
LOGSTDBY Apply process AS05 server id=5 pid=44 OS id=2541 stopped
Mon Sep 29 17:22:40 2014
LOGMINER: session#=1 (Logical_Standby$), preparer MS02 pid=36 OS id=2518 sid=46 stopped
Mon Sep 29 17:22:40 2014
LOGMINER: session#=1 (Logical_Standby$), reader MS00 pid=34 OS id=2514 sid=44 stopped
Mon Sep 29 17:22:40 2014
LOGMINER: session#=1 (Logical_Standby$), builder MS01 pid=35 OS id=2516 sid=34 stopped
LOGSTDBY status: ORA-16222: automatic Logical Standby retry of last action
LOGMINER: Parameters summary for session# = 1
LOGMINER: Number of processes = 3, Transaction Chunk Size = 201
LOGMINER: Memory Size = 30M, Checkpoint interval = 150M
LOGMINER: SpillScn 1114702, ResetLogScn 995548
LOGMINER: summary for session# = 1
LOGMINER: StartScn: 0 (0x0000.00000000)
LOGMINER: EndScn: 0 (0x0000.00000000)
LOGMINER: HighConsumedScn: 1114646 (0x0000.00110216)
LOGMINER: session_flag: 0x1
LOGMINER: Read buffers: 16
Mon Sep 29 17:22:43 2014
LOGMINER: session#=1 (Logical_Standby$), reader MS00 pid=34 OS id=2554 sid=34 started
Mon Sep 29 17:22:43 2014
LOGMINER: session#=1 (Logical_Standby$), builder MS01 pid=35 OS id=2556 sid=44 started
Mon Sep 29 17:22:43 2014
LOGMINER: session#=1 (Logical_Standby$), preparer MS02 pid=36 OS id=2558 sid=45 started
LOGMINER: Turning ON Log Auto Delete
Mon Sep 29 17:22:45 2014
LOGSTDBY Analyzer process AS00 started with server id=0 pid=40 OS id=2560
Mon Sep 29 17:22:45 2014
LOGSTDBY Apply process AS01 started with server id=1 pid=41 OS id=2562
Mon Sep 29 17:22:45 2014
LOGSTDBY Apply process AS04 started with server id=4 pid=44 OS id=2568
Mon Sep 29 17:22:45 2014
Mon Sep 29 17:22:45 2014
LOGSTDBY Apply process AS05 started with server id=5 pid=45 OS id=2570
Mon Sep 29 17:22:45 2014
LOGSTDBY Apply process AS03 started with server id=3 pid=43 OS id=2566
LOGSTDBY Apply process AS02 started with server id=2 pid=42 OS id=2564
LOGMINER: Begin mining logfile for session 1 thread 1 sequence 42, /u01/app/oracle/fast_recovery_area/ORCL2/onlinelog/o1_mf_4_b2l8vov0_.log
LOGSTDBY: SQL Apply about to stop with ORA-1
LOGSTDBY: SQL Apply finished logging error information
LOGSTDBY Apply process AS01 server id=1 pid=41 OS id=2562 stopped
Errors in file /u01/app/oracle/diag/rdbms/orcl2/orcl/trace/orcl_lsp0_2507.trc:
ORA-26808: Apply process AS01 died unexpectedly.
ORA-00001: unique constraint (SYS.IDX_SCOTT_T_1) violated
LOGSTDBY Analyzer process AS00 server id=0 pid=40 OS id=2560 stopped
LOGSTDBY Apply process AS02 server id=2 pid=42 OS id=2564 stopped
LOGSTDBY Apply process AS03 server id=3 pid=43 OS id=2566 stopped
LOGSTDBY Apply process AS04 server id=4 pid=44 OS id=2568 stopped
LOGSTDBY Apply process AS05 server id=5 pid=45 OS id=2570 stopped
Errors in file /u01/app/oracle/diag/rdbms/orcl2/orcl/trace/orcl_as01_2562.trc:
ORA-00001: unique constraint (SYS.IDX_SCOTT_T_1) violated
LOGMINER: session#=1 (Logical_Standby$), reader MS00 pid=34 OS id=2554 sid=34 stopped
LOGMINER: session#=1 (Logical_Standby$), preparer MS02 pid=36 OS id=2558 sid=45 stopped
LOGMINER: session#=1 (Logical_Standby$), builder MS01 pid=35 OS id=2556 sid=44 stopped
trace檔案/u01/app/oracle/diag/rdbms/orcl2/orcl/trace/orcl_as02_2535.trc裡有這個事務相關資訊
ERROR INFORMATION:
PRIMARY TXN xid: 0x0003.003.0000033b (XIDUSN = 3, XIDSLT = 3, XIDSQN = 827)
start scn: 0x0000.0011024e (1114702) commit scn: 0x0000.00110250 (1114704)
PRIMARY TXN xid: 0x0003.003.0000033b (XIDUSN = 3, XIDSLT = 3, XIDSQN = 827)
start scn: 0x0000.0011024e (1114702) commit scn: 0x0000.00110250 (1114704)
檢視裡有可讀性強的錯誤資訊
SQL> select event, status from DBA_LOGSTDBY_EVENTS;
EVENT STATUS
-------------------------------- -----------------------------------------------------------
insert into "SCOTT"."T" ORA-00001: unique constraint (SYS.IDX_SCOTT_T_1) violated
values
"USERNAME" = 'SYS',
"USER_ID" = 0,
"CREATED" = '17-SEP-11'
EVENT STATUS
-------------------------------- -----------------------------------------------------------
insert into "SCOTT"."T" ORA-00001: unique constraint (SYS.IDX_SCOTT_T_1) violated
values
"USERNAME" = 'SYS',
"USER_ID" = 0,
"CREATED" = '17-SEP-11'
。。。。。。。。。。。
根據上面的xidusn,xidslt,xidsqn跳過事務
SQL> exec dbms_logstdby.skip_transaction (3, 3, 827);
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
SQL> ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;
Database altered.
Database altered.
或者直接從檢視裡拼出語句
SQL> select event, status,'exec dbms_logstdby.skip_transaction ('||XIDUSN||', '||XIDSLT||', '||XIDSQN||');' from dba_logstdby_events where XIDUSN is not null;
EVENT STATUS
-------------------------------------------------- ----------------------------------------------------------------------------------------------------
'EXECDBMS_LOGSTDBY.SKIP_TRANSACTION('||XIDUSN||','||XIDSLT||','||XIDSQN||');'
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
insert into "SCOTT"."T" ORA-00001: unique constraint (SYS.IDX_SCOTT_T_1) violated
values
"USERNAME" = 'SYS',
"USER_ID" = 0,
"CREATED" = '17-SEP-11'
exec dbms_logstdby.skip_transaction (3, 3, 827);
EVENT STATUS
-------------------------------------------------- ----------------------------------------------------------------------------------------------------
'EXECDBMS_LOGSTDBY.SKIP_TRANSACTION('||XIDUSN||','||XIDSLT||','||XIDSQN||');'
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
insert into "SCOTT"."T" ORA-00001: unique constraint (SYS.IDX_SCOTT_T_1) violated
values
"USERNAME" = 'SYS',
"USER_ID" = 0,
"CREATED" = '17-SEP-11'
exec dbms_logstdby.skip_transaction (3, 3, 827);
。。。。。。。。。。。。。
還有一個辦法,就是全同步單表
1 在備庫上建立到主庫的dblink,要求dblink在主庫那邊的使用者能夠讀表、鎖表及SELECT_CATALOG_ROLE
create database link dg_orcl connect to system identified by oracle using 'dg_orcl';
2 呼叫儲存過程
exec dbms_logstdby.instantiate_table('SCOTT', 'T', 'DG_ORCL');
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26239116/viewspace-1476287/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 單節點主庫、邏輯備庫升級為RAC、物理備庫、邏輯備庫(1)
- 單節點主庫、邏輯備庫升級為RAC、物理備庫、邏輯備庫(2)
- 單節點主庫、邏輯備庫升級為RAC、物理備庫、邏輯備庫(3)
- 單節點主庫、邏輯備庫升級為RAC、物理備庫、邏輯備庫(4)
- 單節點主庫、邏輯備庫升級為RAC、物理備庫、邏輯備庫(5)
- Windows邏輯備份-EXPDP(保留5天內邏輯備份)批處理指令碼Windows指令碼
- 邏輯備庫Switchover
- 配置物理備庫+邏輯備庫
- 【DATAGUARD】DG系列之11g邏輯備庫的搭建
- 應對複雜故障問題的簡單故障處理庫包:FailsafeAI
- 11 管理邏輯備庫
- 【DATAGUARD】DG系列之邏輯備庫非實時更新小問題處理
- MySQL邏輯查詢處理MySql
- oracle 10g 物理備庫轉換邏輯備庫ORA-19953故障解決方法Oracle 10g
- 資料庫邏輯備份(轉)資料庫
- 影象處理庫GPUImage簡單使用GPUUI
- SAP gateway處理multiple key的邏輯Gateway
- 淺談zip格式處理邏輯漏洞
- 查詢處理的邏輯順序
- 邏輯備份全庫或者邏輯備份多個使用者的資料
- 4節點RAC建立邏輯備庫
- oracle邏輯備用資料庫(一)Oracle資料庫
- Nginx(二): worker 程式處理邏輯-流程框架Nginx框架
- Spring MVC的請求處理邏輯SpringMVC
- WM-QM未清TR處理邏輯
- Android 介面顯示與邏輯處理Android
- 邏輯Data Guard主備庫的轉換
- 【DataGuarad】邏輯遷移與standby備庫
- dataguard之邏輯備庫表空間不足
- 邏輯備庫上有指定表不應用
- ORACLE資料庫的邏輯備份(轉)Oracle資料庫
- 邏輯備份--mysqldumpMySql
- 簡記MySQL的邏輯備份(mydumper+mysqldump)MySql
- 物理DG與邏輯DG的區別與邏輯DG同步異常處理方法
- 邏輯DG主備庫轉換的failoverAI
- dataguard回顧之安裝——建立邏輯備庫
- 資料庫 Mysql 邏輯架構簡介資料庫MySql架構
- WCDMA測試庫故障處理過程