Looking for something? Try here..

Monday, April 4, 2016

RMAN issue on Oracle 12.1.0.2

Thought of writing this article but forgot for a while and now it is.. The following RMAN backup threw me a weird error as follows. The server here is the Windows server 2012 R2 standard.
C:\Users\selvakumar.nagulan>rman target /

Recovery Manager: Release 12.1.0.2.0 - Production on Mon Feb 15 08:24:51 2016

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

connected to target database: XXXX (DBID=4292448189, not open)

RMAN> backup as compressed backupset database format 'D:\selvakumar.nagulan\Backup\port\bkp_b4_compinst.bak';

Starting backup at 15-FEB-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=130 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=D:\SELVAKUMAR.NAGULAN\ORADATA\PORT\SYSTEM_01.DBF
input datafile file number=00002 name=D:\SELVAKUMAR.NAGULAN\ORADATA\PORT\SYSAUX_01.DBF
input datafile file number=00003 name=D:\SELVAKUMAR.NAGULAN\ORADATA\PORT\UNDOTBS_01.DBF
channel ORA_DISK_1: starting piece 1 at 15-FEB-16
channel ORA_DISK_1: finished piece 1 at 15-FEB-16
piece handle=D:\SELVAKUMAR.NAGULAN\BACKUP\PORT\BKP_B4_COMPINST.BAK tag=TAG20160215T082546 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 15-FEB-16
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 02/15/2016 08:26:14
ORA-19504: failed to create file "D:\SELVAKUMAR.NAGULAN\BACKUP\PORT\BKP_B4_COMPINST.BAK"
ORA-27038: created file already exists
OSD-04010: <create> option specified, file already exists

RMAN> show all;

RMAN configuration parameters for database with db_unique_name PORT are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'D:\SELVAKUMAR.NAGULAN\PRODUCT\12.1.0\DATABASE\SNCFPORT.ORA'; # default
I said the issue as weird because as you can see I have not used "including current controlfile" in the backup statement or I have not changed the default setting for non-CDB database RMAN configuration for controlfile autobackup.
RMAN is trying to backup the controlfile with the same name specified in the format clause.

To resolve the issue for then, I tried configuring the autobackup to ON as below.
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;

new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

RMAN> backup as compressed backupset database format 'D:\selvakumar.nagulan\Back
up\port\bkp_before_compinst.bak';

Starting backup at 15-FEB-16
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=D:\SELVAKUMAR.NAGULAN\ORADATA\PORT\SYSTEM_
01.DBF
input datafile file number=00002 name=D:\SELVAKUMAR.NAGULAN\ORADATA\PORT\SYSAUX_
01.DBF
input datafile file number=00003 name=D:\SELVAKUMAR.NAGULAN\ORADATA\PORT\UNDOTBS
_01.DBF
channel ORA_DISK_1: starting piece 1 at 15-FEB-16
channel ORA_DISK_1: finished piece 1 at 15-FEB-16
piece handle=D:\SELVAKUMAR.NAGULAN\BACKUP\PORT\BKP_BEFORE_COMPINST.BAK tag=TAG20
160215T085218 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:26
Finished backup at 15-FEB-16

Starting Control File Autobackup at 15-FEB-16
piece handle=D:\SELVAKUMAR.NAGULAN\PRODUCT\12.1.0\DATABASE\C-4292448189-20160215
-00 comment=NONE
Finished Control File Autobackup at 15-FEB-16

RMAN>
Ha... The setting resolved the issue but I'm confused. Why does my backup command reported error in the first case? Am I missing something or should I report a bug to Oracle??

Waiting for your inputs...

Happy confusion.. :)

Update 06-Apr-2016
Solution:
I had this discussed in the LinkedIn "Oracle Senior DBA Group" group and found it is my mistake that I didn't realize that the control file will always be backed up automatically when datafile 1 is backed up even with the RMAN default setting of autobackup OFF.
I would have avoided this situation with a simple solution in my command as below.
Specify %U to the format clause in the backup command so that the controlfile would have created along with the database backup.
backup as compressed backupset database format 'D:\selvakumar.nagulan\Back
up\port\bkp_before_compinst_%U.bak';

Happy Solution! :)

4 comments:

  1. i think the problem is in the format name bkp_before_compinst%u.bkp i think is creating backup pieces and you said that the only name is bkp_before_compinst.bkp and obviously that file allready exist

    ReplyDelete
    Replies
    1. Hi,
      Exactly the issue is what you have identified. I missed to include the %U. I have updated the post as well.

      Thanks!

      Delete
  2. Hi,
    it's about the filename. For each backupset you NEED to have a new filename. This is why the default filename is "%U" which generates a unique filename for each backup run.
    Finally your backup command should be:
    RMAN> backup as compressed backupset database format 'D:\selvakumar.nagulan\Backup\port\bkp_b4_compinst_%U.bak';

    Read about this in "Backup and Recovery Reference" page 4-29

    regards
    Dieter Henig

    ReplyDelete
    Replies
    1. Hi,

      Thanks! I have updated the post as well. :)

      Delete