ORA-31526: could not find source table string.string for CDC change table string.string ORACLE 报错 故障修复 远程处理

文档解释

ORA-31526: could not find source table string.string for CDC change table string.string

Cause: The source table was missing or was not set up correctly for an imported Change Data Capture change table. A synchronous change table requires the source table to exist and have the Change Data Capture trigger defined on it. An asynchronous change table requires table rules to be defined for the source table.

Action: Drop the imported change table because it is invalid. Verify that the schema containing the source table was included in the original export. If needed, perform the export again, including the schema of the source table. If change table is asynchronous, ensure that STREAMS_CONFIGURATION=y is specified for the import.

错误说明:

ORA-31526错误是ORACLE数据库用户在尝试使用Change Data Capture (CDC) 功能时遇到的错误,表示在尝试创建/使用某个更改表(change table)时或者查询更改表时,未能找到对应源表(source table)。

常见案例

ORA-31526错误可以出现在以下几种情形中:

1. 在尝试创建CDC更改表时发生,表示ORACLE并未检测到相应的源表;

2. 在尝试使用CDC更改表时发生,表示更改表未能与相应的源表建立关联;

3. 在尝试查询CDC更改表时发生,表示更改表并未包含对应的源表信息。

解决方法:

1. 如果想要创建CDC更改表时遇到此错误,需检查源表是否存在,并重建CDC更改表:

SQL> BEGIN

DBMS_CDC_PUBLISH.CREATE_CHANGE_TABLE (

source_schema => ‘schema’,

source_table => ‘table_name’,

change_table => ‘table_name_ct’);

END;

2. 如果想要查询CDC更改表时遇到此错误,需重新启用现有CDC更改表:

SQL> BEGIN

DBMS_CDC_PUBLISH.ALTER_CHANGE_TABLE (

source_schema => ‘schema’,

source_table => ‘table_name’,

change_table => ‘table_name_ct’);

END;

3. 如果想要使用CDC更改表时遇到此错误,则可以检查源表是否存在,然后来更新CDC更改表的变更:

SQL> EXECUTE DBMS_CDC_PUBLISH.SCHEMA_CHANGE_SET(‘schema’, ‘table_name’, SYSDATE);

4. 没有源表可用时,可以手动拆除CDC更改表,然后重新创建CDC更改表,最后再重新连接到相应源表:

SQL> BEGIN

DBMS_CDC_PUBLISH.DROP_CHANGE_TABLE (

source_schema => ‘schema’,

source_table => ‘table_name’,

change_table => ‘table_name_ct’);

DBMS_CDC_PUBLISH.CREATE_CHANGE_TABLE (

source_schema => ‘schema’,

source_table => ‘table_name’,

change_table => ‘table_name_ct’);

END;

SQL> EXECUTE DBMS_CDC_PUBLISH.SCHEMA_CHANGE_SET(‘schema’, ‘table_name’, SYSDATE);


数据运维技术 » ORA-31526: could not find source table string.string for CDC change table string.string ORACLE 报错 故障修复 远程处理