by你好我是李白
目标端清除:cd vardir/log ; rm sync_clt*log
2.2 compare与repair
如果发现或怀疑源端和目标端的表数据不一致,可以通过compare命令查看和修复。
但由于compare需要把比较的数据排序,然后逐条比较,大量数据的比较可能会导致资源的过量使用,所以不建议对大量数据的比较。 sp_ctrl> compare table owner.table to owner.table target target_host@o.targetsid [repair] 比较表分区:
sp_ctrl> compare table owner.table@p1 to owner.table@p1 target target_host@o.targetsid [repair]
直接修复在后面加上repair,不加repair参数则将可用于修复的SQL语句生成在日志文件中。 查看比较进度:
sp_ctrl> show compare [detail] 取消比较:
sp_ctrl> compare cancel id
sp_ctrl> remove log compare id
2.3 param设置参数
sp_ctrl>list param all --列出所有参数。
by你好我是李白
sp_ctrl>set param --设置参数
sp_ctrl>list param modified --查看被修改的参数
shareplex安装目录说明: /bin 包含可执行程序的符号连接 /.app_modules 包含可执行程序
/data 默认参数文件,包含默认的参数设置 /doc 空目录
/install SharePlex安装、license管理等相关的脚本 /lib SharePlex 应用到的库文件
/util SharePlex 工具,SQL脚本,监控脚本等
2.4 清除当前复制
sp_ctrl>shutdown
$ env | grep SP_SYS_VARDIR --一定要在清除之前确认清理的实例正确。 执行下条语句之前一定确认上述参数正确,防止清理掉正在使用的实例。 $ ora_cleanup splex/splex
2.5 SharePlex实用参数命令
export SP_SYS_VARDIR=/splex/vardir --类似ORACLE_SID,指定splex使用指定的队列配置文件等等。
export SP_SYS_HOST_NAME–在启动sp_cop之前设置,指定SharePlex启动在指定的IP上,在RAC安装时需要注意此选项。
sp_ctrl>set param SP_OPO_DISABLE_OBJECT_NUM <源端object_ID> --在目标端设置。抛弃指定表。
sp_ctrl>r 20 2 --执行上条命令20次,两秒一次。 sp_ctrl>help target
by你好我是李白
sp_ctrl>target o.orcl set metadata time:sp_time.op:sp_op --可以在目标端增加列,写入时间戳与DML语句行为。 sp_ctrl>help target set metadata time
2.6 忽略大事务的操作
过大的事务复制可能会遇到问题,所以建议所有大于1000万数据DML操作事务,分成多批次commit,并建议不要对相同表做并行的大事物操作。
在有的场景下可能不希望源端的某些修改复制到目标端,比如源端清除历史数据而目标端需要保留等。
具体步骤如下:
源端,在数据库中以shareplex用户执行util目录下的create_ignore.sql,该脚本创建了SHAREPLEX_IGNORE_TRANS procedure;只需执行一次。
在执行大的事务前先执行这个procedure,即可忽略对该事务(从这个存储过程至下一个commit之间的所有DML操作)的复制,如:
SQL> conn test/test
SQL> exec splex.shareplex_ignore_trans; SQL> insert into tb1 values (100, 'aaa'); SQL>commit;
2.7修改SharePlex的数据库用户密码
SharePlex数据库用户的密码还存在于SharePlex参数文件中,不能简单的在数据库中更改,需要执行SharePlex提供的脚本进行,具体步骤如下。对每个环境都单独列出了详细步骤。
a. 源端stop capture进程,观察SharePlex队列中数据都已应用到目标端; b. shutdown源端和目标端的SharePlex;
c. 执行prod/bin目录下的ora_chpwd命令来自动改变存储在数据库中和
paramdb文件中的密码。
by你好我是李白
? 生产环境:
dcdb02:/oracle$ora_chpwd
This program allows you to change the password of the SharePlex user account needed to run Oracle replication.
In response to prompts, a carriage return will choose the
default given in brackets. If there is no default, a replymust be entered.
Please enter the SID where SharePlex is installed [dl2] : empty response--try again : splex
注意:在此处不要使用本地的实例名,要输入TNS别名,然后回车;
In order to change the password for the SharePlex user account, we must connect to the database as SYSTEM.
Enter password for the SYSTEM account, which will not echo [MANAGER] : empty response--try again :
注意:此处输入oracle数据库system帐户的口令,但应当在口令的后面加上@TNS_ALIAS, 然后回车;
connecting--This may take a few seconds. Enter the current username for SharePlex user : empty response--try again : splex
by你好我是李白
Enter new password for SharePlex user :
empty response--try again :
Re-enter password for SharePlex user : empty response--try again :
注意:此处输入SharePlex用户的口令,但应当在口令的后面加上@TNS_ALIAS, 然后回车。
Changing SharePlex parameter database . . . SharePlex password change completed successfully.
? 管理环境:
dcadm:/oracle$ora_chpwd
This program allows you to change the password of the SharePlex user account needed to run Oracle replication.
In response to prompts, a carriage return will choose the
default given in brackets. If there is no default, a replymust be entered.
Please enter the SID where SharePlex is installed [adm] :adm empty response--try again :
In order to change the password for the SharePlex user account,