日期:2014-05-16  浏览次数:20438 次

本地创建Duplicate数据库

本地创建Duplicate数据库,新创建的文件路径与目标数据库不同,而且辅助实例的初始化参数DB_NAME与目标数据库不能相同。
1.创建辅助实例的秘钥文件
[oracle@linux5 dbs]$ pwd
/u01/app/oracle/10.2.0/db_1/dbs
[oracle@linux5 dbs]$ orapwd file=/u01/app/oracle/10.2.0/db_1/dbs/orapworcldup password=safe entries=30
2.手工建库
[oracle@linux5 admin]$ pwd
/u01/app/oracle/admin
[oracle@linux5 admin]$ mkdir orcldup
[oracle@linux5 admin]$ cd orcldup/
[oracle@linux5 orcldup]$ mkdir {a,b,c,u}dump
[oracle@linux5 orcldup]$ ls
adump  bdump  cdump  udump
[oracle@linux5 orcldup]$
3.配置初始化参数文件
[oracle@linux5 orcldup]$ export ORACLE_SID=orcl
[oracle@linux5 orcldup]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Apr 17 05:32:56 2014

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

Connected to an idle instance.

SQL> create pfile='/u01/dup_test/pfile' from spfile;

File created.


[oracle@linux5 orcldup]$ export ORACLE_SID=orcldup  创建辅助实例的spfile之前要指定sid为辅助实例的sid,否则会覆盖目标数据库。
[oracle@linux5 orcldup]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Apr 17 05:31:41 2014

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

Connected to an idle instance.

[oracle@linux5 ~]$ cd /u01/
[oracle@linux5 u01]$ ls
app  arch  bak  dup_test
[oracle@linux5 u01]$ cd dup_test/
[oracle@linux5 dup_test]$ ls
pfile
[oracle@linux5 dup_test]$ pwd
/u01/dup_test
[oracle@linux5 dup_test]$ mkdir orcldup
[oracle@linux5 dup_test]$ ls
orcldup  pfile
PFILE:
*.control_files='/u01/dup_test/orcldup/control01.ctl','/u01/dup_test/orcldup/control02.ctl','/u01/dup_test/orcldup/control03.ctl'
*.db_block_size=8192
*.db_name='orcldup'
*.shared_pool_size=200000000
*.db_block_size=8192
*.db_file_name_convert='/u01/app/oracle/oradata/orcl','/u01/dup_test/orcldup'
*.log_file_name_convert='/u01/arch','/u01/dup_test/orcldup'
*.audit_file_dest='/u01/app/oracle/admin/orcldup/adump'
*.background_dump_dest='/u01/app/oracle/admin/orcldup/bdump'
*.compatible='10.2.0.1.0'
*.core_dump_dest='/u01/app/oracle/admin/orcldup/cdump'
*.user_dump_dest='/u01/app/oracle/admin/orcldup/udump'

SQL> create spfile from pfile='/u01/dup_test/pfile';

File created.

4.启动辅助实例
SQL> startup nomount
ORACLE instance started.

Total System Global Area  281018368 bytes
Fixed Size                  1218968 bytes
Variable Size             226494056 bytes
Database Buffers           50331648 bytes
Redo Buffers                2973696 bytes
5.配置网络
/etc/sysconfig/network-scripts
eth0:
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=static
DHCPCLASS=
HWADDR=00:0C:29:53:DB:E3
ONBOOT=yes
IPADDR=10.255.17.222
NETMASK=255.255.0.0
GATEWAY=10.255.0.1
~