dblink

createdatabaselinklink名称connectto对方数据库用户名identifiedby对方数据库用户密码using'对方数据库ip:端口/实例名';

createdatabaselinkauthconnecttozwww_authidentifiedbyzwww_authusing'//10.10.44.2:1521/orcl';

SELECT*

fromzwww_auth(数据库名).t_role_usert

或者

SELECT*

fromzwww_auth(数据库名).t_role_user@autht

/*select*

fromZHOUSHAN_20130620.bjxlb(用户名)@slt(dblink名)b

whereb.bjlbbh=60andb.bjxlbhnotin(selectlxbmfromt_soc_rcsjlx)*/

对于在代码上操纵垮库的,是可以的,但是封装太死不行的话可以用视图,这时只有用视图,在数据库上可以用普通方式

createorreplaceviewv_syslogas

select"ID","TYPE","USER_ID","USER_NAME"asUSERNAME,"LOG_DATE"asLOGDATE,"OPERATE","MESSAGE","IP","MAC","STATUS"fromzwww_auth.t_syslog@auth;

相关推荐