Here source db name is SRDB and clone db
name is CLONEDB.
Points to make sure.
a)
Source database must be in archivelog mode.
b)
Database must have a good full db backup.
c)
If the server is different we need to move
backupsets, archivelogs and onlinelogs from source to destination directory,
make sure directory structure of these remains same on destination with source.
d)
Database versions should be same if not at the
end of cloning we have an error clone database should be started in upgrade
mode.
Connect to SRDB .
1.
Create
pfile from spfile on source database for clone db.
SQL> create pfile from spfile;
File created.
Copy the pfile from old $ORACLE_HOME/dbs to new one or the new db which
is cloned should exist in the same ORACLE_HOME, rename it to init<dbname>.ora
having a backup.
2.
Edit the
pfile . Some parameters need to be added and some needs to be changed.
if the directory structures are different
in case of same server add these parameters. (DB_FILE_NAME_CONVERT,
LOG_FILE_NAME_CONVERT ).
Replace word source db name (SRDB) with clone db name (CLONEDB).
3.
Create
directories for clone db.
For adump.
[oracle@TDCVM07S03 dbs]$ mkdir -p /oracle/app/oracle/admin/clonedb/adump
For database files.
[oracle@TDCVM07S03 oradata]$ mkdir clonedb
For fast_recovery_area / flash_recovery_area
If it is
11.2.0.1 -- flash_recovery_area
If it is 11.2.0.2 /
11.2.0.3 – fast_recovery_area
[oracle@TDCVM07S03 flash_recovery_area]$ mkdir clonedb
4.
Create
password file or make a copy of
existing source db(SRDB) ORAPWSRDB password file and rename it to ORAPWCLONEDB
Create new password file by orapwd ---
[oracle@TDCVM07S03 bin]$ orapwd file=$ORACLE_HOME/dbs/orapwclonedb
password=XXXXXXX entries=5
Copy the existing password file
---
[oracle@TDCVM07S03 dbs]$ mv orapwsrdb orapwclonedb
5.
Create new
db service clonedb from another terminal and hold the db in nomount stage.
n
In Linux
Add entry of clonedb in oratab file
-- vi /etc/oratab
[oracle@TDCVM07S03 bin]$ export ORACLE_SID=clonedb
[oracle@TDCVM07S03 bin]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Tue Jul 2 21:58:02 2013
Copyright (c) 1982, 2009, Oracle.
All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 217157632
bytes
Fixed Size 2211928 bytes
Variable Size 159387560
bytes
Database Buffers 50331648
bytes
Redo Buffers 5226496
bytes
n
In Windows
C:\>set ORACLE_HOME=c:\app\admin\product\11.2.0\dbhome_1
C:\>set ORACLE_SID=CLONEDB
C:\>set PATH=%ORACLE_HOME/bin%;%PATH%
C:\>oradim -new -sid clonedb -intpwd oracle -startmode Manual
Instance created.
C:\> sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Tue Jul 2 21:58:02 2013
Copyright (c) 1982, 2009, Oracle.
All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 217157632
bytes
Fixed Size 2211928 bytes
Variable Size 159387560
bytes
Database Buffers 50331648
bytes
Redo Buffers 5226496
bytes
6.
Edit listener.ora
and tnsnames.ora
Statically register the clonedb dbname with the listener and restart it.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME =
/oracle/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = srdb)
(ORACLE_HOME =
/oracle/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = clonedb)
)
)
Add TNS entry in tnsnames.ora .
CLONEDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =xx.xx.xx.xx)(PORT
= 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = clonedb)
)
)
7.
Connect to
target terminal clonedb -- Duplicate target database to clone.
SQL> host rman
Recovery Manager: Release 11.2.0.1.0 - Production on Tue Jul 2 22:00:15
2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
RMAN> connect target sys/xxxxxx@srdb
connected to target database: SRDB (DBID=2167491995)
RMAN> connect auxiliary sys/xxxxxx@clonedb
connected to auxiliary database: CONEDB (not mounted)
RMAN>
duplicate target database to clonedb ;
** Duplicate target database command doesnot include spfile
and nofilenamecheck keywords.
·
Database started from pfile that's why no spfile
command included.
·
Target db conedb directory structure is
different that’s why nofilenamecheck command is included.
No comments:
Post a Comment