旧数据文件,旧控制文件,新日志,怎样恢复?
2024-07-21 02:36:40
供稿:网友
步骤:
1:修改trc文件(或者编写)你的create control file 的脚本(或sql语句)
类似下面的,例如,保存到aaa.sql:
CREATE CONTROLFILE REUSE DATABASE "SCP" NORESETLOGS ARCHIVELOGARCHIVELOG
MAXLOGFILES 64
MAXLOGMEMBERS 2
MAXDATAFILES 254
MAXINSTANCES 32
MAXLOGHISTORY 113
LOGFILE
GROUP 1 '/home/Oracle/recovery5/redo01.dbf' SIZE 130000K,
GROUP 2 '/home/oracle/recovery5/redo02.dbf' SIZE 130000K,
GROUP 3 '/home/oracle/recovery5/redo03.dbf' SIZE 130000K,
GROUP 4 '/home/oracle/recovery5/redo04.dbf' SIZE 130000K,
GROUP 5 '/home/oracle/recovery5/redo05.dbf' SIZE 130000K,
GROUP 6 '/home/oracle/recovery5/redo06.dbf' SIZE 130000K
DATAFILE
'/home/oracle/recovery5/SYSTEM_drd3',
'/home/oracle/recovery5/TOOLS_drd4',
'/home/oracle/recovery5/RBS_drd6',
'/home/oracle/recovery5/TEMP_drd5',
'/home/oracle/recovery5/USERS_drd13',
'/home/oracle/recovery5/INDX_drd12'
CHARACTER SET US7ASCII
;
2:用你的有效备份覆盖现在的错误数据文件
3:重建控制文件,就是前面的帖子的步骤
sqlplus internal或者sqlplus /nolog ; conn / as sysdba
startup nomount
@aaa.sql
4:用控制文件恢复数据库
shutdown
startup mount
recover using backup controlfile until cancel;
直到所有的archive log file都用完了,alter database open resetlogs;
5:resetlogs open db
注重!假如你的archive 和init中定义的不一致,系统会提示你输入: Specify log: {=suggested filename AUTO CANCEL}你可以输入auto,也可以指定你的archive log files的路径和名称,或者你也可以用类似下面的命令:
recover automatic from '/home/oracle/recovery/arch' using backup controlfile until cancel;
(2)丢失所有数据文件,控制文件,redo日志文件 (续1)
成功恢复过程:
1. 拷贝旧冷备数据文件
rcp -r 冷备 数据目录
2. mount数据库
Oracle_home>bin/svrmgrl
SVRMGR> connect internal
SVRMGR> startup mount
3. 用using backup controlfile进行恢复
SVRMGR> recover database until cancel using backup controlfile;
出现输入提示时输入AUTO
4. 用Open Resetlog 打开数据库
SVRMGR> alter database open RESETLOGS;
5. 恢复结束,看一下目前日志状态
SVRMGR> archive log list;
应出现:
Oldest online log sequence 0
Next log sequence to archive 1
Current log sequence 1
其恢复过程如下,
丢失所有数据文件,控制文件,redo日志文件
成功恢复过程:
1. 拷贝旧冷备数据文件
rcp -r 冷备 数据目录
2. mount数据库
Oracle_home>bin/svrmgrl
SVRMGR> connect internal
SVRMGR> startup mount
3. 用using backup controlfile进行恢复
SVRMGR> recover database until cancel using backup controlfile;
出现输入提示时输入AUTO
4. 用Open Resetlog 打开数据库
SVRMGR> alter database open RESETLOGS;
5. 恢复结束,看一下目前日志状态
SVRMGR> archive log list;
应出现:
Oldest online log sequence 0
Next log sequence to archive 1
Current log sequence 1