创建dblink:
create database link [name]
connect to [username] IDENTIFIED BY [password]
using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = [ip])(PORT = [port]))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = xxx)
)
)';
删除dblink:
DROP DATABASE LINK [name];
--或
DROP PUBLIC DATABASE LINK [name];
今天在试着删除的时候报错:
ORA-02018:database link of same name has an open connection
关闭dblink:
ALTER SESSION CLOSE DATABASE LINK [name];
但是报错:
ORA-02080: database link is in use
去v$dblink查看
SELECT * FROM v$dblink;
该dblink确实没有在transaction,很疑惑。搜一下没找到解决办法,然后把plsql关了,过一会再开,执行ALTER SESSION的时候,报错:
ORA-02080: database link is not open
我知道这时应该可以删除了, 然后再DROP,可以了。
本文讨论了在Oracle数据库中遇到删除dblink时报错ORA-02018和ORA-02080的解决方案。通过关闭并重新打开PL/SQL环境,最终成功删除了dblink。
3475

被折叠的 条评论
为什么被折叠?



