logical standby 创建表空间报ORA-01119 故障解决

客户升级了主库,把裸设备改成了ASM形式,结果发现logical standby在创建表空间的时候报ORA-01119错误.如果是物理standby,我们可以通过设置db_file_name_convert来解决.但是logical standby这个参数是无效的.但是我们可以通过创建procedure来解决.在mos上有一篇文章叫Effect of Creating Tablespace/Datafile on Primary when Logical Standby in Place (ORA-01119) [ID 1390662.1].这篇文章介绍了如果解决这个问题.如果你的主库和你的备库都使用的是OMF来管理的话,则不存在这种问题,否则的话,我们需要进行以下步骤.
1.停止备库应用

alter database stop logical standby apply;

2.创建skip handle的存储过程.

SQL> CREATE OR REPLACE PROCEDURE SYS.HANDLE_TBS_DDL (
OLD_STMT IN VARCHAR2,
STMT_TYP IN VARCHAR2,
SCHEMA IN VARCHAR2,
NAME IN VARCHAR2,
XIDUSN IN NUMBER,
XIDSLT IN NUMBER,
XIDSQN IN NUMBER,
ACTION OUT NUMBER,
NEW_STMT OUT VARCHAR2
) AS
BEGIN
NEW_STMT := REPLACE(OLD_STMT,'ASM路径','文件系统路径');
ACTION := DBMS_LOGSTDBY.SKIP_ACTION_REPLACE;
EXCEPTION
WHEN OTHERS THEN
ACTION := DBMS_LOGSTDBY.SKIP_ACTION_ERROR;
NEW_STMT := NULL;
END HANDLE_TBS_DDL;
/
Procedure created.

SQL> EXECUTE DBMS_LOGSTDBY.SKIP (stmt => 'TABLESPACE',proc_name => 'sys.handle_tbs_ddl');

PL/SQL procedure successfully completed.

3.重新开启SQL应用.

SQL> ALTER DATABASE START LOGICAL STANDBY APPLY;
Database altered.

做了上述处理之后,我们就可以做测试,在主库上运行创建表空间的语句,在logical standby的库上面,可以看到应用成功.没有再报ORA-01119错误.
参考文档:Effect of Creating Tablespace/Datafile on Primary when Logical Standby in Place (ORA-01119) [ID 1390662.1]

分享到: 更多

Post a Comment

Your email is never published nor shared. Required fields are marked *