RMAN Duplicate from Active Database - ASM to Non-ASM
copy password file from source to target
================================================
scp orapwindia oracle@192.168.1.112:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwhrprd
Source LISTENER
===================
[oracle@localhost ~]$ cat /u01/app/grid/product/18.0.0/grid_home/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/grid/product/18.0.0/grid_home/network/admin/listener.ora
# Generated by Oracle configuration tools.
#Backup file is /u01/app/grid/product/18.0.0/grid_home/srvm/admin/listener.ora.bak.localhost line added by Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER = ON
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.108)(PORT = 1521))
)
ADR_BASE_LISTENER = /u01/app/grid
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON
[oracle@localhost ~]$
Source tnsnames.ora
======================
[oracle@localhost admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
INDIA =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.108)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = india)
)
)
HRPRD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.112)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = hrprd)
)
)
[oracle@localhost admin]$
Target listener
======================
[oracle@localhost pfile]$ cat /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.112)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = hrprd)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = hrprd)
)
)
ADR_BASE_LISTENER = /u01/app/oracle
[oracle@localhost pfile]$
target TNsnames.ora
=======================
[oracle@localhost admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
HRPRD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.112)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = hrprd)
)
)
INDIA =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.108)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = india)
)
)
[oracle@localhost admin]$
target init file
===================
[oracle@localhost pfile]$ cat inithrprd.ora
db_name=hrprd
[oracle@localhost pfile]$
set local listener on target
===================================
alter system set local_listener='(ADDRESS = (PROTOCOL=TCP)(HOST=192.168.1.108)(PORT=1521))' scope=both;
create directory on target
===============================
mkdir -p /u01/app/oracle/admin/hrprd/adump
mkdir -p /u01/app/oracle/fast_recovery_area/hrprd
mkdir -p /u01/app/oracle/oradata/hrprd
mkdir -p /u01/app/oracle/oradata/hrprd
start the target database
=================================
startup nomount pfile=/u01/app/oracle/admin/hrprd/pfile/inithrprd.ora
connect with rman on target
=============================
rman target sys/sys@india auxiliary sys/sys@hrprd
check source file location
================================
select name from v$datafile
union all
select name from v$tempfile
union all
select name from v$controlfile
union all
select member from v$logfile;
Active dupliacte command
=================================
run
{
DUPLICATE TARGET DATABASE TO "hrprd"
FROM ACTIVE DATABASE
DB_FILE_NAME_CONVERT '+DATA1/india/datafile','/u01/app/oracle/oradata/hrprd','+DATA1/india/tempfile','/u01/app/oracle/oradata/hrprd'
SPFILE
SET LOG_FILE_NAME_CONVERT '+DATA1/india/onlinelog','/u01/app/oracle/oradata/hrprd'
SET AUDIT_FILE_DEST '/u01/app/oracle/admin/hrprd/adump'
SET CONTROL_FILES '/u01/app/oracle/oradata/hrprd/control01.ctl'
SET DB_RECOVERY_FILE_DEST '/u01/app/oracle/fast_recovery_area/hrprd'
SET DB_CREATE_FILE_DEST '/u01/app/oracle/oradata/hrprd'
SET db_create_online_log_dest_1 '/u01/app/oracle/oradata/hrprd'
SET DIAGNOSTIC_DEST '/u01/app/oracle/diag';
}
Duplicate log
================
RMAN> run
{
DUPLICATE TARGET DATABASE TO "hrprd"
FROM ACTIVE DATABASE
DB_FILE_NAME_CONVERT '+DATA1/india/datafile','/u01/app/oracle/oradata/hrprd','+DATA1/india/tempfile','/u01/app/oracle/oradata/hrprd'
SPFILE
SET LOG_FILE_NAME_CONVERT '+DATA1/india/onlinelog','/u01/app/oracle/oradata/hrprd'
SET AUDIT_FILE_DEST '/u01/app/oracle/admin/hrprd/adump'
SET CONTROL_FILES '/u01/app/oracle/oradata/hrprd/control01.ctl'
SET DB_RECOVERY_FILE_DEST '/u01/app/oracle/fast_recovery_area/hrprd'
SET DB_CREATE_FILE_DEST '/u01/app/oracle/oradata/hrprd'
SET db_create_online_log_dest_1 '/u01/app/oracle/oradata/hrprd'
2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> SET DIAGNOSTIC_DEST '/u01/app/oracle/diag';
}
15>
Starting Duplicate Db at 18-FEB-20
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK
contents of Memory Script:
{
backup as copy reuse
targetfile '+DATA1/india/spfileindia.ora' auxiliary format
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilehrprd.ora' ;
sql clone "alter system set spfile= ''/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilehrprd.ora''";
}
executing Memory Script
Starting backup at 18-FEB-20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=48 device type=DISK
Finished backup at 18-FEB-20
sql statement: alter system set spfile= ''/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilehrprd.ora''
contents of Memory Script:
{
sql clone "alter system set db_name =
''HRPRD'' comment=
''duplicate'' scope=spfile";
sql clone "alter system set LOG_FILE_NAME_CONVERT =
''+DATA1/india/onlinelog'', ''/u01/app/oracle/oradata/hrprd'' comment=
'''' scope=spfile";
sql clone "alter system set AUDIT_FILE_DEST =
''/u01/app/oracle/admin/hrprd/adump'' comment=
'''' scope=spfile";
sql clone "alter system set CONTROL_FILES =
''/u01/app/oracle/oradata/hrprd/control01.ctl'' comment=
'''' scope=spfile";
sql clone "alter system set db_recovery_file_dest =
''/u01/app/oracle/fast_recovery_area/hrprd'' comment=
'''' scope=spfile";
sql clone "alter system set DB_CREATE_FILE_DEST =
''/u01/app/oracle/oradata/hrprd'' comment=
'''' scope=spfile";
sql clone "alter system set db_create_online_log_dest_1 =
''/u01/app/oracle/oradata/hrprd'' comment=
'''' scope=spfile";
sql clone "alter system set DIAGNOSTIC_DEST =
''/u01/app/oracle/diag'' comment=
'''' scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set db_name = ''HRPRD'' comment= ''duplicate'' scope=spfile
sql statement: alter system set LOG_FILE_NAME_CONVERT = ''+DATA1/india/onlinelog'', ''/u01/app/oracle/oradata/hrprd'' comment= '''' scope=spfile
sql statement: alter system set AUDIT_FILE_DEST = ''/u01/app/oracle/admin/hrprd/adump'' comment= '''' scope=spfile
sql statement: alter system set CONTROL_FILES = ''/u01/app/oracle/oradata/hrprd/control01.ctl'' comment= '''' scope=spfile
sql statement: alter system set db_recovery_file_dest = ''/u01/app/oracle/fast_recovery_area/hrprd'' comment= '''' scope=spfile
sql statement: alter system set DB_CREATE_FILE_DEST = ''/u01/app/oracle/oradata/hrprd'' comment= '''' scope=spfile
sql statement: alter system set db_create_online_log_dest_1 = ''/u01/app/oracle/oradata/hrprd'' comment= '''' scope=spfile
sql statement: alter system set DIAGNOSTIC_DEST = ''/u01/app/oracle/diag'' comment= '''' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 2371719168 bytes
Fixed Size 2255512 bytes
Variable Size 587203944 bytes
Database Buffers 1778384896 bytes
Redo Buffers 3874816 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''INDIA'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''HRPRD'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
backup as copy current controlfile auxiliary format '/u01/app/oracle/oradata/hrprd/control01.ctl';
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''INDIA'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''HRPRD'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 2371719168 bytes
Fixed Size 2255512 bytes
Variable Size 587203944 bytes
Database Buffers 1778384896 bytes
Redo Buffers 3874816 bytes
Starting backup at 18-FEB-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_india.f tag=TAG20200218T215741 RECID=3 STAMP=1032731861
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 18-FEB-20
database mounted
contents of Memory Script:
{
set newname for datafile 1 to
"/u01/app/oracle/oradata/hrprd/system.256.1030296291";
set newname for datafile 2 to
"/u01/app/oracle/oradata/hrprd/sysaux.257.1030296291";
set newname for datafile 3 to
"/u01/app/oracle/oradata/hrprd/undotbs1.258.1030296291";
set newname for datafile 4 to
"/u01/app/oracle/oradata/hrprd/users.259.1030296291";
set newname for datafile 5 to
"/u01/app/oracle/oradata/hrprd/example.269.1030296381";
set newname for datafile 6 to
"/u01/app/oracle/oradata/hrprd/test.271.1030297077";
backup as copy reuse
datafile 1 auxiliary format
"/u01/app/oracle/oradata/hrprd/system.256.1030296291" datafile
2 auxiliary format
"/u01/app/oracle/oradata/hrprd/sysaux.257.1030296291" datafile
3 auxiliary format
"/u01/app/oracle/oradata/hrprd/undotbs1.258.1030296291" datafile
4 auxiliary format
"/u01/app/oracle/oradata/hrprd/users.259.1030296291" datafile
5 auxiliary format
"/u01/app/oracle/oradata/hrprd/example.269.1030296381" datafile
6 auxiliary format
"/u01/app/oracle/oradata/hrprd/test.271.1030297077" ;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 18-FEB-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=+DATA1/india/datafile/system.256.1030296291
output file name=/u01/app/oracle/oradata/hrprd/system.256.1030296291 tag=TAG20200218T215747
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATA1/india/datafile/sysaux.257.1030296291
output file name=/u01/app/oracle/oradata/hrprd/sysaux.257.1030296291 tag=TAG20200218T215747
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=+DATA1/india/datafile/example.269.1030296381
output file name=/u01/app/oracle/oradata/hrprd/example.269.1030296381 tag=TAG20200218T215747
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=+DATA1/india/datafile/undotbs1.258.1030296291
output file name=/u01/app/oracle/oradata/hrprd/undotbs1.258.1030296291 tag=TAG20200218T215747
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=+DATA1/india/datafile/test.271.1030297077
output file name=/u01/app/oracle/oradata/hrprd/test.271.1030297077 tag=TAG20200218T215747
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=+DATA1/india/datafile/users.259.1030296291
output file name=/u01/app/oracle/oradata/hrprd/users.259.1030296291 tag=TAG20200218T215747
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 18-FEB-20
sql statement: alter system archive log current
contents of Memory Script:
{
backup as copy reuse
archivelog like "+DATA1/india/archivelog/2020_02_18/thread_1_seq_18.274.1032731975" auxiliary format
"/u01/app/oracle/fast_recovery_area/hrprd/HRPRD/archivelog/2020_02_18/o1_mf_1_18_%u_.arc" ;
catalog clone recovery area;
switch clone datafile all;
}
executing Memory Script
Starting backup at 18-FEB-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=18 RECID=3 STAMP=1032731974
output file name=/u01/app/oracle/fast_recovery_area/hrprd/HRPRD/archivelog/2020_02_18/o1_mf_1_18_09uosfa7_.arc RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
Finished backup at 18-FEB-20
searching for all files in the recovery area
List of Files Unknown to the Database
=====================================
File Name: /u01/app/oracle/fast_recovery_area/hrprd/HRPRD/archivelog/2020_02_18/o1_mf_1_18_09uosfa7_.arc
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /u01/app/oracle/fast_recovery_area/hrprd/HRPRD/archivelog/2020_02_18/o1_mf_1_18_09uosfa7_.arc
datafile 1 switched to datafile copy
input datafile copy RECID=3 STAMP=1032731977 file name=/u01/app/oracle/oradata/hrprd/system.256.1030296291
datafile 2 switched to datafile copy
input datafile copy RECID=4 STAMP=1032731977 file name=/u01/app/oracle/oradata/hrprd/sysaux.257.1030296291
datafile 3 switched to datafile copy
input datafile copy RECID=5 STAMP=1032731977 file name=/u01/app/oracle/oradata/hrprd/undotbs1.258.1030296291
datafile 4 switched to datafile copy
input datafile copy RECID=6 STAMP=1032731977 file name=/u01/app/oracle/oradata/hrprd/users.259.1030296291
datafile 5 switched to datafile copy
input datafile copy RECID=7 STAMP=1032731977 file name=/u01/app/oracle/oradata/hrprd/example.269.1030296381
datafile 6 switched to datafile copy
input datafile copy RECID=8 STAMP=1032731977 file name=/u01/app/oracle/oradata/hrprd/test.271.1030297077
contents of Memory Script:
{
set until scn 1260829;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 18-FEB-20
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=18 device type=DISK
starting media recovery
archived log for thread 1 with sequence 18 is already on disk as file /u01/app/oracle/fast_recovery_area/hrprd/HRPRD/archivelog/2020_02_18/o1_mf_1_18_09uosfa7_.arc
archived log file name=/u01/app/oracle/fast_recovery_area/hrprd/HRPRD/archivelog/2020_02_18/o1_mf_1_18_09uosfa7_.arc thread=1 sequence=18
media recovery complete, elapsed time: 00:00:01
Finished recover at 18-FEB-20
Oracle instance started
Total System Global Area 2371719168 bytes
Fixed Size 2255512 bytes
Variable Size 587203944 bytes
Database Buffers 1778384896 bytes
Redo Buffers 3874816 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''HRPRD'' comment=
''Reset to original value by RMAN'' scope=spfile";
sql clone "alter system reset db_unique_name scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set db_name = ''HRPRD'' comment= ''Reset to original value by RMAN'' scope=spfile
sql statement: alter system reset db_unique_name scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 2371719168 bytes
Fixed Size 2255512 bytes
Variable Size 587203944 bytes
Database Buffers 1778384896 bytes
Redo Buffers 3874816 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "HRPRD" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/u01/app/oracle/oradata/hrprd/group_1.262.1030296357', '/u01/app/oracle/oradata/hrprd/group_1.263.1030296359' ) SIZE 50 M REUSE,
GROUP 2 ( '/u01/app/oracle/oradata/hrprd/group_2.264.1030296361', '/u01/app/oracle/oradata/hrprd/group_2.265.1030296363' ) SIZE 50 M REUSE,
GROUP 3 ( '/u01/app/oracle/oradata/hrprd/group_3.266.1030296363', '/u01/app/oracle/oradata/hrprd/group_3.267.1030296365' ) SIZE 50 M REUSE
DATAFILE
'/u01/app/oracle/oradata/hrprd/system.256.1030296291'
CHARACTER SET AL32UTF8
contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/app/oracle/oradata/hrprd/temp.268.1030296373";
switch clone tempfile all;
catalog clone datafilecopy "/u01/app/oracle/oradata/hrprd/sysaux.257.1030296291",
"/u01/app/oracle/oradata/hrprd/undotbs1.258.1030296291",
"/u01/app/oracle/oradata/hrprd/users.259.1030296291",
"/u01/app/oracle/oradata/hrprd/example.269.1030296381",
"/u01/app/oracle/oradata/hrprd/test.271.1030297077";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /u01/app/oracle/oradata/hrprd/temp.268.1030296373 in control file
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/hrprd/sysaux.257.1030296291 RECID=1 STAMP=1032731992
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/hrprd/undotbs1.258.1030296291 RECID=2 STAMP=1032731992
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/hrprd/users.259.1030296291 RECID=3 STAMP=1032731992
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/hrprd/example.269.1030296381 RECID=4 STAMP=1032731992
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/hrprd/test.271.1030297077 RECID=5 STAMP=1032731992
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=1032731992 file name=/u01/app/oracle/oradata/hrprd/sysaux.257.1030296291
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=1032731992 file name=/u01/app/oracle/oradata/hrprd/undotbs1.258.1030296291
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=1032731992 file name=/u01/app/oracle/oradata/hrprd/users.259.1030296291
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=1032731992 file name=/u01/app/oracle/oradata/hrprd/example.269.1030296381
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=1032731992 file name=/u01/app/oracle/oradata/hrprd/test.271.1030297077
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 18-FEB-20
RMAN>
RMAN>
RMAN>
[oracle@localhost admin]$ !sq
sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.4.0 Production on Tue Feb 18 22:11:26 2020
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select name ,open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
HRPRD READ WRITE