*误删多路复用的online日志文件,数据库的变化

1.查看redo日志

col member for a45
set lines 120
SELECT thread#,
         a.sequence#,
         a.group#,
         TO_CHAR (first_change#, '9999999999999999') "SCN",
         a.status,
         MEMBER
    FROM v$log a, v$logfile b
   WHERE a.group# = B.GROUP#
ORDER BY a.sequence# DESC;

SQL> col member for a45
SQL> set lines 120
SQL> SELECT thread#,
  2           a.sequence#,
  3           a.group#,
  4           TO_CHAR (first_change#, '9999999999999999') "SCN",
  5           a.status,
  6           MEMBER
  7      FROM v$log a, v$logfile b
  8     WHERE a.group# = B.GROUP#
  9  ORDER BY a.sequence# DESC;

   THREAD#  SEQUENCE#     GROUP# SCN               STATUS           MEMBER
---------- ---------- ---------- ----------------- ---------------- ---------------------------------------------
         1          5          1           1162988 CURRENT          /u01/app/oracle/oradata/racdb/redo01_1.log
         1          5          1           1162988 CURRENT          /u01/app/oracle/oradata/racdb/redo01_2.log
         1          4          2           1141227 INACTIVE         /u01/app/oracle/oradata/racdb/redo02_1.log
         1          4          2           1141227 INACTIVE         /u01/app/oracle/oradata/racdb/redo02_2.log

2.查看数据库文件名

SQL> !ls -l
total 1663272
drwxr-xr-x. 2 oracle oinstall      4096 Dec 15 22:26 archivelog
-rw-r-----  1 oracle oinstall  18530304 Dec 15 22:34 control01.ctl
-rw-r-----  1 oracle oinstall  18530304 Dec 15 22:34 control02.ctl
-rw-r-----  1 oracle oinstall  18530304 Dec 15 22:34 control03.ctl
-rw-r-----  1 oracle oinstall  10493952 Dec 15 22:26 eas_d_anjoy_standard01.dbf
-rw-r-----  1 oracle oinstall  52429312 Dec 15 22:32 redo01_1.log
-rw-r-----  1 oracle oinstall  52429312 Dec 15 22:32 redo01_2.log
-rw-r-----  1 oracle oinstall  52429312 Dec 15 22:26 redo02_1.log
-rw-r-----  1 oracle oinstall  52429312 Dec 15 22:26 redo02_2.log
-rw-r-----  1 oracle oinstall 576724992 Dec 15 22:32 sysaux01.dbf
-rw-r-----  1 oracle oinstall 775954432 Dec 15 22:32 system01.dbf
-rw-r-----  1 oracle oinstall  20979712 Dec 13 05:30 temp01.dbf
-rw-r-----  1 oracle oinstall  20979712 Dec 15 22:26 test01.dbf
-rw-r-----  1 oracle oinstall  47194112 Dec 15 22:32 undotbs1.dbf
-rw-r-----  1 oracle oinstall   5251072 Dec 15 22:26 
```users01.dbf

# 3.删除当前日志组文件
```sql
SQL> !rm redo01_1.log
SQL> !ls -l
total 1612068
drwxr-xr-x. 2 oracle oinstall      4096 Dec 15 22:26 archivelog
-rw-r-----  1 oracle oinstall  18530304 Dec 15 22:36 control01.ctl
-rw-r-----  1 oracle oinstall  18530304 Dec 15 22:36 control02.ctl
-rw-r-----  1 oracle oinstall  18530304 Dec 15 22:36 control03.ctl
-rw-r-----  1 oracle oinstall  10493952 Dec 15 22:26 eas_d_anjoy_standard01.dbf
-rw-r-----  1 oracle oinstall  52429312 Dec 15 22:35 redo01_2.log
-rw-r-----  1 oracle oinstall  52429312 Dec 15 22:26 redo02_1.log
-rw-r-----  1 oracle oinstall  52429312 Dec 15 22:26 redo02_2.log
-rw-r-----  1 oracle oinstall 576724992 Dec 15 22:32 sysaux01.dbf
-rw-r-----  1 oracle oinstall 775954432 Dec 15 22:32 system01.dbf
-rw-r-----  1 oracle oinstall  20979712 Dec 13 05:30 temp01.dbf
-rw-r-----  1 oracle oinstall  20979712 Dec 15 22:26 test01.dbf
-rw-r-----  1 oracle oinstall  47194112 Dec 15 22:32 undotbs1.dbf
-rw-r-----  1 oracle oinstall   5251072 Dec 15 22:26 users01.dbf

4.查看当前的日志组仍然在使用

SQL> col member for a45
SQL> set lines 120
SQL> SELECT thread#,
  2           a.sequence#,
  3           a.group#,
  4           TO_CHAR (first_change#, '9999999999999999') "SCN",
  5           a.status,
  6           MEMBER
  7      FROM v$log a, v$logfile b
  8     WHERE a.group# = B.GROUP#
  9  ORDER BY a.sequence# DESC;

   THREAD#  SEQUENCE#     GROUP# SCN               STATUS           MEMBER
---------- ---------- ---------- ----------------- ---------------- ---------------------------------------------
         1          5          1           1162988 CURRENT          /u01/app/oracle/oradata/racdb/redo01_1.log
         1          5          1           1162988 CURRENT          /u01/app/oracle/oradata/racdb/redo01_2.log
         1          4          2           1141227 INACTIVE         /u01/app/oracle/oradata/racdb/redo02_1.log
         1          4          2           1141227 INACTIVE         /u01/app/oracle/oradata/racdb/redo02_2.log

5.重启数据库,可以正常重启

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1202556928 bytes
Fixed Size                  2252704 bytes
Variable Size             771752032 bytes
Database Buffers          419430400 bytes
Redo Buffers                9121792 bytes
Database mounted.
Database opened.

6.切换日志查看是否成功,而被删掉的多路复用确定不在,但是在数据库依然可以看到

SQL> col member for a45
SQL> set lines 120
SQL> SELECT thread#,
  2           a.sequence#,
  3           a.group#,
  4           TO_CHAR (first_change#, '9999999999999999') "SCN",
  5           a.status,
  6           MEMBER
  7      FROM v$log a, v$logfile b
  8     WHERE a.group# = B.GROUP#
  9  ORDER BY a.sequence# DESC;

   THREAD#  SEQUENCE#     GROUP# SCN               STATUS           MEMBER
---------- ---------- ---------- ----------------- ---------------- ---------------------------------------------
         1          5          1           1162988 CURRENT          /u01/app/oracle/oradata/racdb/redo01_1.log
         1          5          1           1162988 CURRENT          /u01/app/oracle/oradata/racdb/redo01_2.log
         1          4          2           1141227 INACTIVE         /u01/app/oracle/oradata/racdb/redo02_1.log
         1          4          2           1141227 INACTIVE         /u01/app/oracle/oradata/racdb/redo02_2.log

SQL> alter system switch logfile;

System altered.

SQL> col member for a45
SQL> set lines 120
SQL> SELECT thread#,
  2           a.sequence#,
  3           a.group#,
  4           TO_CHAR (first_change#, '9999999999999999') "SCN",
  5           a.status,
  6           MEMBER
  7      FROM v$log a, v$logfile b
  8     WHERE a.group# = B.GROUP#
  9  ORDER BY a.sequence# DESC;

   THREAD#  SEQUENCE#     GROUP# SCN               STATUS           MEMBER
---------- ---------- ---------- ----------------- ---------------- ---------------------------------------------
         1          6          2           1164459 CURRENT          /u01/app/oracle/oradata/racdb/redo02_1.log
         1          6          2           1164459 CURRENT          /u01/app/oracle/oradata/racdb/redo02_2.log
         1          5          1           1162988 ACTIVE           /u01/app/oracle/oradata/racdb/redo01_1.log
         1          5          1           1162988 ACTIVE           /u01/app/oracle/oradata/racdb/redo01_2.log

SQL> !ls -l
total 1612068
drwxr-xr-x. 2 oracle oinstall      4096 Dec 15 22:41 archivelog
-rw-r-----  1 oracle oinstall  18530304 Dec 15 22:41 control01.ctl
-rw-r-----  1 oracle oinstall  18530304 Dec 15 22:41 control02.ctl
-rw-r-----  1 oracle oinstall  18530304 Dec 15 22:41 control03.ctl
-rw-r-----  1 oracle oinstall  10493952 Dec 15 22:41 eas_d_anjoy_standard01.dbf
-rw-r-----  1 oracle oinstall  52429312 Dec 15 22:41 redo01_2.log
-rw-r-----  1 oracle oinstall  52429312 Dec 15 22:41 redo02_1.log
-rw-r-----  1 oracle oinstall  52429312 Dec 15 22:41 redo02_2.log
-rw-r-----  1 oracle oinstall 576724992 Dec 15 22:41 sysaux01.dbf
-rw-r-----  1 oracle oinstall 775954432 Dec 15 22:41 system01.dbf
-rw-r-----  1 oracle oinstall  20979712 Dec 13 05:30 temp01.dbf
-rw-r-----  1 oracle oinstall  20979712 Dec 15 22:41 test01.dbf
-rw-r-----  1 oracle oinstall  47194112 Dec 15 22:41 undotbs1.dbf
-rw-r-----  1 oracle oinstall   5251072 Dec 15 22:41 users01.dbf

7.查看告警日志(数据库持续告警,并在trace目录下生成了追踪文件)

alert日志:
Checkpoint not complete
  Current log# 2 seq# 6 mem# 0: /u01/app/oracle/oradata/racdb/redo02_1.log
  Current log# 2 seq# 6 mem# 1: /u01/app/oracle/oradata/racdb/redo02_2.log
Errors in file /u01/app/oracle/diag/rdbms/racdb/racdb/trace/racdb_lgwr_3193.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/racdb/redo01_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/racdb/racdb/trace/racdb_lgwr_3193.trc:
ORA-00321: log 1 of thread 1, cannot update log file header
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/racdb/redo01_1.log'
Errors in file /u01/app/oracle/diag/rdbms/racdb/racdb/trace/racdb_lgwr_3193.trc:
ORA-00313: open failed for members of log group 1 of thread 1
Thread 1 advanced to log sequence 7 (LGWR switch)
  Current log# 1 seq# 7 mem# 1: /u01/app/oracle/oradata/racdb/redo01_2.log
Tue Dec 15 22:41:00 2020
Archived Log entry 36 added for thread 1 sequence 6 ID 0x3ee0566e dest 1:
Tue Dec 15 22:41:00 2020
Errors in file /u01/app/oracle/diag/rdbms/racdb/racdb/trace/racdb_m000_3251.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/racdb/redo01_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

8.将别删除的日志文件从日志组剔除,切换日志,告警日志中恢复正常

SQL> alter database drop logfile member '/u01/app/oracle/oradata/racdb/redo01_1.log';

Database altered.

SQL> col member for a45
SQL> set lines 120
SQL> SELECT thread#,
  2           a.sequence#,
  3           a.group#,
  4           TO_CHAR (first_change#, '9999999999999999') "SCN",
  5           a.status,
  6           MEMBER
  7      FROM v$log a, v$logfile b
  8     WHERE a.group# = B.GROUP#
  9  ORDER BY a.sequence# DESC;

   THREAD#  SEQUENCE#     GROUP# SCN               STATUS           MEMBER
---------- ---------- ---------- ----------------- ---------------- ---------------------------------------------
         1          4          2           1110573 CURRENT          /u01/app/oracle/oradata/racdb/redo02_1.log
         1          4          2           1110573 CURRENT          /u01/app/oracle/oradata/racdb/redo02_2.log
         1          3          1           1110570 INACTIVE         /u01/app/oracle/oradata/racdb/redo01_2.log

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

告警日志:
Checker run found 1 new persistent data failures
Tue Dec 15 22:54:40 2020
alter database drop logfile member '/u01/app/oracle/oradata/racdb/redo01_1.log'
Completed: alter database drop logfile member '/u01/app/oracle/oradata/racdb/redo01_1.log'
Tue Dec 15 22:55:14 2020
Thread 1 advanced to log sequence 5 (LGWR switch)
  Current log# 1 seq# 5 mem# 0: /u01/app/oracle/oradata/racdb/redo01_2.log
Tue Dec 15 22:55:14 2020
Archived Log entry 34 added for thread 1 sequence 4 ID 0x3ee0566e dest 1:
Thread 1 cannot allocate new log, sequence 6
Checkpoint not complete
  Current log# 1 seq# 5 mem# 0: /u01/app/oracle/oradata/racdb/redo01_2.log
Thread 1 advanced to log sequence 6 (LGWR switch)
  Current log# 2 seq# 6 mem# 0: /u01/app/oracle/oradata/racdb/redo02_1.log
  Current log# 2 seq# 6 mem# 1: /u01/app/oracle/oradata/racdb/redo02_2.log
Tue Dec 15 22:55:21 2020
Archived Log entry 35 added for thread 1 sequence 5 ID 0x3ee0566e dest 1:

Related Posts