邏輯備庫之ORA-01403解決方案

來源:互聯網
上載者:User

Oracle 的Data Guard環境中, 邏輯備庫應用進程停止,日誌顯示錯誤為ORA-01403 not data found 。

它具體資訊如下:

Mon May 21 10:39:31 2012

LOGSTDBY status: ORA-01403: no data found

LOGSTDBY Apply process P004 pid=143 OS id=13936 stopped

Mon May 21 10:39:32 2012

Errors in file /u01/app/oracle/admin/db/bdump/rdb_lsp0_13922.trc:

ORA-12801: error signaled in parallel query server P004

ORA-01403: no data found

LOGSTDBY Analyzer process P003 pid=38 OS id=13932 stopped

這種錯誤在logical standby 環境中很常見。

通過dba_logstdby_events 視圖查詢失敗的交易資訊。

查詢SQL 如下所示:

select event_time,

       xidusn,

       xidslt,

       xidsqn,

       status,

       status_code,

       event,

       'exec dbms_logstdby.skip_transaction(' || xidusn || ',' || xidslt || ',' ||

       xidsqn || ');' as exec_sql,

       a.*

  from dba_logstdby_events a

 where event_time = (select max(event_time) from dba_logstdby_events);

 

從event 列中我們查詢出失敗的具體資訊,是更新一張表失敗。

解決方案

這類問題的解決方案有兩種:

第一種,可以使用skip_transaction 方法忽略掉該事務。

 exec dbms_logstdby.skip_transaction(487,12,951001);

但這個方法有後遺症,接下來的同步過程中會有不斷的麻煩,資料沒找到的問題會層出不窮。

第二種,使用skip 方法忽略掉該表的所有的操作。

alter database stop logical standby apply;

execute dbms_logstdby.skip('DML','username','T_ZHUSHOU_ORDER');

execute dbms_logstdby.skip('SCHEMA_DDL','username','T_ZHUSHOU_ORDER');

alter database start logical standby apply immediate;

忽略掉出問題的表的DML 操作和SCHEMA_DDL 操作。

資料複製停止的問題是解決了,但這裡造成了一張表事實上不能同步了。

新問題:如何將已skip 的表再加入logical standby 中?

解決這個新問題主要是靠DBMS_LOGSTDBY.INSTANTIATE_TABLE 方法。

官方對它的使用說明:

This procedure creates and populates a table in the standby database from a corresponding table in the primary database. The table requires the name of the database link (dblink) as an input parameter. If the table already exists in the logical standby database, it will be dropped and re-created based on the table definition at the primary database. This procedure only brings over the data associated with the table, and not the associated indexes and constraints.

操作步驟如下:

1 、在邏輯備庫建立指向主庫的資料庫鏈路

2 、在邏輯備庫上unskip 掉該表。

unskip 之前需停止邏輯備庫應用日誌

alter database stop logical standby apply;

execute dbms_logstdby.unskip('DML','username','T_ZHUSHOU_ORDER');

execute dbms_logstdby.unskip('SCHEMA_DDL','username','T_ZHUSHOU_ORDER');

3 、使用INSTANTIATE_TABLE 重新執行個體化一張表。

EXECUTE DBMS_LOGSTDBY.INSTANTIATE_TABLE('username', 'T_ZHUSHOU_ORDER', 'DB_RAC');

注意,源庫上的使用者必須有  SELECT_CATALOG_ROLE 許可權,否則會報錯ORA-16276

SQL> EXECUTE DBMS_LOGSTDBY.INSTANTIATE_TABLE('username', 'T_ZHUSHOU_ORDER', 'DB_RAC');

 

begin DBMS_LOGSTDBY.INSTANTIATE_TABLE('username', 'T_ZHUSHOU_ORDER', 'DB_RAC'); end;

 

ORA-16276: specified database link does not correspond to primary database

ORA-06512: at "SYS.DBMS_INTERNAL_LOGSTDBY", line 5361

ORA-02019: connection description for remote database not found

ORA-06512: at "SYS.DBMS_LOGSTDBY", line 636

ORA-06512: at line 2

更多Oracle相關資訊見Oracle 專題頁面 http://www.bkjia.com/topicnews.aspx?tid=12

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.