Oracle基於使用者管理的不完全恢複(三)恢複過去某個時間點誤操

來源:互聯網
上載者:User

案例2——恢複過去某個時間點誤操作的表(DML)

1、基於change (scn)

SQL> conn scott/tiger

Connected.

SQL> select * from tb01;

ID

----------

1

2

3

SQL> drop table tb01 purge;

Table dropped.

SQL> create table tb01(id int) tablespace test;

Table created.

SQL> insert into tb01 values(1);

1 row created.

SQL> commit;

Commit complete.

——通過logmr 分析出誤操作的scn

SQL> select username,scn,timestamp,sql_redo from v$logmnr_contents

2  where username='SCOTT' and lower(sql_redo) like '%table%';

USERNAME          SCN TIMESTAMP           SQL_REDO

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

SCOTT          851229 2012-03-23 15:45:22 drop table tb01 purge;

SCOTT          851264 2012-03-23 15:45:45 create table tb01(id int) tablespace test;

——這是一種偷懶的方法,在生產環境不能使用

05:52:30 SQL> select current_scn from v$database;        //datablock 記錄的scn

CURRENT_SCN

-----------

1260285

——test 表裡的記錄

SQL> select * from scott.tb01;

ID

----------

1

2、進行基於change的恢複

——在mount狀態,進行restore 和recover

——restore 所有的datafile

SQL> startup force mount

ORACLE instance started.

Total System Global Area  314572800 bytes

查看本欄目更多精彩內容:http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/

Fixed Size                  1279964 bytes

Variable Size              58722340 bytes

Database Buffers          251658240 bytes

Redo Buffers                2912256 bytes

Database mounted.

SQL> !

[oracle@solaris10 ~]$cp /disk1/backup/anny/cold_bak/*.dbf /u01/app/oracle/oradata/anny/

SQL> select file#,checkpoint_change# from v$datafile;——控制檔案的scn號較新

FILE# CHECKPOINT_CHANGE#

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

1             856024

3             856024

4             856024

5             856024

7             856024

10             856024

11             856024

12             856024

8 rows selected.

SQL> select file#,checkpoint_change# from v$datafile_header;

FILE# CHECKPOINT_CHANGE#

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

1             850758

3             850758

4             850758

5             850758

7             850758

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.