資料庫備份與恢復(使用歸檔後滾)

xiaoli發表於2009-11-05

使用物理備份、資料庫歸檔,對資料庫進行後滾操作!

SQL> select * from abc;

NAME

--------

xiaoli

xiaoming

對資料庫做物理備份(資料檔案、控制檔案、redo.log)

[oracle@localhost oradata]$ tar -cvf lctx.tar lctx 壓縮lctx資料夾到lctx.tar

SQL> insert into abc values('xiaozz');

1 row created.

SQL> commit;

Commit complete.

SQL>

SQL> select * from abc;

NAME

--------

xiaoli

xiaoming

xiaozz

SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

Session altered.

SQL> select sysdate from dual;

SYSDATE

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

2009-11-05 03:11:54

SQL> alter system switch logfile;

System altered.

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL>

使用物理備份恢復!

[oracle@localhost oradata]$ tar -xvf lctx.tar lctx 解壓lctx.tarlctx資料夾

SQL> startup mount;

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1218316 bytes

Variable Size 88082676 bytes

Database Buffers 75497472 bytes

Redo Buffers 2973696 bytes

Database mounted.

SQL> recover database until cancel using backup controlfile until time '2009-11-05

03:11:54';

ORA-00279: change 817191 generated at 11/05/2009 02:57:38 needed for thread 1

ORA-00289: suggestion : /u01/archive/1_2_702085269.arc

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

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

auto

ORA-00279: change 817192 generated at 11/05/2009 03:03:02 needed for thread 1

ORA-00289: suggestion : /u01/archive/1_3_702085269.arc

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

ORA-00278: log file '/u01/archive/1_2_702085269.arc' no longer needed for this

recovery

Log applied.

Media recovery complete.

SQL>

SQL> alter database open resetlogs;

Database altered.

SQL> select * from abc;

NAME

--------

xiaoli

xiaoming

xiaozz //可以看到回覆到了2009-11-05 03:11:54的時間點!

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/60144/viewspace-1028472/,如需轉載,請註明出處,否則將追究法律責任。

相關文章