Flashcopy与数据库恢复的完美结合(17/20)
时间:2011-06-03 来源:djb1008
1.5.4.17.2检查数据文件是否处于fuzzy状态
spool scandatafile.sql
set serveroutput on
declare
scn number(12) := 0;
scnmax number(12) := 0;
begin
for f in (select * from v$datafile) loop
scn := dbms_backup_restore.scandatafile(f.file#);
dbms_output.put_line('File ' || f.file# ||' absolute fuzzy scn = ' || scn);
if scn > scnmax then scnmax := scn; end if;
end loop;
dbms_output.put_line('Minimum PITR SCN = ' || scnmax);
end;
/
1.所有文件的fuzzy scn都为0,则直接跳到下一步1.5.3.17.4
File 1 absolute fuzzy scn = 0
File 2 absolute fuzzy scn = 0
File 3 absolute fuzzy scn = 0
File 4 absolute fuzzy scn = 0
File 5 absolute fuzzy scn = 0
Minimum PITR SCN = 0
PL/SQL procedure successfully completed.
2.如果部分文件的fuzzy scn 不为0
File 1 absolute fuzzy scn = 0
File 2 absolute fuzzy scn = 987523
File 3 absolute fuzzy scn = 0
File 4 absolute fuzzy scn = 0
File 5 absolute fuzzy scn = 0
Minimum PITR SCN = 987523
SQL> recover database using backup controlfile until change 987523;
ORA-00279: change 987521 generated at 06/01/2011 17:04:10 needed for thread 1
ORA-00289: suggestion : /archivelog/1_37_750759569.dbf
ORA-00280: change 987521 for thread 1 is in sequence #37
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
Log applied.
Media recovery complete.