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.
Let's say I have two instances, a source
and destination
.
The source
instance configuration, as a result of RMAN> show all
:
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
I've written a backup script, seen below:
#!/bin/bash
export ORACLE_SID=SOURCE
rman target / <<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
In /backup
there appears some files such as backup_4noqqute_151_1
, backup_4noqqute_152_1
, and so on, as well as c-454077755-20131206-07
-- I believe that the former files are the database/archive log backups, the latter the controlfile.
I run the following commands in attempt to restore the backup to another instance, DESTINATION
:
export ORACLE_SID=DESTINATION
rman target /
RMAN> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/backup/%F';
RMAN> RESTORE CONTROLFILE FROM '/backup/c-454077755-20131206-07';
RMAN> ALTER DATABASE MOUNT;
And receive this error message:
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'
How do I solve this problem? I can't rename DESTINATION
as SOURCE
is on the same server and is still running. I saw a similar problem in this post, 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.
Thanks.