某次某用户反馈,一套Oracle 11g DG备库上,手动添加临时表空间文件命中ORA-00604和ORA-16000,如下所示:
SQL> alter tablespace TEMP add tempfile '/app/oracle/oradata/xxxdb/tempfile/temp02.dbf' size 1G autoextend on;
alter tablespace TEMP add tempfile '/app/oracle/oradata/xxxdb/tempfile/temp02.dbf' size 1G autoextend on
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 1302
ORA-16000: database open for read-only access
根据过往经验, DG 备库 TEMP 表空间是允许添加临时文件的,这是一个正常的操作,但在用户的环境上却产生报错,需要思考并进一步分析其根因。
将DG备库启动到read only状态后,此时即使查询临时表空间数据字典视图,也会命中ORA-报错,如下所示:
SQL> select tablespace_name, file_name from dba_temp_files;
ERROR at line 1:
ORA-01157: cannot identify/lock data file 2001 - see DBWR trace file
ORA-01110: data file 2001:
'/app/oracle/oradata/xxxdb/tempfile/temp.266.1029337351'
经过初步分析,怀疑可能是该临时文件并不真实存在导致,仅仅只是控制文件中记录了该信息,尝试手动将该信息清除,如下:
alter database tempfile '/app/oracle/oradata/lisdb/tempfile/temp.266.1029337351' drop;
再次尝试添加临时表空间文件报错依旧,如下:
SQL> alter tablespace TEMP add tempfile '/app/oracle/oradata/xxxdb/tempfile/temp02.dbf' size 1G autoextend on;
alter tablespace TEMP add tempfile '/app/oracle/oradata/xxxdb/tempfile/temp02.dbf' size 1G autoextend on
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 1302
ORA-16000: database open for read-only access
对于这些非常规场景,可以优先在MOS上进行关键词匹配,发现一篇与用户场景相关的文章 ORA-00604:ORA-16000: Alter Tablespace tablesapce_name add datafile On GG Configuration Database (Doc ID 2242898.1),该场景在使用OGG的环境中比较容易遇到,如下:
在该客户案例中,将该触发器禁用之后,TEMP表空间临时文件就可以正常创建,待创建完成后,再手动将触发器enable。当然除了这种方式之外,还有一种修改数据库参数临时生效的方式,也可以处理该问题。
该解决方案,是通过临时设置_system_trig_enabled隐含参数,起到临时禁用数据库全局触发器来进行规避,具体如下:
a] SQL> alter system set "_system_trig_enabled"=FALSE;
b] Execute the statement failing
c] After that make default behavior for _system_trig_enabled as :
d] sql> alter system set "_system_trig_enabled"=TRUE;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30310891/viewspace-3062367/ ,如需转载,请注明出处,否则将追究法律责任。