分类:
2012-03-31 20:47:14
原文地址:在同一个机器上复制数据库 作者:zzjlzx
将IBS库复制为orcl1库。
在两个库上创建密码文件:
set oracle_sid=ibs
orapwd file=F:\BBCLDB\ORCL1\PWDibs1.ora password=system entries=30
set oracle_sid=orcl1
orapwd file=F:\BBCLDB\ORCL1\PWDorcl1.ora password=system entries=30
创建一个新的服务
oradim -NEW -SID orcl1
修改主库、辅助数据库的监听 tnsname.ora文件
IBS 的参数文件:
ibs.__db_cache_size=18253611008
ibs.__java_pool_size=134217728
ibs.__large_pool_size=134217728
ibs.__oracle_base='e:\app\Administrator'#ORACLE_BASE set from environment
ibs.__pga_aggregate_target=15971909632
ibs.__sga_target=22951231488
ibs.__shared_io_pool_size=0
ibs.__shared_pool_size=4026531840
ibs.__streams_pool_size=134217728
*.audit_file_dest='e:\app\Administrator\admin\IBS\adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='F:\BBCLDB\IBS\IBS\control01.ctl','e:\app\Administrator\flash_recovery_area\IBS\control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='IBS'
*.db_recovery_file_dest='e:\app\Administrator\flash_recovery_area'
*.db_recovery_file_dest_size=536870912000
*.diagnostic_dest='e:\app\Administrator'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=IBSXDB)'
*.memory_target=8848692224
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
*.log_archive_format='ARC%S_%R.%T'
*.log_file_name_convert='F:\BBCLDB\IBS\IBS','F:\BBCLDB\ORCL1'
*.db_file_name_convert='F:\BBCLDB\IBS\IBS','F:\BBCLDB\ORCL1'
orcl1的参数文件:
orcl1.__db_cache_size=25769803776
orcl1.__java_pool_size=134217728
orcl1.__large_pool_size=134217728
orcl1.__oracle_base='e:\app\Administrator'#ORACLE_BASE set from environment
orcl1.__pga_aggregate_target=31406948352
orcl1.__sga_target=30467424256
orcl1.__shared_io_pool_size=0
orcl1.__shared_pool_size=3758096384
orcl1.__streams_pool_size=268435456
*.audit_file_dest='e:\app\Administrator\admin\ORCL1\adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='e:\app\Administrator\oradata\ORCL1\control01.ctl','e:\app\Administrator\flash_recovery_area\ORCL1\control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='ORCL1'
*.db_recovery_file_dest='e:\app\Administrator\flash_recovery_area'
*.db_recovery_file_dest_size=4102029312
*.diagnostic_dest='e:\app\Administrator'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=ORCL1XDB)'
*.memory_target=9842915328
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sec_case_sensitive_logon=FALSE
*.undo_tablespace='UNDOTBS1'
*.log_archive_format='ARC%S_%R.%T'
*.log_file_name_convert='F:\BBCLDB\IBS\IBS','F:\BBCLDB\ORCL1'
*.db_file_name_convert='F:\BBCLDB\IBS\IBS','F:\BBCLDB\ORCL1'
两个文件中主要是这三行要加上。
set oracle_sid=ibs
C:\Users\Administrator>rman target sys/system auxiliary
Recovery Manager: Release 11.2.0.1.0 - Production on Fri Dec 30 18:09:41 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: IBS (DBID=623540487)
connected to auxiliary database: ORCL1 (not mounted)
RMAN> DUPLICATE TARGET DATABASE TO orcl1 from active database nofilenamecheck;
Starting Duplicate Db at 30-DEC-11
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=201 device type=DISK
contents of Memory Script:
{
sql clone "alter system set db_name =
''IBS'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''ORCL1'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
backup as copy current controlfile auxiliary format 'E:\APP\ADMINISTRATOR\OR
ADATA\ORCL1\CONTROL01.CTL';
restore clone controlfile to 'E:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORCL1
\CONTROL02.CTL' from
'E:\APP\ADMINISTRATOR\ORADATA\ORCL1\CONTROL01.CTL';
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''IBS'' comment= ''Modified by RMAN
duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''ORCL1'' comment= ''Modified
by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 9820950528 bytes
Fixed Size 2184112 bytes
Variable Size 5033167952 bytes
Database Buffers 4764729344 bytes
Redo Buffers 20869120 bytes
Starting backup at 30-DEC-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=187 device type=DISK
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=E:\APP\ADMINISTRATOR\PRODUCT\11.2.0\DBHOME_1\DATABASE\SNCFIBS.O
RA tag=TAG20111230T181012 RECID=1 STAMP=771271813
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 30-DEC-11
Starting restore at 30-DEC-11
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=193 device type=DISK
channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 30-DEC-11
database mounted
contents of Memory Script:
{
set newname for datafile 1 to
"F:\BBCLDB\ORCL1\SYSTEM01.DBF";
set newname for datafile 2 to
"F:\BBCLDB\ORCL1\SYSAUX01.DBF";
set newname for datafile 3 to
"F:\BBCLDB\ORCL1\UNDOTBS01.DBF";
set newname for datafile 4 to
"F:\BBCLDB\ORCL1\USERS01.DBF";
set newname for datafile 5 to
"F:\BBCLDB\ORCL1\CI_DATALRG01.DBF";
set newname for datafile 6 to
"F:\BBCLDB\ORCL1\DATAUSR01.DBF";
set newname for datafile 7 to
"F:\BBCLDB\ORCL1\DATALRG01.DBF";
set newname for datafile 8 to
"F:\BBCLDB\ORCL1\DATASML01.DBF";
set newname for datafile 9 to
"F:\BBCLDB\ORCL1\INDEXLRG01.DBF";
set newname for datafile 10 to
"F:\BBCLDB\ORCL1\INDEXSML.DBF";
set newname for datafile 11 to
"F:\BBCLDB\ORCL1\DATALRG02.DBF";
set newname for datafile 12 to
"F:\BBCLDB\ORCL1\DATALRG03.DBF";
set newname for datafile 13 to
"F:\BBCLDB\ORCL1\DATALRG04.DBF";
set newname for datafile 14 to
"F:\BBCLDB\ORCL1\DATALRG05.DBF";
set newname for datafile 15 to
"F:\BBCLDB\ORCL1\DATALRG06.DBF";
set newname for datafile 16 to
"F:\BBCLDB\ORCL1\DATALRG07.DBF";
set newname for datafile 17 to
"F:\BBCLDB\ORCL1\INDEXLRG02.DBF";
set newname for datafile 18 to
"F:\BBCLDB\ORCL1\INDEXLRG03.DBF";
set newname for datafile 19 to
"F:\BBCLDB\ORCL1\INDEXLRG04.DBF";
set newname for datafile 20 to
"F:\BBCLDB\ORCL1\INDEXLRG05.DBF";
set newname for datafile 21 to
"F:\BBCLDB\ORCL1\INDEXLRG06.DBF";
set newname for datafile 22 to
"F:\BBCLDB\ORCL1\INDEXLRG07.DBF";
set newname for datafile 23 to
"F:\BBCLDB\ORCL1\DATALRG08.DBF";
backup as copy reuse
datafile 1 auxiliary format
"F:\BBCLDB\ORCL1\SYSTEM01.DBF" datafile
2 auxiliary format
"F:\BBCLDB\ORCL1\SYSAUX01.DBF" datafile
3 auxiliary format
"F:\BBCLDB\ORCL1\UNDOTBS01.DBF" datafile
4 auxiliary format
"F:\BBCLDB\ORCL1\USERS01.DBF" datafile
5 auxiliary format
"F:\BBCLDB\ORCL1\CI_DATALRG01.DBF" datafile
6 auxiliary format
"F:\BBCLDB\ORCL1\DATAUSR01.DBF" datafile
7 auxiliary format
"F:\BBCLDB\ORCL1\DATALRG01.DBF" datafile
8 auxiliary format
"F:\BBCLDB\ORCL1\DATASML01.DBF" datafile
9 auxiliary format
"F:\BBCLDB\ORCL1\INDEXLRG01.DBF" datafile
10 auxiliary format
"F:\BBCLDB\ORCL1\INDEXSML.DBF" datafile
11 auxiliary format
"F:\BBCLDB\ORCL1\DATALRG02.DBF" datafile
12 auxiliary format
"F:\BBCLDB\ORCL1\DATALRG03.DBF" datafile
13 auxiliary format
"F:\BBCLDB\ORCL1\DATALRG04.DBF" datafile
14 auxiliary format
"F:\BBCLDB\ORCL1\DATALRG05.DBF" datafile
15 auxiliary format
"F:\BBCLDB\ORCL1\DATALRG06.DBF" datafile
16 auxiliary format
"F:\BBCLDB\ORCL1\DATALRG07.DBF" datafile
17 auxiliary format
"F:\BBCLDB\ORCL1\INDEXLRG02.DBF" datafile
18 auxiliary format
"F:\BBCLDB\ORCL1\INDEXLRG03.DBF" datafile
19 auxiliary format
"F:\BBCLDB\ORCL1\INDEXLRG04.DBF" datafile
20 auxiliary format
"F:\BBCLDB\ORCL1\INDEXLRG05.DBF" datafile
21 auxiliary format
"F:\BBCLDB\ORCL1\INDEXLRG06.DBF" datafile
22 auxiliary format
"F:\BBCLDB\ORCL1\INDEXLRG07.DBF" datafile
23 auxiliary format
"F:\BBCLDB\ORCL1\DATALRG08.DBF" ;
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
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
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
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 30-DEC-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00007 name=F:\BBCLDB\IBS\IBS\DATALRG01.DBF