Wednesday, January 20, 2010

Allow 11g to access UTL_SMTP

SELECT owner, name, referenced_name FROM DBA_DEPENDENCIES
WHERE referenced_name IN ('UTL_TCP','UTL_SMTP','UTL_MAIL','UTL_HTTP','UTL_INADDR')
AND owner NOT IN ('SYS','PUBLIC','ORDPLUGINS');

begin
dbms_network_acl_admin.create_acl (
acl => 'utl_smtp.xml',
description => 'utl_smtp',
principal => 'ORADBA',
is_grant => TRUE,
privilege => 'connect',
start_date => null,
end_date => null
);
commit;
end;
/


begin
dbms_network_acl_admin.add_privilege (
acl => 'utl_smtp.xml',
principal => 'USER2',
is_grant => TRUE,
privilege => 'connect',
start_date => null,
end_date => null);
commit;
end;
/

begin
dbms_network_acl_admin.assign_acl (
acl => 'utl_smtp.xml',
host => 'mysmtpserver',
lower_port => 1,
upper_port => 1024);
commit;
end;
/