standby上增加tempfile报错ORA-00604,ORA-16000解决方法

众所周知在DG中对primary增加tempfile不会同步到standby上,所以增加tempfile需要在standby上操作,但这次在standby上增加tempfile却报错ORA-00604 ORA-16000 (mount状态,MRP cancel 报错依旧)。

分析:

这里ORA-00604通常是trigger在影响,因为时间紧迫没有做10046 trace,直接查询官方得到权威解释。

原来是因为DB安装了OGG其中trigger GGS_DDL_TRIGGER_BEFORE(trigger主要作用是记录DDL操作)影响到增加tempfile操作。


解决:

在primary中disable trigger GGS_DDL_TRIGGER_BEFORE 后,再standby增加tempfile成功,之后再对primary中trigger enable


官方文章:

11g Standby Unable To Add Temp File (文档 ID 2168646.1)

APPLIES TO:

Oracle Database - Enterprise Edition - Version 12.1.0.2 to 12.1.0.2 [Release 12.1]
Oracle Database - Enterprise Edition - Version 11.2.0.3 to 11.2.0.4 [Release 11.2]
Information in this document applies to any platform.

SYMPTOMS

This occurs in the PHYSICAL standby environment.

Alter tablespace saptmp add tempfile '+DATA'
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-16000: database open for read-only access
ORA-06512: at line 1147
ORA-16000: database open for read-only access

 

SQL> select name, database_role, open_mode from v$database;

NAME DATABASE_ROLE OPEN_MODE
--------- ---------------- --------------------
TPS    PHYSICAL STANDBY READ ONLY


CHANGES

Database DDL trigger added in the Primary.

CAUSE

 This is due to the recent addition of the database DDL trigger added in the Primary. The changes are ransported to the Standby environment.
  When trying to add temporary tablespace(Which is a DDL) in the Standby in READ ONLY mode,it will encounter misleading error message ORA-604 and ORA-16000

SOLUTION

First step get the output from the following SQL in the customer environment, make sure to compare the tempfiles on both PRIMARY and STANDBY environment.

(Note : In rare cases, there had been error messages reported but still the tempfile was added at the database level).


Data Collection

spool standby.out


set lines 200

select name, database_role, open_mode from v$database;
select FILE_NAME,STATUS, round(BYTES/1048576) from dba_temp_files;
REM <Substitute SAPTMP with appropriate Tablespace name
select dbms_metadata.get_ddl('TABLESPACE', 'SAPTMP') from dual;

select * from dba_triggers;


spool off

spool primary.out
set lines 200
select name, database_role, open_mode from v$database;
select FILE_NAME,STATUS, round(BYTES/1048576) from dba_temp_files;
REM <Substitute SAPTMP with appropriate Tablespace name
select dbms_metadata.get_ddl('TABLESPACE', 'SAPTMP') from dual;
select * from dba_triggers;
spool off


Sample output

select name, database_role, open_mode from v$database;

NAME DATABASE_ROLE OPEN_MODE
--------- ---------------- --------------------
TP100 PRIMARY READ WRITE

SQL> select FILE_NAME,STATUS, round(BYTES/1048576) from dba_temp_files;
FILE_NAME STATUS ROUND(BYTES/1048576)
----------------------------------- --------------- --------------------
+DATA/tp100/tempfile/psaptemp.338.797514523 ONLINE 30720
+DATA/tp100/tempfile/psaptemp.12326.846224883 ONLINE 30720
+DATA/tp100/tempfile/psaptemp.15382.871981083 ONLINE 30720

select dbms_metadata.get_ddl('TABLESPACE', 'SAPTMP') from dual;

DBMS_METADATA.GET_DDL('TABLESPACE','SAPTMP')
------------------------------------------------------------------------
CREATE TEMPORARY TABLESPACE "SAPTMP" TEMPFILE SIZE 32212254720 AUTOEXT

DBA_TRIGGERS view will list the details of the trigger, for example
Trigger Type : DDL
Owner : sys
name : GGS_DDL_TRIGGER_BEFORE
status : Enabled
Before ddl on database trigger


Solution


After identifying the suspect trigger, go ahead and disable the trigger in the PRIMARY

Example : ALTER TRIGGER sys.GGS_DDL_TRIGGER_BEFORE DISABLE;

Wait for the changes to be propagated in the STANDBY environment. Now you would be able to add the tempfile in the STANDBY using the "alter tablespace" SQL.

 

Despite above approach, if the error persists then follow the Troubleshooting section for further analysis.

Troubleshooting

Connect as sysdba

alter session set tracefile_identifier='add_tempfile';
alter session set events '10046 trace name context forever,level 12'
alter session set events '604 trace name ERRORSTACK level 3';
alter session set events '16000 trace name errorstack level 3';
-- (Run the Alter tablespace command here)
-- alter tablespace psaptemp add tempfile '+DATA';
-- Make sure to exit session
exit;

Identify all the tracefiles in the trace directory.
ls -al *add_tempfile*

Identify the 10046 trace and run tkprof on that tracefile

Collect the following from customer for review.

a. Upload all the raw trace files along with tkprof output file.

b. Also upload the Alert.log with the error message.

c. Output from

spool tempfile_info.out
select name, database_role, open_mode from v$database;
select file#,ts#, name,status,round(bytes/1048576),con_id from v$tempfile;
select FILE_NAME,STATUS, round(BYTES/1048576) from dba_temp_files;
REM REM <Substitute SAPTMP with appropriate Tablespace name
select dbms_metadata.get_ddl('TABLESPACE', 'SAPTMP') from dual;
select * from v#tempfile;
select * from dba_temp_files;
spool off

 

The 10046 and errorstack should reveal precise details why it is failing to create the temp file.


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25583515/viewspace-2168739/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/25583515/viewspace-2168739/

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ORA-01665 错误表示当前的控制文件不是备用控制文件,无法用于备用库的恢复。要解决这个问题,您可以按照以下步骤操作: 1. 首先,确认当前的控制文件是否确实是备用控制文件。可以使用以下 SQL 语句查询: ``` SELECT NAME, VALUE FROM V$PARAMETER WHERE NAME = 'control_files'; ``` 如果查询结果中只包含备用控制文件的路径,则说明当前的控制文件是备用控制文件。如果查询结果中包含多个控制文件路径,您需要确认其中哪一个是备用控制文件。 2. 如果确认当前的控制文件不是备用控制文件,则需要将其替换为备用控制文件。可以按照以下步骤进行操作: - 连接到主数据库,并使用以下命令生成备用控制文件的副本: ``` ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/path/to/standby/controlfile'; ``` - 将备用控制文件的副本传输到备用数据库,并将其命名为“control01.ctl”。 - 在备用数据库上,停止实例并将控制文件更名为“control02.ctl”。 - 将备用控制文件的副本复制到“control02.ctl”的位置。 - 启动实例并尝试启动备用数据库。 3. 如果确认当前的控制文件是备用控制文件,但仍然出现ORA-01665错误,则可能是由于备用控制文件的元数据与主数据库的控制文件不匹配导致的。您可以按照以下步骤解决此问题: - 在备用数据库上,停止实例并备份当前的控制文件。 - 使用以下命令删除当前的控制文件: ``` ALTER DATABASE RENAME FILE '/path/to/controlfile' TO '/path/to/controlfile.bak'; ``` - 将备用控制文件的副本复制到主数据库的控制文件所在的位置。 - 启动实例并尝试启动备用数据库。 通过以上操作,您应该能够解决ORA-01665错误并成功启动备用数据库

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值