Home | 简体中文 | 繁体中文 | 杂文 | 打赏(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎专栏 | Search | About

第 70 章 数据库链接

Oracle 提供数据库链接功能,实现从当前数据库链接到其他数据库,从当前数据库操作其他数据库上的数据。

创建链接

CREATE DATABASE LINK dblinkname CONNECT TO dbuser IDENTIFIED BY your_password USING 'orcl';

CREATE PUBLIC DATABASE LINK 数据链名称 CONNECT TO 登陆用户名 IDENTIFIED BY 密码 USING '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 对方Oracle服务器的IP地址)(PORT = 端口号)) ) (CONNECT_DATA =(SERVICE_NAME = 对方Oracle服务器服务名) ))'	
	

查询

select * from v$dblink;
select * from user_db_links;
select owner, db_link from dba_db_links;
	

删除链接

drop database link 数据链名称;
	

例 70.1. DB LINK

CREATE DATABASE LINK WEB 
CONNECT TO WEB IDENTIFIED BY 0CfJly7y5YB060Cf5YBCf 
USING 'orcl';

CREATE VIEW ACCOUNT AS SELECT username, password FROM member@WEB;

select * from ACCOUNT where username="netkiller";