如何配置cis

本篇文章目的在于理解CIS概念、掌握CIS的配置过程。本篇文章中,你将有步骤的将cis配置起来,最终实现向访问本地表一样访问远程服务器上的表,可以对其进行查询和更新。

本实验环境中, 最好有两台服务器,在两台服务器上有系统管理员和安全员的角色,网路畅通

实验一、将远程表auths映射到本地代理表proxy_auths中,然后创建该代理表,最后对表执行查询。

一、 配置组件集成服务

1、 为cis配置参数

sp_configure “enable cis”, 1

2、 配置远程服务器

Ø 配置服务器入口

运行DSDEIT,将远程服务器对应的服务器入口配置到接口文件中,如:

server:demo protocol: tcp address:DEMO3,5000

Ø 测试连接参数

Ø 为本地服务器建立了一个名称为sybase12的本地服务器入口

sp_addserver sybase12 , local

3、 增加外部登录用户及口令(该步可选)

当用户使用CIS时,将使用该客户的本地登录用户名和口令连接到远程服务器,此时如果远程服务器上存在一个与本地登录用户名及口令完全相同的登录用户,那么用户便可以直接连接到远程服务器上;否则需使用sp_addexternlogin来定义要连接到远程服务器的外部登录用户名及口令

sp_addexternlogin remote,local_user,remote_user,xtgroup

4、 检查远程服务器配置是否正确

connect to remote

若执行成功,显示下列信息:

Server Message: Number 11217, Severity 10

Server 'sybase12', Line 1:

Entered passthru mode to server 'remote'.

建立到远程数据库的passthrough模式,可以执行如下命令退出该模式:

disconnect to remote

5、 在远程服务器上,做如下的准备工作:

Ø 创建用户数据库aca_database

disk init

name=”aca_dev”,

physname=”d:\Sybase\aca_dev.dat”,

vdevno=3

size=5120

disk init

name="aca_log",

physname="d:\sybase\aca_log.dat",

vdevno=4,

size=1024

create database aca_database

on aca_dev=10

log on aca_log=2

use aca_database

create table auths

(

author_code char(6) not null,

seqno numeric(10) identity,

name varchar(10) not null,

sex bit not null ,

address varchar(30) null ,

postcode char(6) null ,

birthdate datetime not null,

entry_date_time datetime not null,

salary money null ,

picture image null ,

remark varchar(255) null

)

insert into auths(author_code,name,birthdate,postcode,address,

entry_date_time,salary,remark,sex)

values('A00001','王达琳','11/12/58','100080','北京市海淀路15号', '11/12/95',120,null,0)

commit

… …

… …

6、 映射远程表auths到本地代理表proxy_auths

sp_addobjectde proxy_auths , ”remote.aca_database..auths” , ”table”

7、 创建代理表

create existing table proxy_auths

(

author_code char(6) not null,

seqno numeric(10) identity,

name varchar(10) not null,

sex bit not null ,

address varchar(30) null ,

postcode char(6) null ,

birthdate datetime not null,

entry_date_time datetime not null,

salary money null ,

picture image null ,

remark varchar(255) null

)

说明:

1) 代理表与远程表的列类型必须相同

2) 代理表与远程表的列长必须相同

3) 代理表与远程表的null属性必须一致

8、 更新表统计,以确保优化器能够更合理地进行查询

update statistics proxy_auths

9、 执行查询,检验上述步骤是否正确

select author_code,name,birthdate

from proxy_auths

where author_code=”a00001”

10、 也可以对表执行insert、update、delete等语句

update auths

set name=”test”

where author_code=”A00001”

delete auths where author_code=”A00001”

实验二、使用本地代理表创建新表到远程服务器上

1、将远程不存在的表newtable1映射到本地代理表new_tab1上。

Sp_addobjectdef new_tab1,”remote.aca_database..newtable1”,”table”

2、创建代理表new_tab1

create table new_tab1

(

col1 int null,

col2 char(6) not null,

col3 text

)

执行成功后将在本地服务器上创建一个名称为new_tab1的代理表,同时在远程数据库aca_database中创建了一个名称为newtable1的新表

实验三:使用select into 语句将数据导入到远程服务器中。

1、映射远程新表new_auths到本地代理表new_auths:

sp_addobjectdef new_auths,”remote.aca_database..new_auths”,”table”

2、执行select into语句

Ø 分别在本地和远程服务器上执行如下语句

sp_dboption cis_database,”select into/bulkcopy/pllsort” ,true

sp_dboption aca_database,”select into/bulkcopy/pllsort”,true

(别忘了在用户数据库中执行“checkpoint”命令)

Ø 将数据导入到远程表new_auths中

select * into new_auths from aca_database..auths

结论:通过本实验我们了解到, Sybase CIS服务可以使我们透明的访问同质和异质数据库,提供分布查询和分布更新的能力。

作者: eleooz   发布时间: 2007-04-18

这种文章要顶一下。谢谢eleooz。

作者: jarjar   发布时间: 2007-04-19

感谢楼主分享,这种配置一般比较烦的。
楼主的好帖,如论如何要顶啊。

作者: Jerry1126_Gao   发布时间: 2010-10-05