对center添加数据:
INSERT INTO dept VALUES('0000', 'HQ')
INSERT INTO dept VALUES('0001', 'Sales')
INSERT INTO dept VALUES('0002', 'Marketing')
INSERT INTO dept VALUES('0003', 'Admin')
INSERT INTO dept VALUES('0004', 'Education')
INSERT INTO dept VALUES('0005', 'Presales')
INSERT INTO dept VALUES('0006', 'Support')
COMMIT
BEGIN
DECLARE @count INTEGER
SET @count = 1
WHILE (@count <= 2000)
BEGIN
INSERT INTO emp(empname, gender, deptno)
VALUES('PERSON' + STR(@count,4), MOD(@count, 2),
'000' + str(MOD(@count, 7),1))
SET @count = @count + 1
END
END |
对remote数据库:
CREATE TABLE dept(
deptno CHAR(4) NOT NULL PRIMARY KEY,
deptname VARCHAR(20))
CREATE TABLE emp(
empno INTEGER IDENTITY NOT NULL PRIMARY KEY,
empname VARCHAR(20),
gender BIT,
deptno CHAR(4) NOT NULL,
FOREIGN KEY (deptno)
references re_dept (deptno)) |
建立publication:
CREATE PUBLICATION Lab_all
(
TABLE dept,
TABLE emp
) |
建立同步用户:
CREATE SYNCHRONIZATION USER "SIMPLE" |
建立SYNCHRONIZATION SUBSCRIPTION:
CREATE SYNCHRONIZATION SUBSCRIPTION TO Lab_all
FOR "SIMPLE"
TYPE 'TCPIP'
ADDRESS 'host=localhost;port=2439'
OPTION ScriptVersion='Lab01' |
命令行下:
启动同步服务器:
dbmlsrv9 -c "dsn=center" -x tcpip -o
mlserver.mls -v+ -dl -za -zu+ |
触发同步:
dbmlsync -c "dsn=remote" -o dbmlsync.out
-v -e "SendColumnNames=ON" | |