oracle_dblink配置
说明:一下是未配置本地服务的dblink。
前提: 授权> grant create public database link,create database link to myAccount;
1.创建dblink
SQL> create database link demob connect to dblink identified by dblink using '(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 10.100.25.14)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = orcl)))';
Database link created.
参数说明>
demob --link_name
dblink -- 远程数据库的用户账号与密码
(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 10.100.25.14)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = orcl))) -- 远程数据库的tnsnames.ora
------------------------------------------------------------------------------------------------------------------------------
2.使用dblink
SQL> select * from dblink.dblink@demob;
ID
----------
1
2
参数说明
@demob --dblink_name
___________________________________________________________________________________________________
3.查看dblink
select owner,object_name from dba_objects where object_type='DATABASE LINK';
或者
select * from dba_db_links;
—————————————————————————————————————————————————————————————————
4.删除db_link
DROP PUBLIC DATABASE LINK linkfwq; 或者 DROP DATABASE LINK linkfwq