oracle redo 200mb,Oracle的redo log在各场景下的恢复

Oracle的redo log非常重要,redo log损坏将导致数据库开法开启或数据丢失,针对redo log在各种场景下如何打开或恢复数据库,特别模拟测试说明:

各场景包括如下(共6个场景):

场景一.非归档下inactive状态的redo 恢复

场景二.非归档下active状态的redo 恢复

场景三.非归档下current状态的redo恢复

场景四.归档模式下inactive状态的redo 恢复

场景五.归档模式下的active状态的redo 恢复

场景六.归档模式下的current状态的redo恢复

oracle版本为oracle 11.1.0.7

各场景恢复操作如下:

一.非归档下inactive状态的redo 恢复

session 1:

查看归档模式:---非归档

SQL> archive log list

Database log mode No Archive Mode

Automatic archival Disabled

Archive destination /kttest1-1_data1/emsdev/arch

Oldest online log sequence 3

Current log sequence 8

查看log情况:

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM

---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------

1 1 10 104857600 1 NO INACTIVE 1.2790E+13 30-MAY-14

2 1 13 104857600 1 NO CURRENT 1.2790E+13 30-MAY-14

3 1 12 104857600 1 NO ACTIVE 1.2790E+13 30-MAY-14

SQL> col member for a70

SQL> select * from v$logfile;

GROUP# STATUS TYPE MEMBER

---------- ------- ------- ----------------------------------------------------------------------

IS_

---

3 ONLINE /kttest1-1_data1/emsdev/redo03.dbf

NO

1 ONLINE /kttest1-1_data1/emsdev/redo01.dbf

NO

2 ONLINE /kttest1-1_data1/emsdev/redo02.dbf

NO

SQL> alter system checkpoint;

System altered.

SQL> alter system checkpoint;

System altered.

session 2:

root@kttest1-1 # dd if=/dev/null of=/kttest1-1_data1/emsdev/redo02.dbf bs=512 count=10

0+0 records in

0+0 records out

session 1:

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS

---------- ---------- ---------- ---------- ---------- --- ----------------

FIRST_CHANGE# FIRST_TIM

------------- ---------

1 1 23 104857600 1 NO INACTIVE

1.2792E+13 03-JUN-14

2 1 22 104857600 1 NO INACTIVE

1.2792E+13 02-JUN-14

3 1 24 104857600 1 NO CURRENT

1.2792E+13 03-JUN-14

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area 3207790592 bytes

Fixed Size 2119072 bytes

Variable Size 381586016 bytes

Database Buffers 2818572288 bytes

Redo Buffers 5513216 bytes

Database mounted.

ORA-00320: cannot read file header from log 2 of thread 1

ORA-00312: online log 2 thread 1: '/kttest1-1_data1/emsdev/redo02.dbf'

SQL> alter database clear logfile group 2;

Database altered.

SQL> alter database open;

alter database open

*

ERROR at line 1:

ORA-00320: cannot read file header from log 2 of thread 1

ORA-00312: online log 2 thread 1: '/kttest1-1_data1/emsdev/redo02.dbf'

SQL> alter database drop logfile group 2;

Database altered.

SQL> alter database open;

Database altered.

SQL> alter database add logfile group 2 ('/kttest1-1_data1/emsdev/redo02.dbf') size 100m;

alter database add logfile group 2 ('/kttest1-1_data1/emsdev/redo02.dbf') size 300m

*

ERROR at line 1:

ORA-00301: error in adding log file '/kttest1-1_data1/emsdev/redo02.dbf' - file

cannot be created

ORA-27038: created file already exists

Additional information: 1

SQL> alter database add logfile group 2 ('/kttest1-1_data1/emsdev/redo02.dbf') size 100m reuse;

Database altered.

二.非归档下active状态的redo 恢复

如果非current redo 损坏,但是包含active事务,那么情况完全不同。

----Session 1

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS

---------- ---------- ---------- ---------- ---------- --- ----------------

FIRST_CHANGE# FIRST_TIM

------------- ---------

1 1 26 104857600 1 NO CURRENT

1.2792E+13 04-JUN-14

2 1 25 314572800 1 NO ACTIVE

1.2792E+13 04-JUN-14

3 1 24 104857600 1 NO INACTIVE

1.2792E+13 03-JUN-14

SQL> col member for a70

SQL> select * from v$logfile;

GROUP# STATUS TYPE

---------- ------- -------

MEMBER IS_

---------------------------------------------------------------------- ---

3 ONLINE

/kttest1-1_data1/emsdev/redo03.dbf NO

1 ONLINE

/kttest1-1_data1/emsdev/redo01.dbf NO

2 ONLINE

/kttest1-1_data1/emsdev/redo02.dbf NO

session 2:

root@kttest1-1 # dd if=/dev/null of=/kttest1-1_data1/emsdev/redo02.dbf bs=512 count=10

0+0 records in

0+0 records out

---Session 1

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS

---------- ---------- ---------- ---------- ---------- --- ----------------

FIRST_CHANGE# FIRST_TIM

------------- ---------

1 1 26 104857600 1 NO CURRENT

1.2792E+13 04-JUN-14

2 1 25 314572800 1 NO ACTIVE

1.2792E+13 04-JUN-14

3 1 24 104857600 1 NO INACTIVE

1.2792E+13 03-JUN-14

SQL>SQL> shutdown abort

ORACLE instance shut down.

SQL> select * from v$log;

select * from v$log

*

ERROR at line 1:

ORA-01034: ORACLE not available

Process ID: 3544

Session ID: 83 Serial number: 3

SQL> conn /as sysdba

Connected to an idle instance.

SQL> startup

ORACLE instance started.

Total System Global Area 3207790592 bytes

Fixed Size 2119072 bytes

Variable Size 381586016 bytes

Database Buffers 2818572288 bytes

Redo Buffers 5513216 bytes

Database mounted.

ORA-00320: cannot read file header from log 2 of thread 1

ORA-00312: online log 2 thread 1: '/kttest1-1_data1/emsdev/redo02.dbf'

ORA-27069: attempt to do I/O beyond the range of the file

Additional information: 1

Additional information: 1

SQL> alter database clear logfile group 2;

alter database clear logfile group 2

*

ERROR at line 1:

ORA-01624: log 2 needed for crash recovery of instance emsdev1 (thread 1)

ORA-00312: online log 2 thread 1: '/kttest1-1_data1/emsdev/redo02.dbf'

SQL> alter database drop logfile group 2;

alter database drop logfile group 2

*

ERROR at line 1:

ORA-01624: log 2 needed for crash recovery of instance emsdev1 (thread 1)

ORA-00312: online log 2 thread 1: '/kttest1-1_data1/emsdev/redo02.dbf'

SQL> recover database until cancel;

ORA-00279: change 12792226234738 generated at 06/04/2014 09:35:35 needed for

thread 1

ORA-00289: suggestion : /kttest1-1_data1/emsdev/arch/1_32_848646308.arch

ORA-00280: change 12792226234738 for thread 1 is in sequence #32

Specify log: {=suggested | filename | AUTO | CANCEL}

auto

ORA-00308: cannot open archived log

'/kttest1-1_data1/emsdev/arch/1_32_848646308.arch'

ORA-27037: unable to obtain file status

SVR4 Error: 2: No such file or directory

Additional information: 3

ORA-00308: cannot open archived log

'/kttest1-1_data1/emsdev/arch/1_32_848646308.arch'

ORA-27037: unable to obtain file status

SVR4 Error: 2: No such file or directory

Additional information: 3

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: '/kttest1-1_data1/emsdev/system01.dbf'

32没有归档,不能这样恢复

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS

---------- ---------- ---------- ---------- ---------- --- ----------------

FIRST_CHANGE# FIRST_TIM

------------- ---------

1 1 32 104857600 1 NO ACTIVE

1.2792E+13 04-JUN-14

3 1 34 104857600 1 NO CURRENT

1.2792E+13 04-JUN-14

2 1 33 104857600 1 NO ACTIVE

1.2792E+13 04-JUN-14

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: '/kttest1-1_data1/emsdev/system01.dbf'

SQL> show parameter pfile

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

spfile string

SQL> shutdown immediate

ORA-01109: database not open

Database dismounted.

ORACLE instance shut down.

SQL>

在pfile文件中加入两个参数:

*._allow_resetlogs_corruption=true

*._allow_error_simulation=true ----从oracle 10g开始,引入的另外一个参数。

SQL> conn /as sysdba

Connected to an idle instance.

SQL> startup mount

ORACLE instance started.

Total System Global Area 3207790592 bytes

Fixed Size 2119072 bytes

Variable Size 381586016 bytes

Database Buffers 2818572288 bytes

Redo Buffers 5513216 bytes

Database mounted.

SQL> alter database open resetlogs;

Database altered.

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> /

System altered.

SQL> /

System altered.

三.非归档下current状态的redo恢复

session 1:

SQL> create table test as select * from dba_extents;

Table created.

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS

---------- ---------- ---------- ---------- ---------- --- ----------------

FIRST_CHANGE# FIRST_TIM

------------- ---------

1 1 1 104857600 1 NO CURRENT

1.2792E+13 04-JUN-14

2 1 0 104857600 1 YES UNUSED

0

3 1 0 104857600 1 YES UNUSED

session 2 :

root@kttest1-1 # dd if=/dev/null of=/kttest1-1_data1/emsdev/redo01.dbf bs=512 count=10

0+0 records in

0+0 records out

session 1:

SQL> delete from test where rownum <100000;

45074 rows deleted.

SQL> commit;

Commit complete.

SQL> shutdown immediate

ORA-03113: end-of-file on communication channel

Process ID: 14382

Session ID: 83 Serial number: 3

SQL> startup

ORA-24324: service handle not initialized

ORA-01041: internal error. hostdef extension doesn't exist

SQL> conn /as sysdba

Connected to an idle instance.

SQL> startup

ORACLE instance started.

Total System Global Area 3207790592 bytes

Fixed Size 2119072 bytes

Variable Size 381586016 bytes

Database Buffers 2818572288 bytes

Redo Buffers 5513216 bytes

Database mounted.

ORA-00316: log 1 of thread 1, type 0 in header is not log file

ORA-00312: online log 1 thread 1: '/kttest1-1_data1/emsdev/redo01.dbf'

SQL> recover database until cancel;

ORA-00279: change 12792226263763 generated at 06/04/2014 10:45:34 needed for

thread 1

ORA-00289: suggestion : /kttest1-1_data1/emsdev/arch/1_1_849350732.arch

ORA-00280: change 12792226263763 for thread 1 is in sequence #1

Specify log: {=suggested | filename | AUTO | CANCEL}

auto

ORA-00308: cannot open archived log

'/kttest1-1_data1/emsdev/arch/1_1_849350732.arch'

ORA-27037: unable to obtain file status

SVR4 Error: 2: No such file or directory

Additional information: 3

ORA-00308: cannot open archived log

'/kttest1-1_data1/emsdev/arch/1_1_849350732.arch'

ORA-27037: unable to obtain file status

SVR4 Error: 2: No such file or directory

Additional information: 3

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: '/kttest1-1_data1/emsdev/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: '/kttest1-1_data1/emsdev/system01.dbf'

在pfile文件中加入两个参数:

*._allow_resetlogs_corruption=true

*._allow_error_simulation=true

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.

如果无法直接open resetlogs打开的话,要检查一下alert.log报错:

Thu Jul 18 16:38:42 2013

SMON: enabling cache recovery

Thu Jul 18 16:38:43 2013

Errors in file /oracle/admin/orcl/udump/orcl_ora_11149.trc:

ORA-00600: internal error code, arguments: [2662], [0], [4099916], [0], [4100136], [4194313], [], []

Thu Jul 18 16:38:43 2013

Error 600 happened during db open, shutting down database

USER: terminating instance due to error 600

Instance terminated by USER, pid = 11149

ORA-1092 signalled during: alter database open resetlogs...

如出现ora-00600 [2662]报错,需要推进scn。推进方法如下:

ORA-600 [2662] [a] [b] [c] [d] [e]

Arg [a] Current SCN WRAP

Arg [b] Current SCN BASE

Arg [c] dependent SCN WRAP

Arg [d] dependent SCN BASE

Arg [e] Where present this is the DBA where the dependent SCN came from.

算法计算规则如下:Arg [c]*4得出一个数值,假设为V_Wrap,

如果Arg [d]=0,则V_Wrap值为需要的level

Arg [d] < 1073741824,V_Wrap+1为需要的level

Arg [d] < 2147483648,V_Wrap+2为需要的level

Arg [d] < 3221225472,V_Wrap+3为需要的level

数据库处于mount状态下,执行:alter session set events '10015 trace name adjust_scn level 1';

再alter database open;

可以检查v$datafile与v$datafile_header的substr(checkpoint_change#,1,14)大小相同

四.归档模式下的red log恢复

1)inactive logfile损坏的情况

session 1:

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS

---------- ---------- ---------- ---------- ---------- --- ----------------

FIRST_CHANGE# FIRST_TIM

------------- ---------

1 1 4 104857600 1 NO CURRENT

1.2792E+13 04-JUN-14

2 1 2 104857600 1 YES INACTIVE

1.2792E+13 04-JUN-14

3 1 3 104857600 1 YES INACTIVE

1.2792E+13 04-JUN-14

SQL> col member for a70

SQL> select * from v$logfile;

GROUP# STATUS TYPE

---------- ------- -------

MEMBER IS_

---------------------------------------------------------------------- ---

3 ONLINE

/kttest1-1_data1/emsdev/redo03.dbf NO

1 ONLINE

/kttest1-1_data1/emsdev/redo01.dbf NO

2 ONLINE

/kttest1-1_data1/emsdev/redo02.dbf NO

session 2:

root@kttest1-1 # dd if=/dev/null of=/kttest1-1_data1/emsdev/redo03.dbf bs=512 count=10

0+0 records in

0+0 records out

在这一步,如果不将数据库进行shutdown,继续进行logfile的切换,那么redo03仍然是可以写的,然而存在潜在风险。

session 1:

SQL> shutdown abort

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area 3207790592 bytes

Fixed Size 2119072 bytes

Variable Size 381586016 bytes

Database Buffers 2818572288 bytes

Redo Buffers 5513216 bytes

Database mounted.

ORA-00320: cannot read file header from log 3 of thread 1

ORA-00312: online log 3 thread 1: '/kttest1-1_data1/emsdev/redo03.dbf'

SQL> alter database clear logfile group 3;

Database altered.

SQL> alter database drop logfile group 3;

Database altered.

SQL> alter database add logfile group 3 ('/kttest1-1_data1/emsdev/redo03.dbf') size 100m reuse;

Database altered.

SQL> alter database open; ++++ 这里地方由于原来旧有的redo03被进程持有,可能句柄未释放,所以仍然报错,重启实例即可.

alter database open

*

ERROR at line 1:

ORA-00320: cannot read file header from log 3 of thread 1

ORA-00312: online log 3 thread 1: '/kttest1-1_data1/emsdev/redo03.dbf'

SQL> startup

ORACLE instance started.

Total System Global Area 3207790592 bytes

Fixed Size 2119072 bytes

Variable Size 381586016 bytes

Database Buffers 2818572288 bytes

Redo Buffers 5513216 bytes

Database mounted.

Database opened.

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS

---------- ---------- ---------- ---------- ---------- --- ----------------

FIRST_CHANGE# FIRST_TIM

------------- ---------

1 1 4 104857600 1 YES INACTIVE

1.2792E+13 04-JUN-14

2 1 2 104857600 1 YES INACTIVE

1.2792E+13 04-JUN-14

3 1 5 104857600 1 NO CURRENT

1.2792E+13 04-JUN-14

SQL> alter system switch logfile;

System altered.

2. 归档模式下current logfile损坏

场景一:

session 1:

SQL> set line 200

SQL> col member for a30

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM

---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------

1 1 4 104857600 1 YES INACTIVE 1.2792E+13 04-JUN-14

2 1 6 104857600 1 NO CURRENT 1.2792E+13 04-JUN-14

3 1 5 104857600 1 YES INACTIVE 1.2792E+13 04-JUN-14

SQL> select * from v$logfile;

GROUP# STATUS TYPE MEMBER IS_

---------- ------- ------- ------------------------------ ---

3 ONLINE /kttest1-1_data1/emsdev/redo03 NO

.dbf

1 ONLINE /kttest1-1_data1/emsdev/redo01 NO

.dbf

2 ONLINE /kttest1-1_data1/emsdev/redo02 NO

.dbf

session 2:

root@kttest1-1 # dd if=/dev/null of=/kttest1-1_data1/emsdev/redo02.dbf bs=512 count=10

0+0 records in

0+0 records out

session 1:

SQL> shutdown immediate

ORA-03113: end-of-file on communication channel

Process ID: 15430

Session ID: 74 Serial number: 1

SQL> conn /as sysdba

Connected to an idle instance.

SQL> startup

ORACLE instance started.

Total System Global Area 3207790592 bytes

Fixed Size 2119072 bytes

Variable Size 381586016 bytes

Database Buffers 2818572288 bytes

Redo Buffers 5513216 bytes

Database mounted.

ORA-00316: log 2 of thread 1, type 0 in header is not log file

ORA-00312: online log 2 thread 1: '/kttest1-1_data1/emsdev/redo02.dbf'

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM

---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------

1 1 4 104857600 1 YES INACTIVE 1.2792E+13 04-JUN-14

3 1 5 104857600 1 YES INACTIVE 1.2792E+13 04-JUN-14

2 1 6 104857600 1 NO CURRENT 1.2792E+13 04-JUN-14

SQL> conn /as sysdba

Connected.

SQL> shutdown immediate

ORA-01109: database not open

Database dismounted.

ORACLE instance shut down.

在pfile文件中加入两个参数:

*._allow_resetlogs_corruption=true

*._allow_error_simulation=true

SQL> startup

ORACLE instance started.

Total System Global Area 3207790592 bytes

Fixed Size 2119072 bytes

Variable Size 381586016 bytes

Database Buffers 2818572288 bytes

Redo Buffers 5513216 bytes

Database mounted.

ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> recover database until cancel;

ORA-00279: change 12792226298118 generated at 06/04/2014 14:21:06 needed for

thread 1

ORA-00289: suggestion : /kttest1-1_data1/emsdev/arch/1_6_849351843.arch

ORA-00280: change 12792226298118 for thread 1 is in sequence #6

Specify log: {=suggested | filename | AUTO | CANCEL}

auto

ORA-00308: cannot open archived log

'/kttest1-1_data1/emsdev/arch/1_6_849351843.arch'

ORA-27037: unable to obtain file status

SVR4 Error: 2: No such file or directory

Additional information: 3

ORA-00308: cannot open archived log

'/kttest1-1_data1/emsdev/arch/1_6_849351843.arch'

ORA-27037: unable to obtain file status

SVR4 Error: 2: No such file or directory

Additional information: 3

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: '/kttest1-1_data1/emsdev/system01.dbf'

SQL> alter database open resetlogs;

alter database open resetlogs

*

ERROR at line 1:

ORA-01092: ORACLE instance terminated. Disconnection forced

Process ID: 16850

Session ID: 166 Serial number: 3

检查alert.log发现如下报错:

Errors in file /oracle/emsdev/diag/rdbms/emsdev1/emsdev1/trace/emsdev1_ora_16850.trc (incident=107308):

ORA-00600: internal error code, arguments: [2662], [2978], [1813690638], [2978], [1813691502], [4194432], [], [], [], [], [], []

Incident details in: /oracle/emsdev/diag/rdbms/emsdev1/emsdev1/incident/incdir_107308/emsdev1_ora_16850_i107308.trc

Wed Jun 04 14:38:11 2014

Errors in file /oracle/emsdev/diag/rdbms/emsdev1/emsdev1/trace/emsdev1_ora_16850.trc:

ORA-00600: internal error code, arguments: [2662], [2978], [1813690638], [2978], [1813691502], [4194432], [], [], [], [], [], []

Error 600 happened during db open, shutting down database

USER (ospid: 16850): terminating the instance due to error 600

Instance terminated by USER, pid = 16850

ORA-1092 signalled during: alter database open resetlogs...

ORA-1092 : opiodr aborting process unknown ospid (16850_1)

Wed Jun 04 14:38:15 2014

ORA-1092 : opitsk aborting process

/* 如出现ora-00600 [2662]报错,需要推进scn。推进方法如下:

ORA-600 [2662] [a] [b] [c] [d] [e]

Arg [a] Current SCN WRAP

Arg [b] Current SCN BASE

Arg [c] dependent SCN WRAP

Arg [d] dependent SCN BASE

Arg [e] Where present this is the DBA where the dependent SCN came from.

算法计算规则如下:Arg [c]*4得出一个数值,假设为V_Wrap,

如果Arg [d]=0,则V_Wrap值为需要的level

Arg [d] < 1073741824,V_Wrap+1为需要的level

Arg [d] < 2147483648,V_Wrap+2为需要的level

Arg [d] < 3221225472,V_Wrap+3为需要的level

数据库处于mount状态下,执行:alter session set events '10015 trace name adjust_scn level 1';

再alter database open;

可以检查v$datafile与v$datafile_header的substr(checkpoint_change#,1,14)大小相同 */

按以上方法计算出需要推进的scn大小为11914

session 1:

SQL> conn /as sysdba

Connected to an idle instance.

SQL> startup mount

ORACLE instance started.

Total System Global Area 3207790592 bytes

Fixed Size 2119072 bytes

Variable Size 381586016 bytes

Database Buffers 2818572288 bytes

Redo Buffers 5513216 bytes

Database mounted.

SQL> alter session set events '10015 trace name adjust_scn level 11914';

Session altered.

SQL> select substr(checkpoint_change#,1,14) as df_scn from v$datafile;

DF_SCN

--------------------------------------------------------

12792226298122

12792226298122

12792226298122

12792226298122

12792226298122

12792226298122

12792226298122

12792226298122

12792226298122

12792226298122

12792226298122

DF_SCN

--------------------------------------------------------

12792226298122

12792226298122

13 rows selected.

SQL> select substr(checkpoint_change#,1,14) as dfh_scn from v$datafile;

DFH_SCN

--------------------------------------------------------

12792226298122

12792226298122

12792226298122

12792226298122

12792226298122

12792226298122

12792226298122

12792226298122

12792226298122

12792226298122

12792226298122

DFH_SCN

--------------------------------------------------------

12792226298122

12792226298122

13 rows selected.

SQL> alter database open;

Database altered.

场景二:

+++++Session 1

SQL> conn /as sysdba

Connected.

SQL> set lines 200

SQL> col member for a60

SQL> select * from v$Log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM

---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------

1 1 7 10485760 1 NO CURRENT 1073767933 22-JUL-13

2 1 5 10485760 1 YES INACTIVE 1073742213 21-JUL-13

3 1 6 52428800 1 YES INACTIVE 1073742215 21-JUL-13

SQL> select * from v$logfile;

GROUP# STATUS TYPE MEMBER IS_

---------- ------- ------- ------------------------------------------------------------ ---

2 ONLINE /home/ora10g/oradata/roger/redo02.log NO

3 ONLINE /home/ora10g/oradata/roger/redo03.log NO

1 ONLINE /home/ora10g/oradata/roger/redo01.log NO

SQL>

SQL> alter system switch logfile;

System altered.

++++Session 2

[ora10g@killdb ~]$ dd if=/dev/null of=/home/ora10g/oradata/roger/redo02.log bs=512 count=10

0+0 records in

0+0 records out

++++Session 1

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1272600 bytes

Variable Size 96470248 bytes

Database Buffers 67108864 bytes

Redo Buffers 2920448 bytes

Database mounted.

ORA-00327: log 2 of thread 1, physical size less than needed

ORA-00312: online log 2 thread 1: '/home/ora10g/oradata/roger/redo02.log'

SQL> select * from v$Log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM

---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------

1 1 7 10485760 1 YES INACTIVE 1073767933 22-JUL-13

3 1 6 52428800 1 YES INACTIVE 1073742215 21-JUL-13

2 1 8 10485760 1 NO CURRENT 1073770766 22-JUL-13

SQL> recover database until cancel;

Media recovery complete.

SQL> alter database open resetlogs;

alter database open resetlogs

*

ERROR at line 1:

ORA-00327: log 2 of thread 1, physical size less than needed

ORA-00312: online log 2 thread 1: '/home/ora10g/oradata/roger/redo02.log'

在pfile文件中加入两个参数:

*._allow_resetlogs_corruption=true

*._allow_error_simulation=true

SQL> startup mount pfile='/tmp/pfile.ora';

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1272600 bytes

Variable Size 96470248 bytes

Database Buffers 67108864 bytes

Redo Buffers 2920448 bytes

Database mounted.

SQL> alter database open resetlogs;

alter database open resetlogs

*

ERROR at line 1:

ORA-01139: RESETLOGS option only valid after an incomplete database recovery

SQL> recover database until cancel;

ORA-00283: recovery session canceled due to errors

ORA-00600: internal error code, arguments: [2130], [0], [8], [2], [], [], [], []

SQL> show parameter resetlog

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

_allow_resetlogs_corruption boolean TRUE

SQL> show parameter allow

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

_allow_error_simulation boolean TRUE

_allow_resetlogs_corruption boolean TRUE

SQL> alter database open;

Database altered.

SQL>

SQL> alter system switch logfile;

System altered.

3. 归档模式下active logfile损坏

场景一:

session 1:

SQL> set line 300

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM

---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------

1 1 1 104857600 1 YES INACTIVE 1.2793E+13 04-JUN-14

2 1 2 104857600 1 NO CURRENT 1.2793E+13 04-JUN-14

3 1 0 104857600 1 YES UNUSED 0

SQL> alter system switch logfile;

System altered.

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM

---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------

1 1 1 104857600 1 YES INACTIVE 1.2793E+13 04-JUN-14

2 1 2 104857600 1 YES ACTIVE 1.2793E+13 04-JUN-14

3 1 3 104857600 1 NO CURRENT 1.2794E+13 04-JUN-14

session 2:

root@kttest1-1 # dd if=/dev/null of=/kttest1-1_data1/emsdev/redo02.dbf bs=512 count=10

0+0 records in

0+0 records out

session 1:

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area 3207790592 bytes

Fixed Size 2119072 bytes

Variable Size 381586016 bytes

Database Buffers 2818572288 bytes

Redo Buffers 5513216 bytes

Database mounted.

ORA-00320: cannot read file header from log 2 of thread 1

ORA-00312: online log 2 thread 1: '/kttest1-1_data1/emsdev/redo02.dbf'

SQL> alter database clear logfile group 2;

Database altered.

SQL> alter database drop logfile group 2;

Database altered.

SQL> alter database open;

Database altered.

SQL> alter database add logfile group 2 ('/kttest1-1_data1/emsdev/redo02.dbf') size 100m reuse;

Database altered.

场景二:

恢复方法与非归档模式下的active redo log恢复相同

0b1331709591d260c1c78e86d0c51c18.png

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/512065.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

站在原地就是退步——除了死磕通道,云通讯服务商还该做些什么?

受访嘉宾&#xff1a;吴佳钊&#xff0c;杭州云片网络科技有限公司联合创始人、CTO 当前&#xff0c;全球通信云已经步入2.0时代&#xff0c;最大的变化在于通信形式的变革&#xff1a;传统短信语音的通信形式将逐步向包括即时通讯IM实时音视频RTC的互联网通信转变。尤其在5G时…

Cube 技术解读 | 详解「支付宝」全新的卡片技术栈

简介&#xff1a; 魔方卡片&#xff08;Cube&#xff09;&#xff0c;让 App 首页实现敏捷更新。 CodeHub#7 正式落幕&#xff0c;来自蚂蚁集团的技术专家「京君」与掘金社区的开发者们分享了「支付宝」全新的卡片技术栈——魔方卡片&#xff08;Cube&#xff09;。 京君围绕 C…

庖丁解InnoDB之REDO LOG

简介&#xff1a; 数据库故障恢复机制的前世今生一文中提到&#xff0c;今生磁盘数据库为了在保证数据库的原子性(A, Atomic) 和持久性(D, Durability)的同时&#xff0c;还能以灵活的刷盘策略来充分利用磁盘顺序写的性能&#xff0c;会记录REDO和UNDO日志&#xff0c;即ARIES方…

Web 自动化神器,批量下载美图,可直接导入使用

‍‍作者 | 小碗汤来源 | 进击云原生今天为大家分享一款前端自动化操作神器: Automa。Automa介绍它是一款 Chrome 插件&#xff0c;即使你不会写代码&#xff0c;也能按照自己的需求&#xff0c;完成一系列自动化操作。利用它&#xff0c;你可以将一些重复性的任务实现自动化、…

RocketMQ 5.0 POP 消费模式探秘

简介&#xff1a; POP Consumer—使客户端无状态&#xff0c;更轻量&#xff01; 作者&#xff1a;凯易&耘田 前言&#xff1a;随着 RocketMQ 5.0 preview 的发布&#xff0c;5.0 的重大特性逐步与大家见面。POP Consumer 作为 5.0 的一大特性&#xff0c;POP 消费模式展现…

【ESSD技术解读-01】 云原生时代,阿里云块存储 ESSD 快照服务如何被企业级数据保护所集成?

简介&#xff1a; 本文描述了阿里云块存储快照服务基于高性能 ESSD 云盘提升快照服务性能&#xff0c;提供轻量、实时的用户体验及揭秘背后的技术原理。依据行业发展及云上数据保护场景&#xff0c;为企业用户及备份厂商提供基于快照高级特性的数据保护的技术方案&#xff0c;满…

一把王者的时间,我就学会了Nginx

作者 | 步尔斯特来源 | CSDN博客Nginx 简介Nginx("engine x")是一个高性能的 HTTP 和反向代理服务器,特点是占有内存少&#xff0c;并发能力强&#xff0c;事实上 nginx 的并发能力确实在同类型的网页服务器中表现较好&#xff0c;中国大陆使用 nginx 网站用户有&…

【ESSD技术解读-02】企业级利器,阿里云 NVMe 盘和共享存储

简介&#xff1a; 当前 NVMe 云盘结合了业界最先进的软硬件技术&#xff0c;在云存储市场&#xff0c;首创性同时实现了 NVMe 协议 共享访问 IO Fencing 技术。它在 ESSD 之上获得了高可靠、高可用、高性能&#xff0c;同时基于 NVMe 协议实现了丰富的企业特性&#xff0c;如…

php数组json函数,php数组转json的函数是什么

php数组转json的函数是json_encode()。json_encode()函数可以对变量进行JSON编码&#xff0c;将其转换为json字符串数据&#xff0c;语法格式“json_encode (value)”。本教程操作环境&#xff1a;windows7系统、PHP7.1版&#xff0c;DELL G3电脑php数组如何转为json&#xff1…

使用友盟+的APM服务实现对移动端APP的性能监控

简介&#xff1a; 对于信息系统服务&#xff0c;一般我们的重点监控对象都是核心的后端服务&#xff0c;通常会采用一些主流的APM(Application Performance Management)框架进行监控、告警、分析。那么对于移动端的APP、小程序的运行时状态如何进行实时监控与分析呢&#xff1f…

首届“中国物联网数据基础设施最佳案例评选”结果出炉

供稿 | 映云科技 出品 | CSDN云计算 随着物联网技术的成熟与普及&#xff0c;如今的世界早已进入万物互联的时代&#xff0c;全球年活跃连接的物联网设备已达数百亿规模 &#xff08;IoT Analytics, 2021&#xff09;。海量物联设备产生的数据&#xff0c;需要通过统一汇聚和…

Serverless 工程实践 | 快速搭建 Kubeless 平台

简介&#xff1a; Kubeless 是基于 Kubernetes 的原生无服务器框架。其允许用户部署少量的代码&#xff08;函数&#xff09;&#xff0c;而无须担心底层架构。 快速搭建 Kubeless 平台 Kubeless 简介 Kubeless 是基于 Kubernetes 的原生无服务器框架。其允许用户部署少量的…

并发编程实践之公平有界阻塞队列实现

简介&#xff1a; JUC 工具包是 JAVA 并发编程的利器。本文讲述在没有 JUC 工具包帮助下&#xff0c;借助原生的 JAVA 同步原语, 如何实现一个公平有界的阻塞队列。希望你也能在文后体会到并发编程的复杂之处&#xff0c;以及 JUC 工具包的强。 作者 | 李新然 来源 | 阿里技术公…

iOS App 启动优化

简介&#xff1a; 作为程序猿来说&#xff0c;“性能优化”是我们都很熟悉的词&#xff0c;也是我们需要不断努⼒以及持续进⾏的事情&#xff1b;其实优化是⼀个很⼤的课题&#xff0c;因为细分来说的话有⼤⼤⼩⼩⼗⼏种优化⽅向 &#xff0c;但是切忌在实际开发过程中不能盲⽬…

apache1.3 php编译,安装Apache1.3.29 - Linux+Apache+Mysql+PHP典型配置详解_Linux教程_Linux公社-Linux系统门户网站...

2.安装Apache1.3.29。我没有选择安装Apache2.0是我对他还是不放心&#xff0c;因为网上最新公布的apache的漏洞基本上是针对2.0&#xff0c;当然大家可以自己选择安装相应的版本。我这里讲的都是采用DSO动态编译的方法编译Apache.至于有关apache的编译方法&#xff0c;可以参考…

前后端、多语言、跨云部署,全链路追踪到底有多难?

简介&#xff1a; 完整的全链路追踪可以为业务带来三大核心价值&#xff1a;端到端问题诊断&#xff0c;系统间依赖梳理&#xff0c;自定义标记透传。 作者 | 涯海 全链路追踪的价值 链路追踪的价值在于“关联”&#xff0c;终端用户、后端应用、云端组件&#xff08;数据库…

供应商太多,怎么才能高效比价?

本篇文章暨 CSDN《中国 101 计划》系列数字化转型场景之一。 《中国 101 计划——探索企业数字化发展新生态》为 CSDN 联合《新程序员》、GitCode.net 开源代码仓共同策划推出的系列活动&#xff0c;寻访一百零一个数字化转型场景&#xff0c;聚合呈现并开通评选通道&#xff0…

7张图揭晓RocketMQ存储设计的精髓

简介&#xff1a; RocketMQ 作为一款基于磁盘存储的中间件&#xff0c;具有无限积压能力&#xff0c;并提供高吞吐、低延迟的服务能力&#xff0c;其最核心的部分必然是它优雅的存储设计。 存储概述 RocketMQ 存储的文件主要包括 Commitlog 文件、ConsumeQueue 文件、Index 文…

庖丁解InnoDB之UNDO LOG

简介&#xff1a; Undo Log是InnoDB十分重要的组成部分&#xff0c;它的作用横贯InnoDB中两个最主要的部分&#xff0c;并发控制&#xff08;Concurrency Control&#xff09;和故障恢复&#xff08;Crash Recovery&#xff09;&#xff0c;InnoDB中Undo Log的实现亦日志亦数据…

Ampere Altra Max 对比测试数据公布,性能能效双领先

在云计算领域&#xff0c;发展创新的脚步永不停歇。十多年前&#xff0c;伴随着虚拟化及高速网络的发展和成熟&#xff0c;云计算应运而生。在将工作负载迁移到云端的过程中&#xff0c;为了更好地适应云环境&#xff0c;软件架构得以重建&#xff0c;就如同搬进新家时&#xf…