本想练习SQL,哪知道数据库打不开了。
提示如下:
SQL> startup
ORACLE instance started.
ORACLE instance started.
Total System Global Area 612368384 bytes
Fixed Size 1250452 bytes
Variable Size 109054828 bytes
Database Buffers 499122176 bytes
Redo Buffers 2940928 bytes
Database mounted.
ORA-01122: database file 6 failed verification check
ORA-01110: data file 6: 'D:\ORADATA\DATA02.DBF'
ORA-01207: file is more recent than control file - old control file
Fixed Size 1250452 bytes
Variable Size 109054828 bytes
Database Buffers 499122176 bytes
Redo Buffers 2940928 bytes
Database mounted.
ORA-01122: database file 6 failed verification check
ORA-01110: data file 6: 'D:\ORADATA\DATA02.DBF'
ORA-01207: file is more recent than control file - old control file
参考 http://space.itpub.net/67668/viewspace-353270
作如下操作,终于恢复正常。
1、
C:\Documents and Settings\Administrator>set nls_lang=american_america.ZHS16GBK
C:\Documents and Settings\Administrator>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Dec 16 22:10:27 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> startup
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL>
SQL> shutdown immediate;
ORA-01507: database not mounted
Connected.
SQL> startup
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL>
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
2、
SQL> startup
ORACLE instance started.
Total System Global Area 612368384 bytes
Fixed Size 1250452 bytes
Variable Size 109054828 bytes
Database Buffers 499122176 bytes
Redo Buffers 2940928 bytes
Database mounted.
ORA-01122: database file 6 failed verification check
ORA-01110: data file 6: 'D:\ORADATA\DATA02.DBF'
ORA-01207: file is more recent than control file - old control file
Fixed Size 1250452 bytes
Variable Size 109054828 bytes
Database Buffers 499122176 bytes
Redo Buffers 2940928 bytes
Database mounted.
ORA-01122: database file 6 failed verification check
ORA-01110: data file 6: 'D:\ORADATA\DATA02.DBF'
ORA-01207: file is more recent than control file - old control file
3、
SQL> alter database backup controlfile to trace as 'f:\aa';
SQL> alter database backup controlfile to trace as 'f:\aa';
Database altered.
4、打开f:\aa ,选择下面文件保存为f:\create controlfiel.txt,
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG' SIZE 50M,
GROUP 2 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG' SIZE 50M,
GROUP 3 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF',
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF',
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF',
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF',
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\DATA01.DBF',
'D:\ORADATA\DATA02.DBF',
'D:\ORADATA\DATA03.DBF'
CHARACTER SET ZHS16GBK
;
5、
SQL> @"F:\create controlfile.txt"
SP2-0042: unknown command "DATAFILE" - rest of line ignored.
SP2-0734: unknown command beginning "'C:\ORACLE..." - rest of line ignored.
SP2-0734: unknown command beginning "'C:\ORACLE..." - rest of line ignored.
SP2-0734: unknown command beginning "'C:\ORACLE..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "'C:\ORACLE..." - rest of line ignored.
SP2-0734: unknown command beginning "'C:\ORACLE..." - rest of line ignored.
SP2-0734: unknown command beginning "'D:\ORADAT..." - rest of line ignored.
SP2-0734: unknown command beginning "'D:\ORADAT..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "CHARACTER ..." - rest of line ignored.
1 CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS NOARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG' SIZE 50M,
9 GROUP 2 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG' SIZE 50M,
10 GROUP 3 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG' SIZE 50M
11* -- STANDBY LOGFILE
6\
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF',
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF',
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF',
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF',
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\DATA01.DBF',
'D:\ORADATA\DATA02.DBF',
'D:\ORADATA\DATA03.DBF'
CHARACTER SET ZHS16GBK
;
5、
SQL> @"F:\create controlfile.txt"
SP2-0042: unknown command "DATAFILE" - rest of line ignored.
SP2-0734: unknown command beginning "'C:\ORACLE..." - rest of line ignored.
SP2-0734: unknown command beginning "'C:\ORACLE..." - rest of line ignored.
SP2-0734: unknown command beginning "'C:\ORACLE..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "'C:\ORACLE..." - rest of line ignored.
SP2-0734: unknown command beginning "'C:\ORACLE..." - rest of line ignored.
SP2-0734: unknown command beginning "'D:\ORADAT..." - rest of line ignored.
SP2-0734: unknown command beginning "'D:\ORADAT..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "CHARACTER ..." - rest of line ignored.
1 CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS NOARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG' SIZE 50M,
9 GROUP 2 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG' SIZE 50M,
10 GROUP 3 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG' SIZE 50M
11* -- STANDBY LOGFILE
6\
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
7\
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF'
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF'
8\
SQL> set wrap off
SQL> select * from v$log;
SQL> set wrap off
SQL> select * from v$log;
truncating (as requested) before column FIRST_CHANGE#
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRS
---------- ---------- ---------- ---------- ---------- --- ---------------- ----
1 1 134 52428800 1 NO INACTIVE 01-D
3 1 133 52428800 1 NO INACTIVE 01-D
2 1 135 52428800 1 NO CURRENT 03-D
9\
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 856726 generated at 12/03/2009 17:33:09 needed for thread 1
ORA-00289: suggestion :
C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2009_12_16\O1_MF_1_
135_%U_.ARC
ORA-00280: change 856726 for thread 1 is in sequence #135
9\
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 856726 generated at 12/03/2009 17:33:09 needed for thread 1
ORA-00289: suggestion :
C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2009_12_16\O1_MF_1_
135_%U_.ARC
ORA-00280: change 856726 for thread 1 is in sequence #135
Specify log: {
C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG
Log applied.
Media recovery complete.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.