今天在做循序渐进oracle第421页的实验时,按照老盖的步骤居然打不开数据库!于是网上左右百度google,终于使用下面的方法解决!
使用shutdown immediate,等了一会没有结束,于是直接结束了进程,后来又出来一个问题
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: '/u01/app/oracle/oradata/orcl/system01.dbf'
估计应该是日志的问题,又试了下:
SYS@orcl>recover database using backup controlfile until cancel;
ORA-00279: change 747999 generated at 04/09/2014 15:03:10 needed for thread 1
ORA-00289: suggestion : /opt/oracle/archive/arch_1_46_808410282.dbf
ORA-00280: change 747999 for thread 1 is in sequence #46
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/opt/oracle/oradata/orcl/system01.dbf'
ORA-01112: media recovery not started
根据上面提示的内容,注意到 ‘change 747999’ 和 ‘sequence #46’
从网上看到一条语句,可以查出redo logs ,注意要用sys:
SQL> conn sys/oracle as sysdba
Connected.
SYS@orcl>select v1.group#, member, sequence#, first_change#
2 from v$log v1, v$logfile v2
3 where v1.group# = v2.group#;
GROUP# MEMBER SEQUENCE# FIRST_CHANGE#
---------- -------------------------------------------------- ---------- -------------
1 /opt/oracle/oradata/orcl/redo01.log 0 0
3 /opt/oracle/oradata/orcl/redo03.log 0 0
2 /opt/oracle/oradata/orcl/redo02.log 0 0;
从结果里根据 sequence# 和 first_change# 找到了要用到的log file name:
/opt/oracle/oradata/orcl/redo01.log
在 Specify log: {<RET>=suggested | filename | AUTO | CANCEL} 下面输入:
ORA-00279: change 747999 generated at 04/09/2014 15:03:10 needed for thread 1
ORA-00289: suggestion : /opt/oracle/archive/arch_1_46_808410282.dbf
ORA-00280: change 747999 for thread 1 is in sequence #46
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/opt/oracle/oradata/orcl/redo01.log
Log applied.
Media recovery complete.
接着:
SYS@orcl>alter database open resetlogs;
Database altered.
使用shutdown immediate,等了一会没有结束,于是直接结束了进程,后来又出来一个问题
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: '/u01/app/oracle/oradata/orcl/system01.dbf'
估计应该是日志的问题,又试了下:
SYS@orcl>recover database using backup controlfile until cancel;
ORA-00279: change 747999 generated at 04/09/2014 15:03:10 needed for thread 1
ORA-00289: suggestion : /opt/oracle/archive/arch_1_46_808410282.dbf
ORA-00280: change 747999 for thread 1 is in sequence #46
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/opt/oracle/oradata/orcl/system01.dbf'
ORA-01112: media recovery not started
根据上面提示的内容,注意到 ‘change 747999’ 和 ‘sequence #46’
从网上看到一条语句,可以查出redo logs ,注意要用sys:
SQL> conn sys/oracle as sysdba
Connected.
SYS@orcl>select v1.group#, member, sequence#, first_change#
2 from v$log v1, v$logfile v2
3 where v1.group# = v2.group#;
GROUP# MEMBER SEQUENCE# FIRST_CHANGE#
---------- -------------------------------------------------- ---------- -------------
1 /opt/oracle/oradata/orcl/redo01.log 0 0
3 /opt/oracle/oradata/orcl/redo03.log 0 0
2 /opt/oracle/oradata/orcl/redo02.log 0 0;
从结果里根据 sequence# 和 first_change# 找到了要用到的log file name:
/opt/oracle/oradata/orcl/redo01.log
在 Specify log: {<RET>=suggested | filename | AUTO | CANCEL} 下面输入:
/u01/app/oracle/oradata/orcl/redo03.log
ORA-00279: change 747999 generated at 04/09/2014 15:03:10 needed for thread 1
ORA-00289: suggestion : /opt/oracle/archive/arch_1_46_808410282.dbf
ORA-00280: change 747999 for thread 1 is in sequence #46
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/opt/oracle/oradata/orcl/redo01.log
Log applied.
Media recovery complete.
接着:
SYS@orcl>alter database open resetlogs;
Database altered.