一.查看dblink
1)查看全部用户 SELECT OWNER,OBJECT_NAME FROM DBA_OBJECTS WHERE OBJECT_TYPE='DATABASE LINK';
2)查看全部用户 SELECT * FROM DBA_DB_LINKS;
查看本用户 SELECT * FROM USER_DB_LINKS;
二.创建dblink
2.1 如果没有权限的话给权限(有权限的话省略)
给scoot用户权限
GRANT CREATE PUBLIC DATABASE LINK,
CREATE DATABASE LINK TO scoot;
2.2 创建dblink
-- (connection为dblink名字,scott为数据库用户名,tiger为用户名密码,引号内容为远程数据库下tnsnames.ora文件内容)
create database link connection
connect to scott identified by "tiger"
using '(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.52)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
3.使用dblink
SELECT * FROM DEPT@connection;
三.删除dblink
drop database link connection;
四. 注意
dblink不能进行DDL操作!!!
相关文章
暂无评论...