这里我已经有一个安装好的数据库,版本是:10g R2 主机名称:dg1.andylhz.com 实例名dg,另外一台数据库主机,安装oracle软件和第一台数据库的安装环境一样,但没有安装数据库。主机名称:dg2.andylhz.com,实例名,dgc
1、将dg1的系统参数文件,监听文件,密码文件,拷贝到dg2的相应位置。
编辑初始化参数文件initdg.ora 将文件中的dg全部替换成dgc 保存并重命名为:initdgc.ora
如下:
[oracle@dg2 dbs]$ more /u01/app/oracle/10g/dbs/initdgc.ora
dgc.__db_cache_size=67108864
dgc.__java_pool_size=4194304
dgc.__large_pool_size=4194304
dgc.__shared_pool_size=88080384
dgc.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/dgc/adump'
*.background_dump_dest='/u01/app/oracle/admin/dgc/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/u01/app/oracle/oradata/dgc/control01.ctl','/u01/app/oracle/oradata/dgc/control02.ctl','/u01/app/oracle/oradata/dgc
/control03.ctl'
*.core_dump_dest='/u01/app/oracle/admin/dgc/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='dgc'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=dgXDB)'
*.job_queue_processes=10
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=167772160
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/dgc/udump'
*.db_file_name_convert='/u01/app/oracle/oradata/dg','/u01/app/oracle/oradata/dgc'
*.log_file_name_convert='/u01/app/oracle/oradata/dg','/u01/app/oracle/oradata/dgc'
#红色字体的参数需要设置好,否则在执行duplicate命令的时候报告辅助数据库和目标数据库的文件命冲突。
2、将密码文件重命名:mv orapwdg orapwdgc
3、将监听文件中的主机名改成 dg2.andylhz.com 实例名改成dgc
如下:
#注意,这里的监听文件需要使用静态注册,否则客户端连接辅助数据库连接不上。所以不能使用动态链接方式。
#listener.ora
[oracle@dg2 admin]$ more /u01/app/oracle/10g/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/10g/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/10g)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = dgc)
(ORACLE_HOME = /u01/app/oracle/10g)
(SID_NAME = dgc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dg2.andylhz.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
#tnsnames.ora
[oracle@dg2 admin]$ more /u01/app/oracle/10g/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/10g/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
DGC =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = dg2.andylhz.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = dgc)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
3、创建相应的目录:
mkdir –p /u01/app/oracle/oradata/dgc
mkdir –p /u01/app/oracle/admin/dgc/adump
mkdir –p /u01/app/oracle/admin/dgc/bdump
mkdir –p /u01/app/oracle/admin/dgc/cdump
mkdir –p /u01/app/oracle/admin/dgc/ddump
mkdir –p /u01/app/oracle/admin/dgc/udump
mkdir –p /u01/app/oracle/flash_recovery_area
4、启动dg2监听 :
5、创建spfile参数文件并启动dg2实例到nomount状态
6、在dg1上使用rman创建一个全库备份,并传输到dg2的相应目录
7、win7系统数据库客户端的监听配置
测试连通性:
8、执行复制,线连接到目标数据库,然后在连接到辅助数据库:
9、执行duplicate命令复制
RMAN>duplicate target database to dgc;
详细输出内容请参考:
http://andylhz2009.blog.51cto.com/728703/769170
10、验证: