Oracle在NOARCHIVELOG模式下冷備份還原資料庫

來源:互聯網
上載者:User

冷備就是把資料庫的相關檔案複製一份,它只能做還原作業,不能做恢複操作。現在登入到資料庫中,把資料檔案、控制檔案、記錄檔存放路徑找到,然後關閉資料庫,備份列出的檔案。

  1. SQL> show user  
  2. USER 為 "SYS"  
  3. SQL> select INSTANCE_NAME,STATUS from v$instance;  
  4.   
  5. INSTANCE_NAME    STATUS  
  6. ---------------- ------------   
  7. data             OPEN  
  8.   
  9. SQL> select file_name from dba_data_files;  
  10.   
  11. FILE_NAME  
  12. --------------------------------------------------------------------------------   
  13. /u01/app/Oracle/oradata/data/users01.dbf  
  14. /u01/app/oracle/oradata/data/sysaux01.dbf  
  15. /u01/app/oracle/oradata/data/undotbs01.dbf  
  16. /u01/app/oracle/oradata/data/system01.dbf  
  17.   
  18. SQL> select name from v$controlfile;  
  19.   
  20. NAME  
  21. --------------------------------------------------   
  22. /u01/app/oracle/oradata/data/control01.ctl  
  23. /u01/app/oracle/oradata/data/control02.ctl  
  24. /u01/app/oracle/oradata/data/control03.ctl  
  25.   
  26. SQL> select member from v$logfile;  
  27.   
  28. MEMBER  
  29. --------------------------------------------------   
  30. /u01/app/oracle/oradata/data/redo03.log  
  31. /u01/app/oracle/oradata/data/redo02.log  
  32. /u01/app/oracle/oradata/data/redo01.log  
  33.   
  34. SQL> shutdown immediate  
  35. 資料庫已經關閉。  
  36. 已經卸載資料庫。  
  37. ORACLE 常式已經關閉。  

臨時檔案可以不備份,實際中還應該備份參數檔案。這裡我把上面所有的檔案複製到/u01/datafile/下面,然後刪除備份前的所有檔案,類比磁碟故障。

  1. [oracle@linux datafile]$ pwd  
  2. /u01/datafile  
  3. [oracle@linux datafile]$ cp /u01/app/oracle/oradata/data/* /u01/datafile/  
  4. [oracle@linux datafile]$ ll  
  5. 總計 954144  
  6. -rw-r----- 1 oracle oinstall   7061504 10-08 07:46 control01.ctl   
  7. -rw-r----- 1 oracle oinstall   7061504 10-08 07:46 control02.ctl   
  8. -rw-r----- 1 oracle oinstall   7061504 10-08 07:46 control03.ctl   
  9. -rw-r----- 1 oracle oinstall  52429312 10-08 07:46 redo01.log   
  10. -rw-r----- 1 oracle oinstall  52429312 10-08 07:46 redo02.log   
  11. -rw-r----- 1 oracle oinstall  52429312 10-08 07:46 redo03.log   
  12. -rw-r----- 1 oracle oinstall 262152192 10-08 07:46 sysaux01.dbf   
  13. -rw-r----- 1 oracle oinstall 503324672 10-08 07:46 system01.dbf   
  14. -rw-r----- 1 oracle oinstall  20979712 10-08 07:46 temp01.dbf   
  15. -rw-r----- 1 oracle oinstall  26222592 10-08 07:46 undotbs01.dbf   
  16. -rw-r----- 1 oracle oinstall   5251072 10-08 07:46 users01.dbf   
  17. [oracle@linux datafile]$ rm -rf temp01.dbf   
  18. [oracle@linux datafile]$ ll  
  19. 總計 953560  
  20. -rw-r----- 1 oracle oinstall   7061504 10-08 07:46 control01.ctl   
  21. -rw-r----- 1 oracle oinstall   7061504 10-08 07:46 control02.ctl   
  22. -rw-r----- 1 oracle oinstall   7061504 10-08 07:46 control03.ctl   
  23. -rw-r----- 1 oracle oinstall  52429312 10-08 07:46 redo01.log   
  24. -rw-r----- 1 oracle oinstall  52429312 10-08 07:46 redo02.log   
  25. -rw-r----- 1 oracle oinstall  52429312 10-08 07:46 redo03.log   
  26. -rw-r----- 1 oracle oinstall 262152192 10-08 07:46 sysaux01.dbf   
  27. -rw-r----- 1 oracle oinstall 503324672 10-08 07:46 system01.dbf   
  28. -rw-r----- 1 oracle oinstall  26222592 10-08 07:46 undotbs01.dbf   
  29. -rw-r----- 1 oracle oinstall   5251072 10-08 07:46 users01.dbf   
  30. [oracle@linux datafile]$ rm -rf /u01/app/oracle/oradata/data/  

可以看見資料庫不能正常啟動

  1. SQL> conn /as sysdba  
  2. 已串連到空閑常式。  
  3. SQL> startup  
  4. ORACLE 常式已經啟動。  
  5.   
  6. Total System Global Area  167772160 bytes  
  7. Fixed Size                  1266392 bytes  
  8. Variable Size              67112232 bytes  
  9. Database Buffers           96468992 bytes  
  10. Redo Buffers                2924544 bytes  
  11. ORA-00205: ?????????, ??????, ???????  
  12.   
  13.   
  14. SQL> select status from v$instance;  
  15.   
  16. STATUS  
  17. ------------------------   
  18. STARTED  
  19.   
  20. SQL> shutdown immediate  
  21. ORA-01507: ??????  
  22.   
  23.   
  24. ORACLE 常式已經關閉。  
  • 1
  • 2
  • 下一頁

相關文章

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.