oracle使用者管理的完全恢複2:在NOARCHIVELOG 模式下執行恢複(無聯機日誌的備份)

來源:互聯網
上載者:User

1.查看環境

 1 -bash-3.00$ sqlplus /nolog 2  3 SQL*Plus: Release 10.2.0.2.0 - Production on Mon Jan 21 19:22:40 2013 4  5 Copyright (c) 1982, 2005, Oracle.  All Rights Reserved. 6  7 SQL> conn /as sysdba 8 Connected. 9 SQL> archive log list;10 Database log mode              No Archive Mode11 Automatic archival             Disabled12 Archive destination            USE_DB_RECOVERY_FILE_DEST13 Oldest online log sequence     114 Current log sequence           215 SQL> 

2.非歸檔模式下備份(沒有備份聯機日誌)

2.1關機

1 SQL> shutdown immediate2 Database closed.3 Database dismounted.4 ORACLE instance shut down.5 SQL> 

2.2 備份資料檔案,控制檔案

1 /u01/oradata/sunbak2 bash-3.00$ cp *.ctl  /u01/backup/sunbak3 bash-3.00$ cp *.dbf  /u01/backup/sunbak4 bash-3.00$ 

3.破壞當前資料庫

 1 bash-3.00$ pwd    2 /u01/oradata/sunbak 3 bash-3.00$ ls -l 4 total 2142000 5 -rw-r-----   1 oracle   oinstall 7061504 Jan 21 19:27 control01.ctl 6 -rw-r-----   1 oracle   oinstall 7061504 Jan 21 19:27 control02.ctl 7 -rw-r-----   1 oracle   oinstall 7061504 Jan 21 19:27 control03.ctl 8 -rw-r-----   1 oracle   oinstall 104865792 Jan 21 19:33 example01.dbf 9 -rw-r-----   1 oracle   oinstall 52429312 Jan 21 19:27 redo01.log10 -rw-r-----   1 oracle   oinstall 52429312 Jan 21 18:52 redo02.log11 -rw-r-----   1 oracle   oinstall 52429312 Jan 21 18:52 redo03.log12 -rw-r-----   1 oracle   oinstall 251666432 Jan 21 19:34 sysaux01.dbf13 -rw-r-----   1 oracle   oinstall 503324672 Jan 21 19:34 system01.dbf14 -rw-r-----   1 oracle   oinstall 20979712 Jan 21 19:35 temp01.dbf15 -rw-r-----   1 oracle   oinstall 31465472 Jan 21 19:35 undotbs01.dbf16 -rw-r-----   1 oracle   oinstall 5251072 Jan 21 19:35 users01.dbf17 bash-3.00$ rm -f *18 bash-3.00$ 

4.還原(備份是並沒有備份redo檔案)

 1 bash-3.00$ pwd                         2 /u01/oradata/sunbak 3 bash-3.00$ cp /u01/backup/sunbak/* . 4 bash-3.00$ ls -l 5 total 1834512 6 -rw-r-----   1 oracle   oinstall 7061504 Jan 21 19:43 control01.ctl 7 -rw-r-----   1 oracle   oinstall 7061504 Jan 21 19:43 control02.ctl 8 -rw-r-----   1 oracle   oinstall 7061504 Jan 21 19:43 control03.ctl 9 -rw-r-----   1 oracle   oinstall 104865792 Jan 21 19:43 example01.dbf10 -rw-r-----   1 oracle   oinstall 251666432 Jan 21 19:43 sysaux01.dbf11 -rw-r-----   1 oracle   oinstall 503324672 Jan 21 19:44 system01.dbf12 -rw-r-----   1 oracle   oinstall 20979712 Jan 21 19:44 temp01.dbf13 -rw-r-----   1 oracle   oinstall 31465472 Jan 21 19:44 undotbs01.dbf14 -rw-r-----   1 oracle   oinstall 5251072 Jan 21 19:44 users01.dbf15 bash-3.00$ 

5.恢複

5.1 開啟到mount狀態

 1 bash-3.00$ sqlplus /nolog 2  3 SQL*Plus: Release 10.2.0.2.0 - Production on Mon Jan 21 19:47:04 2013 4  5 Copyright (c) 1982, 2005, Oracle.  All Rights Reserved. 6  7 SQL> conn /as sysdba 8 Connected to an idle instance. 9 SQL> startup mount10 ORACLE instance started.11 12 Total System Global Area  289406976 bytes13 Fixed Size                  1279820 bytes14 Variable Size              92276916 bytes15 Database Buffers          192937984 bytes16 Redo Buffers                2912256 bytes17 Database mounted.18 SQL> 

5.2 執行recover命令

 1 SQL> recover database until cancel using backup controlfile; 2 ORA-00279: change 570446 generated at 01/21/2013 19:27:52 needed for thread 1 3 ORA-00289: suggestion : 4 /u01/flash_recovery_area/SUN/archivelog/2013_01_21/o1_mf_1_2_%u_.arc 5 ORA-00280: change 570446 for thread 1 is in sequence #2 6  7 Specify log: {<RET>=suggested | filename | AUTO | CANCEL} 8 cancel 9 Media recovery cancelled.10 SQL> 

5.3 開啟資料庫並建立日誌

1 SQL> alter database open resetlogs;2 3 Database altered.4 5 SQL>

6.驗證記錄檔已被建立

1 SQL> !ls /u01/oradata/sunbak/*.log2 /u01/oradata/sunbak/redo01.log  /u01/oradata/sunbak/redo02.log  /u01/oradata/sunbak/redo03.log3 4 SQL>

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.