Use the RMAN copy database

xiaoxiao2021-03-06  17

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

Experimental environment: Windows Oracle

10.1.0.2.0

Original Database: NING [Archive Mode] Copy Database: TEST

Author: ningoo

2005-3-27

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

Use RMAN's DuPlicate Database to create a replicated database on the same server.

1. Create a new instance

Prepare the corresponding directory structure

E: / Oracle / Product /

10.1.0 / admin / TEST / BDUMP

E: / Oracle / Product /

10.1.0 / admin / TEST / CDUMP

E: / Oracle / Product /

10.1.0 / admin / test / crete

E: / Oracle / Product /

10.1.0 / admin / test / pfile

E: / Oracle / Product /

10.1.0 / Admin / Test / Scripts

E: / Oracle / Product /

10.1.0 / admin / test / udmp

Create a parameter file inittest.ini (can be modified using the original library's PFile), the main parameters are as follows:

DB_NAME = TEST

Background_dump_dest = E: / Oracle / Product / PRODUCT /

10.1.0 / admin / TEST / BDUMP

Core_dump_dest = E: / Oracle / Product /

10.1.0 / admin / TEST / CDUMP

User_dump_dest = E: / Oracle / Product /

10.1.0 / admin / test / udump

Control_files = 'e: /oracle/oradata/test/control01.ctl', 'E: / ORACLE / ORADATA / TEST /CONTROL02.CTL','E :/oracle/oradata/test /control03.ctl '

DB_FILE_NAME_CONVERT = ('E: / ORADATA / NING', 'E: / Oracle / OraData / Test')

LOG_FILE_NAME_CONVERT = ('E: / ORADATA / NING', 'E: / Oracle / ORADATA / TEST')

Placed in E: / Oracle / Product /

10.1.0 / admin / test / pfile or e: /oracle/Product/10.1.0/db_1/database.

Create new instance using ORADIM

C: /> ORADIM -NEW -SID TEST

The routines have been created.

Create a Password file using ORAPWD

C: /> ORAPWD File = E: / Oracle / Product /

10.1.0 / db_1 / database / pwdtest.ora password = test entries = 10

Configure a promising and tnsnames and then use SQLPLUS test connections.

C: /> SQLPLUS / NOLOG

SQL * Plus: Release

10.1.0.2.0 - Production on Sunday March 27 21:01:13 2005

Copyright (C) 1982, 2004, Oracle. All Rights Reserved.

SQL> Conn Sys @ Test As Sysdba

Please enter the password:

The idle routine is connected.

2. Back up the original library using RMAN

Rman> Connect Target Sys / Ning @ ning Connect to Target Database: Ning (DBID = 1141544503)

Replacement Recovery Directory

Rman> Backup Full Database Tag 'Fullbk' Format 'E: / ORACLE / ORABACK / FULL% U_% S_% P';

Start Backup in 27- March -05

Use channel ORA_DISK_1

Channel ORA_DISK_1: Start all data file backup set

Channel ORA_DISK_1: Data file being specified in the backup set

Enter data file fno = 00001 Name = E: /oracle/oradata/ning/system01.dbf

Enter data file fno = 00002 name = E: /oracle/oradata/ning/undotbs01.dbf

Enter data file fno = 00004 name = e: /oracle/oradata/ning/Users01.dbf

Enter data file fno = 00003 name = E: /oracle/oradata/ning/sysaux01.dbf

Enter data file fno = 00005 name = E: /oracle/oradata/ning/test01.dbf

Channel ORA_DISK_1: Start Segment 1 in 27- March -05

Channel ORA_DISK_1: Completed Segment 1 in 27- March -05

Segment Handle = E: / Oracle / ORABACK / FULL03GGCQA4_3_1 Comment = NONE

Channel ORA_DISK_1: The backup set has been completed, after the time: 00: 00: 45

Channel ORA_DISK_1: Start all data file backup set

Channel ORA_DISK_1: Data file being specified in the backup set

Backup Concentration includes current control files

In the backup set contains current SPFile

Channel ORA_DISK_1: Start Segment 1 in 27- March -05

Channel ORA_DISK_1: Completed Segment 1 in 27- March -05

Segment Handle = E: / Oracle / ORABACK / FULL04GGCQBH_4_1 Comment = NONE

Channel ORA_DISK_1: The backup set has been completed, after the time: 00: 00: 09

Complete Backup in 27- March -05

3. Use the RMAN copy database

C: /> rman target sys / ning @ ning auxiliary sys / test@ Test

Recovery Manager: Version

10.1.0.2.0 - Production

Opyright (C) 1995, 2004, Oracle. All Rights Reserved.

Connect to target database: ning (dbid = 1141544503)

Has been connected to the standby database: TEST (not mounted)

Rman> Duplicate Test ';

Start Duplicate DB in 27- March -05

Use channel ORA_AUX_DISK_1

The content of the memory script:

{

SET Until SCN 169960;

Set newname for datafile 1 to

"E: /oracle/oradata/test/system01.dbf";

Set NewName for DataFile 2 TO

"E: /oracle/oradata/test/undotbs01.dbf";

Set Newname for DataFile 3 To

"E: /oracle/oradata/test/sysaux01.dbf";

Set newname for datafile 4 to

"E: /oracle/oradata/test/users01.dbf"; set newname for datafile 5 to

"E: /oracle/oradata/test/test01.dbf";

RESTORE

Check Readonly

Clone Database

;

}

Memory script

Executing a command: set Until Clause

Implement command: set newname

Implement command: set newname

Implement command: set newname

Implement command: set newname

Implement command: set newname

Start Restore in 27- March -05

Use channel ORA_AUX_DISK_1

Channel ORA_AUX_DISK_1: Restore Data File Backup Set

Channel ORA_AUX_DISK_1: Data file being recovered from backup set

Restore data file 00001 to E: /oracle/oradata/test/system01.dbf

Restore data file 00002 to E: /oracle/oradata/test/undotbs01.dbf

Restore data file 00003 to E: /oracle/oradata/test/sysaux01.dbf

Restore data file 00004 to E: /oracle/oradata/test/users01.dbf

Positive data file 00005 is restored to E: /oracle/oradata/test/test01.dbf

Channel ORA_AUX_DISK_1: Restored Backup Segment 1

Segment handle = E: / Oracle / ORABACK / FULL03GGCQA4_3_1 tag = Fullbk

Channel ORA_AUX_DISK_1: Restore completion

Complete Restore in 27- March -05

SQL statement: Create ControlFile Reuse Set Database "test" replandlogs archivelog

MaxLogfiles 16

MaxLogmembers 3

MaxDataFiles 100

MaxInstances 8

MaxLoghistory 454

Logfile

Group 1 'E: /oracle/oradata/test/redo01.log' size

10 m,

Group 2 'E: /oracle/oradata/test/redo02.log' size

10 m,

Group 3 'E: /oracle/oradata/test/redo03.log' size

10 m

DataFile

'E: /oracle/oradata/test/system01.dbf'

Character set zhs16gbk

The content of the memory script:

{

Switch Clone DataFile ALL;

}

Memory script

Data file 2 has been converted into a copy of the data file

Enter data file copy RECID = 1 stamp = 554071105 file name = E: / oracle / oradata / test / undotbs01

.Dbf

Data file 3 has been converted into a copy of the data file

Enter data file copy RECID = 2 stamp = 554071105 file name = E: / Oracle / ORADATA / TEST / SYSAUX01.

DBF

Data file 4 has been converted into a copy of the data file

Enter data file copy Recid = 3 stamp = 554071105 file name = E: /oracle/oradata/test/USERS01.D

BF

Data file 5 has been converted into a copy of the data file

Enter data file copy RECID = 4 stamp = 554071105 file name = E: /oracle/oradata/test/test01.dbf

The content of the memory script:

{

SET Until SCN 169960;

Recover

Clone Database

Delete ArchiveLog

;

}

Memory script

Executing a command: set Until Clause

Start Recover from 27- March -05

Use channel ORA_AUX_DISK_1

Recovery of the media

Archive log thread 1 Sequence 16 has been used as file E: /oracle/arch/arc00016_0553949015.001

Disk

Archive log file name = E: /oracle/arch/arc00016_0553949015.001 thread = 1 sequence = 16

Completion of media recovery

Complete Recover from 27- March -05

The content of the memory script:

{

SHUTDOWN Clone;

Startup Clone Nomount;

}

Memory script

Database has been uninstalled

Oracle routines have been closed

Alternate database (not started)

Oracle routines have been started

System global region totals 142606336 bytes

Fixed size 787848 bytes

Variable size 116390520 bytes

Database buffers 25165824 bytes

Redo buffers 262144 bytes

SQL statement: Create ControlFile Reuse Set Database "test" replandlogs archivelog

MaxLogfiles 16

MaxLogmembers 3

MaxDataFiles 100

MaxInstances 8

MaxLoghistory 454

Logfile

Group 1 'E: /oracle/oradata/test/redo01.log' size

10 m,

Group 2 'E: /oracle/oradata/test/redo02.log' size

10 m,

Group 3 'E: /oracle/oradata/test/redo03.log' size

10 m

DataFile

'E: /oracle/oradata/test/system01.dbf'

Character set zhs16gbk

The content of the memory script:

{

Catalog Clone DataFileCopy "E: /oracle/oradata/test/undotbs01.dbf";

Catalog Clone DataFileCopy "E: /oracle/oradata/test/sysaux01.dbf";

Catalog Clone DataFileCopy "E: /Oracle/oradata/test/USERS01.DBF";

Catalog Clone DataFileCopy "E: /oracle/oradata/test/test01.dbf";

Switch Clone DataFile ALL;

}

Memory script

A copy of the data file has been included in the directory

Data file copy filename = E: /oracle/roadata/test/undotbs01.dbf recid = 1 stamp = 5540716

73

A copy of the data file has been included in the directory

Data file copy filename = E: /oracle/oradata/test/sysaux01.dbf Recid = 2 stamp = 554071673

A copy of the data file has been included in the directory

Data file copy filename = E: /oracle/oradata/test/users01.dbf recid = 3 stamp = 554071673

A copy of the data file has been included in the directory

Data file copy filename = E: /oracle/oradata/test/test1.dbf recid = 4 stamp = 554071673

Data file 2 has been converted into a copy of the data file

Enter data file copy RECID = 1 stamp = 554071673 file name = E: / oracle / oradata / test / undotbs01

.Dbf

Data file 3 has been converted into a copy of the data file

Enter data file copy RECID = 2 stamp = 554071673 file name = E: / oracle / oradata / test / sysaux01.

DBF

Data file 4 has been converted into a copy of the data file

Enter data file copy RECID = 3 stamp = 554071673 file name = E: /oracle/oradata/test/USERS01.D

BF

Data file 5 has been converted into a copy of the data file

Enter data file copy RECID = 4 stamp = 554071673 file name = E: /oracle/oradata/test/test01.db

Fly

The content of the memory script:

{

Alter Clone Database Open RESETLOGS;

}

Memory script

Database has been opened

Complete Duplicate DB in 27- March -05

4. Check the status of the replication library

C: /> SQLPLUS / NOLOG

SQL * Plus: Release

10.1.0.2.0 - Production on Sunday March 27 21:05:52 2005

Copyright (C) 1982, 2004, Oracle. All Rights Reserved.

SQL> Conn Sys @ Test As Sysdba

Please enter the password:

connected.

SQL> SELECT Instance_name, Status from V $ INSTANCE;

Instance_name status

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

Test Open

Then remove the db_file_name_convert and log_file_name_convert parameters of INITTTEST.ORA, and use this file to generate SPFile

SQL> CREATE SPFILE from Pfile = 'E: / Oracle / Product /

10.1.0 / db_1 / database / inittest.ora ';

The file has been created.

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

Reference article:

Oracle® Database Backup and Recovery Advanced User's Guide10g Release 1 (10.1) Part Number B10734-01

转载请注明原文地址:https://www.9cbs.com/read-41599.html

New Post(0)