tart a new instance and mount the database:
STARTUP MOUNT
Reinitialize the damaged log group. For example, to clear redo log group 2, issue the following statement:
ALTER DATABASE CLEAR LOGFILE GROUP 2;
Clearing Inactive, Unarchived Redo
清除 inactive 未归档的日志
Clearing a not-yet-archived redo log allows it to be reused without archiving it. This action makes backups unusable if they were started before the last change in the log, unless the file was taken offline before the first change in the log. Hence, if you need the cleared log file for recovery of a backup, then you cannot recover that backup. Clearing a not-yet-archived-redo-log, prevents complete recovery from backups due to the missing log.
清除的没有归档的日志允许被被重用。如果日志的最后一次改变之前开始, 这个操作会导致备份不可用,除非日志文件在第一次改变之前被置为offline。此后,如果你需要被清除的日志去做备份恢复,是不能备份恢复的。
To clear an inactive, online redo log group that has not been archived:
清除一个inactive ,日志没有归档:
If the database is shut down, then start a new instance and mount the database:
SQL> STARTUP MOUNT
Clear the log using the UNARCHIVED keyword.
For example, to clear log group 2, issue the following SQL statement:
SQL> ALTER DATABASE CLEAR UNARCHIVED LOGFILE GROUP 2;
If there is an offline data file that requires the cleared log to bring it online, then the keywords UNRECOVERABLE DATAFILE are required. The data file must be dropped because the redo logs necessary to bring the data file online are being cleared, and there is no copy of it. For example, enter:
如果有一个数据文件offline, 需要清除日志后使数据文件上线,那么此时需要使用关键字UNRECOVERABLE DATAFILE.数据文件必须被删除因为
SQL> ALTER DATABASE CLEAR UNARCHIVED LOGFILE GROUP 2 UNRECOVERABLE DATAFILE;
Immediately back up all data files in the database with an operating system utility, so that you have a backup you can use for complete recovery without relying on the cleared log group. For example, enter:
立即备份所有的数据文件使用操作系统工具,以至于你有一个不用依赖被清除的日志组就能做完全恢复的备份,
% cp /disk1/oracle/dbs/*.dbf /disk2/backup
Back up the database's control file with the ALTER DATABASE statement. For example, enter:
SQL> ALTER DATABASE BACKUP CONTROLFILE TO '/oracle/dbs/cf_backup.f';
Failure of CLEAR LOGFILE Operation
失败的清除日志文件操作
The ALTER DATABASE CLEAR LOGFILE statement can fail with an I/O error due to media failure when it is not possible to:
alter database clear logfile 语句如果不能做下面的操作 会失败由于介质故障导致的io错误,
Relocate the redo log file onto alternative media by re-creating it under the currently configured redo log file name
通过当前配置的日志文件的名称重新创建日志文件 迁移日志日志到另外的介质上
Reuse the currently configured log file name to re-create the redo log file because the name itself is invalid or unusable (for example, due to media failure)
重新使用当前的配置日志文件的名称去重新创建日志文件因为他自己的名字是无效的或者不可用。
In these cases, the ALTER DATABASE CLEAR LOGFILE statement (before receiving the I/O error) would have successfully informed the control file that the log was being cleared and did not require archiving. The I/O error occurred at the step in which the CLEAR LOGFILE statement attempted to create the new redo log file and write zeros to it. This fact is reflected in V$LOG.CLEARING_CURRENT.
在这些情况下,alter database clear logfile 语句
Losing an Active Online Redo Log Group
If the database is still running and the lost active redo log is not the current log, then issue the ALTER SYSTEM CHECKPOINT statement. If the operation is successful, then the active redo log becomes inactive, and you can follow the procedure in "Losing an Inactive Online Redo Log Group". If the operation is unsuccessful, or if your database