tags:

views:

3176

answers:

7

Hi everyone,

I'm having a bit of trouble with the UTL_MAIL package in Oracle 10g, and was wondering if anyone had any solutions?

I connect to my DB as SYSMAN and load the following two scripts;

@C:\oracle\product\10.2.0\db_1\rdbms\admin\utlmail.sql

@C:\oracle\product\10.2.0\db_1\rdbms\admin\prvtmail.plb

I set up the SMTP server;

ALTER SYSTEM SET smtp_out_server='mymailserver.fake:25' SCOPE=BOTH;

I grant the user the required permission;

GRANT execute ON 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;

PLS-00201: identifier 'UTL_MAIL.SEND' must be declared

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.

Is there a way to install these scripts so that they are accessible universally, and do not require the SYSMAN prefix to execute?

Cheers,

Chris

+3  A: 

Sounds like you need to create a PUBLIC SYNONYM for the package..

CREATE PUBLIC SYNONYM UTL_MAIL FOR SYSMAN.UTL_MAIL;
cagcowboy
A: 

That could be workable, thanks.

However, I'd really prefer it if I could figure out a way to access this package in the same way as any of the other Oracle-supplied packages (without any special prefix or synonyms).

I'm trying to understand what is different from say, the UTL_SMTP package which is installed by default and doesn't require a prefix, and the UTL_MAIL package, which is installed manually and does need the prefix. Is it the fact that it's installed manually that causes this difference? Do you know if there's a different way to install it, or a difference privilege to grant, which would remove the need for this SYSMAN. prefix?

Thanks for your help, much appreciated.

C.McAtackney
+4  A: 

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

cagcowboy
A: 

Great, you were right. Those other packages were all listed there as synonyms of SYS..

Cheers mate, very much appreciated.

C.McAtackney
A: 

logon as sys and run the scripts

A: 

try ALTER SYSTEM SET smtp_out_server='mymailserver.fake:25' SCOPE=BOTH; as the user you are running the procedure not as sys.

ie. connect to MYTABLESPACE as MYUSER and run the alter session Hope am clear

KkK
A: 

Can somebody please advice using special character in message body is allowed or not? I am using a word "month's" in the nessage body but it is getting replaced by "month?s" in the email. Please HELP!!!!

Amol
-> question http://stackoverflow.com/questions/2234055/using-utl-mail-package-to-send-email-on-oracle-10g-grid
Jeffrey Kemp