sybase中 类似dblink 的实现

转自:BBS.ChinaUnix.net

回复 1楼 heley7983 的帖子

代理表演示:

例子两台ASE服务器名称为 Server1,Server2,需要在Server1中建立代理表

1.在双方服务器interfaces中添加对方服务器信息


添加本地服务器名称
使用isql连接进入服务器Server1,Server2
1>select @@servername
2>go
确定服务器本地名称已经生效
如果返回NULL,
1>sp_addserver Server_name,local
2>go
Server_name应该跟interfaces中所用服务器名称一致

重新启动服务器,让本地名称生效, 确认 CIS 集成服务已经启动。

2.
A. 添加远程服务器信息
在Server1上执行如下命令:
isql -Usa -P -SServer1
exec sp_addserver Server2, ASEnterprise, Server2

B. 添加远程登录信息
isql -Usa -P -SServer1
exec sp_addremotelogin Server2, sa, sa
exec sp_remoteoption Server2, sa, sa, trusted, true
go
或者
isql -Usa -P -SServer1
execsp_addexternlogin Server2, sa, sa , xxxxxx(xxxxxx为远程服务器Server2上sa的口令)

3. 建立代理表
在Server2数据库pubs2建立表t_testproxy
create table t_testproxy (id int,name char(10))
在Server1数据库test中添加代理表信息
use test
go
create proxy_table t_testproxy at "Server2.pubs2.dbo.t_testproxy"

代理表名与原表名可以不同

Server1上查看代理表 信息如下:

Name Owner Object_type
---- ----- -----------
t_testproxy dbo user table

Data_located_on_segment When_created
----------------------- ------------
default Nov 28 2002 11:59AM

Column_name Type Length Prec Scale Nulls Default_name Rule_name Access_Rule_name Identity
----------- ---- ----------- ----------- ----------- ----------- ------------ --------- ---------------- -----------
id int 4 NULL NULL 0 NULL NULL NULL 0
name char 10 NULL NULL 0 NULL NULL NULL 0

exp_row_size reservepagegap fillfactormax_rows_per_page identity_gap
------------ -------------- ----------- ----------------- ------------
1 0 0 0 0

concurrency_opt_threshold
-------------------------
0

Object is Remote/External
-------------------------
presales.pubs2.dbo.t_testproxy //可从此处看出代理表所指向的真正对象

Object created with 'existing' option

Object does not have any indexes.
No defined keys for this object.
Object is not partitioned.
Lock scheme Allpages
The attribute 'exp_row_size' is not applicable to tables with allpages lock scheme.
The attribute 'concurrency_opt_threshold' is not applicable to tables with allpages lock scheme.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值