Tuesday, November 8, 2011

Open up Network access in Oracle 11g in 3 lines of code

If you want to quickly open up internet access to an Database User in Oracle 11g, here is the 3 lines of code you need to execute (Of course as SYSTEM or SYS)


BEGIN
  DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('allow_access.xml','Allows Users to access internet using UTL_HTTP', 'SCOTT', TRUE, 'connect');
  DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('allow_access.xml' ,' SCOTT', TRUE, 'resolve');
  DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('allow_access.xml','*');
  COMMIT;
END;
/


This will allow DB User SCOTT to access any websites using UTL_HTTP.

Note: This is not advisable on a production and you may have to restrict access based on website and port.

More details at: http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_networkacl_adm.htm

No comments:

Post a Comment