使用flashback快速解决当前日志文件丢失

SQL> select flashback_on,force_logging from v$database;

FLASHBACK_ON       FOR
------------------ ---
YES                YES

SQL> show parameter db_recovery_file;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /oracle/flash_recovery_area
db_recovery_file_dest_size           big integer 2G
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     1
Next log sequence to archive   1
Current log sequence           1

SQL> alter database open;

Database altered.

SQL> SELECT CURRENT_SCN FROM V$DATABASE;

CURRENT_SCN
-----------
     638023

SQL>  alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> /

System altered.


SQL> conn ctais2/oracle;
Connected.
SQL>  truncate table test;

Table truncated.


SQL>  select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
         1          1          3   52428800          1 YES INACTIVE                638029 01-APR-09
         3          1          4   52428800          1 NO  CURRENT                 638032 01-APR-09


--破环日志文件

SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;
ALTER SYSTEM ARCHIVE LOG CURRENT
*
ERROR at line 1:
ORA-16038: log 3 sequence# 4 cannot be archived
ORA-00312: online log 3 thread 1: '/oracle/oradata/logminer/redo03.log'


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


SQL> startup mount
ORACLE instance started.

Total System Global Area  205520896 bytes
Fixed Size                  1266608 bytes
Variable Size              79694928 bytes
Database Buffers          121634816 bytes
Redo Buffers                2924544 bytes
Database mounted.

SQL> flashback database to scn 638031;  (638032-1)

Flashback complete.


SQL> alter database open read only;

Database altered.

SQL> select count(*) from ctais2.test;

  COUNT(*)
----------
      2000

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

Total System Global Area  205520896 bytes
Fixed Size                  1266608 bytes
Variable Size              79694928 bytes
Database Buffers          121634816 bytes
Redo Buffers                2924544 bytes
Database mounted.
SQL> alter database open resetlogs;

Database altered.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8242091/viewspace-591191/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8242091/viewspace-591191/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值