码迷,mamicode.com
首页 > 数据库 > 详细

『ORACLE』 DBLINK(11g)

时间:2017-05-24 21:07:26      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:ons   history   0 rows   trie   nts   data   log   link   size   

使用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)

标签:ons   history   0 rows   trie   nts   data   log   link   size   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!