DG方式进行数据库迁移切换后,启动数据库时出现报错:ORA-30012: undo tablespace 'UNDOTBS1' does not exist or of wrong type
经分析为前一阶段有人为修改undo_tablespace指向的UNDO表空间名字,修改参数为ALTER SYSTEM SET undo_tablespace='UNDOTBS3' SCOPE=BOTH;导致在RAC环境这个修改的优化级是低于drdb1.undo_tablespace='UNDOTBS1'这样指定了实例名的参数的,重启数据库时按老参数查找UNDO表空间,所以出现报错找不到对应表空间。前期READ ONLY方式打开数据库时,没有报错此问题。
这也再次提醒我们做迁移等时,要在正式操作前核对好信息;数据库维护操作时,要谨慎,不埋雷,把操作做对。
处理过程如下:
1.OPEN数据库时报错信息:
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
Database altered.
SQL> select open_mode,protection_mode,switchover_status,database_role from v$database;
OPEN_MODE PROTECTION_MODE SWITCHOVER_STATUS DATABASE_ROLE
-------------------- -------------------- -------------------- ----------------
MOUNTED MAXIMUM PERFORMANCE NOT ALLOWED PRIMARY
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-30012: undo tablespace 'UNDOTBS1' does not exist or of wrong type
Process ID: 381193
Session ID: 387 Serial number: 3
2.查看ALERT及TRACE进行问题分析及处理-修改SPFILE中参数重启数据库即可;
SUCCESS: diskgroup RECOC1 was mounted
Fri Jun 05 21:15:51 2020
Thread 1 advanced to log sequence 17075 (thread open)
ARC1: Archiving disabled thread 2 sequence 30827
Fri Jun 05 21:15:51 2020
ERROR: failed to establish dependency between database AAABBBstd and diskgroup resource ora.RECOC1.dg
Thread 1 opened at log sequence 17075
Current log# 3 seq# 17075 mem# 0: +DATAC1/AAABBBstd/onlinelog/group_3.793.1039350493
Successful open of redo thread 1
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Fri Jun 05 21:15:51 2020
SMON: enabling cache recovery
Archived Log entry 4277 added for thread 2 sequence 30827 ID 0x0 dest 1:
Archived Log entry 4278 added for thread 1 sequence 17074 ID 0x32eeedce dest 1:
Undo initialization errored: err:30012 serial:0 start:4245300056 end:4245300116 diff:60 (0 seconds)
Errors in file /u01/app/oracle/diag/rdbms/AAABBBstd/AAABBB1/trace/AAABBB1_ora_95443.trc:
ORA-30012: undo tablespace 'UNDOTBS1' does not exist or of wrong type
Errors in file /u01/app/oracle/diag/rdbms/AAABBBstd/AAABBB1/trace/AAABBB1_ora_95443.trc:
ORA-30012: undo tablespace 'UNDOTBS1' does not exist or of wrong type
Error 30012 happened during db open, shutting down database
USER (ospid: 95443): terminating the instance due to error 30012
Instance terminated by USER, pid = 95443
ORA-1092 signalled during: alter database open...
opiodr aborting process unknown ospid (95443) as a result of ORA-1092
Fri Jun 05 21:15:53 2020
ORA-1092 : opitsk aborting process
4.老环境上的修改参数时动作的排查
可以查到修改参数时的错误:
================查找参数文件修改记录
Thu Apr 09 11:43:57 2020
drop tablespace undotbs1 including contents and datafiles
Thu Apr 09 11:07:25 2020
create undo tablespace undotbs3 datafile '+DATAC1/AAABBB/undotbs3.dbf' size 1024M reuse autoextend on next 100M maxsize unlimited
Completed: create undo tablespace undotbs3 datafile '+DATAC1/AAABBB/undotbs3.dbf' size 1024M reuse autoextend on next 100M maxsize unlimited
Thu Apr 09 11:10:52 2020
[36175] Successfully onlined Undo Tablespace 76.
[36175] **** active transactions found in undo Tablespace 2 - moved to Pending Switch-Out state.
[36175] active transactions found/affinity dissolution incompletein undo tablespace 2 during switch-out.
ALTER SYSTEM SET undo_tablespace='UNDOTBS3' SCOPE=BOTH; =======>>>>>没指定SID,参数文件中优化级小于指定了SID的值。
Thu Apr 09 11:14:27 2020
[236375] **** active transactions found in undo Tablespace 2 - moved to Pending Switch-Out state.
查看SPFILE
AAABBB1.thread=1
AAABBB2.thread=2
AAABBB1.undo_tablespace='UNDOTBS1'=======>>>>
AAABBB2.undo_tablespace='UNDOTBS2'
*.undo_tablespace='UNDOTBS3' =======>>>>