Article directory
Copyright statement: This article is an original article by CSDN blogger "Yang Qun". It follows the CC 4.0 BY-SA copyright agreement and was first published on CSDN on September 10, 2023. Please attach the original source link and this statement when reprinting.
Original link: https://blog.csdn.net/u011046671
1. Basic environment
Operating system: Windows or Linux
Database version: Oracle Database 11.2.0.1.0 and above
2. Applicable scenarios
3. Process and methods
1. Check whether the current user has the permission to create dblink.
select t.username 账户名称,
t.privilege 权限名称,
t.admin_option 是否可以转授权
from user_sys_privs t
where t.privilege like '%LINK%'
2. If you do not have permission, you must first authorize it before proceeding to the next step.
-- 创建的dblink只有自己可以查看和使用
grant create database link to [username];
--可以创建供其他用户查看和使用的dblink
grant create public database link to [username];
3. Create dblink
create database link [名称]
connect to [账户] identified by [密码]
using '(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = IP地址)(PORT = 端口号)))(CONNECT_DATA =(SERVICE_NAME = 实例名)))';
4. Query dblink
select t.db_link, t.username, t.host, t.created from user_db_links t
5. Use dblink
select t.tname, t.tabtype from tab@QZJ_IDC t
4. Reference materials
Copyright statement: This article is an original article by CSDN blogger "Yang Qun". It follows the CC 4.0 BY-SA copyright agreement and was first published on CSDN on September 10, 2023. Please attach the original source link and this statement when reprinting.
Original link: https://blog.csdn.net/u011046671