Wednesday, December 27, 2017

ORA-29273: HTTP request failed , ORA-06512: at "SYS.UTL_HTTP", ORA-29273: HTTP request failed, ORA-24247: network access denied by access control list (ACL)

ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1525
ORA-29261: bad argument

ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1130
ORA-24247: network access denied by access control list (ACL)

ORA-06512: at "SYS.DBMS_ISCHED", line 196
ORA-06512: at "SYS.DBMS_SCHEDULER", line 486
ORA-06512: at line 8
29273. 00000 -  "HTTP request failed"

Do this
grant execute on utl_http to username;
grant execute on utl_smtp to username;
grant execute on  utl_tcp to username;

Check ACL

SELECT host, lower_port, upper_port, acl FROM   dba_network_acls;

SELECT acl,
       principal,
       privilege,
       is_grant,
       TO_CHAR(start_date, 'DD-MON-YYYY') AS start_date,
       TO_CHAR(end_date, 'DD-MON-YYYY') AS end_date
FROM   dba_network_acl_privileges;

SELECT host, lower_port, upper_port, privilege, status
FROM   user_network_acl_privileges;


Create ACL

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

Add privs


 begin
     dbms_network_acl_admin.add_privilege (
       acl         => 'utl_http.xml',
      principal   => 'username',
       is_grant    => true,
      privilege   => 'connect',
      position    => null,
       start_date  => null,
       end_date    => null);

    commit;
   end;
   /
 
    begin
     dbms_network_acl_admin.add_privilege (
       acl         => 'utl_http.xml',
      principal   => 'username',
       is_grant    => true,
      privilege   => 'resolve',
      position    => null,
       start_date  => null,
       end_date    => null);

    commit;
   end;
   /
 
   IF want to delete

    begin
     dbms_network_acl_admin.delete_privilege (
      acl        => 'utl_http.xml',
      principal   => 'username',
      is_grant    => false,
      privilege   => 'connect');

    commit;
   end;
   /
 
Assign

BEGIN
 DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL (
  acl => 'utl_http.xml',
  host => '*.oraclecloud.com',
  lower_port => NULL,
  upper_port => NULL);
END;

BEGIN
 DBMS_NETWORK_ACL_ADMIN.unassign_ACL (
  acl => 'utl_http.xml',
  host => '*.oraclecloud.com',
  lower_port => 80,
  upper_port => 443);
END;


TEST
SELECT host, lower_port, upper_port, acl FROM   dba_network_acls;

SELECT acl,
       principal,
       privilege,
       is_grant,
       TO_CHAR(start_date, 'DD-MON-YYYY') AS start_date,
       TO_CHAR(end_date, 'DD-MON-YYYY') AS end_date
FROM   dba_network_acl_privileges;

SELECT host, lower_port, upper_port, privilege, status
FROM   user_network_acl_privileges;


select utl_http.request('https://oraclecloud.com') from dual;


Reference
https://oracle-base.com/articles/11g/fine-grained-access-to-network-services-11gr1
http://www.dba-oracle.com/t_11g_new_acls_plsql.htm
https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:9526497800346930725







No comments:

Post a Comment

AWS how to delete VPC when it has error with Network interface , Gateway decencies

   how to delete VPC when it has error with Network interface , Gateway decencies  in AWS 1. Check if it is running on EC2 instance then Sto...