DISABLE FIREWALLS
================================================================
vi 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.
PROD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.83.138.139)(PORT = 1521))
)
ADR_BASE_PROD = /u01/app/oracle
SID_LIST_TEST =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = test)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = test)
)
)
TEST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.83.138.140)(PORT = 1522))
)
ADR_BASE_TEST = /u01/app/oracle
SID_LIST_PROD =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = prod)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = prod)
)
)
vi 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.
PROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.83.138.139)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = prod)
)
)
TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.83.138.140)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = test)
)
)
copy the both the files to the other server
================================================================================================
tnsping with each other
bash-4.1$ export ORACLE_SID=prod
-bash-4.1$ !sql
sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Feb 6 11:29:10 2017
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area 830930944 bytes
Fixed Size 2232920 bytes
Variable Size 494931368 bytes
Database Buffers 327155712 bytes
Redo Buffers 6610944 bytes
Database mounted.
Database opened.
SQL> select name from v$database;
NAME
---------
PROD
crate pfile and copy that to other server(target server)
edit dbname and controlfile locations on target said
create password file:-
=============================================================================================
orapwd file=orapwSID password=manager entries=5 FORCE=Y
copy password file from production to destination and change its name no test
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch
Oldest online log sequence 26
Next log sequence to archive 28
Current log sequence 28
SQL> alter system switch logfile;
/
/
/
target said:=
===================================================================================================
Edit dbname and controlfile locations on target said
add below parameters:
db_file_name_convert = '/u01/prod','/u01/test'
log_file_name_convert ='/u01/prod','/u01/test'
-bash-4.1$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/dbs
-bash-4.1$ mkdir mkdir udump arch bdump audit cdump
bash-4.1$ export ORACLE_SID=test
-bash-4.1$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Feb 6 11:37:15 2017
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 242208768 bytes
Fixed Size 2227176 bytes
Variable Size 184550424 bytes
Database Buffers 50331648 bytes
Redo Buffers 5099520 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
-bash-4.1$ rman target sys/manager@prod AUXILIARY sys/manager@test
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Feb 7 04:34:48 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PROD (DBID=347054404)
connected to auxiliary database: TEST (not mounted)
RMAN> duplicate target database to 'test' from active database nofilenamecheck;
Starting Duplicate Db at 07-FEB-17
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=63 device type=DISK
contents of Memory Script:
{
sql clone "alter system set db_name =
''PROD'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''TEST'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
backup as copy current controlfile auxiliary format '/u01/test/control01.ctl';
restore clone controlfile to '/u01/test/control02.ctl' from
'/u01/test/control01.ctl';
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''PROD'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''TEST'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 242208768 bytes
Fixed Size 2227176 bytes
Variable Size 184550424 bytes
Database Buffers 50331648 bytes
Redo Buffers 5099520 bytes
Starting backup at 07-FEB-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=71 device type=DISK
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_prod.f tag=TAG20170207T043513 RECID=7 STAMP=935296514
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 07-FEB-17
Starting restore at 07-FEB-17
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=63 device type=DISK
channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 07-FEB-17
database mounted
contents of Memory Script:
{
set newname for datafile 1 to
"/u01/test/system01.dbf";
set newname for datafile 2 to
"/u01/test/sysaux01.dbf";
set newname for datafile 3 to
"/u01/test/undotbs01.dbf";
set newname for datafile 4 to
"/u01/test/users01.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/u01/test/system01.dbf" datafile
2 auxiliary format
"/u01/test/sysaux01.dbf" datafile
3 auxiliary format
"/u01/test/undotbs01.dbf" datafile
4 auxiliary format
"/u01/test/users01.dbf" ;
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
Starting backup at 07-FEB-17
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/prod/system01.dbf
output file name=/u01/test/system01.dbf tag=TAG20170207T043524
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:48
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/prod/sysaux01.dbf
output file name=/u01/test/sysaux01.dbf tag=TAG20170207T043524
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/prod/undotbs01.dbf
output file name=/u01/test/undotbs01.dbf tag=TAG20170207T043524
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=/u01/prod/users01.dbf
output file name=/u01/test/users01.dbf tag=TAG20170207T043524
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 07-FEB-17
sql statement: alter system archive log current
contents of Memory Script:
{
backup as copy reuse
archivelog like "/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch/1_34_935216071.dbf" auxiliary format
"/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch/1_34_935216071.dbf" ;
catalog clone archivelog "/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch/1_34_935216071.dbf";
switch clone datafile all;
}
executing Memory Script
Starting backup at 07-FEB-17
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=34 RECID=33 STAMP=935296673
output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch/1_34_935216071.dbf RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
Finished backup at 07-FEB-17
cataloged archived log
archived log file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch/1_34_935216071.dbf RECID=33 STAMP=935296675
datafile 1 switched to datafile copy
input datafile copy RECID=7 STAMP=935296675 file name=/u01/test/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=8 STAMP=935296675 file name=/u01/test/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=9 STAMP=935296675 file name=/u01/test/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=10 STAMP=935296675 file name=/u01/test/users01.dbf
contents of Memory Script:
{
set until scn 1082037;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 07-FEB-17
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 34 is already on disk as file /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch/1_34_935216071.dbf
archived log file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch/1_34_935216071.dbf thread=1 sequence=34
media recovery complete, elapsed time: 00:00:00
Finished recover at 07-FEB-17
Oracle instance started
Total System Global Area 242208768 bytes
Fixed Size 2227176 bytes
Variable Size 184550424 bytes
Database Buffers 50331648 bytes
Redo Buffers 5099520 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''TEST'' 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 = ''TEST'' 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 242208768 bytes
Fixed Size 2227176 bytes
Variable Size 184550424 bytes
Database Buffers 50331648 bytes
Redo Buffers 5099520 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "TEST" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/u01/test/redo01.log' ) SIZE 50 M REUSE,
GROUP 2 ( '/u01/test/redo02.log' ) SIZE 50 M REUSE,
GROUP 3 ( '/u01/test/redo03.log' ) SIZE 50 M REUSE
DATAFILE
'/u01/test/system01.dbf'
CHARACTER SET WE8MSWIN1252
contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/test/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/u01/test/sysaux01.dbf",
"/u01/test/undotbs01.dbf",
"/u01/test/users01.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /u01/test/temp01.dbf in control file
cataloged datafile copy
datafile copy file name=/u01/test/sysaux01.dbf RECID=1 STAMP=935296694
cataloged datafile copy
datafile copy file name=/u01/test/undotbs01.dbf RECID=2 STAMP=935296694
cataloged datafile copy
datafile copy file name=/u01/test/users01.dbf RECID=3 STAMP=935296694
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=935296694 file name=/u01/test/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=935296694 file name=/u01/test/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=935296694 file name=/u01/test/users01.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 07-FEB-17
SQL> select name,status from v$database,v$instance;
NAME STATUS
--------- ------------
TEST OPEN
No comments:
Post a Comment