控制文件发生损坏,如何恢复

1、You may need to create control files if:

  • All control files are lost because of a failure.
  • The name of a database needs to be changed.
  • The current settings in the control file need to be changed.

2、The behavior of multiplexed control files is this:

  • The database writes to all filenames listed for the initialization parameter CONTROL_FILES in the database initializaton parameter file.

oracle server 在往控制文件中写数据的时候,会同时往多个文件中写数据,而且内容是一样的.

  • The database reads only the first file listed in the CONTROL_FILES parameter during database operation.

oracle server 在读控制文件的时候,只会读第一个控制文件,其他的不读.

  • If any of the control files become unavailable during database operation,the instance becomes inoperable and should be aborted.

如果控制文件中的任何一个失效或者损坏,那么instance将会停止工作,此时DBA应当shutdown abort;

3、对比动态性能试图

SQL> select file#,checkpoint_change# from v$datafile_header;

     FILE# CHECKPOINT_CHANGE#
---------- ------------------
         1            1464420
         2            1464420
         3            1464420
         4            1464420
         5            1464420
         6            1464420
         7            1465263

7 rows selected.

动态性能试图v$datafile_header是通过读数据文件的头信息获取到的scn号

SQL> select file#,checkpoint_change# from v$datafile;

     FILE# CHECKPOINT_CHANGE#
---------- ------------------
         1            1464420
         2            1464420
         3            1464420
         4            1464420
         5            1464420
         6            1464420
         7            1465263

7 rows selected.

动态性能试图v$datafile是通过读控制文件的信息,获取到scn号的.

 4、SCN Scenarios

Condition on Start-Up Oracle Behavior DBA Action
CF checkpoint SCN<Datafile checkpoint SCN "Control file too old" error Restore a newer control file.
CF checkpoint SCN>Datafile checkpoint SCN Media recovery required Most likely a datafile has been restored from a backup.Recovery is now required.

(CF checkpoint SCN=Datafile SCN)

Database in mount mode,instance thread status=OPEN

Start up normally

Crash recovery required

None

None

5、控制文件恢复的方法

(a)、控制文件丢失一个,其他文件完好无损,直接拷贝另外的控制文件或者修改spfile文件都可以重新恢复数据库;

(b)、所有的控制文件都损坏,根据trace file进行脚本执行,然后恢复控制文件即可;

原文地址:https://www.cnblogs.com/arcer/p/2984350.html