`
mikixiyou
  • 浏览: 1087284 次
  • 性别: Icon_minigender_1
  • 来自: 南京
博客专栏
C3c8d188-c0ab-3396-821d-b68331e21226
Oracle管理和开发
浏览量:349690
社区版块
存档分类
最新评论

逻辑备库之ORA-01403解决方法

阅读更多

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

0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics