Bajwa Consulting Need senior Oracle DBA help? Performance tuning, Cloud migrations, GoldenGate, backup and DR. Plus 70+ free DBA scripts.
Visit bajwaconsulting.com →

Wednesday, January 21, 2015

How to create ACL for database user



Anytime you want to use UTL_SMTP, DBMS_LDAP, UTL_HTTP anything related to do with network (including web, ldap).  You need to do 

1.       Make sure that XDB database option is installed.
2.       Do the following for each schema
---- Create the ACL
begin
dbms_network_acl_admin.create_acl (
acl => 'mailserver_acl.xml',
description => 'ACL for user to connect to my email  SMTP Server',
principal => 'DB_USER',
is_grant => TRUE,
privilege => 'connect');
end;
/
commit;
--- Assign the ACL
begin
dbms_network_acl_admin.assign_acl (
acl => 'mailserver_acl.xml',
host => 'smtp.mymailserver.com',
lower_port => 25);   ß default port
end;
/
commit;

--- Add a privilege to grant/deny

begin
dbms_network_acl_admin.add_privilege (
acl => 'mailserver_acl.xml',
principal => 'DB_USER',
is_grant => TRUE,
privilege => 'connect');
end;
/
commit;

No comments:

Post a Comment