Вы находитесь на странице: 1из 17

ACTIVE

DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE

RMAN ACTIVE DATABASE CLONING

RMAN has the ability duplicate a database from a backup or from an active database. Using RMAN possible to create a duplicate database on a remote server with the same directory structure and

different directory structure or else the local server with a different directory structure.

Oracle 11 g has introduced active database duplication, we can create a duplicate of the target database without any backups. Duplication is performed over the network. Let us do active database duplication in auxiliary server with different directory structure.

Source server database name

: CRMS

Auxiliary server database name

: CRMS

Source database path

: /u02/app/oracle/oradata/crms/

Auxiliary database path : /u02/app/oracle/oradata/crms/

SOURCE SERVER

192.168.1.130 (SERVER1.ORACLE.COM) SERVER1 PRODUCTION

AUXILIARY SERVER 192.168.1.131 (SERVER2.ORACLE.COM) SERVER2 DEVELOPMENT

NETWORK AVAILABILITY

BETWEEN TWO SERVERS

FROM SOURCE SERVER
FROM SOURCE
SERVER
NETWORK AVAILABILITY BETWEEN TWO SERVERS FROM SOURCE SERVER Exploring the Oracle DBA Technology by Gunasekaran ,

Exploring the Oracle DBA Technology

by

Gunasekaran , Thiyagu

ACTIVE

DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE

FROM THE AUXILIARY

SERVER

- SAME DIRECTORY STRUCTURE FROM THE AUXILIARY SERVER STEPS TO PERFORM ACTIVE DATABASE DUPLICATION Configure t
- SAME DIRECTORY STRUCTURE FROM THE AUXILIARY SERVER STEPS TO PERFORM ACTIVE DATABASE DUPLICATION Configure t

STEPS

TO PERFORM ACTIVE DATABASE DUPLICATION

Configure the network files

Add an entry in tnsnames.ora & listener.ora on the Target server & Auxiliary server.

Create & Edit the initialization parameter file

Create an init.ora from the source database & SCP to the auxiliary server.

If you wish to change db_domain = <new_name>

# optional only

Maintain existing path for control_files, audit_file_dest, etc … as per target database path.

Below Parameters are used for from where to where the DATAFILES & LOGFILES will be cloned.

FILE SYSTEM & DIRECTORY NAMING CONVENTION is same, so NOT MANDATORY to add below parameters

db_file_name_convert=(/source path location’, clone path location’)

log_file_name_convert=(/source path location’, ’clone path location’)

Create all necessary directories physically in auxiliary server. Create a Password file (password must be same) for clone & target database. Start the auxiliary database instance using the init.ora file. Connect to the Target(source) & Auxiliary (clone) databases in the Target server. Execute the duplicate command to perform database duplication.

Exploring the Oracle DBA Technology

by

Gunasekaran , Thiyagu

ACTIVE

DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE

CONNECTING

SOURCE

DATABASE

SYS>select name, dbid from v$database;

NAME

DBID

--------- ----------

CRMS

1570419964

SYS>show parameter db_domain;

NAME

TYPE

VALUE

------------------------------------ ----------- ------------------------------

db_domain

string

server1.com

SYS>show parameter service_names;

 

NAME

TYPE

VALUE

 

------------------------------------ ----------- ----------------------

service_names

string

crms.server1.com

 

PARAMETER

FILE BACKUP FOR AUXILIARY DATABASE

SYS>show parameter pfile;

NAME TYPE VALUE ------- --------- ------------------------------------------------------ spfile string
NAME
TYPE
VALUE
-------
--------- ------------------------------------------------------
spfile
string
/u02/app/oracle/product/11.2.0/dbhome_1/dbs/spfilecrms.ora
SENDING
PFILE TO THE AUXILIARY SERVER

crms

db_cache_size=419430400

 

crms

java_pool_size=16777216

crms

large_pool_size=16777216

crms

oracle_base='/u02/app/oracle'

# ORACLE_BASE set from environment

crms

pga_aggregate_target=503316480

crms

sga_target=754974720

 

crms

shared_io_pool_size=0

crms

shared_pool_size=285212672

 

Exploring the Oracle DBA Technology

by

Gunasekaran , Thiyagu

TARGET

DATABASE

PFILE

ACTIVE

DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE

crms streams_pool_size=0 *.audit_file_dest='/u02/app/oracle/admin/crms/adump' *.audit_trail='db'
crms
streams_pool_size=0
*.audit_file_dest='/u02/app/oracle/admin/crms/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u02/app/oracle/oradata/crms/control01.ctl','/u02/app/oracle/flash_recovery_area/crms/control02.ctl'
*.db_block_size=8192
*.
db_domain='server1.com'
*.db_name='crms'
*.db_recovery_file_dest='/u02/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='/u02/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=crmsXDB)'
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=1244659712
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
AUXILIARY DATABASE
PFILE
crms
db_cache_size=419430400
crms
java_pool_size=16777216
crms
large_pool_size=16777216
crms
oracle_base='/u02/app/oracle'
# ORACLE_BASE set from environment
crms
pga_aggregate_target=503316480
crms
sga_target=754974720
crms
shared_io_pool_size=0
crms
shared_pool_size=285212672
crms
streams_pool_size=0
*.audit_file_dest='/u02/app/oracle/admin/crms/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u02/app/oracle/oradata/crms/control01.ctl', '/u02/app/oracle/flash_recovery_area/crms/control02.ctl'
*.db_block_size=8192
*.db_domain='server2.com'
*.db_name='crms'
*.db_recovery_file_dest='/u02/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='/u02/app/oracle'

Exploring the Oracle DBA Technology

by

Gunasekaran , Thiyagu

ACTIVE

DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE

*.dispatchers='(PROTOCOL=TCP) (SERVICE=crmsXDB)'

*.log_archive_format='%t_%s_%r.dbf'

*.memory_target=1244659712

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.undo_tablespace='UNDOTBS1'

# Below Parameters are used for from where to where the DATAFILES & LOGFILES will be cloned.

db_file_name_convert=('/u02/app/oracle/oradata/crms/', '/u02/app/oracle/oradata/crms/’)

log_file_name_convert=('/u02/app/oracle/oradata/crms/', '/u02/app/oracle/oradata/crms/')

If the source database directory structure & clone database directory structure differs, then only

you need to use db_file_name_convert & log_file_name_convert parameters.

I am using here

.

CREATE DIRECTORY STRUCTURE FOR AUXILIARY DATABASE

$ mkdir -p /u02/app/oracle/oradata/crms/

$

mkdir -p /u02/app/oracle/admin/crms/adump/

$ mkdir -p /u02/app/oracle/admin/crms/dpdump/ $ mkdir -p /u02/app/oracle/flash_recovery_area/crms #(for control file)
$ mkdir -p /u02/app/oracle/admin/crms/dpdump/
$ mkdir -p /u02/app/oracle/flash_recovery_area/crms
#(for control file)
LISTENER.ORA
ON
TARGET SERVER  192.168. 1.130
# listener.ora Network Configuration File: /u02/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME=crms)
(ORACLE_HOME = /u02/app/oracle/product/11.2.0/dbhome_1)
# (GLOBAL_DBNAME=crms)
)
)
ADR_BASE_LISTENER = /u02/app/oracle
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL=TCP)(HOST=192.168.241.130)(PORT=1521))
)
)

Exploring the Oracle DBA Technology

by

Gunasekaran , Thiyagu

ACTIVE

DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE

TNSNAMES.ORA ON TARGET SERVER 192.168.1.130

# tnsnames.ora Network Configuration File: /u02/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

CRMSDB =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL=TCP)(HOST=192.168.1.130)(PORT=1521))

= ( PROTOCOL =TCP)( HOST =192.168.1.130 )( PORT =1521)) ) FOR TARGET SERVER ( CONNECT_DATA =

)

FOR

TARGET SERVER

(CONNECT_DATA =

(SERVER=DEDICATED)

(SERVICE_NAME=

)

crms)

)
)

TO_CRMSDB =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST=192.168.1.131)(PORT=1521))

(CONNECT_DATA =

FOR AUXILIARY SERVER

(SERVER = DEDICATED)

)

)

(SERVICE_NAME =

crms)

SERVER = DEDICATED) ) ) ( SERVICE_NAME = crms ) LISTENER.ORA ON AUXILIARY SERVER  192.168.1.131
LISTENER.ORA ON AUXILIARY SERVER  192.168.1.131
LISTENER.ORA ON AUXILIARY SERVER  192.168.1.131

# listener.ora Network Configuration File: /u02/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.131)(PORT = 1521))

) )
)
)

ADR_BASE_LISTENER = /u02/app/oracle

SID_LIST_LISTENER = (SID_LIST = (SID_DESC =
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =

(ORACLE_HOME = /u02/app/oracle/product/11.2.0/dbhome_1)

(SID_NAME = crms)

) )
)
)

Exploring the Oracle DBA Technology

by

Gunasekaran , Thiyagu

ACTIVE

DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE

STARTING LISTENER IN AUXILIARY SERVER

$ lsnrctl ---> listener control

LSNRCTL> start listener

Starting /u02/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait

TNSLSNR for Linux: Version 11.2.0.1.0 - Production

System parameter file is /u02/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Log messages written to /u02/app/oracle/diag/tnslsnr/SERVER2/listener/alert/log.xml

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.131)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.131)(PORT=1521)))

STATUS of the LISTENER

-----------------------------

Alias

listener

 

Version

TNSLSNR for Linux: Version 11.2.0.1.0 - Production

Start Date

07-JAN-2015 10:48:31

 

Uptime

0 days 0 hr. 0 min. 0 sec

 
Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File
Trace Level
off
Security
ON: Local OS Authentication
SNMP
OFF
Listener Parameter File
/u02/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File
/u02/app/oracle/diag/tnslsnr/SERVER2/listener/alert/log.xml
Listening Endpoints Summary
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.131)(PORT=1521)))

Services Summary

Service "crms" has 1 instance(s).

Instance "crms", status UNKNOWN, has 1 handler(s) for this service

The command completed successfully

STARTING LISTENER IN TARGET SERVER

$ lsnrctl start listener

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 07-JAN-2015 10:48:48

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Starting /u02/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait

TNSLSNR for Linux: Version 11.2.0.1.0 - Production

System parameter file is /u02/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Log messages written to /u02/app/oracle/diag/tnslsnr/SERVER1/listener/alert/log.xml

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=SERVER1.ORACLE.COM)(PORT=1521))) ***********

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SERVER1.ORACLE.COM)(PORT=1521)))

Exploring the Oracle DBA Technology

by

Gunasekaran , Thiyagu

ACTIVE

DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE

STATUS of the LISTENER

------------------------------

Alias listener Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 07-JAN-2015 10:48:48 Uptime
Alias
listener
Version
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date
07-JAN-2015 10:48:48
Uptime
0 days 0 hr. 0 min. 0 sec
Trace Level
off
Security
ON: Local OS Authentication
SNMP
OFF

Listener Parameter File

/u02/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Listener Log File

/u02/app/oracle/diag/tnslsnr/SERVER1/listener/alert/log.xml

Listening Endpoints Summary

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=SERVER1.ORACLE.COM)(PORT=1521)))

Services Summary

Service "crms" has 1 instance(s).

Instance "crms", status UNKNOWN, has 1 handler(s) for this service

The command completed successfully

CHECKING TNS CONNECTIVITY ON TARGET SEVER [oracle@SERVER1 admin]$ tnsping crmsdb TNS Ping Utility for Linux:
CHECKING TNS CONNECTIVITY ON TARGET SEVER
[oracle@SERVER1 admin]$ tnsping crmsdb
TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 07-JAN-2015 10:51:42
Copyright (c) 1997, 2009, Oracle. All rights reserved.
Used parameter files:

Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST= (ADDRESS = PROTOCOL= TCP)(HOST = 192.168.1.130) (PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = crms)))OK (30 msec)

[oracle@SERVER1 admin]$ tnsping to_crmsdb

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 07-JAN-2015 10:52:23 Copyright (c) 1997, 2009, Oracle. All rights reserved. Used parameter files:

Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST =(ADDRESS =(PROTOCOL= TCP)(HOST = 192.168.1.131) (PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = crms)))OK (50 msec)

CONFIGURE

PASSWORD FILE ON

AUXILIARY SERVER

$ cd $ORACLE_HOME/dbs $ export ORACLE_SID= c rms [oracle@SERVER2 dbs]$ orapwd file=orapw c rms password=

$ cd $ORACLE_HOME/dbs

$ export ORACLE_SID=crms

[oracle@SERVER2 dbs]$ orapwd file=orapwcrms password=

$ cd $ORACLE_HOME/dbs $ export ORACLE_SID= c rms [oracle@SERVER2 dbs]$ orapwd file=orapw c rms password= oracle

oracle

$ cd $ORACLE_HOME/dbs $ export ORACLE_SID= c rms [oracle@SERVER2 dbs]$ orapwd file=orapw c rms password= oracle
$ export ORACLE_SID= c rms [oracle@SERVER2 dbs]$ orapwd file=orapw c rms password= oracle entries=3 force=y
$ export ORACLE_SID= c rms [oracle@SERVER2 dbs]$ orapwd file=orapw c rms password= oracle entries=3 force=y
$ export ORACLE_SID= c rms [oracle@SERVER2 dbs]$ orapwd file=orapw c rms password= oracle entries=3 force=y
$ export ORACLE_SID= c rms [oracle@SERVER2 dbs]$ orapwd file=orapw c rms password= oracle entries=3 force=y
$ export ORACLE_SID= c rms [oracle@SERVER2 dbs]$ orapwd file=orapw c rms password= oracle entries=3 force=y
$ export ORACLE_SID= c rms [oracle@SERVER2 dbs]$ orapwd file=orapw c rms password= oracle entries=3 force=y

entries=3 force=y

$ export ORACLE_SID= c rms [oracle@SERVER2 dbs]$ orapwd file=orapw c rms password= oracle entries=3 force=y
$ export ORACLE_SID= c rms [oracle@SERVER2 dbs]$ orapwd file=orapw c rms password= oracle entries=3 force=y
$ export ORACLE_SID= c rms [oracle@SERVER2 dbs]$ orapwd file=orapw c rms password= oracle entries=3 force=y
$ export ORACLE_SID= c rms [oracle@SERVER2 dbs]$ orapwd file=orapw c rms password= oracle entries=3 force=y

Password must be same on Target database & Auxiliary database.

When you connect RMAN to the

Source database as TARGET, must specify a password, even if RMAN uses OS authentication.

Exploring the Oracle DBA Technology

by

Gunasekaran , Thiyagu

ACTIVE

DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE

SET THE

SAME PASSWORD OF CLONE DATABASE INTO THE TARGET DATABASE

SYS> alter user sys identified by

oracle

;

(or)

$ cd $ORACLE_HOME/dbs

$ export ORACLE_SID=crms

[oracle@SERVER2 dbs]$ orapwd file=orapwcrms password=

oracle

entries=3 force=y

To create a password in target server, we can use alter user statement or orapwd utlity.

STARTUP

AUXILIARY DATABASE AT

NOMOUNT STAGE & EXIT

[oracle@SERVER2 ~]$ export ORACLE_SID=crms [oracle@SERVER2 ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Tue Jan 7 12:03:05 2015

Copyright (c) 1982, 2009, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup nomount; ORACLE instance started.

Total System Global Area 1255473152 bytes Fixed Size Variable Size Database Buffers Redo Buffers 1336232
Total System Global Area 1255473152 bytes
Fixed Size
Variable Size
Database Buffers
Redo Buffers
1336232 bytes
822086744 bytes
419430400 bytes
12619776 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

POINTS TO NOTE :

Once I started my auxiliary instance in NOMOUNT state, i have disconnected SYS as ‘NO SESSION’ before duplicating a database. It is must and should.

DUPLICATING TARGET DATABASE

In order to clone with the source database open and must be on archivelog mode. From 11g we can clone databases using the “from active” database option. In this case we do NOT require an existing backup, the active datafiles will be used as the source for the clone.

DUPLICATE TARGET DATABASE COMMAND PERFORMS THE FOLLOWING STEPS.

Creates an SPFILE.

Shuts down the instance and restarts it with the new spfile.

Restores the controlfile from the backup.

Mounts the database. Restore all datafiles.

RMAN creates all files in the converted names.

Recovers the datafiles up to the time specified and opens the database for availability.

Exploring the Oracle DBA Technology

by

Gunasekaran , Thiyagu

ACTIVE

DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE

CONNECT TO THE TARGET (SOURCE) & AUXILIARY (NEW CLONE) DATABASES USING RMAN

$ export ORACLE_SID=crms

$ rman target sys/oracle@CRMSDB auxiliary sys/orac1e@TO_CRMSDB

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Jan 7 12:04:55 2015

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

connected to target database: CRMS (DBID=1570419964) connected to auxiliary database: HRMS (not mounted)

RMAN> duplicate target database to 'hrms' from active database nofilenamecheck;

Starting Duplicate Db at 07-JAN-15

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:

{

sql clone "create spfile from memory"; } executing Memory Script sql statement: create spfile from
sql clone "create spfile from memory";
}
executing Memory Script
sql statement: create spfile from memory
contents of Memory Script:
{

shutdown clone immediate;

startup clone nomount;

}

executing Memory Script

Oracle instance shut down

connected to auxiliary database (not started)

Oracle instance started

Total System Global Area

Fixed Size Variable Size Database Buffers Redo Buffers

1255473152 bytes

1336232 bytes 754977880 bytes 486539264 bytes 12619776 bytes

contents of Memory Script:

{

sql clone "alter system set db_name =

''CRMS'' comment=

''Modified by RMAN duplicate'' scope=spfile";

Exploring the Oracle DBA Technology

by

Gunasekaran , Thiyagu

ACTIVE

DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE

sql clone "alter system set db_unique_name = ''CRMS'' comment= ''Modified by RMAN duplicate

'' scope=spfile";

shutdown clone immediate;

startup clone force nomount

backup as copy current controlfile auxiliary format

'/u02/app/oracle/oradata/crms/control01.ctl ';

restore clone controlfile to '/u02/app/oracle/flash_recovery_area/crms/control02.ctl' from

'/u02/app/oracle/oradata/crms/control01.ctl';

alter clone database mount;

}

executing Memory Script

sql statement: alter system set db_name = ''CRMS'' comment= ''Modified by RMAN duplicate'' scope= spfile

sql statement: alter system set db_unique_name = ''CRMS'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area

1255473152 bytes

Fixed Size 1336232 bytes Variable Size 754977880 bytes Database Buffers 486539264 bytes Redo Buffers 12619776
Fixed Size
1336232 bytes
Variable Size
754977880 bytes
Database Buffers
486539264 bytes
Redo Buffers
12619776 bytes
Starting backup at 07-JAN-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=39 device type=DISK

channel ORA_DISK_1: starting datafile copy

copying current control file

output file name=/u02/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_crms.f

tag=TAG20150107T191625 R ECID=5 STAMP=868389386

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03

Finished backup at 07-JAN-15

Starting restore at 07-JAN-15

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=20 device type=DISK

channel ORA_AUX_DISK_1: copied control file copy

Finished restore at 07-JAN-15

database mounted

contents of Memory Script:

{

set newname for datafile 1 to

"/u02/app/oracle/oradata/crms/system01.dbf";

set newname for datafile 2 to

Exploring the Oracle DBA Technology

by

Gunasekaran , Thiyagu

ACTIVE

DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE

"/u02/app/oracle/oradata/crms/sysaux01.dbf";

set newname for datafile 3 to

"/u02/app/oracle/oradata/crms/undotbs01.dbf";

set newname for datafile 4 to

"/u02/app/oracle/oradata/crms/users01.dbf";

backup as copy reuse datafile 1 auxiliary format

"/u02/app/oracle/oradata/crms/system01.dbf"

datafile

2

auxiliary format

"/u02/app/oracle/oradata/crms/sysaux01.dbf"

datafile

3

auxiliary format

"/u02/app/oracle/oradata/crms/undotbs01.dbf"

4 auxiliary format

"/u02/app/oracle/oradata/crms/users01.dbf"

datafile

;

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
executing command: SET NEWNAME

Starting backup at 07-JAN-15 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy input datafile file number=00001 name=/u02/app/oracle/oradata/crms/system01.dbf output file name=/u02/app/oracle/oradata/crms/system01.dbf tag=TAG20150107T191635 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25 channel ORA_DISK_1: starting datafile copy input datafile file number=00002 name=/u02/app/oracle/oradata/crms/sysaux01.dbf output file name=/u02/app/oracle/oradata/crms/sysaux01.dbf tag=TAG20150107T191635 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=/u02/app/oracle/oradata/crms/undotbs01.dbf output file name=/u02/app/oracle/oradata/crms/undotbs01.dbf tag=TAG20150107T191635 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=/u02/app/oracle/oradata/crms/users01.dbf output file name=/u02/app/oracle/oradata/crms/users01.dbf tag=TAG20150107T191635 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01 Finished backup at 07-JAN-15

sql statement: alter system archive log current

contents of Memory Script:

Exploring the Oracle DBA Technology

by

Gunasekaran , Thiyagu

ACTIVE

DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE

{

backup as copy reuse

archivelog like

"/u02/app/oracle/flash_recovery_area/CRMS/archivelog/2015_01_07/o1_mf_1_11_bbtg 7w9n arc"

auxiliary format

"/u02/app/oracle/flash_recovery_area/CRMS/archivelog/2015_01_07/o1_mf_1_11_%u

catalog clone recovery area;

switch clone datafile all;

}

executing Memory Script

arc"

;

Starting backup at 07-JAN-15

using channel ORA_DISK_1

channel ORA_DISK_1: starting archived log copy

input archived log thread=1 sequence=11 RECID=10 STAMP=868389460

output file

name=/u02/app/oracle/flash_recovery_area/CRMS/archivelog/2015_01_07/o1_mf_1_11_0pps54ik

RECID=0 STAMP=0

channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01

Finished backup at 07-JAN-15

arc

searching for all files in the recovery area List of Files Unknown to the Database
searching for all files in the recovery area
List of Files Unknown to the Database
=====================================
File Name:
/u02/app/oracle/flash_recovery_area/CRMS/archivelog/2015_01_07/o1_mf_1_11_0pps54ik arc
File Name:
/u02/app/oracle/flash_recovery_area/CRMS/archivelog/2015_01_07/o1_mf_1_8_0jps50sk arc
File Name:

/u02/app/oracle/flash_recovery_area/CRMS/archivelog/2015_01_07/o1_mf_1_5_0dps4g2i arc

cataloging files

cataloging done

List of Cataloged Files

=======================

File Name:

/u02/app/oracle/flash_recovery_area/CRMS/archivelog/2015_01_07/o1_mf_1_11_0pps54ik arc

File Name:

/u02/app/oracle/flash_recovery_area/CRMS/archivelog/2015_01_07/o1_mf_1_8_0jps50sk arc

File Name:

/u02/app/oracle/flash_recovery_area/CRMS/archivelog/2015_01_07/o1_mf_1_5_0dps4g2i arc

datafile 1 switched to datafile copy

input datafile copy RECID=5 STAMP=868389462 file name=/u02/app/oracle/oradata/crms/system01.dbf

datafile 2 switched to datafile copy

input datafile copy RECID=6 STAMP=868389462 file name=/u02/app/oracle/oradata/crms/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=7 STAMP=868389462 file name=/u02/app/oracle/oradata/crms/undotbs01.dbf

datafile 4 switched to datafile copy

Exploring the Oracle DBA Technology

by

Gunasekaran , Thiyagu

ACTIVE

DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE

input datafile copy RECID=8 STAMP=868389462 file name=/u02/app/oracle/oradata/crms/users01.dbf

contents of Memory Script:

{

set until scn 897001;

recover

clone database

delete archivelog

}

;

executing Memory Script

executing command: SET until clause

Starting recover at 07-JAN-15

using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 11 is already on disk as file /u02/app/oracle/flash_recover y_area/CRMS/archivelog/2015_01_07/o1_mf_1_11_0pps54ik arc

archived log file name=/u02/app/oracle/flash_recovery_area/CRMS/archivelog/2015_01_07/o1_mf_1_11_0p ps54ik arc thread=1 sequence=11

media recovery complete, elapsed time: 00:00:01 Finished recover at 07-JAN-15 contents of Memory Script: {
media recovery complete, elapsed time: 00:00:01
Finished recover at 07-JAN-15
contents of Memory Script:
{
shutdown clone immediate;

startup clone nomount;

sql clone "alter system set db_name =

''CRMS'' 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

database dismounted

Oracle instance shut down

connected to auxiliary database (not started)

Oracle instance started

Total System Global Area

Fixed Size Variable Size Database Buffers Redo Buffers

1255473152 bytes

1336232 bytes 754977880 bytes 486539264 bytes 12619776 bytes

Exploring the Oracle DBA Technology

by

Gunasekaran , Thiyagu

ACTIVE

DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE

sql statement: alter system set db_name = ''CRMS'' comment= ''Reset to original value by RMAN'' s cope=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

Fixed Size

Variable Size

Database Buffers

Redo Buffers

1255473152 bytes

1336232 bytes

754977880 bytes

486539264 bytes

12619776 bytes

sql statement: CREATE CONTROLFILE REUSE SET DATABASE "CRMS" RESETLOGS ARCHIVELOG

MAXLOGFILES

16

MAXLOGMEMBERS

3

MAXDATAFILES

100

MAXINSTANCES

8

MAXLOGHISTORY

292

LOGFILE GROUP 1 ( '/u02/app/oracle/oradata/crms/redo01.log' ) SIZE 50 M REUSE, GROUP 2 (
LOGFILE
GROUP 1 ( '/u02/app/oracle/oradata/crms/redo01.log' ) SIZE 50 M REUSE,
GROUP 2 ( '/u02/app/oracle/oradata/crms/redo02.log' ) SIZE 50 M REUSE,
GROUP 3 ( '/u02/app/oracle/oradata/crms/redo03.log' ) SIZE 50 M REUSE
DATAFILE
'/u02/app/oracle/oradata/crms/system01.dbf'
CHARACTER SET WE8MSWIN1252

contents of Memory Script:

{

 

set newname for tempfile 1 to

"/u02/app/oracle/oradata/crms/temp01.dbf";

switch clone tempfile all;

catalog clone datafilecopy "/u02/app/oracle/oradata/crms/sysaux01.dbf",

"/u02/app/oracle/oradata/crms/undotbs01.dbf",

"/u02/app/oracle/oradata/crms/users01.dbf";

switch clone datafile all;

}

executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u02/app/oracle/oradata/crms/temp01.dbf in control file

cataloged datafile copy

datafile copy file name=/u02/app/oracle/oradata/crms/sysaux01.dbf RECID=1 STAMP=868389480

cataloged datafile copy

datafile copy file name=/u02/app/oracle/oradata/crms/undotbs01.dbf RECID=2 STAMP=868389480

Exploring the Oracle DBA Technology

by

Gunasekaran , Thiyagu

ACTIVE

DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE

cataloged datafile copy

datafile copy file name=/u02/app/oracle/oradata/crms/users01.dbf RECID=3 STAMP=868389480

datafile 2 switched to datafile copy

input datafile copy RECID=1 STAMP=868389480 file name=/u02/app/oracle/oradata/crms/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=2 STAMP=868389480 file name=/u02/app/oracle/oradata/crms/undotbs01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=3 STAMP=868389480 file name=/u02/app/oracle/oradata/crms/users01.dbf

contents of Memory Script:

{

Alter clone database open resetlogs;

}

executing Memory Script

database opened

Finished Duplicate Db at 07-JAN-15

CONNECTING

AUXILIARY DATABASE

$ export ORACLE_SID=crms $ rlsqlplus "/as sysdba" SQL*Plus: Release 11.2.0.1.0 Production on Wed Jan 7
$ export ORACLE_SID=crms
$ rlsqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Wed Jan 7 12:58:06 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

SYS>select name, dbid, open_mode from v$database;

NAME

--------- ---------- ----------

CRMS

DBID

OPEN_MODE

1570458918 READ WRITE

---------- CRMS DBID OPEN_MODE 1570458918 READ WRITE Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

Exploring the Oracle DBA Technology

by

Gunasekaran , Thiyagu

ACTIVE

DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE

ACTIVE DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu
ACTIVE DATABASE DUPLICATION - SAME DIRECTORY STRUCTURE Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

Exploring the Oracle DBA Technology

by

Gunasekaran , Thiyagu