Showing posts with label Oracle 11g tips and tricks. Show all posts
Showing posts with label Oracle 11g tips and tricks. Show all posts

Tuesday, February 5, 2008

What CPU Jan 2008 Patch will not tell you

What CPU Jan 2008 Patch will not tell you

File system space :- opatch suppose to check files system space as a part of Running prerequisite checks... and start apply patch when enough space is there.

Patching component oracle.rdbms, 11.1.0.6.0...

Updating archive file "/u01/app/oracle/product/11.1.0.6/lib/libserver11.a" with "lib/libserver11.a/kzsr.o"
Updating archive file "/u01/app/oracle/product/11.1.0.6/lib/libserver11.a" with "lib/libserver11.a/kzu.o"

The following actions have failed:

Archive not applied /home/oracle/patch/CPU2008/6646866/6650135/files/lib/libserver11.a/kzsr.o to /u01/app/oracle/product/11.1.0.6/lib/libserver11.a... ''

Archive not applied /home/oracle/patch/CPU2008/6646866/6650135/files/lib/libserver11.a/kzu.o to /u01/app/oracle/product/11.1.0.6/lib/libserver11.a... ''

Do you want to proceed? [yn]

Well I came out with N option. When we started opatch again , it gave error some thing like spacecheck fail.

So make sure you have enough space on file system.

In case of RAC database, CPU patch readme.txt will not tell you that one need to set cluster_database = false , before starting database in upgrade mode(“startup upgrade”). For compiling views and objects.

So make sure, in RAC environment you have set cluster_database = false before starting database in upgrade mode

Wednesday, August 22, 2007

SQL Performance Analyzer (SPA) Part - 2

Case: - You want to adjust some parameters in production and you want to check how over all application going to run i.e. is SQL performance improved or it degrade ?

Solution: - Oracle 11g nw features SQL Performance Analyzer (SPA) analyze the SQL performance impact of any type of system changes. SQL Performance Analyzer automates the process of assessing the overall effect of a change on the full SQL workload by identifying performance divergence for each statement.

SPA report that shows the net impact on the workload performance due to the change is provided. For regressed SQL statements, SQL Performance Analyzer also provides appropriate executions plan details along with tuning recommendations. As a result, DBAs can remedy any negative outcome before their end users are affected and can validate, with significant time and cost savings, that the system change to the production environment will result in net improvemengt


The steps of the SQL Performance Analyzer workflow are as follows:

  1. Capture SQLs on Production Database
  2. Move SQLs to Test Database
  3. Create a SQL Performance Analyzer task on the test system
  4. Generate and store the query execution statistics before the change.
  5. Make changes (Database upgrade to 11g , parameter changes etc)
  6. Generate and store the query execution statistics after the change.
  7. Compare Performance
  8. Generate Report

1) Capture SQL ( Steps on production)

exec dbms_sqltune.drop_sqlset('STS_RAG_CMUL');

exec dbms_sqltune.create_sqlset('STS_RAG_CMUL');

DECLARE
sts_cmul VARCHAR2(30) := 'STS_RAG_CMUL';

BEGIN

dbms_sqltune.capture_cursor_cache_sqlset(sts_cmul,750000,1,
'MERGE',dbms_sqltune.MODE_ACCUMULATE_STATS);

END;
/

capture_cursor_cache_sqlset : The procedure captures a workload from the cursor cache into a SQL tuning set, polling the cache multiple times over a time period and updating the workload data stored there. It can execute over as long a period as required to capture an entire system workload.

  • time_limit : 750000 ( The total amount of time, in seconds, to execute )
  • repeat_interval : 1 ( The amount of time, in seconds, to pause between sampling )
  • capture_option During capture, either insert new statements, update existing ones, or both.
  • 'INSERT'
  • 'UPDATE',
  • 'MERGE'
  • capture_mode capture Option (UPDATE and MERGE capture options).

MODE_REPLACE_OLD_STATS - Replace statistics when the number of executions seen is greater than that stored in the SQL tuning set

MODE_ACCUMULATE_STATS - Add new values to current values for SQL we already store. Note that this mode detects if a statement has been aged out, so the final value for a statistics will be the sum of the statistics of all cursors that statement existed under.

The CAPTURE_CURSOR_CACHE_SQLSET function enables the capture of the full
system workload by repeatedly polling the cursor cache over a specified interval.
This function is a lot more efficient than repeatedly using the SELECT_CURSOR_
CACHE and LOAD_SQLSET procedures to capture the cursor cache over an
extended period of time. This function effectively captures the entire workload, as
SQL Profiles opposed to the AWR—which only captures the workload of high-load SQL
statements—or the LOAD_SQLSET procedure, which accesses the data source only
once.

2) Move SQLs to test system

Steps on production database

Create staging table for STS and pack STS data into staging table and import the staging table

a) Create a staging table

exec dbms_sqltune.create_stgtab_sqlset('SQLSET_TAB');

b) Pack the sqlset in a staging table

exec dbms_sqltune.pack_stgtab_sqlset('STS_RAG_CMUL','APPS','SQLSET_TAB','APPS');

c) Export the staging table

exp apps/apps file=sqlset_tab.dmp tables=sqlset_tab

Steps on test database

Import staging table and unpack staged data in STS

d) Import the staging table in the target database

imp apps/apps file=sqlset_tab.dmp full=y

e) unpack the staging table into sqlset

exec dbms_sqltune.drop_sqlset('STS_RAG_CMUL');

exec dbms_sqltune.create_sqlset('STS_RAG_CMUL');

exec dbms_sqltune.UNPACK_STGTAB_SQLSET(
SQLSET_NAME=>'%',
SQLSET_OWNER=>'APPS',
REPLACE=>true,
STAGING_TABLE_NAME=>'SQLSET_TAB',
STAGING_SCHEMA_OWNER=>'APPS'
);

3) Create a SQL Performance Analyzer task on the test system

Create a SQL Performance Analyzer task on the test system using the
SQL Tuning Set as its input source.

var l_task_id char(30)
begin
:l_task_id:=dbms_sqlpa.create_analysis_task(sqlset_name =>
'STS_RAG_CMUL',task_name => 'MY_REPLAY_TASK');
end;
/

>

Since we processing whole system load, So TIME_LIMIT
need to increase


exec dbms_sqltune.set_tuning_task_parameter('MY_REPLAY_TASK',
'LOCAL_TIME_LIMIT',60);

exec dbms_sqltune.set_tuning_task_parameter('MY_REPLAY_TASK',
'TIME_LIMIT',200000000000);

The time_limit parameter specifies the global time limit to process all SQL
statements in a SQL Tuning Set beforetiming out.

The local_time_limit parameter specifies the time limit to process each SQL
statement in a SQL Tuning Set before timing out.

4)Generate and store the query execution statistics before the change


Use SQL Performance Analyzer to build the pre-change performance data by executing the
SQL statements stored in the SQL Tuning Set.


Begin
DBMS_SQLPA.EXECUTE_ANALYSIS_TASK(task_name => 'MY_REPLAY_TASK',execution_type => 'TEST EXECUTE',execution_name => 'MY_REPLAY_EXECUTE_BEFORE');
end;
/


Check status of Analysis task

SQL> col TASK_NAME format a30

SQL> col EXECUTION_NAME for a30

SQL> l
select execution_name, status, execution_end
from DBA_ADVISOR_EXECUTIONS
where task_name='MY_REPLAY_TASK'
order by execution_end

SQL> /

EXECUTION_NAME STATUS EXECUTION_END

-------------------- --------------------------- ---------------
MY_REPLAY_EXECUTE_BEFORE EXECUTING

--Check time

SQL> select TASK_ID,TASK_NAME,TASK_NAME , STATUS
FROM USER_ADVISOR_TASKS
WHERE task_name = 'MY_REPLAY_TASK';

TASK_ID TASK_NAME TASK_NAME STATUS
---------- -------------------- -------------------- --------------
244563 MY_REPLAY_TASK MY_REPLAY_TASK EXECUTING


SQL> SELECT sofar, totalwork
FROM V$ADVISOR_PROGRESS
where TASK_ID=244563;

SOFAR TOTALWORK
---------- ----------
142 100630

5) Make database Changes

alter system set "_b_tree_bitmap_plans" = false;

--- More application change
--- Stats collection- etc

6) Generate and store the query execution statistics after the change.

Use SQL Performance Analyzer to build the post-change performance data
by re-executing the SQL statements in the SQL Tuning Set on the post-change
test system.

Begin

DBMS_SQLPA.EXECUTE_ANALYSIS_TASK(task_name => 'MY_REPLAY_TASK',execution_type => 'TEST EXECUTE',
execution_name => 'MY_REPLAY_EXECUTE_after');

end;
/

7) Compare execution plans

Use SQL Performance Analyzer to compare and analyze
the pre-change and post-change versions of performance data

Begin

DBMS_SQLPA.EXECUTE_ANALYSIS_TASK(task_name => 'MY_REPLAY_TASK',execution_type => 'COMPARE PERFORMANCE',
execution_name => 'MY_COMPARE_EXECUTION');

end;
/

8) Compare the execution changes due to your database changes

Generate a report to identify the SQL statements in the
SQL workload that have improved, remained unchanged, or
regressed after the system change. Review the report and
interpret the results.

--Displaying the Results of a SQL Tuning Task

set serveroutput on size 999999
set long 999999

select DBMS_SQLPA.REPORT_ANALYSIS_TASK('MY_REPLAY_TASK')from dual;

-- [ Click Here for Sample Report of above command ]OR


var rep CLOB;
EXEC :rep := DBMS_SQLPA.REPORT_ANALYSIS_TASK('MY_REPLAY_TASK', -
'text', 'typical', 'summary');

SET LONG 100000 LONGCHUNKSIZE 100000 LINESIZE 130

PRINT :rep


--Note above commands will take few Min.

>

exec dbms_sqlpa.DROP_ANALYSIS_TASK('MY_REPLAY_TASK');


>

Some more article on 11g 

1. Oracle 11g TOP feature for DBA

2.11g Automatic Diagnostic Repository (ADR)

3. Sql Performance Analyzer (SPA) Part 1

4. Sql Performance Analyzer (SPA) Part 2

Sunday, August 12, 2007

Oracle SQL REPLAY & Sql Performance Analyzer(SPA) Part 1

Oracle SQL REPLAY Part 1
Virag Sharma virag123@gmail.com


You can use Sql Performance Analyzer (SPA) to analyze the SQL performance impact of any type of system changes.

  • Implementation of tuning recommendations ( like parameter changes )
  • Schema changes (eg Application Patch )
  • Statistics gathering
  • Database upgrades
  • OS/hardware changes

SQL Performance Analyzer allows for the comparison of SQL performance statistics before and after changes and provide comparison report.

Steps for SQL REPLAY

  1. Collect Sqls
  2. Create the SQL Replay Task with SQL Tuning Set (STS)
  3. Collect SQL Performance Before Changes
  4. Make Database Change ( eg collect stats etc)
  5. Collect SQL Performance After Changes
  6. Comparing SQL Performance Before and After Change
  7. Display the Results of a SQL Replay Task


    Steps in details

1. Collect SQL

To create an SQL Tuning Set (STS)

exec dbms_sqltune.create_sqlset ('MYSQLSET');

PL/SQL procedure successfully completed.

Collect sqls in the SQL Tuning Set(STS) with all queries from the cursor cache.
You can call the procedure multiple times to add new SQL statements or replace
attributes of existing statements.

DECLARE

cur dbms_sqltune.sqlset_cursor;

BEGIN

OPEN cur FOR
SELECT VALUE(p)
FROM TABLE (dbms_sqltune.select_cursor_cache) p;

dbms_sqltune.load_sqlset(
sqlset_name => 'MYSQLSET',
populate_cursor => cur);
END;

/

Collect sql mentioned in AWR as well , You populate the tuning set with 'ACCUMULATE' as yourupdate_option because it is assumed the cursors currently in the cache had aged out since the snapshot was taken.

DECLARE
cur DBMS_SQLTUNE.SQLSET_CURSOR;
BEGIN

OPEN cur FOR
SELECT VALUE(P)
FROM table(
DBMS_SQLTUNE.SELECT_WORKLOAD_REPOSITORY(1,100) P;

DBMS_SQLTUNE.LOAD_SQLSET(sqlset_name => 'MYSQLSET',
populate_cursor => cur,
load_option => 'MERGE',
update_option => 'ACCUMULATE');

END;

Note 1 is start snap id and 100 is END snap ID

  1. Create the SQL Replay Task with SQL Tuning Set (STS)

Create the SQL Replay Task with SQL Tuning Set(STS) named MYSQLSET

var l_task_id char(30)
begin
:l_task_id:=dbms_sqlpa.create_analysis_task(
sqlset_name => 'MYSQLSET',
task_name => 'MY_REPLAY_TASK');
end;

/

Collect SQL Performance data Before Changes

begin
DBMS_SQLPA.EXECUTE_ANALYSIS_TASK(
task_name => 'MY_REPLAY_TASK',
execution_type => 'TEST EXECUTE',
execution_name => 'MY_REPLAY_EXECUTE_BEFORE');
end;
/

  1. Make Database Change ( eg collect stats etc)

Make application , database changes

alter system set "_b_tree_bitmap_plans" = false;

alter system set optimizer_index_cost_adj=15

  1. Collect SQL Performance After Changes
begin
DBMS_SQLPA.EXECUTE_ANALYSIS_TASK(
task_name => 'MY_REPLAY_TASK',
execution_type => 'TEST EXECUTE',
execution_name => 'MY_REPLAY_EXECUTE_after');
end;
/

  1. Comparing SQL Performance Before and After Change

Analyze the Performance (Improvement or regressions)

begin
DBMS_SQLPA.EXECUTE_ANALYSIS_TASK(
task_name => 'MY_REPLAY_TASK',
execution_type => 'COMPARE PERFORMANCE',
execution_name => 'MY_COMPARE_EXECUTION');
end;

  1. Display the Results of a SQL Replay Task


-- Checking the Status of a SQL Tuning Task

SELECT status FROM USER_ADVISOR_TASKS WHERE task_name = 'MY_REPLAY_TASK'

-- Checking the Progress of the SQL Tuning Advisor

SELECT sofar, totalwork FROM V$ADVISOR_PROGRESS WHERE task_name = 'MY_REPLAY_TASK'

--Displaying the Results of a SQL Tuning Task

set serveroutput on size 999999

set long 999999

select DBMS_SQLPA.REPORT_ANALYSIS_TASK('MY_REPLAY_TASK') from dual;

--Note above command will take few Min.

OR

VAR rep CLOB;
EXEC :rep := DBMS_SQLPA.REPORT_ANALYSIS_TASK('MY_REPLAY_TASK', -
'text', 'typical', 'summary');
SET LONG 100000 LONGCHUNKSIZE 100000 LINESIZE 130
PRINT :rep

- Sample Output of report

Projected Workload Change Impact:
-------------------------------------------
Overall Impact : 92.33%

REP
------------------------------------------------
Improvement Impact : 92.33%
Regression Impact : 0%

SQL Statement Count
-------------------------------------------
SQL Category SQL Count Plan Change Count
Overall 3813 0
Improved 2 0
Unchanged 3775 0
with Errors 36 0

In this article Sql Performance Analyzer Part 1,we just covered Sql Performance Analyzer (SPA) basic functionality , In part 2 I will cover more expects and case study of SPA

Some more article on 11g 

  1. Oracle 11g TOP feature for DBA
  2. 11g Automatic Diagnostic Repository (ADR)
  3. Sql Performance Analyzer (SPA) Part 1
  4. Sql Performance Analyzer (SPA) Part 2


SQL Tuning Information Views

· Advisor views,

  • DBA_ADVISOR_TASK
  • DBA_ADVISOR_EXECUTIONS,
  • DBA_ADVISOR_FINDINGS
  • DBA_ADVISOR_RECOMMENDATIONS
  • DBA_ADVISOR_RATIONALE views

· SQL tuning views,

  • DBA_SQLTUNE_STATISTICS
  • DBA_SQLTUNE_BINDS, and
  • DBA_SQLTUNE_PLANS views

· SQL Tuning Set views,

  • DBA_SQLSET,
  • DBA_SQLSET_BINDS,
  • DBA_SQLSET_STATEMENTS,
  • DBA_SQLSET_REFERENCES views.

· Captured execution plans for statements in SQL Tuning Sets

  • DBA_SQLSET_PLANS
  • USER_SQLSET_PLANS

· SQL tuning view,

  • V$SQL,
  • V$SQLAREA,
  • V$SQLSTATS,
  • V$SQL_BINDS views
· SQL Profile information is displayed in the DBA_SQL_PROFILES view.
The TYPE parameter shows if the SQL profile was created manually by the SQL Tuning Advisor (if TYPE = MANUAL) or automatically by automatic SQL tuning (if TYPE = AUTO).

· Advisor execution progress information is displayed in the V$ADVISOR_PROGRESS view.

References

Automatic SQL Tuning

Sunday, July 29, 2007

Oracle 11g IPS ( Incident Packaging Service)

Oracle 11g new Features , IPS ( Incident Packaging Service)

Virag Sharma virag123@gmail.com

To make oracle support better , oracle 11g introduce new feature / Service known IPS ( Incident Packaging Service ) . Basically it is a part/extention of Oracle 11g new feature ADR ( Automatic Diagnostic repository)[Click Here for details ]. ADR is new concept in oracle 11g and it is just a file based repository of diagnostic data. ADR gives lot fexibility to maintain / handle diagnostic data.

When critical errors(i.e Problem) are detected, they automatically create an “incident” ( one occurrence of problem is Incident i.e relation between problem and incident is one to many).
Information(trace ,dump ) related to the incident is automatically captured in file based repository known as ADR ( Automatic Diagnostic repository), all the incident related files are taged with Incident Number and certain health checks are run automatically. This information can be packaged to be sent to Oracle support

Incident Packaging Service (IPS) wraps up all information about an incidentand allows you to send the whole package to Oracle Support.

Here is steps to collect and send data to support using IPS


$ adrci
adrci> help ips
adrci> show incident
( For example above command show incident No 9817 for ORA-600 [XYZ] )

adrci> ips create package incident
9817 <= ( it will give package No.)
adrci> ips create package incident 9817
Created package 4 based on incident id 9817, correlation level typical


adrci>
ips add incident 9817 package 4
Added incident 9817 to package 4

adrci>

adrci>>ips add file
/u01/app/oracle/diag/rdbms/orcl2/orcl2/trace/alert_orcl2.log package 4

Added file /u01/app/oracle/diag/rdbms/orcl2/orcl2/trace/alert_orcl2.log to
package 4

adrci>>ips generate package 4 in /tmp
Generated package 4 in file /tmp/ORA600kci_20070514184516_COM_1.zip, mode
complete
adrci>>



Send above created file to Support


TAG = > Oracle 11g New Features , Oracle 11g tips and tricks, Oracle Database 11g New Features for DBA, Oracle Database 11g New Features


Friday, July 27, 2007

How to check alert.log in Oracle 11g

Virag Sharma virag123@gmail.com

Oracle 11g introduce new tool/utility called ADRCI known as ADR command line tool.
This tool allow user to interact with ADR ,check alert log, check health monitor(HM) status ,

Package incident and problem information into a zip file for send to Oracle Support. Etc.

No username/password need to log in to ADRCI, ADRCI interact with file system and ADR data is secured only by operating system permissions on the ADR directories.

$adrci
adrci> set editor vi
adrci> show alert ( it will open alert in vi editor )
adrci> show alert -tail ( Similar to Unix tail command )
adrci> show alert -tail 200 ( Similar to Unix Command tail -200 )
adrci> show alert -tail -f ( Similar to Unix command tail -f )

adrci> show alert -tail 100 -f ( Similar to tail -100f )


Too list all the "ORA-" error run following command

$adrci
adrci>
show alert -P "MESSAGE_TEXT LIKE '%ORA-%'"

>


In 11g alert file is saved in 2 location, one is in alert directory ( in XML format log.xml ) and
old style alert file in trace directory. Both these directory reside inside ADR HOME. ADR (
Automatic Diagnostic Repository ) is a file system based directory structure outside of the database, So you can have access of diagnostic data even database is down.

New initialization parameter
DIAGNOSTIC_DEST decide where to store ADR data ( i.e diagnostic data). In oracle 11g parameter background_dump_dest, core_dump_dest, user_dump_dest is replaced by DIAGNOSTIC_DEST. Even you set background_dump_dest, core_dump_dest, user_dump_dest it not going to used i.e. 11g ignore these parameters.

SQL> show parameter diagnostic_dest

NAME TYPE VALUE
--------------- --------------------------- -------------------------

diagnostic_dest string /u01/app/oracle



More Oracle Database 11g New Features

  1. Oracle SQL REPLAY

  2. IPS ( Incident Packaging Service)
  3. Automatic Diagnostic Repository (ADR)

  4. Database Replay [Click for Detail]

TAG = > Oracle 11g New Features , Oracle 11g tips and tricks , Oracle Database 11g New Features for DBA , Oracle Database 11g New Features

Saturday, July 14, 2007

Oracle 11g and ACL ( access control list )

Virag Sharma virag123@gmail.com
If your application code ( package , procedure , function ) uses utl_tcp , utl_smtp etc and you upgraded database to oracle 11g , then that code will not work even you gave execute permission on utl_tcp etc to user

You need execute addition steps and add user to ACL ( access control list )

How to check XML DB installed or not

.

SQL> select COMP_NAME, status from dba_registry;

COMP_NAME STATUS
-------------------------------------------- --------
Oracle Database Catalog Views VALID
Oracle Database Packages and Types VALID
Oracle Real Application Clusters VALID
Oracle XML Database VALID

...


How to install XML DB
If above query not show XML DB component then run following sql to install XML DB


sqlplus "/ as sysdba"
SQL>@?/rdbms/admin/catqm.sql

How to add user to ACL
Following example show , how add scott user to ACL

SQL> exec DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('MY.xml',
'Comments ..', 'SCOTT', TRUE, 'connect');

SQL>exec DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('MY.xml','*.abc.com');
SQL> Commit;

Note :- Don't forget to commit


As per Oracle 11g Upgrade manual

Configure Fine-Grained Access to External Network Services

Oracle Database 11g Release 1 (11.1) includes fine-grained access control to the UTL_TCP, UTL_SMTP, UTL_MAIL, UTL_HTTP, or UTL_INADDR packages using Oracle XML DB. If you have applications that use one of these packages, you must install Oracle XML DB if it is not already installed. You must also configure network access control lists (ACLs) in the database before these packages can work as they did in prior releases.

The following example first looks for any ACL currently assigned to host_name. If one is found, then the example grants user_name the CONNECT privilege in the ACL only if that user does not already have it. If no ACL exists for host_name, then the example creates a new ACL called ACL_name, grants the CONNECT privilege to user_name, and assigns the ACL to host_name.

DECLARE

acl_path VARCHAR2(4000);

BEGIN

SELECT acl INTO acl_path FROM dba_network_acls
WHERE host = 'host_name' AND lower_port
IS
NULL AND upper_port IS NULL;

IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(acl_path,
'user_name','connect') IS NULL THEN

DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl_path,
'user_name', TRUE, 'connect');

END IF;

EXCEPTION

WHEN no_data_found THEN

DBMS_

NETWORK_ACL_ADMIN.CREATE_ACL('ACL_name.xml',

'ACL description', 'user_name', TRUE, 'connect');

DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('ACL_name.xml','host_name');

END;

COMMIT;



UTL_TCP, UTL_HTTP, UTL_SMTP, UTL_MAIL, and UTL_INADDR PL/SQL Packages

A new security measure is introduced in this release for the following network-related
PL/SQL packages: UTL_TCP, UTL_HTTP, UTL_SMTP, UTL_MAIL, and UTL_INADDR.
The invoker of those packages needs additional privileges to connect to an external
host or to resolve the name or the IP address of a host. The packages check the
invoker for the necessary privileges only when the calls are made at runtime and
raises an exception if the invoker lacks the privileges. This new security measure is
implemented by XML DB's access control list (ACL) mechanism and, therefore,
requires XML DB to be installed in order to use those packages.

Each external host that a database user wants to connect to or to resolve the name
or IP address for from the database is restricted by an access control list (ACL).
To grant a user the privileges for the host, the database administrator should create
an ACL, add the privileges to the ACL for the user, assign the ACL to the host
and commit the changes using the DBMS_NETWORK_ACL_ADMIN PL/SQL package.
For example, to give the users SCOTT and ADAMS the permission to connect
to www.oracle.com via HTTP (namely to connect to TCP/IP port 80), the
database administrator should execute the following:

SQL> REM Creates a new ACL and adds SCOTT the privilege 
SQL> REM to the ACL to make TCP connections
SQL> EXECUTE DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('acl_for_oracle.xml', -
> 'ACL for www.oracle.com', 'SCOTT', TRUE, 'connect')
 
SQL> REM Adds ADAMS the privilege to the ACL to make TCP connections also
SQL> EXECUTE DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('acl_for_oracle.xml', -
> 'ADAMS', TRUE, 'connect')
 
SQL> REM Assigns the new ACL to www.oracle.com for TCP/IP port 80 (HTTP)
SQL> EXECUTE DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('acl_for_oracle.xml', -
> 'www.oracle.com', 80)
 
SQL> REM Commits to make the ACL take effect
SQL> COMMIT
 

The invoker of the UTL_TCP, UTL_HTTP, UTL_SMTP, and UTL_MAIL packages needs the 'connect' privilege to make TCP/IP, HTTP, or SMTP connections to the external host. The invoker of the UTL_INADDR package needs the 'resolve' privilege to resolve the name or the IP address of the external host. Note that those privileges are not granted through the GRANT SQL statement but through the DBMS_NETWORK_ACL_ADMIN package.

The current ACL assignment to external hosts and the privileges currently defined
in the ACLs are shown through the system catalog views DBA_NETWORK_ACLS
and DBA_NETWORK_ACL_PRIVILEGES.

The invokers of other database components that use those PL/SQL packages to
perform network operations from the database, which are XML DB's
HttpUriType, Oracle Multimedia (formerly interMedia), and Spatial, are
subject to the same network permission check and need the same privileges.




TAG=> Oracle 11g New Features, Oracle 11g tips and tricks, Oracle Database 11g New Features for DBA, Oracle Database 11g New Features
Google