Recovering an instance in a catastrophic environment of an Oracle database (1)

Source: Internet
Author: User

Recovering an instance in a catastrophic environment of an Oracle database (1)

The so-called catastrophic means that all database-related files are lost or damaged due to disk faults or other causes and cannot be repaired. Backup must be used for restoration. The following experiments simulate the loss of all database files, then, restore and restore through backup.

Version and database file information

 
 
  1. Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production 
  2. PL/SQL Release 11.2.0.3.0 - Production 
  3. CORE    11.2.0.3.0      Production 
  4. TNS for Linux: Version 11.2.0.3.0 - Production 
  5. NLSRTL Version 11.2.0.3.0 - Production 
  6.  
  7. SQL> column name format a50 
  8. SQL> select file#,status,name from v$datafile; 
  9.  
  10.     FILE# STATUS  NAME 
  11. ---------- ------- -------------------------------------------------- 
  12.          1 SYSTEM  /u01/oradata/sydb/system01.dbf 
  13.          2 ONLINE  /u01/oradata/sydb/sysaux01.dbf 
  14.          3 ONLINE  /u01/oradata/sydb/undotbs01.dbf 
  15.          4 ONLINE  /u01/oradata/sydb/users01.dbf 
  16.          5 ONLINE  /u01/oradata/sydb/tbs01.dbf 
  17.  
  18. SQL> column member format a50 
  19. SQL> select * from v$Logfile; 
  20.  
  21.     GROUP# STATUS  TYPE    MEMBER                                             IS_ 
  22. ---------- ------- ------- -------------------------------------------------- --- 
  23.          1         ONLINE  /u01/oradata/sydb/REDO01.LOG                       NO 
  24.          2         ONLINE  /u01/oradata/sydb/REDO02.LOG                       NO 
  25.  
  26. SQL> select * from v$controlfile; 
  27.  
  28. STATUS  NAME                                               IS_ BLOCK_SIZE FILE_SIZE_BLKS 
  29. ------- -------------------------------------------------- --- ---------- -------------- 
  30.         /u01/oradata/sydb/control01.ctl                    NO       16384            668 

Back up database

Note: If the tablespace configured with configure exclude for tablespace tbsname is not backed up during database backup, recover the tablespace backup configure exclude for tablespace tbsname clear; if the automatic backup control file and parameter file are not set, manually add the backup control file script at the end of the backup script; set the automatic backup control file and parameter file:

 
 
  1. CONFIGURE CONTROLFILE AUTOBACKUP On;  
  2. CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/backup/%F_%d_controlfile.bkp';  

The control file name format must contain % F, % F in the format of: c-IIIIIIIIII-YYYYMMDD-QQ, IIIIIIIIII (10 bits) means that DBID can be known through it in the event of a disaster, YYYYMMDD indicates the timestamp during automatic backup, and QQ indicates the hexadecimal serial number. The starting value is 00 and the maximum value is FF. Start data backup

 
 
  1.  run 
  2.  { 
  3.  allocate channel dev type disk; 
  4.  allocate channel dev2 type disk; 
  5.  backup incremental level 0 database plus archivelog delete input 
  6.  tag 'sydb_incr_level0' 
  7.  format '/u01/backup/%d_%s_%U'; 
  8.  release channel dev; 
  9.  release channel dev2; 
  10.  } 
  11.  
  12. allocated channel: dev 
  13. channel dev: SID=181 device type=DISK 
  14.  
  15. allocated channel: dev2 
  16. channel dev2: SID=18 device type=DISK 
  17.  
  18.  
  19. Starting backup at 29-MAY-15 
  20. current log archived 
  21. channel dev: starting archived log backup set 
  22. channel dev: specifying archived log(s) in backup set 
  23. input archived log thread=1 sequence=17 RECID=1 STAMP=880994007 
  24. channel dev: starting piece 1 at 29-MAY-15 
  25. channel dev2: starting archived log backup set 
  26. channel dev2: specifying archived log(s) in backup set 
  27. input archived log thread=1 sequence=18 RECID=2 STAMP=880994016 
  28. input archived log thread=1 sequence=19 RECID=3 STAMP=880994311 
  29. channel dev2: starting piece 1 at 29-MAY-15 
  30. channel dev: finished piece 1 at 29-MAY-15 
  31. piece handle=/u01/backup/SYDB_1_01q85q07_1_1 tag=SYDB_INCR_LEVEL0 comment=NONE 
  32. channel dev: backup set complete, elapsed time: 00:00:07 
  33. channel dev: deleting archived log(s) 
  34. archived log file name=/u01/app/product/11.2.3/db_1/dbs/arch1_17_880905808.dbf RECID=1 STAMP=880994007 
  35. channel dev2: finished piece 1 at 29-MAY-15 
  36. piece handle=/u01/backup/SYDB_2_02q85q07_1_1 tag=SYDB_INCR_LEVEL0 comment=NONE 
  37. channel dev2: backup set complete, elapsed time: 00:00:08 
  38. channel dev2: deleting archived log(s) 
  39. archived log file name=/u01/app/product/11.2.3/db_1/dbs/arch1_18_880905808.dbf RECID=2 STAMP=880994016 
  40. archived log file name=/u01/app/product/11.2.3/db_1/dbs/arch1_19_880905808.dbf RECID=3 STAMP=880994311 
  41. Finished backup at 29-MAY-15 
  42.  
  43. Starting backup at 29-MAY-15 
  44. channel dev: starting incremental level 0 datafile backup set 
  45. channel dev: specifying datafile(s) in backup set 
  46. input datafile file number=00001 name=/u01/oradata/sydb/system01.dbf 
  47. input datafile file number=00004 name=/u01/oradata/sydb/users01.dbf 
  48. input datafile file number=00005 name=/u01/oradata/sydb/tbs01.dbf 
  49. channel dev: starting piece 1 at 29-MAY-15 
  50. channel dev2: starting incremental level 0 datafile backup set 
  51. channel dev2: specifying datafile(s) in backup set 
  52. input datafile file number=00003 name=/u01/oradata/sydb/undotbs01.dbf 
  53. input datafile file number=00002 name=/u01/oradata/sydb/sysaux01.dbf 
  54. channel dev2: starting piece 1 at 29-MAY-15 
  55. channel dev: finished piece 1 at 29-MAY-15 
  56. piece handle=/u01/app/product/11.2.3/db_1/dbs/03q85q0f_1_1 tag=TAG20150529T163839 comment=NONE 
  57. channel dev: backup set complete, elapsed time: 00:00:35 
  58. channel dev2: finished piece 1 at 29-MAY-15 
  59. piece handle=/u01/app/product/11.2.3/db_1/dbs/04q85q0f_1_1 tag=TAG20150529T163839 comment=NONE 
  60. channel dev2: backup set complete, elapsed time: 00:00:35 
  61. Finished backup at 29-MAY-15 
  62.  
  63. Starting backup at 29-MAY-15 
  64. current log archived 
  65. channel dev: starting archived log backup set 
  66. channel dev: specifying archived log(s) in backup set 
  67. input archived log thread=1 sequence=20 RECID=4 STAMP=880994354 
  68. channel dev: starting piece 1 at 29-MAY-15 
  69. channel dev: finished piece 1 at 29-MAY-15 
  70. piece handle=/u01/backup/SYDB_5_05q85q1i_1_1 tag=SYDB_INCR_LEVEL0 comment=NONE 
  71. channel dev: backup set complete, elapsed time: 00:00:01 
  72. channel dev: deleting archived log(s) 
  73. archived log file name=/u01/app/product/11.2.3/db_1/dbs/arch1_20_880905808.dbf RECID=4 STAMP=880994354 
  74. Finished backup at 29-MAY-15 
  75.  
  76. Starting Control File and SPFILE Autobackup at 29-MAY-15 
  77. piece handle=/u01/backup/c-3634177744-20150529-00_control.bkp comment=NONE 
  78. Finished Control File and SPFILE Autobackup at 29-MAY-15 
  79.  
  80. released channel: dev 
  81.  
  82. released channel: dev2 

By using the backup log, you can know which data files are backed up and which are not backed up or have not been backed up successfully. For example, you can find that many data blocks are damaged and the tablespace is excluded from the backup (exclude) table space is skip. It is very important to pay attention to this information, because once a disaster occurs, it means your database recovery success rate and helps you optimize and adjust the backup script.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.