`
qcyycom
  • 浏览: 190923 次
社区版块
存档分类
最新评论

Controlfile Recovery WITHOUT Resetlogs

 
阅读更多

Well last week I had a few posts about controlfile recovery; one about recovering without a backup and one about recovering with a backup using RESETLOGS. In the second post I showed how when you restore a backup controlfile Oracle will always require you to recover then open the database with RESETLOGS.

Hemant Chitale pointed out that you do not always need to do a RESETLOGS when you open the database. If you recreate the controlfile rather than restoring a backup then Oracle allows you to open the database normally (assuming of course a normal database shutdown). Naturally you will lose any information in your controlfile (RMAN configuration and records, the incarnation table, etc) so I would personally prefer keeping the old file. But it’s certainly possible – so here’s a demo of Hemant’s suggestion on Oracle 10 release 2. Really it’s abit of a rehash; Hemant actually posted all of this himself on oracle-l last week. (And more – he also posted a scenario of losing both the controlfile and online logs.) He also mentioned it in his blog. So for more detail you can also check out email.

The setup is exactly the same as recovery with a backup controlfile – I’m just going to do some different steps starting at the “Recovery” part:

Recovery

We’ll pick up from the other post with the attempt to open the database that fails. Remember that I have already restored a backup controlfile and mounted it.

SQL> alter database open noresetlogs;
alter database open noresetlogs
*
ERROR at line 1:
ORA-01588: must use RESETLOGS option for database open

Now if you already have a backup of your controlfile then you’re all set. But of course if you don’t you can even make one using your controlfile backup. That’s what I did here:

SQL> alter database backup controlfile to trace
  2  as '/u04/oracle/oradata/jt10g/newctl.sql';

Database altered.

Now one thing that we’re definitely going to lose is the incarnation table. Let’s have a quick look at the contents right now.

SQL> select * from v$database_incarnation;

INCARNATION# RESETLOGS_CHANGE# RESETLOGS PRIOR_RESETLOGS_CHANGE# PRIOR_RES
------------ ----------------- --------- ----------------------- ---------
STATUS  RESETLOGS_ID PRIOR_INCARNATION# FLASHBACK_DATABASE_ALLOWED
------- ------------ ------------------ --------------------------
           1                 1 12-JUL-05                       0
PARENT     563434975                  0 NO

           2            524107 03-MAY-07                       1 12-JUL-05
PARENT     621607779                  1 NO

           3            565455 03-MAY-07                  524107 03-MAY-07
PARENT     621627183                  2 NO

           4            784376 09-MAY-07                  565455 03-MAY-07
CURRENT    622130726                  3 NO

Recreating the Control File

It’s worth quickly pointing out that you can of course do this as long as you can generate the proper CREATE CONTROLFILE statement. If you know your datafile and logfile layout then you can generate this statement even with no backup of anything. Of course the best way to get it is with “backup to trace”.

First you need to have the instance started but no controlfile mounted. When you recreate the controlfile it will read the CONTROL_FILES initialization parameter and overwrite any existing files.

SQL> shutdown immediate;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.

SQL> startup nomount
ORACLE instance started.

Total System Global Area  629145600 bytes
Fixed Size                  1980712 bytes
Variable Size             180356824 bytes
Database Buffers          440401920 bytes
Redo Buffers                6406144 bytes

SQL> CREATE CONTROLFILE REUSE DATABASE "JT10G" NORESETLOGS  NOARCHIVELOG
  2      MAXLOGFILES 16
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 100
  5      MAXINSTANCES 8
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 '/u04/oracle/oradata/jt10g/redo01.log'  SIZE 50M,
  9    GROUP 2 '/u04/oracle/oradata/jt10g/redo02.log'  SIZE 50M,
 10    GROUP 3 '/u04/oracle/oradata/jt10g/redo03.log'  SIZE 50M
 11  DATAFILE
 12    '/u04/oracle/oradata/jt10g/system01.dbf',
 13    '/u04/oracle/oradata/jt10g/undotbs01.dbf',
 14    '/u04/oracle/oradata/jt10g/sysaux01.dbf',
 15    '/u04/oracle/oradata/jt10g/users01.dbf',
 16    '/u04/oracle/oradata/jt10g/example01.dbf'
 17  CHARACTER SET WE8ISO8859P1
 18  ;

Control file created.

SQL> ALTER DATABASE OPEN;

Database altered.

I got that statement out of a trace file. Also you need to remember to recreate your tempfiles; the appropriate statements will also be in your trace file.

SQL> ALTER TABLESPACE TEMP
  2  ADD TEMPFILE '/u04/oracle/oradata/jt10g/temp01.dbf' REUSE;

Tablespace altered.

Now as I mentioned before you will lose all information in your controlfile. Let’s quickly verify this by examining the incarnation table.

SQL> select * from v$database_incarnation;

INCARNATION# RESETLOGS_CHANGE# RESETLOGS PRIOR_RESETLOGS_CHANGE# PRIOR_RES
------------ ----------------- --------- ----------------------- ---------
STATUS  RESETLOGS_ID PRIOR_INCARNATION# FLASHBACK_DATABASE_ALLOWED
------- ------------ ------------------ --------------------------
           1            784376 09-MAY-07                  565455 03-MAY-07
CURRENT    622130726                  0 NO

And there you have it. Controlfile recovery without a RESETLOGS. As I mentioned before I prefer the RESETLOGS case and keeping the original controlfile if at all possible. Perhaps the main reason is that incarnations exist for a reason; they help you keep track of changes to you database. It’s good to have that electronic record. But this is also a very important recovery method to be aware of!


FROM: http://www.ardentperf.com/2007/05/15/controlfile-recovery-without-resetlogs/

分享到:
评论

相关推荐

    Oracle 12c Rman Backup and Recovery

    #### 一、RMAN(Recovery Manager)概述 在Oracle 12c版本中,RMAN是用于管理数据库备份和恢复的强大工具。它不仅可以帮助管理员执行数据库备份,还能进行灾难恢复操作,确保数据的安全性和完整性。RMAN能够自动...

    oracle遇到的问题汇总[参照].pdf

    - 使用`ALTER DATABASE BACKUP CONTROLFILE TO TRACE RESETLOGS`命令备份当前最新的控制文件,以确保安全性。 ```sql CONNECT INTERNAL ALTER DATABASE BACKUP CONTROLFILE TO TRACE RESETLOGS ``` **注意事项...

    oracle改redo日志方法.doc

    alter database backup controlfile to trace resetlogs; ``` 9. 删除不活动的重做日志成员: 如果某个日志文件处于非活动状态,可以删除它并创建新的成员。例如,向日志组1添加新的日志成员: ``` ALTER DATABASE ...

    ORACLE备份恢复

    对于正常`shutdown`或`shutdown abort`,以及当前或非当前数据文件受损,可能需要结合强制打开数据库的方法,如使用`backup controlfile to trace`或`resetlogs`的trace,并且没有数据文件备份。 总的来说,Oracle...

    oracle控制文件的建立

    - 示例:`CREATE CONTROLFILE SET DATABASE 'mydb' RESETLOGS`。 #### 三、修改控制文件 1. **添加控制文件副本**: - 可以使用`ALTER DATABASE ADD CONTROLFILE`命令来添加控制文件副本,以增强冗余性和可用性...

    案例解决:一次oracle掉电的处理过程

    这通常意味着数据库在异常关闭后需要进行介质恢复(Media Recovery),并且日志文件的状态可能已经不一致。 首先,让我们了解一下Oracle数据库在遇到此类问题时的一般处理流程: 1. **检查实例状态**:通过SQL*...

    Oracle 控制文件恢復

    RMAN> restore controlfile from '/home/oracle/app/oracle/fast_recovery_area/ORCL/backupset/2018_05_04/o1_mf_ncsnf_TAG20180504T154139_fgr3pgd5_.bkp'; 等待恢复完成后,启动数据库到 mount 状态: alter ...

    file control

    文件控制在IT行业中是一项至关重要的工作,它涉及到信息的安全、高效管理和合规性。这份文档主要阐述了一套完整的文件管理制度,适用于公司内部所有文件、资料的管理。以下是详细的知识点解析: ...

    重置在线重做日志(迁移)

    SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE RESETLOGS; ``` 这条命令将会创建一个控制文件的备份,并且重置日志文件序列,这意味着所有的日志文件都会被标记为新的序列号。 #### 3. 总结 本指南详细介绍了...

    oracle实时在线备份工具-rman

    - 设置自动备份控制文件:执行`RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;`。 #### 相关概念简介 ##### 快速恢复区域 快速恢复区域主要用于存储与数据库恢复相关的文件,如控制文件、联机REDO日志文件、归档...

    Oracle认证分类模拟题8-附答案解析.doc

    使用RESETLOGS打开数据库。 - 正确答案是A. 5,1,3,2,4。 4. **丢失临时表空间的影响**: - 临时表空间用于存储排序和临时数据。 - 如果丢失所有临时文件,用户可能会看到: - D. 用户不能在查询中使用...

    Oracle控制文件的备份和恢复

    SQL> CREATE CONTROLFILE SET DATABASE 'sales' RESETLOGS DATABASE ID 12345678901234567 ENCRYPTION ('ON') ... ``` 需要注意的是,上述命令仅为示例,实际重建控制文件的具体步骤会因具体情况而异。例如,如果...

    oracle介质恢复的内部过程

    本文将详细探讨Oracle介质恢复的内部过程,通过对控制文件(controlfile)、重做日志(redolog)、数据文件(datafile)等内容的深入分析,帮助读者理解这一复杂的流程。 #### 二、Oracle介质恢复的基本概念 1. **Start ...

    oracle-备份恢复脚本

    ### 一、Oracle RMAN(Recovery Manager)基础 RMAN是Oracle提供的一种用于管理数据库备份、恢复以及灾难恢复的强大工具。它能够自动执行备份策略,简化恢复过程,并且支持增量备份等多种高级功能。 ### 二、脚本...

    Oracle11g 崩溃后-dbf数据库文件恢复

    6. **打开数据库**:最后,使用`ALTER DATABASE OPEN RESETLOGS`命令打开数据库,这将创建新的重做日志组并更新控制文件。 7. **验证数据**:打开数据库后,进行全面的数据验证,确保所有表和索引都处于一致状态。 ...

    数据库的物理结构(4).ppt

    8. **RMAN信息**:与Oracle Recovery Manager相关的备份和恢复信息。 控制文件的大小通常在2MB到10MB之间,取决于数据库的配置参数,如`maxdatafiles`、`maxlogfiles`、`maxlogmembers`、`maxloghistory`和`...

Global site tag (gtag.js) - Google Analytics