Controlfile Recovery WITHOUT Resetlogs

2024-03-10 00:18

本文主要是介绍Controlfile Recovery WITHOUT Resetlogs,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

丢失控制文件后,用脚本重建控制文件,打开数据库时可不必指定RESETLOGS选项,不会产生新的incarnation,但是会丢失原来控制文件中信息,如RMAN配置与备份记录、incarnation表。


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 trace2  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 NO2            524107 03-MAY-07                       1 12-JUL-05
PARENT     621607779                  1 NO3            565455 03-MAY-07                  524107 03-MAY-07
PARENT     621627183                  2 NO4            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 openDatabase 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 bytesSQL> CREATE CONTROLFILE REUSE DATABASE "JT10G" NORESETLOGS  NOARCHIVELOG2      MAXLOGFILES 163      MAXLOGMEMBERS 34      MAXDATAFILES 1005      MAXINSTANCES 86      MAXLOGHISTORY 2927  LOGFILE8    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 50M11  DATAFILE12    '/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 WE8ISO8859P118  ;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 TEMP2  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/

这篇关于Controlfile Recovery WITHOUT Resetlogs的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/792408

相关文章

Oracle(110)什么是RMAN(Recovery Manager)?

RMAN(Recovery Manager)是Oracle数据库提供的一个高效的备份和恢复工具。它能够简化和自动化复杂的备份和恢复操作,并且提供了强大的功能来确保数据的完整性和安全性。 RMAN 的主要功能 备份数据库:支持全备份、增量备份和归档日志备份。恢复数据库:支持从备份中恢复整个数据库或部分数据。克隆数据库:可以方便地创建数据库的副本。验证备份:确保备份数据的一致性和完整性。管理备份空

Recovery中常用到的系统函数汇总(一)

最近在研究Android 5.1的recovery升级,发现里面的很多系统函数都不是很熟悉,现在做一下笔记,方便自己及有需要的朋友。 1、库函数 int strcmp(const char *str1, const char *str2) 把 str1 所指向的字符串和 str2 所指向的字符串进行比较。下面的函数跟strcmp类似,返回值情况类似。C 库函数 int strncmp(const

POJ 2255 Tree Recovery

提示:二叉树遍历。给出前序和中序,求后序。 解题思路   1、前序遍历的第一个字母必是 根 2、在中序遍历的字母串中找出 根字母,那么根字母左右两边的字符串就分别是它的左、右子树 3、利用递归复原二叉树(把子树看作新的二叉树) 4、后序遍历特征:后序遍历字母串 自右至左 依次为: 最外层(总树,设为第0层)右子树的根,内1层右子树的根,内2层右子树的根….内n层右

without bells and whistles 深度学习

深度学习经常能看到这句话: without bells and whistles  英语本意是花哨的事物,翻译成中文我们经常说的花里胡哨的东西 一般网络都是组装的。用别人的backbone,然后加上自己发明的部件,或者理念。之后证明自己有效。 并不会把现有的所有最好用的东西都试一遍,得到一个好结果,然后再说自己有用。 通常还会做消融性实验,证明自己部件 能够对现有网络的增幅。而且科学研究不

TWRP 使用帮助 第三方Recovery

简介        TWRP 是国外安卓爱好者开发的一款工具全称为:Team Win Recovery Project。是一个由Omnirom开源团队中的@Dees Troy主导开发,旨在打造最完美第三方recovery的开源项目。目前主要由包括@Dees Troy在内的4个人共同维护。 主要作用包括刷机、备份、救砖     TWRP拥有包括支持刷入ROM刷机包、Root设备、修改系统、清空分

监控flash_recovery_area的使用情况(V$FLASH_RECOVERY_AREA_USAGE,V$RECOVERY_FILE_DEST)

--监控flash_recovery_area的使用情况(V$FLASH_RECOVERY_AREA_USAGE,V$RECOVERY_FILE_DEST)SYS@PROD1> select * from V$FLASH_RECOVERY_AREA_USAGE;FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF

LeetCode #3. Longest Substring Without Repeating Characters

题意: 计算一个字符串的中的最长的不含有重复字母的长度 解法: 尺取法的裸题了,维护2个指针l,r, 不断移动r指针,同时检查[l,r]是不是存在重复的了,如果存在就移动l指针了 class Solution {public:int lengthOfLongestSubstring(string s) {int n = s.size();int l=0, r=0;set<char> S;in

OPPO Find5(X909)刷入CM10.1的第三方recovery教程

准备要求:find5一台;电脑一台(已经装好驱动,驱动一般手机内存卡里会自带) 教程开始: 1.双击下载好的exe文件(文章末尾提供下载) 2.手机关机,然后按住音量向上键加开机键 3.显朱雀网络 www.zhuquewl.com ROM包下载示进入fastboot后按任意键 4。等待……

Aiseesoft Data Recovery for Mac:专业级数据恢复解决方案

在数字时代,数据的安全与恢复成为了我们不可忽视的重要议题。对于Mac用户而言,Aiseesoft Data Recovery无疑是一款值得信赖的专业级数据恢复软件。它以其强大的恢复能力、简洁的操作界面以及广泛的兼容性,在众多数据恢复工具中脱颖而出,成为众多用户恢复丢失数据的首选。 全面恢复,无所遗漏 Aiseesoft Data Recovery支持从Mac硬盘、外部硬盘、USB驱动器、SD卡、

【PyYaml】yaml.load()时总是出现警告:YAMLLoadWarning: calling yaml.load() without Loader=...

警告提示:YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.   YAML 5.1版本后弃用了yaml.load(file)