11203 RMAN Active
Database Cloning without Source Backup:
Source database will be in Mount Stage (No ArchiveLog Mode) è SRCDB
Target Database will be In NoMount Stage while Active
cloning: è
DUPB
Time Taken: 12mins for 180GB (Same Server with ASM
DiskGroup)
Steps Overview:
Step1: Source DB = Mount (NO ARCHIVE
LOG)
Setp2: Target DB - Nomount (Auxiliary)
Step3: RMAN -
run {
ALLOCATE CHANNEL d1 TYPE DISK ;
ALLOCATE CHANNEL d2 TYPE DISK ;
ALLOCATE CHANNEL d3 TYPE DISK ;
ALLOCATE AUXILIARY CHANNEL a1 TYPE DISK ;
ALLOCATE AUXILIARY CHANNEL a2 TYPE DISK ;
ALLOCATE AUXILIARY CHANNEL a3 TYPE DISK ;
duplicate target database to DUPDB from active database;
}
Step 4:
Copy the wallet encryption file from source db
to target db (if you having Wallet encryption in your database)
Step5:
start the db in mount stage (after cloning)
step6:
open the wallet
step7: Alter database open;
[oracle@MyServer
~]$ echo $ORACLE_SID
SRCDB
[oracle@MyServer
~]$ sqlplus '/as sysdba'
SQL>
create pfile='/localfs/export/SRCDB/initSRCDB.ora' from spfile;
File
created.
SQL> exit
Edit your PFILE:
[oracle@MyServer
SRCDB]$ cp initSRCDB.ora initDUPDB.ora
[oracle@MyServer
SRCDB]$ vi initDUPDB.ora
*.audit_file_dest='/localfs/orasrc/admin/DUPDB/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
#*.control_files='/localfs/oradata/DUPDB/control01.ctl','/localfs/oradata/DUPDB/control02.ctl'
*.db_block_size=8192
*.db_domain='MYDOMAIN.ORG'
*.db_name='DUPDB'
*.diagnostic_dest='/localfs/orasrc'
*.dispatchers='(PROTOCOL=TCP)
(SERVICE=DUPDBXDB)'
*.open_cursors=300
*.pga_aggregate_target=235929600
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=707788800
*.undo_tablespace='UNDOTBS1'
db_file_name_convert='/localfs/oradata/SRCDB/','/localfs/oradata/DUPDB/'
log_file_name_convert='/localfs/oradata/SRCDB/','/localfs/oradata/DUPDB/'
Copy your Soruce Password file
[oracle@MyServer
SRCDB]$ cd $ORACLE_HOME/dbs
[oracle@MyServer
dbs]$ cp orapwSRCDB orapwDUPDB
[oracle@MyServer
dbs]$ cd -
/localfs/export/SRCDB
Creating Spfile:
[oracle@MyServer
SRCDB]$ sqlplus '/as sysdba'
SQL*Plus:
Release 11.2.0.2.0 Production on Tue Feb 19 04:14:33 2013
Copyright
(c) 1982, 2010, Oracle. All rights
reserved.
Connected to
an idle instance.
SQL>
create spfile from pfile='/localfs/export/SRCDB/initDUPDB.ora';
File
created.
SQL>
startup nomount;
ORACLE
instance started.
Total System
Global Area 705662976 bytes
Fixed
Size 2229840 bytes
Variable
Size 201329072 bytes
Database
Buffers 494927872 bytes
Redo
Buffers 7176192 bytes
SQL> exit
Source Database Mount:
[oracle@MyServer
admin]$ echo $ORACLE_SID
SRCDB
SQL>
shutdown immediate;
Database
closed.
Database
dismounted.
ORACLE
instance shut down.
SQL>
startup mount;
ORACLE
instance started.
Total System
Global Area 705662976 bytes
Fixed
Size 2229840 bytes
Variable
Size 201329072 bytes
Database
Buffers 494927872 bytes
Redo
Buffers 7176192 bytes
Database
mounted.
SQL> exit
My Listener Entries:
LSNR_DUPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = MyServer.MYDOMAIN.ORG)(PORT = 1522))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = MyServer.MYDOMAIN.ORG)(PORT = 1522))
)
SID_LIST_LSNR_DUPDB =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = DUPDB.MYDOMAIN.ORG)
(ORACLE_HOME = /localfs/orasrc/product/db/11.2.0.2)
(SID_NAME = DUPDB)
)
(SID_DESC =
(GLOBAL_DBNAME = SRCDB.MYDOMAIN.ORG)
(ORACLE_HOME = /localfs/orasrc/product/db/11.2.0.2)
(SID_NAME = SRCDB)
)
)
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = DUPDB.MYDOMAIN.ORG)
(ORACLE_HOME = /localfs/orasrc/product/db/11.2.0.2)
(SID_NAME = DUPDB)
)
(SID_DESC =
(GLOBAL_DBNAME = SRCDB.MYDOMAIN.ORG)
(ORACLE_HOME = /localfs/orasrc/product/db/11.2.0.2)
(SID_NAME = SRCDB)
)
)
[oracle@MyServer admin]$ ps -ef | grep tns
oracle 28013 1 0 04:36 ? 00:00:00 /localfs/orasrc/product/db/11.2.0.2/bin/tnslsnr LSNR_DUPDB -inherit
oracle 28013 1 0 04:36 ? 00:00:00 /localfs/orasrc/product/db/11.2.0.2/bin/tnslsnr LSNR_DUPDB -inherit
Note: NoMount Stage
Database required the Seperate Listener to avoid the below error while
cloning the database using RMAN Auxiliary connection
ORA-12528: TNS:listener: all appropriate instances are blocking new connections
My TnsName Entry:
SRCDB.MYDOMAIN.ORG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = MyServer.MYDOMAIN.ORG)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = SRCDB.MYDOMAIN.org)
)
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = MyServer.MYDOMAIN.ORG)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = SRCDB.MYDOMAIN.org)
)
)
DUPDB.MYDOMAIN.ORG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = MyServer.MYDOMAIN.ORG)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DUPDB.MYDOMAIN.org)
)
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = MyServer.MYDOMAIN.ORG)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DUPDB.MYDOMAIN.org)
)
)
=============================================================================
RMAN Execution:
[oracle@MyServer SRCDB]$ rman
Recovery Manager: Release 11.2.0.2.0 - Production on Tue Feb 19 04:40:54 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
RMAN> connect auxiliary sys/PassWd@DUPDB
connected to auxiliary database: DUPDB (not mounted)
RMAN> connect target sys/PassWd@SRCDB
connected to target database: SRCDB (DBID=523443299, not open)
RMAN> run
2> {
3> ALLOCATE CHANNEL d1 TYPE DISK ;
ALLOCATE CHANNEL d2 TYPE DISK ;
4> 5> ALLOCATE CHANNEL d3 TYPE DISK ;
6> ALLOCATE AUXILIARY CHANNEL a1 TYPE DISK ;
7> ALLOCATE AUXILIARY CHANNEL a2 TYPE DISK ;
8> ALLOCATE AUXILIARY CHANNEL a3 TYPE DISK ;
9> duplicate target database to DUPDB from active database;
10> }
2> {
3> ALLOCATE CHANNEL d1 TYPE DISK ;
ALLOCATE CHANNEL d2 TYPE DISK ;
4> 5> ALLOCATE CHANNEL d3 TYPE DISK ;
6> ALLOCATE AUXILIARY CHANNEL a1 TYPE DISK ;
7> ALLOCATE AUXILIARY CHANNEL a2 TYPE DISK ;
8> ALLOCATE AUXILIARY CHANNEL a3 TYPE DISK ;
9> duplicate target database to DUPDB from active database;
10> }
using target database control file instead of recovery catalog
allocated channel: d1
channel d1: SID=63 device type=DISK
allocated channel: d1
channel d1: SID=63 device type=DISK
allocated channel: d2
channel d2: SID=129 device type=DISK
channel d2: SID=129 device type=DISK
allocated channel: d3
channel d3: SID=191 device type=DISK
channel d3: SID=191 device type=DISK
allocated channel: a1
channel a1: SID=63 device type=DISK
channel a1: SID=63 device type=DISK
allocated channel: a2
channel a2: SID=129 device type=DISK
channel a2: SID=129 device type=DISK
allocated channel: a3
channel a3: SID=192 device type=DISK
channel a3: SID=192 device type=DISK
Starting Duplicate Db at 19-FEB-13
contents of Memory Script:
{
sql clone "alter system set db_name =
''SRCDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''DUPDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
backup as copy current controlfile auxiliary format '/localfs/orasrc/product/db/11.2.0.2/dbs/cntrlDUPDB.dbf';
alter clone database mount;
}
executing Memory Script
......
{
sql clone "alter system set db_name =
''SRCDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''DUPDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
backup as copy current controlfile auxiliary format '/localfs/orasrc/product/db/11.2.0.2/dbs/cntrlDUPDB.dbf';
alter clone database mount;
}
executing Memory Script
......
......
......
......
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 19-FEB-13
released channel: d1
released channel: d2
released channel: d3
released channel: a1
released channel: a2
released channel: a3
Finished Duplicate Db at 19-FEB-13
released channel: d1
released channel: d2
released channel: d3
released channel: a1
released channel: a2
released channel: a3
RMAN> exit
Recovery Manager complete.
[oracle@MyServer SRCDB]$
=============================================================================
[oracle@MyServer ~]$ export ORACLE_SID=DUPDB
[oracle@MyServer ~]$ sqlplus '/as sysdba'
[oracle@MyServer ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 11.2.0.2.0 Production on Tue Feb 19 04:45:02 2013
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select open_mode from v$database;
OPEN_MODE
------------------------------------------------------------
READ WRITE
------------------------------------------------------------
READ WRITE
======================================================================
No comments:
Post a Comment