[转帖]shareplex 同步数据库_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 8127 | 回复: 0   主题: [转帖]shareplex 同步数据库        下一篇 
yi.liao
注册用户
等级:少校
经验:917
发帖:52
精华:4
注册:2013-1-31
状态:离线
发送短消息息给yi.liao 加好友    发送短消息息给yi.liao 发消息
发表于: IP:您无权察看 2013-2-7 10:32:23 | [全部帖] [楼主帖] 楼主

源端

OS:Red Hat Enterprise Linux Server release 5.5 (Tikanga)
ORACLE:Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production


shareplex目录:/oradata/shareplex
目的端:

OS:Red Hat Enterprise Linux Server release 5.8 (Tikanga)
ORACLE:Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production


shareplex目录:/data/shareplex

QUEST公司shareplex软件:SharePlex-7.6.1-b27-oracle100-rh-40-amd64-m64.tar
解压后:SharePlex-7.6.1-b27-oracle100-rh-40-amd64-m64.tpm

1)创建SPLEX用户及设置归档模式
A 、源端与目标端--创建用户及授权(注意系统时间):

create user splex identified by splex default tablespace users;----最好为SPLEX用户单独创建一个表空间
grant dba,connect,resource to splex;---SPLEX必须有DBA权限


源端必须处于归档模式

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 7
Next log sequence to archive 9
Current log sequence 9
alter database add supplemental log data (primary key,unique index) columns;


目标端创建需同步进去的数据(注意在目标端创建好源端默认表空间及数据表空间)

create user test identified by test default tablespace
TBS_DATA01
;
grant connect,resource,unlimited tablespace to test;


B 、源端-导出数据(这里使用SCN来保证 一致性):

SQL> set num 50
SQL> select current_scn from v$database;
CURRENT_SCN
--------------------------------------------------
165290627611
expdp system/XXXX DIRECTORY=DUMP_DIR DUMPFILE=20120730_HR.dmp FLASHBACK_SCN=165290627611 SCHEMAS=test LOGFILE=20120730_HR.log


6) 目标端-导入数据

impdp system/oracle DIRECTORY=DUMP_DIR DUMPFILE=20120730_HR.dmp SCHEMAS=test LOGFILE=impdp_2012730_HR.log


查找相关JOB

select job_name from dba_scheduler_jobs where OWNER='TEST';


查找触发器

select 'alter trigger '||owner||'.'||object_name||' disable'
from dba_objects
where object_type='TRIGGER' and owner='TEST';


查找外键及约束

select 'alter table '||t.owner||'.'||t.table_name||' disable constraint '||t.constraint_name||';'
From dba_constraints t
where owner='TEST' and constraint_type='R';


2) 安装shareplex
源端

$ ./SharePlex-7.6.1-b27-oracle100-rh-40-amd64-m64.tpm
Unpacking ..................................................................
..........................................................................
..........................................................................
..........................................................................
SharePlex for Oracle installation program:
SharePlex Version: 7.6.1
Supported Oracle Version: 10gR2
Build platform: rh-40-amd64
Target platform: rh-40-amd64
Please enter the product directory location? /oradata/shareplex/prodir
Please enter the variable data directory location? /oradata/shareplex/vardir
Please specify the SharePlex Admin group (select a number):
1. [oinstall]
2. dba
3. oper
?
Please wait while the installer obtains Oracle information ..
Please enter the ORACLE_SID that corresponds to this installation? [
hrdb
]
Please enter the ORACLE_HOME directory that corresponds to this ORACLE_SID? [/opt/app/oracle/product/10.2.0/db_1]
Please enter the TCP/IP port number for SharePlex communications? [2100] 2200
Preparing to install SharePlex for Oracle v. 7.6.1:
User: oracle
Admin Group: oinstall
Product Directory: /oradata/shareplex/prodir
Variable Data Directory: /oradata/shareplex/vardir
ORACLE_SID: hrdb
ORACLE_HOME: /opt/app/oracle/product/10.2.0/db_1
Proceed with installation? [yes]
Installing ................................................................
.........................................................................
....................................................................
Setting file ownerships ...................................................
.........................................................................
........
Setting file permissions ..................................................
.........................................................................
.........
Do you have a valid SharePlex for Oracle v. 7.6.1 license? [yes]
Please enter the License key? XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Please enter the customer name associated with this license key? YYYYYYYYYYYYYYYYYYYYYYYYYYY
SharePlex for Oracle v. 7.6.1 license validation successful:
Customer Name: YYYYYYYYYYYYYYYYYYYYYYYYYYY
License Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Product Name: SharePlex for Oracle - RAC
License Key Type: "Perpetual Key"
NOTE: You can upgrade this license key or add license keys for additional machines
by executing utility /oradata/shareplex/prodir/install/splex_add_key.
Installation log saved to: /home/oracle/.shareplex/INSTALL-SharePlex-7.6.1-1106130040.log
SharePlex for Oracle v. 7.6.1 installation successful.
$ ./ora_setup
Welcome to the Oracle SharePlex setup process.
This process creates tables and user accounts needed to run
Oracle SharePlex replication.
Please note the following:
** In response to prompts, a carriage return will choose the default
given in brackets. If there is no default, a reply must be entered.
** To exit the program while the program is waiting for input, use the
CTRL-C key sequence.
This sequences can be entered by holding down the CONTROL key and
pressing the C key.
Enter the Oracle SID for which SharePlex should be installed [hrdb] :
In order to create the SharePlex tables and user account, we must
connect to the database as a DBA user
Enter a DBA user name : system
Enter password for the DBA account, which will not echo :
connecting--This may take a few seconds.
validating user name and password. . . This may take a few seconds.
SharePlex objects will need to be created under a special
account. You can pick an existing user or create a new one.
Would you like to create a new SharePlex user ? [y] : n
Enter username of an existing user : splexhr
Enter user password for splexhr :
validating user name and password. . . This may take a few seconds.
Warning: This user is now being granted unlimited tablespace.
This privilege will remain in effect until it is explicitly changed.
SPLEX_ROLE_BOTH already exists; continuing setup . . .
Setup will now install SharePlex objects.
These are the existing tablespaces.
SYSTEM UNDOTBS1 SYSAUX TEMP USERS TBS_DATA01 TBS_DATA02 TBS_DATA03
TBS_INDEX01 TBS_INDEX02 TBS_INDEX03 TBS_SPLEX
Enter the default tablespace for use by SharePlex [TBS_SPLEX] :
Enter the temporary tablespace for use by SharePlex [TEMP] :
Enter the index tablespace for use by SharePlex [TBS_SPLEX] :
Creating SharePlex objects [Installation type: Upgrade]. . .
SPLEXHR.SHAREPLEX_ACTID already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_MARKER already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_OBJMAP already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_OBJMAP_I1 already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_TRANS already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_LOGLIST already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_LOBMAP already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_ROUTES already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_ROUTES_I1 already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_ROUTES_I2 already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_WILDCARD already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_WILDCARD_I1 already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_WILDCARD_I2 already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_PARTITION_CACHE already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_PARTITION_CACHE_I1 already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_LOB_CACHE already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_LOB_CACHE_I1 already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_CONFIG already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_COMMAND already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_JOBID already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_JOBS already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_JOB_STATS already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_DATAEQUATOR already exists; continuing setup . . .
already exists; continuing setup . . .
already exists; continuing setup . . .
already exists; continuing setup . . .
SPLEXHR.DEMO_SRC already exists; continuing setup . . .
SPLEXHR.DEMO_DEST already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_ACT_MARKER already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_PARTITION already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_OOS_MASTER already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_OOS_KEYS already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_SYNC_MARKER already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_CHANGE_OBJECT already exists; continuing setup . . .
SPLEXHR.SHAREPLEX_DDL_CONTROL already exists; continuing setup . . .
Creating SharePlex Oracle-timezone-region map . . . Done.
Creating Conflict Resolution Package . . . Done.
Setup of SharePlex objects successful . . .
Changing SharePlex parameter database . . .
Setup completed successfully


目标端
安装shareplex过程中./SharePlex-7.6.1-b27-oracle100-rh-40-amd64-m64.tpm及./ora_setup类似,不同
之外在于

Oracle ASM detected. Enable SharePlex ASM support? [y] :
SharePlex ASM support enabled.
(RAC安装有所不同,有机会再指出)
(备注:如在源端或目标端都有安装过shareplex,则记得清除SPLEX用户capture或post信息,则在启动前记得以下操作:

./ora_cleansp splexhr/splexhr

)


3) 源端操作
A 、启动shareplex

[oracle@hrdb bin]$ ./sp_cop -u2200 &
[1] 25839
[oracle@hrdb bin]$
*******************************************************
* SharePlex for Oracle Startup
* 10 Quest Software, Inc.
* ALL RIGHTS RESERVED.
* Protected by U.S. Patents: 7,461,103 and 7,065,538
* Version: 7.6.1.27-m64-oracle100
* VarDir : /oradata/shareplex/vardir
* Port : 2200
*******************************************************


B 、进入控制台

[oracle@hrdb bin]$ ./sp_ctrl
*******************************************************
* SharePlex for Oracle Command Utility
* 10 Quest Software, Inc.
* ALL RIGHTS RESERVED.
* Protected by U.S. Patents: 7,461,103 and 7,065,538
*******************************************************


C 、添加配置文件

sp_ctrl (hrdb:2200)> list config
File Name State Datasource
-------------------------------------------------- ---------- ---------------
ORA_config Inactive o.SOURCE_SID
Last Modified At: 13-Jun-11 00:43 Size: 151
sp_ctrl (hrdb:2200)> copy config ORA_config to hr_config
sp_ctrl (hrdb:2200)> view config hr_config
datasource:o.hrdb
#source tables target tables routing map
splex.demo_src splex.demo_dest 10.1.2.18@o.backupdb
expand TEST.% TEST.% 10.1.2.18@o.backupdb


8)启动目标端sp_cop

$./sp_cop -u2200 &
$./sp_ctrl
sp_ctrl (backupdb:2200)> status
Brief Status for backupdb
Process State PID Running Since
--------------- ------------------------------ -------- --------------------
Cop Running 26483 31-Jul-12 09:31:06
Cmd & Ctrl Running 26485 31-Jul-12 09:31:14
There are no active configuration files
sp_ctrl (backupdb:2200)> stop post


9)源端

sp_ctrl (hrdb:2200)> activate config hr_config
Not all tables activated successfully


10)目标端

sp_ctrl (backupdb:2200)> qstatus
Queues Statistics for backupdb
Name: hrdb (o.hrdb-o.backupdb) (MTPost queue)
Number of messages: 207 (Age 0 min; Size 0 mb)
Backlog (messages): 207 (Age 0 min)
sp_ctrl (backupdb:2200)>reconcile queue hrdb for o.hrdb-o.backupdb scn 165290627611
sp_ctrl (backupdb:2200)>start post


到此,安装结束,只需要检查各进程是否运行正常便可。

***********************************

清除源端或目标端下队列记录信息:

$ ./ora_cleansp splexhr/splexhr
sp_cop is running: are you sure you want to perform the clean? (N) c
Y
SQL*Plus: Release 10.2.0.5.0 - Production on Mon Jul 30 11:11:39 2012
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL>
Table truncated.
SQL>
Table truncated.
SQL>
1 row updated.
SQL>
Table truncated.
SQL>
Table truncated.
SQL>
Table truncated.
SQL>
Table truncated.
SQL>
Table truncated.
SQL>
Table truncated.
SQL>
Table truncated.
SQL>
Table truncated.
SQL>
Table truncated.
SQL>
Table truncated.
SQL>
Table truncated.
SQL>
1 row updated.
SQL>
Table truncated.
SQL> SQL>
Table altered.
SQL>
Table altered.
SQL>
Table truncated.
SQL>
Table truncated.
SQL>
Table altered.
SQL>
Table altered.
SQL> SQL>
Commit complete.
SQL> SQL> SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Cleaning /shareplex/vardir subdirectories
***********************************


该贴被yi.liao编辑于2013-2-7 10:33:38




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论