OCP-1Z0-053-V12.02-178题

178.If a log file becomes corrupted, it may cause the database to stall. How would you correct such a situation?

A. Recover the online redo log from backup.

B. Delete and re-create the log file.

C. Use the alter database clear logfile command to clear the log file.

D. Shut down the database and restart it.

E. Shut down the database and then mount it. Clear the log file with the alter database clear logfile

command and then restart the database with alter database open resetlogs.

Answer: C 
答案解析:

sys@TEST1107> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARC STATUS           FIRST_CHANGE#
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- -------------
FIRST_TIME         NEXT_CHANGE# NEXT_TIME
------------------ ------------ ------------------
         1          1          0   52428800        512          2 YES UNUSED                 1387129
07-NOV-13               1387224 07-NOV-13

         2          1         26   52428800        512          2 YES INACTIVE               1387224
07-NOV-13               1387262 07-NOV-13

         3          1         27   52428800        512          2 NO  CURRENT                1387262
07-NOV-13            2.8147E+14

[oracle@rtest ~]$ rm -f /u01/app/oracle/oradata/test1107/redo02.log

sys@TEST1107> alter database clear logfile group 2;

Database altered.


----如果没有执行上面这个语句,在再次启动数据库时 被删掉的日志会变成INVALID状态。执行alter database clear logfile group 2,再次启动数据库时,日志都是正常的。
所以可以直接在线清除日志信息,E答案不用resetlogs打开数据库,错误。
D答案,再次启动,日志会变成INVALID状态。
B答案,需要关闭再起库到mount状态。
A答案,直接清除就可以,不需要恢复。

以下关闭再启库,只是测试日志是否正常。

sys@TEST1107> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
sys@TEST1107> startup
ORACLE instance started.

Total System Global Area 1269366784 bytes
Fixed Size                  2227984 bytes
Variable Size             872415472 bytes
Database Buffers          385875968 bytes
Redo Buffers                8847360 bytes
Database mounted.
Database opened.
sys@TEST1107> select * from v$logfile;

    GROUP# STATUS  TYPE    MEMBER                                             IS_
---------- ------- ------- -------------------------------------------------- ---
         3         ONLINE  /u01/app/oracle/oradata/test1107/redo03.log        NO
         2         ONLINE  /u01/app/oracle/oradata/test1107/redo02.log        NO
         1         ONLINE  /u01/app/oracle/oradata/test1107/redo01.log        NO
         1         ONLINE  /u01/app/oracle/oradata/test1107/redo01a.log       NO
         2         ONLINE  /u01/app/oracle/oradata/test1107/redo02a.log       NO
         3         ONLINE  /u01/app/oracle/oradata/test1107/redo03a.log       NO

6 rows selected.

原文地址:https://www.cnblogs.com/hzcya1995/p/13316506.html