• No results found

Now Duplicate the Target Database

In document Oracle DBA (Page 189-194)

)

or we can also use netca command to configure the tns . check tns entries as below :

C:\> tnsping clone

TNS Ping Utility for 32-bit Windows: Version 11.1.0.6.0 - Production on 22-APR-2011 11:33:04

Copyright (c) 1997, 2007, Oracle. All rights reserved.

Used parameter files:

D:\oracle\product\11.1.0\db_1\network\admin\sqlnet.ora Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = xxxx)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = clone))) OK (30 msec)

Step 6 : Now Connect with Duplicate Database.

c:\> set ORACLE_SID=clone c:\>sqlplus / as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Fri Apr 22 10:44:14 2011 Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup nomount pfile='C:\clone.ora';

ORACLE instance started.

Total System Global Area 318046208 bytes Fixed Size 1332920 bytes Variable Size 234883400 bytes Database Buffers 75497472 bytes Redo Buffers 6332416 bytes SQL> create spfile from pfile='C:\clone.ora';

SQL>shut immediate

ORA-01507: database not mounted ORACLE instance shut down.

SQL> startup nomount ORACLE instance started.

Total System Global Area 318046208 bytes Fixed Size 1332920 bytes Variable Size 234883400 bytes Database Buffers 75497472 bytes Redo Buffers 6332416 bytes SQL> exit

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

Step 7 : Now Duplicate the Target Database .

C:\>rman target sys/ramtech@noida auxiliary sys/clone@clone

Recovery Manager: Release 11.1.0.6.0 - Production on Fri Apr 22 11:16:38 2011 Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: NOIDA (DBID=1502483083) connected to auxiliary database: CLONE (not mounted)

RMAN> duplicate target database to "clone" nofilenamecheck;

Starting Duplicate Db at 22-APR-11

using target database control file instead of recovery catalog

channel ORA_AUX_DISK_1: starting datafile backup set restore

channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring datafile 00001 to

D:\ORACLE\ORADATA\CLONE\SYSTEM01.DBF

channel ORA_AUX_DISK_1: restoring datafile 00002 to D:\ORACLE\ORADATA\CLONE\SYSAUX01.DBF

channel ORA_AUX_DISK_1: restoring datafile 00003 to D:\ORACLE\ORADATA\CLONE\UNDOTBS01.DBF

channel ORA_AUX_DISK_1: restoring datafile 00004 to D:\ORACLE\ORADATA\CLONE\USERS01.DBF

channel ORA_AUX_DISK_1: restoring datafile 00005 to D:\ORACLE\ORADATA\CLONE\EXAMPLE01.DBF

channel ORA_AUX_DISK_1: restoring datafile 00006 to D:\ORACLE\ORADATA\CLONE\TRANS.DBF

channel ORA_AUX_DISK_1: reading from backup piece

D:\ORACLE\FLASH_RECOVERY_AREA\NOIDA\BACKUPSET\2011_04_21\O1_MF_NNNDF_TA G20110421T134444_6TZSWBRW_.BKP

channel ORA_AUX_DISK_1: piece

handle=D:\ORACLE\FLASH_RECOVERY_AREA\NOIDA\BACKUPSET\2011_04_21\O1_MF_NN NDF_TAG20110421T134444_6TZSWBRW_.BKP tag=TAG20110421T134444

channel ORA_AUX_DISK_1: restored backup piece 1

channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:03:35 Finished restore at 22-APR-11

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

GROUP 1 ( 'D:\ORACLE\ORADATA\CLONE\REDO01.LOG' ) SIZE 50 M REUSE, GROUP 2 ( 'D:\ORACLE\ORADATA\CLONE\REDO02.LOG' ) SIZE 50 M REUSE, GROUP 3 ( 'D:\ORACLE\ORADATA\CLONE\REDO03.LOG' ) SIZE 50 M REUSE DATAFILE

datafile 2 switched to datafile copy

input datafile copy RECID=1 STAMP=749128842 file name=D:\ORACLE\ORADATA\CLONE\SYSAUX01.DBF datafile 3 switched to datafile copy

input datafile copy RECID=2 STAMP=749128842 file name=D:\ORACLE\ORADATA\CLONE\UNDOTBS01.DBF datafile 4 switched to datafile copy

input datafile copy RECID=3 STAMP=749128843 file name=D:\ORACLE\ORADATA\CLONE\USERS01.DBF datafile 5 switched to datafile copy

input datafile copy RECID=4 STAMP=749128843 file name=D:\ORACLE\ORADATA\CLONE\EXAMPLE01.DBF datafile 6 switched to datafile copy

input datafile copy RECID=5 STAMP=749128843 file name=D:\ORACLE\ORADATA\CLONE\TRANS.DBF

archived log for thread 1 with sequence 47 is already on disk as file D:\ARCHIVE\ARC00047_0748802215.001

archived log for thread 1 with sequence 48 is already on disk as file D:\ARCHIVE\ARC00048_0748802215.001

archived log for thread 1 with sequence 49 is already on disk as file D:\ARCHIVE\ARC00049_0748802215.001

archived log for thread 1 with sequence 50 is already on disk as file D:\ARCHIVE\ARC00050_0748802215.001

archived log for thread 1 with sequence 51 is already on disk as file D:\ARCHIVE\ARC00051_0748802215.001

archived log for thread 1 with sequence 52 is already on disk as file D:\ARCHIVE\ARC00052_0748802215.001

archived log for thread 1 with sequence 53 is already on disk as file D:\ARCHIVE\ARC00053_0748802215.001

archived log for thread 1 with sequence 54 is already on disk as file D:\ARCHIVE\ARC00054_0748802215.001

archived log for thread 1 with sequence 55 is already on disk as file D:\ARCHIVE\ARC00055_0748802215.001

archived log for thread 1 with sequence 56 is already on disk as file D:\ARCHIVE\ARC00056_0748802215.001

archived log for thread 1 with sequence 57 is already on disk as file D:\ARCHIVE\ARC00057_0748802215.001

archived log for thread 1 with sequence 58 is already on disk as file D:\ARCHIVE\ARC00058_0748802215.001

archived log for thread 1 with sequence 59 is already on disk as file D:\ARCHIVE\ARC00059_0748802215.001

archived log file name=D:\ARCHIVE\ARC00047_0748802215.001 thread=1 sequence=47 archived log file name=D:\ARCHIVE\ARC00048_0748802215.001 thread=1 sequence=48 archived log file name=D:\ARCHIVE\ARC00049_0748802215.001 thread=1 sequence=49 archived log file name=D:\ARCHIVE\ARC00050_0748802215.001 thread=1 sequence=50 archived log file name=D:\ARCHIVE\ARC00051_0748802215.001 thread=1 sequence=51 archived log file name=D:\ARCHIVE\ARC00052_0748802215.001 thread=1 sequence=52 archived log file name=D:\ARCHIVE\ARC00053_0748802215.001 thread=1 sequence=53 archived log file name=D:\ARCHIVE\ARC00054_0748802215.001 thread=1 sequence=54 archived log file name=D:\ARCHIVE\ARC00055_0748802215.001 thread=1 sequence=55 archived log file name=D:\ARCHIVE\ARC00056_0748802215.001 thread=1 sequence=56 archived log file name=D:\ARCHIVE\ARC00057_0748802215.001 thread=1 sequence=57 archived log file name=D:\ARCHIVE\ARC00058_0748802215.001 thread=1 sequence=58 archived log file name=D:\ARCHIVE\ARC00059_0748802215.001 thread=1 sequence=59 media recovery complete, elapsed time: 00:01:35

Finished recover at 22-APR-11

contents of Memory Script:

{

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 318046208 bytes Fixed Size 1332920 bytes Variable Size 234883400 bytes Database Buffers 75497472 bytes

Redo Buffers 6332416 bytes

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

GROUP 1 ( 'D:\ORACLE\ORADATA\CLONE\REDO01.LOG' ) SIZE 50 M REUSE, GROUP 2 ( 'D:\ORACLE\ORADATA\CLONE\REDO02.LOG' ) SIZE 50 M REUSE, GROUP 3 ( 'D:\ORACLE\ORADATA\CLONE\REDO03.LOG' ) SIZE 50 M REUSE DATAFILE

catalog clone datafilecopy "D:\ORACLE\ORADATA\CLONE\SYSAUX01.DBF";

catalog clone datafilecopy "D:\ORACLE\ORADATA\CLONE\UNDOTBS01.DBF";

catalog clone datafilecopy "D:\ORACLE\ORADATA\CLONE\USERS01.DBF";

catalog clone datafilecopy "D:\ORACLE\ORADATA\CLONE\EXAMPLE01.DBF";

catalog clone datafilecopy "D:\ORACLE\ORADATA\CLONE\TRANS.DBF";

switch clone datafile all;

}

executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to D:\ORACLE\ORADATA\CLONE\TEMP02.DBF in control file cataloged datafile copy

datafile 2 switched to datafile copy

input datafile copy RECID=1 STAMP=749128969 file name=D:\ORACLE\ORADATA\CLONE\SYSAUX01.DBF datafile 3 switched to datafile copy

input datafile copy RECID=2 STAMP=749128970 file name=D:\ORACLE\ORADATA\CLONE\UNDOTBS01.DBF datafile 4 switched to datafile copy

input datafile copy RECID=3 STAMP=749128970 file

name=D:\ORACLE\ORADATA\CLONE\USERS01.DBF datafile 5 switched to datafile copy

input datafile copy RECID=4 STAMP=749128970 file name=D:\ORACLE\ORADATA\CLONE\EXAMPLE01.DBF datafile 6 switched to datafile copy

input datafile copy RECID=5 STAMP=749128971 file name=D:\ORACLE\ORADATA\CLONE\TRANS.DBF contents of Memory Script:

{

Alter clone database open resetlogs;

}

executing Memory Script database opened

Finished Duplicate Db at 22-APR-11 RMAN> exit

Recovery Manager complete.

Step 8 : Check the Duplicate "clone" Database . C:\>sqlplus sys/clone@clone as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Fri Apr 22 11:43:05 2011 Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select name,open_mode from v$database;

NAME OPEN_MODE --- --- CLONE READ WRITE

Loss Of Control-file in various Scenario's

A Control file is a small binary file that is part of an Oracle database. The control file is used to keep track of the database's status and physical structure. The control file is absolutely crucial to database operation . Here , we will discuss the various scenario's when control file(s) get lost or corrupt.

In document Oracle DBA (Page 189-194)