Thursday, December 25, 2014

How to backup a database in noarchivelog mode

In this posts I suggest also to configure the NLS_DATE_FORMAT environment variable: it's useful when you want to know from RMAN the exact date including time format a problem occurred. By default RMAN displays only the date.
My SID is ORCL, no NLS variable sets, database in NOARCHIVELOG mode.

  1. [oracle@localhost ~]$ env|grep SID  
  2. ORACLE_SID=orcl  
  3. [oracle@localhost ~]$ env|grep NSL  
  4. [oracle@localhost ~]$ sqlplus / as sysdba  
  5. SQL> archive log list  
  6. Database log mode              No Archive Mode  
  7. Automatic archival             Disabled  
  8. Archive destination            USE_DB_RECOVERY_FILE_DEST  
  9. Oldest online log sequence     580  
  10. Current log sequence           582  
  11. SQL> exit  
What does it happen when I try to backup my database when it's open and in NOARCHIVELOG... ? I'm not using any recovery catalog for these examples as you can see. 
  1. [oracle@localhost ~]$ rman target /  
  2.   
  3. Recovery Manager: Release 11.2.0.2.0 - Production on Sun Jul 15 05:36:18 2012  
  4.   
  5. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.  
  6.   
  7. connected to target database: ORCL (DBID=1229390655)  
  8.   
  9. RMAN> backup database;  
  10.   
  11. Starting backup at 15-JUL-12  
  12. using target database control file instead of recovery catalog  
  13. allocated channel: ORA_DISK_1  
  14. channel ORA_DISK_1: SID=32 device type=DISK  
  15. channel ORA_DISK_1: starting full datafile backup set  
  16. channel ORA_DISK_1: specifying datafile(s) in backup set  
  17. RMAN-03009: failure of backup command on ORA_DISK_1 channel at 07/15/2012 05:36:42  
  18. ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode  
  19. continuing other job steps, job failed will not be re-run  
  20. channel ORA_DISK_1: starting full datafile backup set  
  21. channel ORA_DISK_1: specifying datafile(s) in backup set  
  22. including current control file in backup set  
  23. including current SPFILE in backup set  
  24. channel ORA_DISK_1: starting piece 1 at 15-JUL-12  
  25. channel ORA_DISK_1: finished piece 1 at 15-JUL-12  
  26. piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2012_07_15/o1_mf_ncsnf_TAG20120715T053641_805gbvhz_.bkp tag=TAG20120715T053641 comment=NONE  
  27. channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01  
  28. RMAN-00571: ===========================================================  
  29. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============  
  30. RMAN-00571: ===========================================================  
  31.   
  32. RMAN-03009: failure of backup command on ORA_DISK_1 channel at 07/15/2012 05:36:42  
  33. ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode  
  34. RMAN> exit  
  35.   
  36. Recovery Manager complete.  
As you can easily read from the RMAN log put on screen you... "ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode". Note also that some logs (Starting backup at 15-JUL-12) write the date and it doesn't show any time information. So let's first set the NLS_DATE_FORMAT environment variable to the right value 
  1. [oracle@localhost ~]$ echo "export NLS_DATE_FORMAT='DD-MM-RRRR HH24:MI:SS'" >> .bash_profile   
  2. [oracle@localhost ~]$ export NLS_DATE_FORMAT='DD-MM-RRRR HH24:MI:SS'  

To backup a database in NOARCHIVELOG mode you have to shutdown it first, open in mount mode and only then you can start your backup process. 
  1. [oracle@localhost ~]$ rman target /  
  2.   
  3. Recovery Manager: Release 11.2.0.2.0 - Production on Sun Jul 15 05:43:30 2012  
  4.   
  5. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.  
  6.   
  7. connected to target database: ORCL (DBID=1229390655)  
  8.   
  9. RMAN> shutdown immediate;  
  10.   
  11. using target database control file instead of recovery catalog  
  12. database closed  
  13. database dismounted  
  14. Oracle instance shut down  
  15.   
  16. RMAN> startup mount;  
  17.   
  18. connected to target database (not started)  
  19. Oracle instance started  
  20. database mounted  
  21.   
  22. Total System Global Area     456146944 bytes  
  23.   
  24. Fixed Size                     1344840 bytes  
  25. Variable Size                352324280 bytes  
  26. Database Buffers              96468992 bytes  
  27. Redo Buffers                   6008832 bytes  
  28.   
  29. RMAN> backup database;  
  30.   
  31. Starting backup at 15-07-2012 05:47:44  
  32. allocated channel: ORA_DISK_1  
  33. channel ORA_DISK_1: SID=19 device type=DISK  
  34. channel ORA_DISK_1: starting full datafile backup set  
  35. channel ORA_DISK_1: specifying datafile(s) in backup set  
  36. input datafile file number=00002 name=/home/oracle/app/oracle/oradata/orcl/sysaux01.dbf  
  37. input datafile file number=00001 name=/home/oracle/app/oracle/oradata/orcl/system01.dbf  
  38. input datafile file number=00004 name=/home/oracle/app/oracle/oradata/orcl/users01.dbf  
  39. input datafile file number=00005 name=/home/oracle/app/oracle/oradata/orcl/example01.dbf  
  40. input datafile file number=00003 name=/home/oracle/app/oracle/oradata/orcl/undotbs01.dbf  
  41. input datafile file number=00006 name=/home/oracle/app/oracle/oradata/orcl/APEX_1930613455248703.dbf  
  42. channel ORA_DISK_1: starting piece 1 at 15-07-2012 05:47:46  
  43. channel ORA_DISK_1: finished piece 1 at 15-07-2012 05:50:43  
  44. piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2012_07_15/o1_mf_nnndf_TAG20120715T054745_805gzldn_.bkp tag=TAG20120715T054745 comment=NONE  
  45. channel ORA_DISK_1: backup set complete, elapsed time: 00:02:57  
  46. channel ORA_DISK_1: starting full datafile backup set  
  47. channel ORA_DISK_1: specifying datafile(s) in backup set  
  48. including current control file in backup set  
  49. including current SPFILE in backup set  
  50. channel ORA_DISK_1: starting piece 1 at 15-07-2012 05:50:45  
  51. channel ORA_DISK_1: finished piece 1 at 15-07-2012 05:50:46  
  52. piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2012_07_15/o1_mf_ncsnf_TAG20120715T054745_805h55ol_.bkp tag=TAG20120715T054745 comment=NONE  
  53. channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01  
  54. Finished backup at 15-07-2012 05:50:46  

How can I see my backup on RMAN ? Use just the following command: 
  1. RMAN> list backup;  
  2.   
  3. List of Backup Sets  
  4. ===================  
  5.   
  6.   
  7. BS Key  Type LV Size       Device Type Elapsed Time Completion Time      
  8. ------- ---- -- ---------- ----------- ------------ -------------------  
  9. 1       Full    9.36M      DISK        00:00:02     15-07-2012 05:32:28  
  10.         BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20120715T053225  
  11.         Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2012_07_15/o1_mf_ncsnf_TAG20120715T053225_805g2vpk_.bkp  
  12.   SPFILE Included: Modification time: 15-07-2012 05:24:54  
  13.   SPFILE db_unique_name: ORCL  
  14.   Control File Included: Ckp SCN: 13564407     Ckp time: 15-07-2012 05:32:25  
  15.   
  16. BS Key  Type LV Size       Device Type Elapsed Time Completion Time      
  17. ------- ---- -- ---------- ----------- ------------ -------------------  
  18. 2       Full    9.36M      DISK        00:00:01     15-07-2012 05:36:43  
  19.         BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20120715T053641  
  20.         Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2012_07_15/o1_mf_ncsnf_TAG20120715T053641_805gbvhz_.bkp  
  21.   SPFILE Included: Modification time: 15-07-2012 05:24:54  
  22.   SPFILE db_unique_name: ORCL  
  23.   Control File Included: Ckp SCN: 13564668     Ckp time: 15-07-2012 05:36:42  
  24.   
  25. BS Key  Type LV Size       Device Type Elapsed Time Completion Time      
  26. ------- ---- -- ---------- ----------- ------------ -------------------  
  27. 3       Full    1.90G      DISK        00:02:50     15-07-2012 05:50:35  
  28.         BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20120715T054745  
  29.         Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2012_07_15/o1_mf_nnndf_TAG20120715T054745_805gzldn_.bkp  
  30.   List of Datafiles in backup set 3  
  31.   File LV Type Ckp SCN    Ckp Time            Name  
  32.   ---- -- ---- ---------- ------------------- ----  
  33.   1       Full 13565488   15-07-2012 05:44:01 /home/oracle/app/oracle/oradata/orcl/system01.dbf  
  34.   2       Full 13565488   15-07-2012 05:44:01 /home/oracle/app/oracle/oradata/orcl/sysaux01.dbf  
  35.   3       Full 13565488   15-07-2012 05:44:01 /home/oracle/app/oracle/oradata/orcl/undotbs01.dbf  
  36.   4       Full 13565488   15-07-2012 05:44:01 /home/oracle/app/oracle/oradata/orcl/users01.dbf  
  37.   5       Full 13565488   15-07-2012 05:44:01 /home/oracle/app/oracle/oradata/orcl/example01.dbf  
  38.   6       Full 13565488   15-07-2012 05:44:01 /home/oracle/app/oracle/oradata/orcl/APEX_1930613455248703.dbf  
  39.   
  40. BS Key  Type LV Size       Device Type Elapsed Time Completion Time      
  41. ------- ---- -- ---------- ----------- ------------ -------------------  
  42. 4       Full    9.36M      DISK        00:00:02     15-07-2012 05:50:46  
  43.         BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: TAG20120715T054745  
  44.         Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2012_07_15/o1_mf_ncsnf_TAG20120715T054745_805h55ol_.bkp  
  45.   SPFILE Included: Modification time: 15-07-2012 05:44:26  
  46.   SPFILE db_unique_name: ORCL  
  47.   Control File Included: Ckp SCN: 13565488     Ckp time: 15-07-2012 05:44:01  

Have a look at the time when the backup is finished and the time information provided by the "list backup" command in RMAN... So we have a first backup... That's all

No comments:

Post a Comment

Followers