dblink creation
在想要使用dlink的数据库上执行,下面为目标库的一些配置信息
create database link d_erp (dlink名称)
connect to userName(目标用户名) identified by password(目标库密码) using '
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = 192.168.1.100) --目标库地址
(PORT = 1521)) )
(CONNECT_DATA =
(SERVICE_NAME = orcl) -- orcl 为目标库sid
) )';
————————————————
local to the hr schema on the local database:
CREATE DATABASE LINK local
CONNECT TO hr IDENTIFIED BY hr
USING 'local';
After this database link is created, hr can query tables in the schema hr on the local database in this manner:
SELECT * FROM employees@local;
User hr can also use DML statements to modify data on the local database:
INSERT INTO employees@local
(employee_id, last_name, email, hire_date, job_id)
VALUES (999, 'Claus', 'sclaus@oracle.com', SYSDATE, 'SH_CLERK');
UPDATE jobs@local SET min_salary = 3000
WHERE job_id = 'SH_CLERK';
DELETE FROM employees@local
WHERE employee_id = 999;
Using this fixed database link, user hr on the remote database can also access tables owned by other users on the same database. This statement assumes that user hr has SELECT privileges on the oe.customers table. The statement connects to the user hr on the local database and then queries the oe.customers table:
SELECT * FROM oe.customers@local;
Defining a CURRENT_USER Database Link: Example The following statement defines a current-user database link to the remote database, using the entire service name as the link name:
CREATE DATABASE LINK remote.us.oracle.com
CONNECT TO CURRENT_USER
USING 'remote';
————————————————
版权声明:本文为CSDN博主「arthur.dy.lee」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/paincupid/article/details/9005673
版权声明:本文为CSDN博主「arthur.dy.lee」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/paincupid/article/details/9005673
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 没有源码,如何修改代码逻辑?
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战