>  기사  >  데이터 베이스  >  oracle 在本地查询远程数据库的方法,如何组合远程链接字符串

oracle 在本地查询远程数据库的方法,如何组合远程链接字符串

WBOY
WBOY원래의
2016-06-07 15:18:431128검색

方法如下: 第一、创建远程链接的link: create public database like linkorcl(创建的link名称) connect to zhang(用户名) identified by xxxx(密码) using '111.111.1.1:1521/orcl'(远程数据库ip和数据库名称); 其他均为关键字 第二、使用创建的li

方法如下:

第一、创建远程链接的link:

create public database like linkorcl(创建的link名称) connect to zhang(用户名) identified by
xxxx(密码) using  '111.111.1.1:1521/orcl'(远程数据库ip和数据库名称);

其他均为关键字

 

第二、使用创建的link名称进行查询即可:

select * from student@linkorcl;

 

实例如下:

SQL>
SQL> CREATE   PUBLIC   DATABASE   LINK   linkorcl CONNECT   TO   zhang IDENTIFIED   BY
  2  XXXX USING   '111.111.1.1:1521/orcl';
 
Database link created
 
SQL> select * from student@linkorcl;
 
S_ID                                                                             S_NAME                                             S_AGE
-------------------------------------------------------------------------------- -------------------------------------------------- -----
1                                                                                potter                                                26
2                                                                                马明                                                  21
3                                                                                张士波                                                12
4                                                                                renee                                                 15
5                                                                                reday                                                 18
6                                                                                alisa                                                 19
7                                                                                胡总                                                  23
8                                                                                阿里山                                                29
9                                                                                扎西                                                  20
10                                                                               香格里拉                                              24
11                                                                               琪琪格                                                28
12                                                                               暗夜精灵                                              19
 
12 rows selected
 
SQL>

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.