通过代理通过名称中包含特殊字符的其他用户授予用户连接权:
CREATE USER "A-USER" IDENTIFIED BY "a";
CREATE USER foo IDENTIFIED BY "random-trash";
ALTER USER foo GRANT CONNECT THROUGH "A-USER";
现在我正在努力创建一个指向此的数据库链接:
CREATE PUBLIC DATABASE LINK dbl CONNECT TO A-USER[FOO] IDENTIFIED BY "a";
-- ... but it complains about '-'
CREATE PUBLIC DATABASE LINK dbl CONNECT TO "A-USER[FOO]" IDENTIFIED BY "a";
-- ... but it treats whole "A-USER[FOO]" as a username
CREATE PUBLIC DATABASE LINK dbl CONNECT TO "A-USER"[FOO] IDENTIFIED BY "a";
-- ... but it expects IDENTIFIED right after closing quote
除了显然摆脱用户名中的特殊字符外,有没有我可以使用的符号?
答案 0 :(得分:2)
这应该有效,有或没有特殊字符;这是在11.2.0.3中,首先没有:
CREATE USER "AUSER" IDENTIFIED BY "a";
CREATE USER bar IDENTIFIED BY "random-trash";
ALTER USER bar GRANT CONNECT THROUGH "AUSER";
GRANT CREATE SESSION TO "AUSER";
GRANT CREATE SESSION TO "BAR";
CREATE PUBLIC DATABASE LINK dbl CONNECT TO "AUSER[BAR]" IDENTIFIED BY "a" using 'MYDB';
SELECT * FROM dual@dbl;
D
-
X
并且:
CREATE USER "A-USER" IDENTIFIED BY "a";
CREATE USER foo IDENTIFIED BY "random-trash";
ALTER USER foo GRANT CONNECT THROUGH "A-USER";
GRANT CREATE SESSION TO "A-USER";
GRANT CREATE SESSION TO "FOO";
DROP PUBLIC DATABASE LINK dbl;
CREATE PUBLIC DATABASE LINK dbl CONNECT TO "A-USER[FOO]" IDENTIFIED BY "a" using 'MYDB';
SELECT * FROM dual@dbl;
D
-
X
两者都不适用于11.2.0.4;有或没有特殊字符的错误:
select * from dual@dbl
*
ERROR at line 1:
ORA-01017: invalid username/password; logon denied
ORA-02063: preceding line from DBL
如果您使用11.2.0.4或更高版本,那么您可能会遇到错误19191702,这似乎已通过数据库链接破坏了代理功能。有关更多信息,请参见MOS注释19191702.8。这似乎是故意的新行为,而不是一个错误,而旧的行为 - 这在哪里工作 - 被描述为不正确。
可能有一个补丁可用于设置特定事件以恢复行为(并且它应该在12.2中可用),但作为"允许现有应用程序的临时解决方案,依赖于[旧]不正确的行为,继续工作"。如果您的平台和版本没有补丁或事件没有帮助,那么您需要提出服务请求;无论如何当然可能值得提升一个。