Oracle: How do I add users to the HTTP ACL in Oracle 11? How do I add a user to the network ACL (access control list)?

When running this code

declare
    req utl_http.req;
begin
    req := utl_http.begin_request('http://example.com');
end;


I receive this error.

ORA-24247: network access denied by access control list (ACL)
First, see if you have an ACL for port 80, the HTTP port.  If you do, it should look something like  this.

select * from dba_network_acls;

HOST     LOWER_PORT UPPER_PORT ACL                     ACLID                                                                                                                                                                                                
---      ---------- ---------- ---                     -----
*        80         80         /sys/acls/www.xml       1FBEC09C32D78F5AE05335D6488A7883                                                                                                                                                         


If you need to recreate it, you can drop it with this command:

dbms_network_acl_admin.drop_acl('www.xml');


Create the ACL:

 dbms_network_acl_admin.create_acl(
     acl =&gt; 'www.xml',
     description =&gt; 'WWW ACL',
     principal =&gt; 'SCOTT',
     is_grant =&gt; true,
     privilege =&gt; 'connect'
 );


Assign hosts and ports to the ACL:

 dbms_network_acl_admin.assign_acl(
     acl =&gt; 'www.xml',
     host =&gt; '*',
     lower_port =&gt; 80
 );


Add users to the ACL:

 dbms_network_acl_admin.add_privilege(
     acl =&gt; 'www.xml',
     principal =&gt; 'OE',
     is_grant =&gt; true,
     privilege =&gt; 'connect'
 );



  version note: kevinsky points out that this is applicable for Oracle 11 but that it has changed in Oracle 12.