eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

« 如何启动DataGuard的备用数据库 | Blog首页 | Oracle Open World 2006文档下载 »

Oracle9i与Oracle10g之间的高级复制配置

今天有朋友问及,Oracle9i和Oracle10g之间能够构建高级复制环境。
基于实现原理,我们知道一定是可以的,但是还是动手测试了一下。

测试了简单的表复制,结论是没有问题。
高级复制的详细过程可以参考我以前的文章:
http://www.eygle.com/archives/2005/06/oraclessoeaeaeo.html

测试的简单过程如下(略去了一些基本步骤).
首先测试两个数据库的连通性:

$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.4.0 - Production on Tue Oct 31 10:36:31 2006

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production

SQL> show parameter glob

NAME TYPE VALUE
------------------------------------ ----------- ---------------------
global_context_pool_size string
global_names boolean TRUE
SQL> select * from global_name;

GLOBAL_NAME
----------------------------------------------------------------------
HSBILL.HURRAY.COM.CN

SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production

bash-2.03$ tnsping mars

TNS Ping Utility for Solaris: Version 9.2.0.4.0 - Production on 31-OCT-2006 10:39:41

Copyright (c) 1997 Oracle Corporation. All rights reserved.

Used parameter files:
/opt/oracle/product/9.2.0/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.31.110)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = mars)))
OK (10 msec)

两个数据库分别创建db link:
9i的数据库:

bash-2.03$ sqlplus repadmin/repadmin

SQL*Plus: Release 9.2.0.4.0 - Production on Tue Oct 31 10:57:49 2006

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production

SQL> create public database link "MARS.HURRAY.COM.CN" connect to repadmin identified by repadmin using 'MARS';

Database link created.

SQL> select * from dual@mars;

D
-
X

10g的数据库:

bash-2.03$ sqlplus "/ as sysdba"

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Oct 31 10:15:20 2006

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SQL> select username from dba_users where username='REPADMIN';

USERNAME
------------------------------
REPADMIN

SQL> connect repadmin/repadmin
Connected.
SQL> select * from tab;

no rows selected

SQL> select * from global_name;

GLOBAL_NAME
--------------------------------------------------------------------------------
MARS.HURRAY.COM.CN

SQL> create public database link "HSBILL.HURRAY.COM.CN" connect to repadmin identified by repadmin using 'HSBILL';

Database link created.

SQL> select * from dual@hsbill;

D
-
X

两个数据库分别创建测试表:

SQL> connect eygle/eygle
Connected.

SQL> create table eygle as select * from v$session;

Table created.

SQL> alter table eygle add (constraint pk_eygle primary key (SADDR));

Table altered.

进行复制创建:

SQL> connect repadmin/repadmin
Connected.

SQL> execute dbms_repcat.create_master_repgroup('rep_910');

PL/SQL procedure successfully completed.

SQL> execute dbms_repcat.create_master_repobject(sname=>'eygle',oname=>'eygle', type=>'table',use_existing_object=>true,gname=>'rep_910',copy_rows=>false);

PL/SQL procedure successfully completed.

SQL> execute dbms_repcat.generate_replication_support('eygle','eygle','table');

PL/SQL procedure successfully completed.

SQL> execute dbms_repcat.add_master_database(gname=>'rep_910',master=>'MARS.HURRAY.COM.CN',use_existing_objects=>true, copy_rows=>false, propagation_mode => 'synchronous');

PL/SQL procedure successfully completed.


SQL> execute dbms_repcat.resume_master_activity('rep_910',true);

PL/SQL procedure successfully completed.

基本测试:

SQL> select count(*) from eygle.eygle;

COUNT(*)
----------
20

SQL> select count(*) from eygle.eygle@mars;

COUNT(*)
----------
20

SQL> delete from eygle.eygle where rownum <11;

10 rows deleted.

SQL> commit;

Commit complete.

SQL> select count(*) from eygle.eygle;

COUNT(*)
----------
10

SQL> select count(*) from eygle.eygle@mars;

COUNT(*)
----------
10

SQL> select * from v$version@mars;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Solaris: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
PL/SQL Release 9.2.0.4.0 - Production
CORE 9.2.0.3.0 Production
TNS for Solaris: Version 9.2.0.4.0 - Production
NLSRTL Version 9.2.0.4.0 - Production

SQL>

本例未作全面测试,仅用于说明Oracle9iR2和Oracle10gR2之间的高级复制功能上可行。

-The End-


历史上的今天...
    >> 2012-10-31文章:
    >> 2011-10-31文章:
    >> 2010-10-31文章:
    >> 2008-10-31文章:
    >> 2007-10-31文章:
    >> 2005-10-31文章:
    >> 2004-10-31文章:

无觅

By eygle on 2006-10-31 14:27 | Comments (4) | Advanced | 952 |

4 Comments

不知道9i和10G的主机环境是什么,是同一个环境?
如果是WIN2003+ORACLE10G和AIX 5+ORACLE 9I之间做复制,有没有问题呢,目前这里出现了“ORA-24812: 向/从 UCS2 进行的字符集转换失败”,虽然测试的表是很简单的表

字符集不同么?

字符集设成一样了,问了ORACLE工程师(没有买现场服务),也不太清楚原因。
现在怀疑是主机平台的问题,等一台HP主机到了后,装了10G再试试。
目前再WIN2003上装了一个虚拟机,装了一个linux+oracle9i,然后和WIN2003+ORACLE10G做高级复制,是可行的。

现在换了主机后,已经成功实现了。
HPUX+ORACLE10G(10.2.0.2.0) 和 AIX5+ORACLE9I(9.2.0.4)


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com