How to open without RESETLOGS after restore cold backup

本文详细介绍了Oracle数据库中RESETLOGS和NORESETLOGS的作用及应用场景,包括在进行不完全介质恢复、使用备份控制文件进行介质恢复、未完成的OPEN RESETLOGS操作以及闪回数据库操作后的必要性。此外还提供了避免使用RESETLOGS的具体步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

RESETLOGS | NORESETLOGS 
======================== 
This clause determines whether Oracle Database resets the current log sequence number to 1, archives any unarchived logs (including the current log), and discards any redo information that was not applied during recovery, ensuring that it will never be applied. Oracle Database uses NORESETLOGS automatically except in the following specific situations, which require a setting for this clause: 

You must specify RESETLOGS: 

1.After performing incomplete media recovery or media recovery using a backup controlfile 
2.After a previous OPEN RESETLOGS operation that did not complete 
3.After a FLASHBACK DATABASE operation 

If a created controlfile is mounted, then you must specify RESETLOGS if the online logs are lost, or you must specify  NORESETLOGS if they are not lost. So, the point is that if we restored the controlfile backup, we have to do OPEN RESETLOGS because the controlfile type will be BACKUP controlfile. Moreover, online redo logs backups should also be available as RMAN doesn't backup online redo logs. 

In order to avoid RESETLOGS, the following steps can be followed: 
  • In addition to take cold backup of database, also take backup of online redo logs.
  • Restore controlfile and database cold backup :
     RMAN> restore controlfile...... 
     RMAN> mount database ; 
     RMAN> restore database ; 
  • Copy the online redo logs to the desired location for new database.
  • Login to SQL*Plus and generate controlfile trace script ( please note that the database is mounted from rman after restoring controlfile ) :
     SQL> alter database backup controlfile to trace NORESETLOGS as '/tmp/ctl.sql' ; 
     SQL> SHUTDOWN IMMEDIATE 
  • Edit the controlfile if required. For example, to change the location of online redo logs copied.
  • Shutdown and STARTUP NOMOUNT the database and run the create controlfile script :
     SQL> STARTUP NOMOUNT 
     SQL> @/tmp/ctl.sql 
  •  Recover the database and open normal :
     SQL> RECOVER DATABASE ; 
     SQL> ALTER DATABASE OPEN ;
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值