oracle恢复案例:rename一个数据文件后做不完全恢复

案例:rename一个数据文件后做不完全恢复

sql>startup mount; //启动到mount状态

sql> show parameter control_files //查看控制文件的位置信息

name type value

———————————— ———– ——————————

control_files string +data/metro/controlfile/backup

.268.848861257

sql> select name from v$datafile;

//查看数据文件的信息

name

——————————————————————————–

/u01/app/oracle/oradata/metro/system01.dbf

/u01/app/oracle/oradata/metro/undotbs01.dbf

/u01/app/oracle/oradata/metro/sysaux01.dbf

/u01/app/oracle/oradata/metro/users01.dbf

/u01/app/oracle/oradata/metro/example01.dbf

sql> alter database rename file ‘/u01/app/oracle/oradata/metro/system01.dbf’ to ‘+data/metro/datafile/system.257.848858337’;

//更改数据文件的信息

sql> select status from v$instance;

//查看当前状态

status

————

mounted

sql> alter database open; //尝试启库,报出需要resetlogs提示

alter database open

*

error at line 1:

ora-01589: must use resetlogs or noresetlogs option for database open

sql> alter database open resetlogs;//以resetlogs形式启库,提示数据文件1不

alter database open resetlogs

*

error at line 1:

ora-01152: file 1 was not restored from a sufficiently old backup

ora-01110: data file 1: ‘+data/metro/datafile/system.257.848858337’

sql> select checkpoint_change# from v$datafile; //检查控制文件中各数据文件scn

checkpoint_change#

——————

862849

862849

862849

862849

862849

sql> select checkpoint_change# from v$datafile_header; //检查实际文件的scn号

checkpoint_change#

——————

861998

863385

863385

863385

863385

sql> recover datafile 1;

ora-00283: recovery session canceled due to errors

ora-01610: recovery using the backup controlfile option must be done

sql> recover datafile 1 using backup controlfile;

ora-00274: illegal recovery option using

sql> recover database; //提示需使用备份的控制文件

ora-00283: recovery session canceled due to errors

ora-01610: recovery using the backup controlfile option must be done

sql> recover database using backup controlfile; //使用备份的控制文件恢复数据库

ora-00279: change 861998 generated at 05/29/2014 15:02:17 needed for thread 1

ora-00289: suggestion : /u01/app/oracle/arch1/1_15_848741495.dbf

ora-00280: change 861998 for thread 1 is in sequence #15 //提示恢复需要sequence号为15的日志

specify log: {<ret>=suggested | filename | auto | cancel}

ora-00308: cannot open archived log ‘/u01/app/oracle/arch1/1_15_848741495.dbf’

ora-27037: unable to obtain file status

ibm aix risc system/6000 error: 2: no such file or directory

additional information: 3

sql> select * from v$log; //查看日志组信息

group# thread# sequence# bytes members arc status

———- ———- ———- ———- ———- — —————-

first_change# first_tim

————- ———

1 1 14 52428800 2 yes inactive

859720 29-may-14

3 1 13 52428800 2 yes inactive

858472 29-may-14

2 1 15 52428800 2 no current

859846 29-may-14

sql> select group#,member from v$logfile;

group#

———-

member

——————————————————————————–

3

/u01/app/oracle/oradata/metro/redo03.log

2

/u01/app/oracle/oradata/metro/redo02.log

1

/u01/app/oracle/oradata/metro/redo01.log

group#

———-

member

——————————————————————————–

1

/disk1/metro/redofile/redo01a.log

2

/disk1/metro/redofile/redo02a.log

3

/disk1/metro/redofile/redo03a.log

6 rows selected.

sql> recover database using backup controlfile;

ora-00279: change 861998 generated at 05/29/2014 15:02:17 needed for thread 1

ora-00289: suggestion : /u01/app/oracle/arch1/1_15_848741495.dbf

ora-00280: change 861998 for thread 1 is in sequence #15

specify log: {<ret>=suggested | filename | auto | cancel}

/disk1/metro/redofile/redo02a.log //输入查找到sequence号为15对应的日志

log applied.

media recovery complete.

sql> select checkpoint_change# from v$datafile_header; //恢复完成后检查点的scn

checkpoint_change#

——————

863385

863385

863385

863385

863385

sql> alter database open

2 ;

alter database open

*

error at line 1:

ora-01589: must use resetlogs or noresetlogs option for database open

sql> alter database open resetlogs; //使用resetlogs打开库

database altered.

sql> select name from v$datafile //查看数据文件信息

2 ;

name

——————————————————————————–

+data/metro/datafile/system.257.848858337

/u01/app/oracle/oradata/metro/undotbs01.dbf

/u01/app/oracle/oradata/metro/sysaux01.dbf

/u01/app/oracle/oradata/metro/users01.dbf

/u01/app/oracle/oradata/metro/example01.dbf

sql>

(0)
上一篇 2022年3月22日
下一篇 2022年3月22日

相关推荐