时间:2021-07-01 10:21:17 帮助过:49人阅读
注意,在操作dataguard环境里,在操作undo表空间和数据时, 要特别注意,这里就是一个例子。发现没有变化undo_tablespace,于是想
Oracle 11g dataguard undo恢复
环境:
os:CentOS5.5
db:oracle11g datauard
version:11.2.0.2.0
在primary收缩数据文件大小
ALTER DATABASE
DATAFILE '/oracle/oradata/skatedb/undotbs03.dbf'
RESIZE 1024M;
稍后就收到报警短信,登录standby库,发现在alert.logl里有如下错误
......
Media Recovery Waiting for thread 1 sequence 17248 (in transit)
Recovery of Online Redo Log: Thread 1 Group 8 Seq 17248 Reading mem 0
Mem# 0: /oracle/oradata/skatedb/sdbyredo08.log
Thu Oct 11 13:59:06 2012
Archived Log entry 10938 added for thread 1 sequence 17247 ID 0xa47b04d0 dest 1:
Thu Oct 11 14:06:26 2012
Errors in file /oracle/app/diag/rdbms/skate04/skatedb/trace/skatedb_pr0d_25721.trc (incident=40497):
ora-00600: internal error code, arguments: [3020], [3], [160], [12583072], [], [], [], [], [], [], [], []
ora-10567: Redo is inconsistent with data block (file# 3, block# 160, file offset is 1310720 bytes)
ora-10564: tablespace UNDOTBS1
ora-01110: data file 3: '/oracle/oradata/skatedb/undotbs01.dbf'
ora-10560: block type 'KTU SMU HEADER BLOCK'
Incident details in: /oracle/app/diag/rdbms/skate04/skatedb/incident/incdir_40497/skatedb_pr0d_25721_i40497.trc
Thu Oct 11 14:06:52 2012
......
standby库无法apply
重启standby,数据库可以
alter database mount standby database;
但是open read only的时候,总报如上的错误
在standby上,执行如下也不可以
sql> recover standby database;
为了解决这个问题,我们决定不恢复了undotbs01.dbf , 直接从primary把这个文件复制过来(主库的比较新),
然后在恢复standby库,操作如下:
为了数据文件的一致性,冻结表空间undo
1.primary:
sql> ALTER TABLESPACE UNDOTBS1 BEGIN BACKUP;
2.standby:
shutdown immediate
3.primary:
把primary上的undotbs01.dbf文件copy到standby上,待copy完之后,一定要解冻(如不解冻,在standby库apply时会hang住)
sql> ALTER TABLESPACE UNDOTBS1 END BACKUP;
4.standby:
sql> startup nomount;
sql> alter database mount standby database;
sql> alter database open read only;
sql> alter database recover managed standby database disconnect using current logfile;
注意,在操作dataguard环境里,在操作undo表空间和数据时, 要特别注意,这里就是一个例子。
还有一个例子,为了节省空间,决定收缩undo的大小,步骤如下:
1.在primary上新建undotbs2表空间,查看并验证了在primary和standby上都有的表空间和相应的数据文件
2.在primary上更换在线undo表空间,如下命令
SQL> alter system set undo_tablespace = undotbs2 scope=both;
System altered
SQL>
在primary上查看
SQL> show parameter undo
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string AUTO
undo_retention integer 900
undo_tablespace string UNDOTBS2
但在standby上查看
SQL> show parameter undo
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string AUTO
undo_retention integer 900
undo_tablespace string UNDOTBS1
发现没有变化undo_tablespace,,于是想通过更改到spfile文件里,然后重启库,结果错误出现(用如山方法恢复),理论不应该报错的。以后找环境继续测试的。
------end------