Showing posts with label Oracle. Show all posts
Showing posts with label Oracle. Show all posts

Thursday, March 13, 2014

DBMS Network ACL of HTTP call using UTL_HTTP in oracle


Oracle allows access to external network services using several PL/SQL APIs (UTL_TCPUTL_SMTPUTL_MAILUTL_HTTP and UTL_INADDR), all of which are implemented using the TCP protocol. In previous versions of the database, access to external services was effectively an on/off switch based on whether a user was granted execute permissions on a specific package or not. Oracle 11g introduces fine grained access to network services using access control lists (ACL) in the XML DB repository, allowing control over which users access which network resources, regardless of package grants.

Access control lists are manipulated using the DBMS_NETWORK_ACL_ADMIN package. reference

Scripts :



begin
dbms_network_acl_admin.create_acl (
   acl          => 'networkacl.xml',
   description  => 'Allow Network Connectivity',
   principal    => 'PUBLIC',
   is_grant     => TRUE,
   privilege    => 'connect',
   start_date   => SYSTIMESTAMP,
   end_date     => NULL);

dbms_network_acl_admin.assign_acl (
   acl         => 'networkacl.xml',
   host        => '*',
   lower_port  => NULL,
   upper_port  => NULL);

commit;
end;

Monday, November 18, 2013

Create New Schema in Oracle

Step One : Create Table Space


CREATE TABLESPACE SPR_DATA  DATAFILE 
'location in local hard disk\SPR_DATA_01.DBF'
SIZE 1000M EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE     
MANAGEMENT AUTO;

Step Two: Create User

CREATE USER sprora IDENTIFIED BY "sprora" DEFAULT TABLESPACE SPR_DATE;

Step Three: Giving Permission

GRANT CONNECT TO sprora;
ALTER USER SPRORA QUOTA UNLIMITED ON SPR_DATA;
GRANT CREATE TABLE TO SPRORA;
GRANT DBA TO SPRORA; 
GRANT CREATE SESSION,CREATE TABLE,CREATE SEQUENCE,CREATE VIEW TO sprora; 
GRANT EXECUTE ON DBMS_SQLHASH TO  sprora;
GRANT EXECUTE ON DBMS_LOCK TO sprora;
GRANT DEBUG CONNECT SESSION TO sprora; 
GRANT DEBUG ANY PROCEDURE TO sprora;

Step Four: Connect as new user and create test table

CONNECT sprora/sprora
CREATE TABLE TEST (CITY varchar2(32), POPULATION number);
INSERT INTO TEST (CITY, POPULATION) values ('edmonton', 10);
INSERT INTO TEST (CITY, POPULATION) values ('vancouver', 20);
COMMIT;

Now test newly created table using select query :
SELECT * FROM TEST