Oracle Recovery Manager (RMAN) provides a comprehensive foundation for efficiently backing up and recovering the Oracle databases, it provides a common interface, via command line and Enterprise Manager, for backup tasks across different host operating systems, automates administration of your backup strategies.
In this scenario we have different database name and different directory structure. And we are not using SPFILE.
Target
(source) details:
|
Database Name
|
prod
|
|
Hostname
|
NSM-SRC
|
|
Ip Address
|
172.16.110.18
|
|
OS
|
Linux
|
|
Version
|
x86_64
|
|
Datafile Location
|
/data2/prod
|
|
Backup Location
|
/backup/rman_backup
|
|
Database Name
|
nospfile
|
|
Hostname
|
NSM-TRG
|
|
Ip Address
|
172.16.110.16
|
|
OS
|
Linux
|
|
Version
|
x86_64
|
|
Datafile Location
|
/data2/nospfile/
|
|
Backup Location
|
/backup/rman_backup
|
- Password file from target database.
- Sqlnet.ora should have correct parameters.
- Target database should be running through pfile.
- Auxiliary instance should be start with pfile in nomount stage.
Steps on source server
- Set Oracle sid on which backup will perform.
dbs]$ hostname
dbs]$ export ORACLE_SID=prod
- Check database is running from pfile or spfile.
————–
select value from v$parameter where name=’spfile’;
show parameter pfile
——————————— ——————————
-
Connect to target instance via RMAN.
dbs]$ rman target sys/oracle
Manager: Release 11.2.0.1.0 – Production on Mon Apr 13 10:13:01 2015
(c) 1982, 2009, Oracle and/or its affiliates.
All rights reserved.
to target database: PROD (DBID=284539893)
- Issue the following command to initiate backup. Before issue the backup command check the backup location is sat correctly.
show all;
target database control file instead of recovery catalog
configuration parameters for database with db_unique_name PROD are:
RETENTION POLICY TO REDUNDANCY 1; # default
BACKUP OPTIMIZATION OFF; # default
DEFAULT DEVICE TYPE TO DISK; # default
CONTROLFILE AUTOBACKUP ON;
CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘/backup/rman_backup/controlfile_%F’;
DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CHANNEL DEVICE TYPE DISK FORMAT
‘/backup/rman_backup/db_arch_%U.bkp’;
MAXSETSIZE TO UNLIMITED; # default
ENCRYPTION FOR DATABASE OFF; # default
ENCRYPTION ALGORITHM ‘AES128’; # default
COMPRESSION ALGORITHM ‘BASIC’ AS OF RELEASE ‘DEFAULT’ OPTIMIZE FOR LOAD TRUE ;
# default
ARCHIVELOG DELETION POLICY TO NONE; # default
SNAPSHOT CONTROLFILE NAME TO
‘/data2/app/oracle/product/11.2.0/dbs/snapcf_prod.f’; # default
list backup;
does not match any backup in the repository
backup database plus archivelog;
backup at 13-APR-15
log archived
channel: ORA_DISK_1
ORA_DISK_1: SID=15 device type=DISK
ORA_DISK_1: starting archived log backup set
ORA_DISK_1: specifying archived log(s) in backup set
archived log thread=1 sequence=153 RECID=149 STAMP=876910536
ORA_DISK_1: starting piece 1 at 13-APR-15
ORA_DISK_1: finished piece 1 at 13-APR-15
handle=/backup/rman_backup/db_arch_2uq495u9_1_1.bkp tag=TAG20150413T101536
comment=NONE
ORA_DISK_1: backup set complete, elapsed time: 00:00:01
backup at 13-APR-15
backup at 13-APR-15
channel ORA_DISK_1
ORA_DISK_1: starting full datafile backup set
ORA_DISK_1: specifying datafile(s) in backup set
datafile file number=00001 name=/data2/prod/system01.dbf
datafile file number=00002 name=/data2/prod/sysaux01.dbf
datafile file number=00005 name=/data2/prod/example01.dbf
datafile file number=00003 name=/data2/prod/undotbs01.dbf
datafile file number=00006 name=/data2/prod/data01.dbf
datafile file number=00004 name=/data2/prod/users01.dbf
datafile file number=00007 name=/data2/prod/test01.dbf
datafile file number=00008 name=/data2/prod/tools01.dbf
ORA_DISK_1: starting piece 1 at 13-APR-15
ORA_DISK_1: finished piece 1 at 13-APR-15
handle=/backup/rman_backup/db_arch_2vq495ua_1_1.bkp tag=TAG20150413T101538 comment=NONE
ORA_DISK_1: backup set complete, elapsed time: 00:00:55
backup at 13-APR-15
backup at 13-APR-15
log archived
channel ORA_DISK_1
ORA_DISK_1: starting archived log backup set
ORA_DISK_1: specifying archived log(s) in backup set
archived log thread=1 sequence=154 RECID=150 STAMP=876910594
ORA_DISK_1: starting piece 1 at 13-APR-15
ORA_DISK_1: finished piece 1 at 13-APR-15
handle=/backup/rman_backup/db_arch_30q49603_1_1.bkp tag=TAG20150413T101635
comment=NONE
ORA_DISK_1: backup set complete, elapsed time: 00:00:01
backup at 13-APR-15
Control File Autobackup at 13-APR-15
handle=/backup/rman_backup/controlfile_c-284539893-20150413-00 comment=NONE
Control File Autobackup at 13-APR-15
list backup;
Backup Sets
Key Size Device Type Elapsed Time Completion Time
———- ———– ———— —————
DISK 00:00:00 13-APR-15
/backup/rman_backup/db_arch_2uq495u9_1_1.bkp
Low SCN Low Time Next SCN
Next Time
———
153 5172938 13-APR-15 5176490 13-APR-15
Key Type LV Size Device Type Elapsed Time Completion Time
—- — ———- ———– ———— —————
1.11G DISK 00:00:54 13-APR-15
/backup/rman_backup/db_arch_2vq495ua_1_1.bkp
Name
Full 5176498 13-APR-15
/data2/prod/system01.dbf
Full 5176498 13-APR-15
/data2/prod/sysaux01.dbf
Full 5176498 13-APR-15 /data2/prod/undotbs01.dbf
Full 5176498 13-APR-15
/data2/prod/users01.dbf
Full 5176498 13-APR-15
/data2/prod/example01.dbf
Full 5176498 13-APR-15
/data2/prod/data01.dbf
Full 5176498 13-APR-15
/data2/prod/test01.dbf
Full 5176498 13-APR-15
/data2/prod/tools01.dbf
Key Size Device Type Elapsed Time Completion Time
———- ———– ———— —————
DISK 00:00:00 13-APR-15
/backup/rman_backup/db_arch_30q49603_1_1.bkp
Low SCN Low Time Next SCN
Next Time
———
154 5176490 13-APR-15 5176531 13-APR-15
Key Type LV Size Device Type Elapsed Time Completion Time
—- — ———- ———– ———— —————
9.52M DISK 00:00:02
13-APR-15
/backup/rman_backup/controlfile_c-284539893-20150413-00
- Create pfile and copy to destination server
pfile=’/backup/rman_backup/initprod.ora’ from spfile;
dbs]$ scp initprod.ora
oracle@172.16.110.16:/data1/oracle11g/product/dbs/initnospfile.ora
password:
00:00
prod]$ mkdir -p /backup/rman_backup/
-
Copy rman backup from target to destination server.
exit
Manager complete.
dbs]$ cd /backup/rman_backup/
rman_backup]$ ls -lrt
1176020
1 oracle dba 3526656 Apr 13 10:15
db_arch_2uq495u9_1_1.bkp
1 oracle dba 1190690816 Apr 13 10:16 db_arch_2vq495ua_1_1.bkp
1 oracle dba 9728 Apr 13 10:16
db_arch_30q49603_1_1.bkp
1 oracle dba 9994240 Apr 13 10:16
controlfile_c-284539893-20150413-00
rman_backup]$ scp * oracle@172.16.110.16:/backup/rman_backup/
password:
00:01
00:00
01:42
00:00
Steps on destination server:
- Create new directory structure.
dbs]$ mkdir -p /data2/nospfile/
-
Edit the pfile which we have copied from source server.
dbs]$ vi initnospfile.ora
- Create password file
dbs]$ orapwd file=orapwnospfile password=oracle
- Start the instance in no mount stage.
dbs]$ export ORACLE_SID=nospfile
dbs]$ sqlplus
Release 11.2.0.1.0 Production on Mon Apr 13 10:42:46 2015
(c) 1982, 2009, Oracle. All rights
reserved.
user-name: sys as sysdba
to an idle instance.
startup nomount
instance started.
System Global Area 1152450560 bytes
Size 2212696 bytes
Size 352324776 bytes
Buffers 788529152 bytes
Buffers 9383936 bytes
exit
from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit
Production
Partitioning, OLAP, Data Mining and Real Application Testing options
dbs]$
- Connect to auxiliary instance via RMAN and issue the duplicate command.
dbs]$ rman auxiliary sys/oracle
Manager: Release 11.2.0.1.0 – Production on Mon Apr 13 10:47:05 2015
(c) 1982, 2009, Oracle and/or its affiliates.
All rights reserved.
NOSPFILE (not mounted)
nospfile BACKUP LOCATION ‘/backup/rman_backup’
‘/data2/prod’,’/data2/nospfile’
SIZE 50m,
SIZE 50m;
Duplicate Db at 13-APR-15
of Memory Script:
memory”;
Memory Script
statement: create spfile from memory
of Memory Script:
Memory Script
instance shut down
to auxiliary database (not started)
instance started
System Global Area 1152450560 bytes
Size 2212696 bytes
Size 335547560 bytes
Buffers 805306368 bytes
Buffers 9383936 bytes
of Memory Script:
scope=spfile”;
scope=spfile”;
‘/backup/rman_backup/controlfile_c-284539893-20150413-00’;
Memory Script
statement: alter system set db_name
= ”PROD” comment= ”Modified by RMAN
duplicate” scope=spfile
statement: alter system set
db_unique_name = ”NOSPFILE”
comment= ”Modified by RMAN duplicate” scope=spfile
instance shut down
instance started
System Global Area 1152450560 bytes
Size 2212696 bytes
Size 335547560 bytes
Buffers 805306368 bytes
Buffers 9383936 bytes
restore at 13-APR-15
channel: ORA_AUX_DISK_1
ORA_AUX_DISK_1: SID=63 device type=DISK
ORA_AUX_DISK_1: restoring control file
ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
file name=/data2/nospfile/control01.ctl
file name=/data2/nospfile/control02.ctl
restore at 13-APR-15
mounted
channel: ORA_AUX_DISK_1
channel: ORA_AUX_DISK_1
ORA_AUX_DISK_1: SID=63 device type=DISK
of Memory Script:
Memory Script
command: SET until clause
command: SET NEWNAME
command: SET NEWNAME
command: SET NEWNAME
command: SET NEWNAME
command: SET NEWNAME
command: SET NEWNAME
command: SET NEWNAME
command: SET NEWNAME
restore at 13-APR-15
channel ORA_AUX_DISK_1
ORA_AUX_DISK_1: starting datafile backup set restore
ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
ORA_AUX_DISK_1: restoring datafile 00001 to /data2/nospfile/system01.dbf
ORA_AUX_DISK_1: restoring datafile 00002 to /data2/nospfile/sysaux01.dbf
ORA_AUX_DISK_1: restoring datafile 00003 to /data2/nospfile/undotbs01.dbf
ORA_AUX_DISK_1: restoring datafile 00004 to /data2/nospfile/users01.dbf
ORA_AUX_DISK_1: restoring datafile 00005 to /data2/nospfile/example01.dbf
ORA_AUX_DISK_1: restoring datafile 00006 to /data2/nospfile/data01.dbf
ORA_AUX_DISK_1: restoring datafile 00007 to /data2/nospfile/test01.dbf
ORA_AUX_DISK_1: restoring datafile 00008 to /data2/nospfile/tools01.dbf
ORA_AUX_DISK_1: reading from backup piece
/backup/rman_backup/db_arch_2vq495ua_1_1.bkp
ORA_AUX_DISK_1: piece handle=/backup/rman_backup/db_arch_2vq495ua_1_1.bkp
tag=TAG20150413T101538
ORA_AUX_DISK_1: restored backup piece 1
ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
restore at 13-APR-15
of Memory Script:
Memory Script
switched to datafile copy
datafile copy RECID=9 STAMP=876912854 file name=/data2/nospfile/system01.dbf
switched to datafile copy
datafile copy RECID=10 STAMP=876912855 file name=/data2/nospfile/sysaux01.dbf
switched to datafile copy
datafile copy RECID=11 STAMP=876912856 file name=/data2/nospfile/undotbs01.dbf
switched to datafile copy
datafile copy RECID=12 STAMP=876912857 file name=/data2/nospfile/users01.dbf
switched to datafile copy
datafile copy RECID=13 STAMP=876912857 file name=/data2/nospfile/example01.dbf
switched to datafile copy
datafile copy RECID=14 STAMP=876912858 file name=/data2/nospfile/data01.dbf
switched to datafile copy
datafile copy RECID=15 STAMP=876912859 file name=/data2/nospfile/test01.dbf
switched to datafile copy
datafile copy RECID=16 STAMP=876912860 file name=/data2/nospfile/tools01.dbf
of Memory Script:
recover
Memory Script
command: SET until clause
recover at 13-APR-15
channel ORA_AUX_DISK_1
media recovery
ORA_AUX_DISK_1: starting archived log restore to default destination
ORA_AUX_DISK_1: restoring archived log
log thread=1 sequence=154
ORA_AUX_DISK_1: reading from backup piece
/backup/rman_backup/db_arch_30q49603_1_1.bkp
ORA_AUX_DISK_1: piece handle=/backup/rman_backup/db_arch_30q49603_1_1.bkp
tag=TAG20150413T101635
ORA_AUX_DISK_1: restored backup piece 1
ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
log file name=/backup/archive/1_154_872701561.dbf thread=1 sequence=154
clone_default: deleting archived log(s)
log file name=/backup/archive/1_154_872701561.dbf RECID=1 STAMP=876912867
recovery complete, elapsed time: 00:00:04
recover at 13-APR-15
of Memory Script:
scope=spfile”;
Memory Script
dismounted
instance shut down
to auxiliary database (not started)
instance started
System Global Area 1152450560 bytes
Size 2212696 bytes
Size 335547560 bytes
Buffers 805306368 bytes
Buffers 9383936 bytes
statement: alter system set db_name
= ”NOSPFILE” comment= ”Reset to
original value by RMAN” scope=spfile
statement: alter system reset
db_unique_name scope=spfile
instance shut down
to auxiliary database (not started)
instance started
System Global Area 1152450560 bytes
Size 2212696 bytes
Size 335547560 bytes
Buffers 805306368 bytes
Buffers 9383936 bytes
statement: CREATE CONTROLFILE REUSE SET DATABASE “NOSPFILE” RESETLOGS
ARCHIVELOG
1 ( ‘/data2/nospfile/redo01.log’ ) SIZE 50 M ,
2 ( ‘/data2/nospfile/redo02.log’ ) SIZE 50 M
of Memory Script:
Memory Script
command: SET NEWNAME
tempfile 1 to /data2/nospfile/temp01.dbf in control file
datafile copy
copy file name=/data2/nospfile/sysaux01.dbf RECID=1 STAMP=876912891
datafile copy
copy file name=/data2/nospfile/undotbs01.dbf RECID=2 STAMP=876912892
datafile copy
copy file name=/data2/nospfile/users01.dbf RECID=3 STAMP=876912892
datafile copy
copy file name=/data2/nospfile/example01.dbf RECID=4 STAMP=876912892
datafile copy
copy file name=/data2/nospfile/data01.dbf RECID=5 STAMP=876912893
datafile copy
copy file name=/data2/nospfile/test01.dbf RECID=6 STAMP=876912893
datafile copy
copy file name=/data2/nospfile/tools01.dbf RECID=7 STAMP=876912894
switched to datafile copy
copy RECID=1 STAMP=876912891 file name=/data2/nospfile/sysaux01.dbf
switched to datafile copy
datafile copy RECID=2 STAMP=876912892 file name=/data2/nospfile/undotbs01.dbf
switched to datafile copy
datafile copy RECID=3 STAMP=876912892 file name=/data2/nospfile/users01.dbf
switched to datafile copy
datafile copy RECID=4 STAMP=876912892 file name=/data2/nospfile/example01.dbf
switched to datafile copy
datafile copy RECID=5 STAMP=876912893 file name=/data2/nospfile/data01.dbf
switched to datafile copy
datafile copy RECID=6 STAMP=876912893 file name=/data2/nospfile/test01.dbf
switched to datafile copy
datafile copy RECID=7 STAMP=876912894 file name=/data2/nospfile/tools01.dbf
of Memory Script:
Memory Script
opened
Duplicate Db at 13-APR-15
Conclusion
In the preceding scenario based article, we have learned that backup based duplication using Rman utility with different database name and different directory structure, without using spfile
BY
Name: Mirza Sarmadullah Baig
Designation: Senior Database Engineer
Organization: Netsoftmate IT Solutions.
Email: info@netsoftmate.com