恢复控制文件

Posted: 03月 8, 2011 in br, oracle

控制文件是自动备份的(CONFIGURE CONTROLFILE AUTOBACKUP ON),那么在备份数据库时,先备份数据文件,再自动备份控制文件的。因此备份的控制文件是包含了备份集信息的。其步骤应该如下:
SQL>shutdown immediate;
SQL>startup nomount;
SQL>restore controlfile from ‘控制文件的备份全路径';
SQL>alter database mount;
SQL>restore database;
SQL>recover database using backup controlfile until cancel;

Do you mean “备份控制文件” instead?

I hope we can find an official answer from MOS or documentation. For now, here’s what I read in Rama Velpuri’s “Oracle8 Backup and Recovery Handbook”, p.273

“A backup control file wouldn’t have valid information about the online log files and the data file stop SCNs. Therefore, Oracle can’t use the online log file during recovery, and hence assumes infinite stop SCNs for the data files. In order to correct this informationm when you open the database you must have the RESETLOGS option specified.”

A little explanation of stop SCNs. They’re the SCNs recorded in the control file, set to infinite when the database is open, and to the same as the start SCNs for the corresponding datafiles in datafile headers after a clean shutdown. Mismatch between the stop SCNs and datafile header start SCNs causes crash recovery (but not media recovery, which is triggered by checkpoint counter check between datafile headers and the control file).

Based on Rama’s description, we know that it’s the lack of information about *online* logs in the backup control file that requires open resetlogs. Obviously this info about online logs is not provided by log_archive_format or log_archive_dest_x, which provides info about *archived* logs.

To further understand this point, consider Jeremy Schneider’s blog at
http://www.ardentperf.com/2007/0 … requires-resetlogs/

He tried hard to avoid resetlogs when using a backup control file. The only way to avoid that is, natually, as Hemant Chitale pointed out, creating a new controlfile (which is what Jeremy wants to avoid in the first place), if everything about th database is still available, I mean location of datafiles, what sequence is current, etc. As Jeremy demo’ed, a backup control file can’t get the current log sequence right (as shown in v$log). That type of info is what forces you to open resetlogs in order to completely wipe out and recreate online logs.

Yong Huang

About these ads
评论
  1. eversmily 说到:

    利用备份的控制文件,scn会从数据文件头获取,继而更新控制文件,达到一致性

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s