1

一个用户被授权通过另一个名称包含特殊字符的用户通过代理连接:

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

除了明显摆脱用户名中的特殊字符外,还有什么我可以使用的符号吗?

4

1 回答 1

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 中可用),但作为“允许现有应用程序的临时解决方案,依赖于 [旧] 不正确的行为,继续工作”。如果您的平台和版本没有补丁或者事件没有帮助,那么您需要提出服务请求;当然,它可能值得培养一个。

于 2015-11-09T17:26:01.373 回答