首页 > 数据库 > Oracle > 创建本地数据库到远程数据库的DB_link
1.配置TNS,在A库中添加B库的tns信息
2.测试能否tnsping通
[oracle@gc1 admin]$ tnsping SHANGHAI
3.通过A库连接B库
[oracle@gc1 dbhome_1]$ sqlplus sys/oracle@SHANGHAI as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Jul 21 16:24:18 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
4.登录A库创建DB_linkSQL>create database link dl_5_scott connect to scott identified
2 by tiger using 'SHANGHAI';
Database link created.
SQL>select * from dept@dl_5_scott;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31362743/viewspace-2122755/ ,如需转载,请注明出处,否则将追究法律责任。