(1) Create an OS directory for storing various files related to the replication database.
(2) create a copy data warehouse routine service.
(3) create a parameter file for the copy data library routine.
- Connect to the primary database to create a text parameter file.
- Edit the text parameter file.
- Create a server parameter file.
(4) startup routine.
(5) create a replication database.
C: \> mkdir D: \ dupdb
C: \> mkdir D: \ dupdb \ bdump
C: \> mkdir D: \ dupdb \ udump
C: \> mkdir D: \ dupdb \ archive
C: \> oradim-New-Sid dupdb-syspwd Oracle
The instance has been created.
C: \> sqlplus sys/orcl @ demo as sysdba
SQL * Plus: Release 10.2.0.1.0-production on Wednesday February 4 14:45:12 2009
Copyright (c) 1982,200 5, Oracle. All rights reserved.
Connect:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production
With the partitioning, OLAP and Data Mining options
SQL> Create pfile = '% ORACLE_HOME % \ database \ initdupdb. ora' from spfile;
The file has been created.
Modify:
Db_name = 'dupdb'
Instance_name = dupdb
Service_names = dupdb
Background_dump_dest = 'd: \ dupdb \ bdump'
Control_files = 'd: \ dupdb \ control01.ctl'
User_dump_dest = 'd: \ dupdb \ udump'
Log_archive_dest_1 = 'location = D: \ dupdb \ archive'
SQL> Create spfile = '% ORACLE_HOME % \ database \ spfiledupdb. ora' from pfile = '% ORACLE _
Home % \ database \ initdupdb. ora ';
The file has been created.
SQL> exit
From Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production
With the partitioning, OLAP and Data Mining options disconnected
C: \> set oracle_sid = dupdb
C: \> sqlplus sys/Oracle AS sysdba
SQL * Plus: Release 10.2.0.1.0-production on Wednesday February 4 14:56:56 2009
Copyright (c) 1982,200 5, Oracle. All rights reserved.
Already connected to the idle routine.
SQL> startup nomount
The Oracle routine has been started.
Total system global area 603979776 bytes
Fixed size 1250380 bytes
Variable Size 260049844 bytes
Database buffers 335544320 bytes
Redo buffers 7135232 bytes
SQL> exit
From Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production
With the partitioning, OLAP and Data Mining options disconnected
C: \> set oracle_sid = dupdb
C: \> RMAN target sys/orcl @ demo auxiliary sys/Oracle
Recovery MANAGER: Release 10.2.0.1.0-production on Wednesday February 4 14:59:04 2009
Copyright (c) 1982,200 5, Oracle. All rights reserved.
Connect to the target database: Demo (dbid = 3411805505)
Connected to secondary Database: dupdb (not loaded)
RMAN> backup database format = 'd: \ demo \ Bak \ % d _ % S. Bak'
2> include current controlfile
3> plus archivelog format = 'd: \ demo \ Bak \ % d _ % S. Bak ';
Start backup from month-2 to month-09
The current log is archived.
Use the target database control file to replace the recovery directory
Allocated channel: ora_disk_1
Channel ora_disk_1: SID = 141 devtype = Disk
Channel ora_disk_1: archiving log backup set is being started
Channel ora_disk_1: archiving logs in the specified backup set
Input archiving log thread = 1 sequence = 26 record ID = 65 timestamp = 674825136
Input archiving log thread = 1 sequence = 27 Record ID = 67 timestamp = 674825141
Input archiving log thread = 1 sequence = 28 Record ID = 69 timestamp = 674907531
Input archiving log thread = 1 sequence = 29 Record ID = 71 timestamp = 675344283
Input archiving log thread = 1 sequence = 30 Record ID = 73 timestamp = 675444289
Input archiving log thread = 1 sequence = 31 record ID = 75 timestamp = 675682631
Input archiving log thread = 1 sequence = 32 Record ID = 77 timestamp = 675770439
Input archiving log thread = 1 sequence = 33 record ID = 79 timestamp = 676132883
Input archiving log thread = 1 sequence = 34 record ID = 81 timestamp = 676213288
Input archiving log thread = 1 sequence = 35 Record ID = 83 timestamp = 676213399
Input archiving log thread = 1 sequence = 36 Record ID = 85 timestamp = 677673237
Input archiving log thread = 1 sequence = 37 Record ID = 87 timestamp = 677675018
Input archiving log thread = 1 sequence = 38 record ID = 89 timestamp = 677688015
Input archiving log thread = 1 sequence = 39 Record ID = 91 timestamp = 677756429
Input archiving log thread = 1 sequence = 40 Record ID = 93 timestamp = 677756696
Input archiving log thread = 1 sequence = 41 Record ID = 95 timestamp = 677768743
Input archiving log thread = 1 sequence = 42 Record ID = 97 timestamp = 677768881
Input archiving log thread = 1 sequence = 43 record ID = 99 timestamp = 677842304
Input archiving log thread = 1 sequence = 44 Record ID = 101 timestamp = 677842404
Input archiving log thread = 1 sequence = 45 record ID = 104 timestamp = 677842510
Input archiving log thread = 1 sequence = 46 Record ID = 105 timestamp = 677842936
Input archiving log thread = 1 sequence = 47 Record ID = 107 timestamp = 677843090
Input archiving log thread = 1 sequence = 48 Record ID = 109 timestamp = 677843490
Input archiving log thread = 1 sequence = 49 record ID = 111 timestamp = 677843642
Input archiving log thread = 1 sequence = 50 Record ID = 113 timestamp = 677843995
Input archiving log thread = 1 sequence = 51 Record ID = 115 timestamp = 677844088
Input archiving log thread = 1 sequence = 52 Record ID = 117 timestamp = 677844230
Input archiving log thread = 1 sequence = 53 record ID = 119 timestamp = 677847340
Input archiving log thread = 1 sequence = 54 record ID = 121 timestamp = 677849157
Input archiving log thread = 1 sequence = 55 Record ID = 123 timestamp = 677856839
Input archiving log thread = 1 sequence = 56 Record ID = 125 timestamp = 677856994
Input archiving log thread = 1 sequence = 57 Record ID = 127 timestamp = 677936383
Input archiving log thread = 1 sequence = 58 Record ID = 129 timestamp = 677943108
Input archiving log thread = 1 sequence = 59 record ID = 131 timestamp = 677944120
Input archiving log thread = 1 sequence = 60 Record ID = 133 timestamp = 677947895
Input archiving log thread = 1 sequence = 61 Record ID = 135 timestamp = 677948052
Input archiving log thread = 1 sequence = 62 Record ID = 137 timestamp = 677948359
Channel ora_disk_1: Starting segment 1 from month-2 to month-09
Channel ora_disk_1: Completed segment 1 from month-2 to month-09
Segment handle = D: \ demo \ Bak \ demo_33.bak tag = tag20090204t145920 annotation = none
Channel ora_disk_1: Backup set completed. elapsed time: 00: 00: 41
Backup completed from month-2 to month-09
Start backup from month-2 to month-09
Use channel ora_disk_1
Channel ora_disk_1: Start all data file backup Sets
Channel ora_disk_1: Specifies the data file in the backup set.
Enter data file fno = 00001 name = D: \ demo \ system01.dbf
Enter the data file fno = 00004 name = D: \ demo \ users01.dbf
Enter the data file fno = 00003 name = D: \ demo \ sysaux01.dbf
Enter the data file fno = 00002 name = D: \ demo \ undotbs01.dbf
Channel ora_disk_1: Starting segment 1 from month-2 to month-09
Channel ora_disk_1: Completed segment 1 from month-2 to month-09
Segment handle = D: \ demo \ Bak \ demo_34.bak mark = tag20090204t150006 comment = none
Channel ora_disk_1: Backup set completed. elapsed time: 00: 01: 45
Channel ora_disk_1: Start all data file backup Sets
Channel ora_disk_1: Specifies the data file in the backup set.
The backup set includes the current control file
Include the current spfile in the backup set
Channel ora_disk_1: Starting segment 1 from month-2 to month-09
Channel ora_disk_1: Completed segment 1 from month-2 to month-09
Segment handle = D: \ demo \ Bak \ demo_35.bak mark = tag20090204t150006 comment = none
Channel ora_disk_1: Backup set completed. elapsed time: 00: 00: 03
Backup completed from month-2 to month-09
Start backup from month-2 to month-09
The current log is archived.
Use channel ora_disk_1
Channel ora_disk_1: archiving log backup set is being started
Channel ora_disk_1: archiving logs in the specified backup set
Input archiving log thread = 1 sequence = 63 record ID = 140 timestamp = 677948516
Channel ora_disk_1: Starting segment 1 from month-2 to month-09
Channel ora_disk_1: Completed segment 1 from month-2 to month-09
Segment handle = D: \ demo \ Bak \ demo_36.bak mark = tag20090204t150156 comment = none
Channel ora_disk_1: Backup set completed. elapsed time: 00: 00: 02
Backup completed from month-2 to month-09
RMAN> run {
2> set newname for datafile 1 to 'd: \ dupdb \ system01.dbf ';
3> set newname for datafile 2 to 'd: \ dupdb \ undotbs01.dbf ';
4> set newname for datafile 3 to 'd: \ dupdb \ sysaux01.dbf ';
5> set newname for datafile 4 to 'd: \ dupdb \ users01.dbf ';
6> set newname for tempfile 1 to 'd: \ dupdb \ temp01.dbf ';
7> duplicate target database to dupdb logfile
8> 'd: \ dupdb \ redo01.log 'size 10 m,
9> 'd: \ dupdb \ redo02.log 'size 10 m,
10> 'd: \ dupdb \ redo03.log 'size 10 m;
11>}
Executing command: Set newname
Executing command: Set newname
Executing command: Set newname
Executing command: Set newname
Executing command: Set newname
Start duplicate DB from month-2 to month-09
Use channel ora_aux_disk_1
Memory script content:
{
Set until SCN 1702511;
Set newname for datafile 1
"D: \ dupdb \ system01.dbf ";
Set newname for datafile 2
"D: \ dupdb \ undotbs01.dbf ";
Set newname for datafile 3
"D: \ dupdb \ sysaux01.dbf ";
Set newname for datafile 4
"D: \ dupdb \ users01.dbf ";
Restore
Check readonly
Clone Database
;
}
Executing memory script
Executing command: set until clause
Executing command: Set newname
Executing command: Set newname
Executing command: Set newname
Executing command: Set newname
Start restore from month-2 to month-09
Use channel ora_aux_disk_1
Channel ora_aux_disk_1: recovering the data file backup set
Channel ora_aux_disk_1: Specifies the data file to be recovered from the backup set.
Restoring data file 00001 to D: \ dupdb \ system01.dbf
Restoring data file 00002 to D: \ dupdb \ undotbs01.dbf
Restoring data file 00003 to D: \ dupdb \ sysaux01.dbf
Restoring data file 00004 to D: \ dupdb \ users01.dbf
Channel ora_aux_disk_1: Reading the backup segment D: \ demo \ Bak \ demo_34.bak
Channel ora_aux_disk_1: recovered backup segment 1
Segment handle = D: \ demo \ Bak \ demo_34.bak mark = tag20090204t150006
Channel ora_aux_disk_1: Recovery completed, time: 00:01:56
The restore is completed from month 2 to month 09.
SQL statement: Create controlfile reuse set Database "dupdb" resetlogs archivelog
Maxlogfiles 16
Maxlogmembers 3
Maxdatafiles 100
Maxinstances 8
# Maxloghistory 292
Logfile
Group 1 'd: \ dupdb \ redo01.log 'size 10 m,
Group 2 'd: \ dupdb \ redo02.log 'size 10 m,
Group 3 'd: \ dupdb \ redo03.log 'size 10 m
Datafile
'D: \ dupdb \ system01.dbf'
Character Set zhs16gbk
Memory script content:
{
Switch clone datafile all;
}
Executing memory script
Released channel: ora_disk_1
Released channel: ora_aux_disk_1
Data File 2 has been converted to a data file copy
Input data file copy recid = 1 Stamp = 677948847 name of file = D: \ dupdb \ undotbs01.dbf
Data File 3 has been converted to a data file copy
Input data file copy recid = 2 Stamp = 677948847 name of file = D: \ dupdb \ sysaux01.dbf
Data File 4 has been converted to a data file copy
Input data file copy recid = 3 stamp = 677948847 name of file = D: \ dupdb \ users01.dbf
Memory script content:
{
Set until SCN 1702511;
Recover
Clone Database
Delete archivelog
;
}
Executing memory script
Executing command: set until clause
Start recover from month-2 to month-09
Allocated channel: ora_aux_disk_1
Channel ora_aux_disk_1: SID = 159 devtype = Disk
Restoring media...
The archive log thread 1 Series 63 has been used as the file D: \ demo \ archive \ cb5c05410967449300000000063_0020.c
Bc29ecf. Arc exists on disk
Archive log file name = D: \ demo \ archive \ cb5c05410967449300000000063_0020.cbc29ecf.arc thread =
1 sequence = 63
Media Recovery completed. Time: 00:00:06
The recover is completed from month 2 to month 09.
Memory script content:
{
Shutdown clone;
Startup clone nomount;
}
Executing memory script
Database uninstalled
Oracle instance disabled
Connected to the secondary database (not started)
Oracle instance started
The system's global region consists of 603979776 bytes.
Fixed size 1250380 bytes
Variable Size 260049844 bytes
Database buffers: 335544320 bytes
Redo buffers: 7135232 bytes
SQL statement: Create controlfile reuse set Database "dupdb" resetlogs archivelog
Maxlogfiles 16
Maxlogmembers 3
Maxdatafiles 100
Maxinstances 8
# Maxloghistory 292
Logfile
Group 1 'd: \ dupdb \ redo01.log 'size 10 m,
Group 2 'd: \ dupdb \ redo02.log 'size 10 m,
Group 3 'd: \ dupdb \ redo03.log 'size 10 m
Datafile
'D: \ dupdb \ system01.dbf'
Character Set zhs16gbk
Memory script content:
{
Set newname for tempfile 1
"D: \ dupdb \ temp01.dbf ";
Switch clone tempfile all;
Catalog clone datafilecopy "D: \ dupdb \ undotbs01.dbf ";
Catalog clone datafilecopy "D: \ dupdb \ sysaux01.dbf ";
Catalog clone datafilecopy "D: \ dupdb \ users01.dbf ";
Switch clone datafile all;
}
Executing memory script
Executing command: Set newname
Temporary File 1 has been renamed to D: \ dupdb \ temp01.dbf in the control file
The data file copy has been included in the directory
Data file copy filename = D: \ dupdb \ undotbs01.dbf recid = 1 Stamp = 677948866
The data file copy has been included in the directory
Data file copy filename = D: \ dupdb \ sysaux01.dbf recid = 2 Stamp = 677948867
The data file copy has been included in the directory
Data file copy filename = D: \ dupdb \ users01.dbf recid = 3 stamp = 677948867
Data File 2 has been converted to a data file copy
Input data file copy recid = 1 Stamp = 677948866 name of file = D: \ dupdb \ undotbs01.dbf
Data File 3 has been converted to a data file copy
Input data file copy recid = 2 Stamp = 677948867 name of file = D: \ dupdb \ sysaux01.dbf
Data File 4 has been converted to a data file copy
Input data file copy recid = 3 stamp = 677948867 name of file = D: \ dupdb \ users01.dbf
Memory script content:
{
Alter clone database open resetlogs;
}
Executing memory script
Database opened
Complete duplicate dB in month-09-09