首页 > 数据库技术 > 详细

『ORACLE』 DBLINK(11g)

时间:2017-05-24 20:37:34      阅读:287      评论:0      收藏:0      [点我收藏+]

使用tnsnames.ora

SQL> grant create database link to scott;

Grant succeeded.

SQL> conn scott/tiger
Connected.

SQL> create database link lk connect to hr identified by hr using ‘enmo1‘;

Database link created.

SQL> select * from tab@lk;

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
COUNTRIES TABLE
DEPARTMENTS TABLE
EMPLOYEES TABLE
EMP_DETAILS_VIEW VIEW
EMP_SAL_CHANGE TABLE
JOBS TABLE
JOB_HISTORY TABLE
LOCATIONS TABLE
REGIONS TABLE
SP_LOGERR TABLE

10 rows selected.

SQL> conn hr/hr
Connected.
SQL> select * from tab;

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
COUNTRIES TABLE
DEPARTMENTS TABLE
EMPLOYEES TABLE
EMP_DETAILS_VIEW VIEW
EMP_SAL_CHANGE TABLE
JOBS TABLE
JOB_HISTORY TABLE
LOCATIONS TABLE
REGIONS TABLE
SP_LOGERR TABLE

10 rows selected.

使用easy connect

SQL> create database link d_1 connect to scott identified by tiger using‘192.0.2.5:1521/enmo1‘;

Database link created.

SQL> select * from tab@d_1;

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
BONUS TABLE
DEPT TABLE
EMP TABLE
SALGRADE TABLE

SQL> conn scott/tiger
Connected.
SQL> select * from tab;

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
BONUS TABLE
DEPT TABLE
EMP TABLE
SALGRADE TABLE

『ORACLE』 DBLINK(11g)

原文:http://www.cnblogs.com/KT-melvin/p/6900799.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!