Oracle 10g - UTL_MAIL 包
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/197097/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Oracle 10g - UTL_MAIL package
提问by Christopher McAtackney
I'm having a bit of trouble with the UTL_MAIL package in Oracle 10g, and was wondering if anyone had any solutions?
我在使用 Oracle 10g 中的 UTL_MAIL 包时遇到了一些麻烦,想知道是否有人有任何解决方案?
I connect to my DB as SYSMAN and load the following two scripts;
我以 SYSMAN 身份连接到我的数据库并加载以下两个脚本;
@C:\oracle\product\10.2.0\db_1\rdbms\admin\utlmail.sql
@C:\oracle\product\10.2.0\db_1\rdbms\admin\utlmail.sql
@C:\oracle\product\10.2.0\db_1\rdbms\admin\prvtmail.plb
@C:\oracle\product\10.2.0\db_1\rdbms\admin\prvtmail.plb
I set up the SMTP server;
我设置了 SMTP 服务器;
ALTER SYSTEM SET smtp_out_server='mymailserver.fake:25' SCOPE=BOTH;
更改系统设置 smtp_out_server='mymailserver.fake:25' SCOPE=BOTH;
I grant the user the required permission;
我授予用户所需的权限;
GRANT execute ON utl_mail TO MYUSER;
GRANT 执行 utl_mail TO MYUSER;
But then if I connect to the "MYTABLESPACE" (where MYUSER exists), I get the following error if I make reference to UTL_MAIL.SEND;
但是,如果我连接到“MYTABLESPACE”(存在 MYUSER 的地方),如果我引用 UTL_MAIL.SEND,则会出现以下错误;
PLS-00201: identifier 'UTL_MAIL.SEND' must be declared
PLS-00201:必须声明标识符“UTL_MAIL.SEND”
If I prefix it with SYSMAN though (SYSMAN.UTL_MAIL.SEND), it works, but I don't want to do this as this procedure that contains this call has no knowledge of the tablespace which installed the scripts.
如果我用 SYSMAN 作为前缀(SYSMAN.UTL_MAIL.SEND),它可以工作,但我不想这样做,因为包含此调用的这个过程不知道安装脚本的表空间。
Is there a way to install these scripts so that they are accessible universally, and do not require the SYSMAN prefix to execute?
有没有办法安装这些脚本,以便它们可以普遍访问,并且不需要 SYSMAN 前缀来执行?
Cheers,
干杯,
Chris
克里斯
回答by cagcowboy
I'm pretty sure that public synonyms will be the only difference.
我很确定公共同义词将是唯一的区别。
SELECT * FROM ALL_SYNONYMS WHERE OWNER = 'PUBLIC' and table_name LIKE 'UTL%'
will confirm or deny
将确认或否认
回答by cagcowboy
Sounds like you need to create a PUBLIC SYNONYM for the package..
听起来您需要为包创建一个公共同义词..
CREATE PUBLIC SYNONYM UTL_MAIL FOR SYSMAN.UTL_MAIL;
回答by KkK
try ALTER SYSTEM SET smtp_out_server='mymailserver.fake:25' SCOPE=BOTH;
as the user you are running the procedure not as sys.
ALTER SYSTEM SET smtp_out_server='mymailserver.fake:25' SCOPE=BOTH;
以您正在运行该程序的用户身份而不是 sys.path 身份尝试。
ie.
connect to MYTABLESPACE as MYUSER
and run the alter session
Hope am clear
IE。连接MYTABLESPACE as MYUSER
并运行更改会话希望很清楚
回答by KkK
logon as sys and run the scripts
以 sys 身份登录并运行脚本