title: Restoring RMAN backup to another instance: database name in control file is not instance name
body: <p>I've been tasked with developing an Oracle 11g backup/restore strategy for some remote instances. My goal is to have one script that will backup the instance, which I will be able to use with an existing instance (possibly on the same server) or create an entirely new instance with.</p>
  
  <p>Let's say I have two instances, a <code>source</code> and <code>destination</code>.</p>
  
  <p>The <code>source</code> instance configuration, as a result of <code>RMAN&gt; show all</code>:</p>
  
  <pre><code>using target database control file instead of recovery catalog
  RMAN configuration parameters for database with db_unique_name SOURCE 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 ARCHIVELOG DELETION POLICY TO NONE; # default
  </code></pre>
  
  <p>I've written a backup script, seen below:</p>
  
  <pre><code>#!/bin/bash
  export ORACLE_SID=SOURCE
  rman target / &lt;&lt;EOF
  CONFIGURE CONTROLFILE AUTOBACKUP ON;
  SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/backup/%F';
  SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE to '/backup/%F';    
  DELETE NOPROMPT BACKUP;
  BACKUP CURRENT CONTROLFILE;
  BACKUP AS BACKUPSET CHECK LOGICAL DATABASE PLUS ARCHIVELOG DELETE INPUT;
  QUIT;
  EOF
  </code></pre>
  
  <p>In <code>/backup</code> there appears some files such as <code>backup_4noqqute_151_1</code>, <code>backup_4noqqute_152_1</code>, and so on, as well as <code>c-454077755-20131206-07</code> -- I believe that the former files are the database/archive log backups, the latter the controlfile.</p>
  
  <p>I run the following commands in attempt to restore the backup to another instance, <code>DESTINATION</code>:</p>
  
  <pre><code>export ORACLE_SID=DESTINATION
  rman target /
  RMAN&gt; SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/backup/%F';
  RMAN&gt; RESTORE CONTROLFILE FROM '/backup/c-454077755-20131206-07';
  RMAN&gt; ALTER DATABASE MOUNT;
  </code></pre>
  
  <p>And receive this error message:</p>
  
  <pre><code>RMAN-00571: ===========================================================
  RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  RMAN-00571: ===========================================================
  RMAN-03002: failure of alter db command at 12/06/2013 10:44:51
  ORA-01103: database name 'SOURCE' in control file is not 'DESTINATION'
  </code></pre>
  
  <p>How do I solve this problem? I can't rename <code>DESTINATION</code> as <code>SOURCE</code> is on the same server and is still running. I saw a similar problem in <a href="https://stackoverflow.com/questions/11446666/change-database-name-controlfiles-after-restore">this post</a>, but it is incompletely explained and I don't understand it. I'm hoping that since I've provided a lot of information, someone is able to adequately explain to me how to fix this problem.</p>
  
  <p>Thanks.</p>