tag:blogger.com,1999:blog-53306867489825933702024-02-20T09:05:42.978-08:00ORACLE BASICS AND INTERNALSAnonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.comBlogger37125tag:blogger.com,1999:blog-5330686748982593370.post-30512919777780095302012-11-27T21:19:00.000-08:002012-11-27T21:19:03.985-08:00<br />
<br />
<br />
Dear Readers,<br />
<br />
I thank you all for sparing your valuable time to read my posts. Since last few days, I have writing on my new blog . Hence, for latest posts visit the following link:<br />
<br />
<a href="http://oracleinaction.blogspot.in/">http://oracleinaction.blogspot.in/</a><br />
<br />
Do visit and give your valuable comments/feedback.<br />
<br />
RegardsAnonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com0tag:blogger.com,1999:blog-5330686748982593370.post-56760162895583878902012-09-30T22:12:00.001-07:002012-10-04T03:00:01.082-07:00RECOVERY USING STANDBY DATABASE<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
RECOVERY USING STANDBY DATABASE<br />
<br />
In this post, I will demonstrate the use of standby database to restore a datafile which got <br />
<br />
corrupted on primary.<br />
<br />
In the following scenario we have OP1 primary database and standby database is OP2 and catalog <br />
<br />
database is CDB. TNS entries for op1 and op2 are there on the machne hosting recovery catalog <br />
<br />
database cdb. Now the plan is to recover a lost datafile of primary database from standby <br />
<br />
database.....<br />
<br />
<b style="color: purple;">OVERVIEW:</b><br />
<br />
- Create Recovery Catalog<br />
- Register Primary database with catalog.<br />
- Connect to catalog and primary. Configure persistent RMAN settings for primary .<br />
- Connect to catalog and standby. Configure persistent RMAN settings for standby .<br />
- Switch logs on primary so that tablespace is created on standby also<br />
- Corrupt the datafile fo tbs_Sales on primary.<br />
- Connect to standby database as target database using RMAN.<br />
- Connect to primary database as auxiliary .<br />
- Take backup of tbs_sales from standby database so that backup file is created on primary.<br />
- connect to catalog and primary.<br />
- Catalog the backup file created earlier<br />
- Restore/recover tablespace<br />
<br />
<b style="background-color: purple;">IMPLEMENTATION:</b><br />
<br />
<b style="color: blue;">-- Create Recovery Catalog --</b><br />
<br />
Log in to CDB catalog and do the following<br />
<br />
<span style="background-color: #eeeeee;">SQL> grant connect ,resource to catown identified by c;</span><br />
<br />
Grant succeeded.<br />
<br />
<span style="background-color: #eeeeee;">SQL> grant recovery_catalog_owner to catown;</span><br />
<br />
Grant succeeded.<br />
<br />
<span style="background-color: #eeeeee;">SQL> select name from v$datafile;</span><br />
<br />
NAME<br />
--------------------------------------------------------------------------------<br />
/u01/app/oracle/oradata/cdb/system01.dbf<br />
/u01/app/oracle/oradata/cdb/sysaux01.dbf<br />
/u01/app/oracle/oradata/cdb/undotbs01.dbf<br />
/u01/app/oracle/oradata/cdb/users01.dbf<br />
<br />
<span style="background-color: #eeeeee;">SQL> create tablespace cattbs datafile '/u01/app/oracle/oradata/cdb/cat1a.dbf' size 300m;</span><br />
<br />
Tablespace created.<br />
<br />
<span style="background-color: #eeeeee;">SQL> alter user catown default tablespace cattbs quota unlimited on cattbs</span>;<br />
<br />
User altered.<br />
<br />
<span style="background-color: #eeeeee;">[oracle@node1 ~]$ rman catalog catown/c</span><br />
<br />
Recovery Manager: Release 11.2.0.1.0 - Production on Sat Sep 29 09:28:08 2012<br />
<br />
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.<br />
<br />
connected to recovery catalog database<br />
<br />
<span style="background-color: #eeeeee;">RMAN> create catalog tablespace cattbs ;</span><br />
<br />
recovery catalog created<br />
<br />
<br />
<b style="color: blue;">#### Register OP1 with catalog CDB</b><br />
<br />
<span style="background-color: #eeeeee;">RMAN> register database;</span><br />
<br />
database registered in recovery catalog<br />
starting full resync of recovery catalog<br />
full resync complete<br />
<br />
RMAN configuration parameters for database with db_unique_name OP1 are:<br />
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default<br />
CONFIGURE BACKUP OPTIMIZATION OFF; # default<br />
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default<br />
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default<br />
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default<br />
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default<br />
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default<br />
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default<br />
CONFIGURE MAXSETSIZE TO UNLIMITED; # default<br />
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default<br />
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default<br />
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default<br />
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default<br />
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_op1.f'; <br />
<br />
# default<br />
<br />
<span style="background-color: #eeeeee;">RMAN> report schema for db_unique_name op1;</span><br />
<br />
Report of database schema for database with db_unique_name OP1<br />
<br />
List of Permanent Datafiles<br />
===========================<br />
File Size(MB) Tablespace RB segs Datafile Name<br />
---- -------- -------------------- ------- ------------------------<br />
1 670 SYSTEM YES /u01/app/oracle/oradata/op1/system01.dbf<br />
2 490 SYSAUX NO /u01/app/oracle/oradata/op1/sysaux01.dbf<br />
3 45 UNDOTBS1 YES /u01/app/oracle/oradata/op1/undotbs01.dbf<br />
4 5 USERS NO /u01/app/oracle/oradata/op1/users01.dbf<br />
<br />
List of Temporary Files<br />
=======================<br />
File Size(MB) Tablespace Maxsize(MB) Tempfile Name<br />
---- -------- -------------------- ----------- --------------------<br />
1 20 TEMP 32767 /u01/app/oracle/oradata/op1/temp01.dbf<br />
<br />
<span style="background-color: #eeeeee;">RMAN> show all for db_unique_name op1;</span><br />
<br />
RMAN configuration parameters for database with db_unique_name OP1 are:<br />
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default<br />
CONFIGURE BACKUP OPTIMIZATION OFF; # default<br />
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default<br />
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default<br />
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default<br />
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default<br />
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default<br />
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default<br />
CONFIGURE MAXSETSIZE TO UNLIMITED; # default<br />
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default<br />
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default<br />
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default<br />
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default<br />
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_op1.f'; <br />
<br />
# default<br />
<br />
<span style="background-color: #eeeeee;">RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;</span><br />
<br />
new RMAN configuration parameters:<br />
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;<br />
new RMAN configuration parameters are successfully stored<br />
starting full resync of recovery catalog<br />
full resync complete<br />
<br />
<b style="color: blue;">-- Configure persistent setting so that archivelogs are not deleted <br />-- until they have been applied to standby</b><br />
<span style="background-color: #eeeeee;">RMAN> configure archivelog deletion policy to applied on all standby ;</span><br />
<br />
new RMAN configuration parameters:<br />
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;<br />
new RMAN configuration parameters are successfully stored<br />
starting full resync of recovery catalog<br />
full resync complete<br />
<br />
<span style="background-color: #eeeeee;">RMAN> show all for db_unique_name op1;</span><br />
<br />
RMAN configuration parameters for database with db_unique_name OP1 are:<br />
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;<br />
CONFIGURE BACKUP OPTIMIZATION OFF; # default<br />
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default<br />
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default<br />
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default<br />
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default<br />
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default<br />
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default<br />
CONFIGURE MAXSETSIZE TO UNLIMITED; # default<br />
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default<br />
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default<br />
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default<br />
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;<br />
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_op1.f'; <br />
<br />
# default<br />
<br />
<span style="background-color: #eeeeee;">RMAN> configure db_unique_name op1 connect identifier 'op1' ;</span><br />
<br />
new RMAN configuration parameters:<br />
CONFIGURE DB_UNIQUE_NAME 'op1' CONNECT IDENTIFIER 'op1';<br />
new RMAN configuration parameters are successfully stored<br />
starting full resync of recovery catalog<br />
full resync complete<br />
<br />
<b style="color: blue;">####REGISTER SERVICE OF STANDBY WITH RMAN</b><br />
<span style="background-color: #eeeeee;">RMAN> configure db_unique_name op2 connect identifier 'op2' ;</span><br />
<br />
new RMAN configuration parameters:<br />
CONFIGURE DB_UNIQUE_NAME 'op2' CONNECT IDENTIFIER 'op2';<br />
new RMAN configuration parameters are successfully stored<br />
starting full resync of recovery catalog<br />
full resync complete<br />
<br />
<span style="background-color: #eeeeee;">RMAN> list db_unique_name of database;</span><br />
<br />
List of Databases<br />
DB Key DB Name DB ID Database Role Db_unique_name<br />
------- ------- ----------------- --------------- ------------------<br />
161 OP1 588960404 PRIMARY OP1 <br />
161 OP1 588960404 STANDBY OP2 <br />
<br />
<span style="background-color: #eeeeee;">RMAN> report schema for db_unique_name op2;</span><br />
<br />
Report of database schema for database with db_unique_name OP2<br />
<br />
List of Permanent Datafiles<br />
===========================<br />
File Size(MB) Tablespace RB segs Datafile Name<br />
---- -------- -------------------- ------- ------------------------<br />
1 670 SYSTEM YES <br />
2 490 SYSAUX NO <br />
3 45 UNDOTBS1 YES <br />
4 5 USERS NO <br />
<br />
<b style="color: blue;">####connect to standby database</b><br />
<span style="background-color: #eeeeee;">[oracle@node1 ~]$ rman target sys@op2</span><br />
<br />
Recovery Manager: Release 11.2.0.1.0 - Production on Sat Sep 29 09:42:40 2012<br />
<br />
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.<br />
<br />
target database Password:<br />
connected to target database: OP1 (DBID=588960404, not open)<br />
<br />
<span style="background-color: #eeeeee;">RMAN> connect catalog catown@cdb</span><br />
<br />
recovery catalog database Password:<br />
connected to recovery catalog database<br />
<br />
<span style="background-color: #eeeeee;">RMAN> show all for db_unique_name op2;</span><br />
<br />
RMAN configuration parameters for database with db_unique_name OP2 are:<br />
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;<br />
CONFIGURE BACKUP OPTIMIZATION OFF; # default<br />
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default<br />
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default<br />
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default<br />
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default<br />
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default<br />
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default<br />
CONFIGURE MAXSETSIZE TO UNLIMITED; # default<br />
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default<br />
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default<br />
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default<br />
CONFIGURE DB_UNIQUE_NAME 'op1' CONNECT IDENTIFIER 'op1';<br />
CONFIGURE DB_UNIQUE_NAME 'op2' CONNECT IDENTIFIER 'op2';<br />
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;<br />
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_op2.f'; <br />
<br />
# default<br />
<br />
<b style="color: blue;">-- Configure persistent settings for Standby database <br />-- Controlfile autobackup on<br />-- backup optimization<br />-- archivelogs are not deleted unless they are backed up once</b><br />
<br />
<span style="background-color: #eeeeee;">RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON ;</span><br />
<br />
new RMAN configuration parameters:<br />
CONFIGURE CONTROLFILE AUTOBACKUP ON;<br />
new RMAN configuration parameters are successfully stored<br />
<br />
<span style="background-color: #eeeeee;">RMAN> CONFIGURE BACKUP OPTIMIZATION ON ;</span><br />
<br />
new RMAN configuration parameters:<br />
CONFIGURE BACKUP OPTIMIZATION ON;<br />
new RMAN configuration parameters are successfully stored<br />
<br />
<span style="background-color: #eeeeee;">RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO DEVICE TYPE DISK ;</span><br />
<br />
old RMAN configuration parameters:<br />
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;<br />
new RMAN configuration parameters:<br />
CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO DISK;<br />
new RMAN configuration parameters are successfully stored<br />
<br />
<b><span style="color: blue;">#### On primary create the tablespace and create a table in the tablespace</span></b><br />
<br />
<span style="background-color: #eeeeee;">SQL> create tablespace tbs_sales datafile '/u01/app/oracle/oradata/op1/tbsales.dbf' size 50m;</span><br />
<br />
Tablespace created.<br />
<br />
<span style="background-color: #eeeeee;">SQL> create table scott.sales3 (id numbeR) tablespace tbs_sales;</span><br />
<br />
Table created.<br />
<br />
<span style="background-color: #eeeeee;">SQL> insert into scott.sales3 values(90);</span><br />
<br />
1 row created.<br />
<br />
<span style="background-color: #eeeeee;">SQL> commit;</span><br />
<br />
Commit complete.<br />
<br />
<b style="color: blue;">-- On primary, corrupt the datafile for tbs_sales tablespace with echo command but before this make <br /><br />sure the log group should be switched so that tablespace is created on standby also...</b><br />
<span style="background-color: #eeeeee;">SYS@OP1>alter system switch logfile;</span><br />
<br />
<span style="background-color: #eeeeee;">[oracle@node1 ~]$ echo > /u01/app/oracle/oradata/op1/tbsales.dbf</span><br />
<br />
<b style="color: blue;">-- Flush buffer cache and query newly created table. The query will fail as the <br /> datafile has been corrupted</b><br />
<span style="background-color: #eeeeee;">SQL> alter system flush buffer_cache;</span><br />
<br />
System altered.<br />
<br />
<span style="background-color: #eeeeee;">SQL> select * from scott.sales3;</span><br />
select * from scott.sales3<br />
*<br />
ERROR at line 1:<br />
ORA-00376: file 5 cannot be read at this time<br />
ORA-01110: data file 5: '/u01/app/oracle/oradata/op1/tbsales.dbf'<br />
<br />
<br />
<b style="color: blue;">-- Now is the time to recover primary tablespace from standby</b><br />
<span style="background-color: #eeeeee;">[oracle@node1 ~]$ rman target sys@op2</span><br />
<br />
Recovery Manager: Release 11.2.0.1.0 - Production on Sat Sep 29 09:50:30 2012<br />
<br />
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.<br />
<br />
target database Password:<br />
connected to target database: OP1 (DBID=588960404, not open)<br />
<br />
<b style="color: blue;">-- Connect to primary database using auxiliary channel</b><br />
<br />
<span style="background-color: #eeeeee;">RMAN> connect auxiliary sys@op1</span><br />
<br />
auxiliary database Password:<br />
connected to auxiliary database: OP1 (DBID=588960404)<br />
<br />
<b style="color: blue;">-- Take image copy backup of tbs_sales tablespace from standby database<br /> on primary database</b><br />
<br />
<span style="background-color: #cccccc;">RMAN> backup as copy datafile 5 auxiliary format '/u01/app/sales_sby.dbf' ;</span><br />
<br />
Starting backup at 29-SEP-12<br />
using target database control file instead of recovery catalog<br />
allocated channel: ORA_DISK_1<br />
channel ORA_DISK_1: SID=40 device type=DISK<br />
channel ORA_DISK_1: starting datafile copy<br />
input datafile file number=00005 name=/u01/app/oracle/oradata/op2/tbsales.dbf<br />
output file name=/u01/app/sales_sby.dbf tag=TAG20120929T095124<br />
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03<br />
Finished backup at 29-SEP-12<br />
<br />
<b style="color: blue;">####CONNECT TO PRIMARY</b><br />
<br />
<span style="background-color: #eeeeee;">[oracle@node1 ~]$ rman target/</span><br />
<br />
Recovery Manager: Release 11.2.0.1.0 - Production on Sat Sep 29 10:07:06 2012<br />
<br />
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.<br />
<br />
connected to target database: OP1 (DBID=588960404)<br />
<br />
<span style="background-color: #eeeeee;">RMAN> connect catalog catown@cdb</span><br />
<br />
recovery catalog database Password:<br />
connected to recovery catalog database<br />
<br />
<b style="color: blue;">-- Catalog the image copy backup with primary since the backup was taken without<br /> connecting to catalog</b><br />
<br />
<span style="background-color: #eeeeee;">RMAN> catalog datafilecopy '/u01/app/sss5.dbf' ;</span><br />
<br />
starting full resync of recovery catalog<br />
full resync complete<br />
cataloged datafile copy<br />
datafile copy file name=/u01/app/sss5.dbf RECID=1 STAMP=795262055<br />
<br />
<span style="background-color: #eeeeee;">RMAN>alter tablespace tbs_sales offline;</span><br />
<br style="background-color: #eeeeee;" />
<span style="background-color: #eeeeee;">RMAN> run {</span><br />
<span style="background-color: #eeeeee;"> restore datafile 5 ;</span><br />
<span style="background-color: #eeeeee;"> recover datafile 5 ; }</span><br />
<br />
<br />
<span style="color: blue;">####CHECK ON PRIMARY</span><br />
<br />
<span style="background-color: #eeeeee;">SQL>select * from scott.sales5</span><br />
<span style="background-color: #eeeeee;">*</span><br />
ERROR at line 1:<br />
ORA-00376: file 5 cannot be read at this time<br />
ORA-01110: data file 5: '/u01/app/oracle/oradata/op1/tbsales5.dbf'<br />
<br />
<span style="background-color: #eeeeee;">SQL> alter tablespace tbs_sales5 online;</span><br />
alter tablespace tbs_sales5 online<br />
*<br />
ERROR at line 1:<br />
ORA-01113: file 5 needs media recovery<br />
ORA-01110: data file 5: '/u01/app/sss5.dbf'<br />
<br />
<b style="color: blue;">#### DO THE RECOVERY FROM RMAN on Primary </b><br />
<span style="background-color: #cccccc;">RMAN> recover tablespace tbs_sales5;</span><br />
<br />
Starting recover at 29-SEP-12<br />
allocated channel: ORA_DISK_1<br />
channel ORA_DISK_1: SID=43 device type=DISK<br />
<br />
starting media recovery<br />
media recovery complete, elapsed time: 00:00:00<br />
<br />
Finished recover at 29-SEP-12<br />
<br />
<b style="color: blue;">#### COME BACK TO PRIMARY</b><br />
<br />
<span style="background-color: #eeeeee;">SQL> alter tablespace tbs_sales5 online;</span><br />
<br />
Tablespace altered.<br />
<br />
<span style="background-color: #eeeeee;">SQL> select * from scott.sales5;</span><br />
<br />
ID<br />
----------<br />
90<br />
90<br />
<br />
#### ENJOY ####<br />
---------------------------------------------------------------------<br />
Related links:<br />
<br />
<br />
<div style="margin: 0px;">
<div style="margin: 0px;">
HOME</div>
</div>
<div style="margin: 0px;">
<div style="margin: 0px;">
<a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></div>
</div>
<br />
<div>
<span dir="ltr">11G DATA GUARD NEW FEATURES </span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><a href="http://koenigocm.blogspot.in/2012/03/11g-data-guard-new-features.html" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/2012/03/11g-data-guard-new-features.html</span></a></span></div>
<div style="background-color: transparent; color: black; font-family: arial,helvetica,sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr">DATA GUARD SETUP</span> </span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/DATA%20GUARD%20SETUP" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/DATA%20GUARD%20SETUP</span></a></span></div>
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com2tag:blogger.com,1999:blog-5330686748982593370.post-24816929017510336082012-09-27T20:33:00.000-07:002012-10-04T03:00:20.306-07:00MIGRATE OUTLINES TO SQL MANAGEMENT BASE<div dir="ltr" style="text-align: left;" trbidi="on">
MIGRATE OUTLINES TO SQL MANAGEMENT BASE<br />
<br />
In this post, we will learn about outlines and more importantly in 11g Release 2 sometimes we need to migrate outlines from older versions to 11G... so thats what we will see .<br />
_____________________________________________________-<br />
<br />
Outlines can be created automatically by Oracle or manually for specific statements. The automatic creation of outlines is controlled using the create_stored_outlines parameter than can be set at session or instance level using the following commands.<br />
<br />
ALTER SYSTEM SET create_stored_outlines=TRUE;<br />
ALTER SESSION SET create_stored_outlines=TRUE;<br />
<br />
Outlines can be generated for specific statements using the CREATE OUTLINE statement or the DBMS_OUTLN.CREATE_OUTLINE procedure and also we need to give privileges to the user who is doing this if he is not a DBA. The privileges are CREATE ANY OUTLINE and EXECUTE_CATALOG_ROLE .<br />
<br />
<b style="color: blue;">Now let me show you a small demo</b><br />
<br />
<span style="background-color: #eeeeee;">SQL> create outline outline_karan for category sales on select * from emp;</span><br />
<span style="background-color: #eeeeee;">SQL> SELECT name, category, sql_text FROM user_outlines WHERE category = 'SALES';</span><br />
<br style="background-color: #eeeeee;" />
<br />
<b style="color: blue;">Note that outline stores the information in the form of hints</b><br />
<br />
<br />
<br />
<br />
<br style="background-color: #eeeeee;" />
<span style="background-color: #eeeeee;">SQL> SELECT node, stage, join_pos, hint FROM user_outline_hints WHERE name = 'OUTLINE_KARAN'</span><br />
<br />
NODE STAGE JOIN_POS HINT<br />
---------- ---------- ---------- --------------------------------------------------------------------------------<br />
1 1 1 FULL(@"SEL$1" "EMP"@"SEL$1")<br />
1 1 0 OUTLINE_LEAF(@"SEL$1")<br />
1 1 0 ALL_ROWS<br />
1 1 0 DB_VERSION('11.2.0.1')<br />
1 1 0 OPTIMIZER_FEATURES_ENABLE('11.2.0.1')<br />
1 1 0 IGNORE_OPTIM_EMBEDDED_HINTS<br />
<br />
<b style="color: blue;">## Now you see below the outline is unused because the query associated with outline is not fired. </b><br />
]<br />
<span style="background-color: #eeeeee;">SQL> SELECT name, category, used FROM user_outlines where name='OUTLINE_KARAN';</span><br />
<br />
NAME CATEGORY USED<br />
------------------------------ ------------------------------ ------<br />
OUTLINE_KARAN SALES UNUSED<br />
<br />
<b style="color: blue;">###Lets fire the query see</b><br />
<br />
<span style="background-color: #eeeeee;">SQL> select * from emp;</span><br />
<br />
## I have removed the 14 rows of the output to reduce the size of demo<br />
<br />
<b style="color: blue;">### Note that outline is used when the query is executed (USED = USED)</b><br />
<br />
<span style="background-color: #eeeeee;">SQL> SELECT name, category, used FROM user_outlines where name='OUTLINE_KARAN';</span><br />
<br />
NAME CATEGORY USED<br />
------------------------------ ------------------------------ ------<br />
OUTLINE_KARAN SALES USED<br />
<br />
<b style="color: blue;">## Now we will migrate information in the outlilne to SQL management base</b><br />
<div style="color: blue;">
<br /></div>
<b style="color: blue;">-- Fine out the names of the outlines -- </b><br />
<br />
<br />
<br />
<span style="background-color: #eeeeee;">SQL> select name,sql_text from user_outlines ;</span><br />
<br />
<div style="color: blue;">
<b>-- Migrate the stored outline</b></div>
<div style="color: blue;">
</div>
<br />
<span style="background-color: #eeeeee;">SQL>variable v1 clob;</span><br />
<br style="background-color: #eeeeee;" />
<span style="background-color: #eeeeee;">SQL> begin</span><br />
<span style="background-color: #eeeeee;">:v1 := dbms_spm.migrate_stored_outline(</span><br />
<span style="background-color: #eeeeee;">attribute_name=>'outline_name',</span><br />
<span style="background-color: #eeeeee;">attribute_value=>'OUTLINE_KARAN',fixed=>'NO');</span><br />
<span style="background-color: #eeeeee;">end;</span><br />
<span style="background-color: #eeeeee;">/</span><br />
<br />
### NOTE := I had already give extra special privileges to scott who is doing this work, the privileges are CREATE ANY OUTLINE, ALTER ANY OUTLINE<br />
ADMINISTER SQL MANAGEMENT OBJECT<br />
<br />
<b style="color: blue;">###Now how can we determine whether stored outline was migrated or not.. See the following</b><br />
<span style="background-color: #eeeeee;">SQL> select name,sql_text,migrated FROM user_outlines where name='OUTLINE_KARAN';</span><br />
<br />
NAME SQL_TEXT MIGRATED<br />
------------------------------ -------------------------------------------------------------------------------- ------------<br />
OUTLINE_KARAN select * from emp MIGRATED<br />
<br />
<b style="color: blue;">## Login as SYSDBA and see the below dictionary query to check that outline has been stored</b><br />
<b style="color: blue;"> as baseline in SQL Management Base</b><br />
<span style="background-color: #eeeeee;">SQL> select SQL_HANDLE,ORIGIN,ENABLED,ACCEPTED from dba_sql_plan_baselines where SQL_TEXT like 'select * from em%';</span><br />
<br />
SQL_HANDLE ORIGIN ENA ACC<br />
------------------------------ -------------- --- ---<br />
SYS_SQL_612b4fadc881121e STORED-OUTLINE YES YES<br />
<br />
<b style="color: blue;">#### Some more methods to show you how to create and work on outlines, but first lets say i deleted my previous outline</b><br />
<br />
<span style="background-color: #eeeeee;">SQL> drop outline OUTLINE_KARAN;</span><br />
drop outline OUTLINE_KARAN<br />
*<br />
ERROR at line 1:<br />
ORA-18006: DROP ANY OUTLINE privilege is required for this operation<br />
<br />
<span style="background-color: #eeeeee;">SQL> conn / as sysdba</span><br />
Connected.<br />
<span style="background-color: #eeeeee;">SQL> grant DROP ANY OUTLINE to scott;</span><br />
<br style="background-color: #eeeeee;" />
<span style="background-color: #eeeeee;">SQL> conn scott/tiger</span><br />
<br style="background-color: #eeeeee;" />
<span style="background-color: #eeeeee;">SQL> drop outline OUTLINE_KARAN;</span><br />
<br />
<br />
<br style="background-color: #eeeeee;" />
<b style="color: blue;">-- Create a outline by setting create_stored_outlines=true at instance level --</b><br />
<br style="background-color: #eeeeee;" />
<span style="background-color: #eeeeee;">SQL> conn / as sysdba</span><br />
<br style="background-color: #eeeeee;" />
<span style="background-color: #eeeeee;">SQL> ALTER SYSTEM SET create_stored_outlines=TRUE;</span><br />
<br />
System altered.<br />
<br />
<span style="background-color: #eeeeee;">SQL> select * from scott.dept;</span><br />
<br />
DEPTNO DNAME LOC<br />
---------- -------------- -------------<br />
10 ACCOUNTING NEW YORK<br />
20 RESEARCH DALLAS<br />
30 SALES CHICAGO<br />
40 OPERATIONS BOSTON<br />
<br />
<span style="background-color: #eeeeee;">SQL> ALTER SYSTEM SET create_stored_outlines=FALSE;</span><br />
<br />
<b style="color: blue;">-- Check that outline has been created --</b><br />
<br />
<span style="background-color: #eeeeee;">SQL> select name,owner,SQL_TEXT from dba_outlines;</span><br />
<br />
NAME OWNER SQL_TEXT<br />
------------------------------ ------------------------------ --------------------------------------------------------------------------------<br />
SYS_OUTLINE_12092715271822003 SYS select * from scott.dept<br />
<br />
<br />
<br />
<b style="color: blue;">-- Create outline by using DBMS_OUTLN.create_outline procedure </b><br />
<b style="color: blue;"></b><br />
<b style="color: blue;"> </b><br />
<b style="color: blue;">-- Issue the statement for which outline is to be stored<br /> </b><br />
<span style="background-color: #eeeeee;">SQL> conn scott/tiger</span><br />
<br style="background-color: #eeeeee;" />
<span style="background-color: #eeeeee;">SQL>select dname,loc from dept where deptno=10;</span><br />
<br style="background-color: #eeeeee;" />
<span style="background-color: #eeeeee;">SQL> conn / as sysdba</span><br />
Connected.<br />
<br />
<div style="color: blue;">
<b>-- Find out sql_id of the statement --</b></div>
<br />
<span style="background-color: #eeeeee;">SQL> select sql_id,HASH_VALUE,CHILD_NUMBER from v$sql where sql_text like 'select dname,loc from dept where dept%';</span><br />
<br />
SQL_ID HASH_VALUE CHILD_NUMBER<br />
------------- ---------- ------------<br />
6kd9zwrdtur6h 3684523216 0<br />
<br />
<br />
<b style="color: blue;">-- Create outline --</b><br />
<br />
<span style="background-color: #eeeeee;">SQL> BEGIN</span><br />
<span style="background-color: #eeeeee;"> DBMS_OUTLN.create_outline(</span><br />
<span style="background-color: #eeeeee;"> hash_value =>3684523216,</span><br />
<span style="background-color: #eeeeee;"> child_number => 0,</span><br />
<span style="background-color: #eeeeee;"> category => 'PAYABLES_OUTLINES');</span><br />
<span style="background-color: #eeeeee;"> END; </span><br />
<span style="background-color: #eeeeee;"> /</span><br />
<br />
PL/SQL procedure successfully completed.<br />
<br />
<b style="color: blue;">-- check that outline has been craeted -- </b><br />
<br />
<span style="background-color: #eeeeee;">SQL> select name,owner,SQL_TEXT from dba_outlines;</span><br />
<br />
NAME OWNER SQL_TEXT<br />
------------------------------ ------------------------------ --------------------------------------------------------------------------------<br />
SYS_OUTLINE_12092715305717804 SCOTT select dname,loc from dept where deptno=10<br />
<br />
********THANKS FOR YOUR TIME ******************************<span class="yiv700228752HOEnZb"><span style="color: #888888;"></span></span><br />
<span class="yiv700228752HOEnZb"><span style="color: #888888;"></span></span><br />
<span class="yiv700228752HOEnZb"><span style="color: #888888;"></span></span><br />
<span class="yiv700228752HOEnZb"><span style="color: #888888;">Related links:</span></span><br />
<span class="yiv700228752HOEnZb"><span style="color: #888888;"></span></span><br />
<span class="yiv700228752HOEnZb"><span style="color: #888888;">Home</span></span><br />
<span class="yiv700228752HOEnZb"><span style="color: #888888;"> http://koenigocm.blogspot.in/</span></span><br />
<br />
<span class="yiv700228752HOEnZb"><span style="color: #888888;">SQL PLAN MANAGEMENT PART-I</span></span><br />
<span class="yiv700228752HOEnZb"><span style="color: #888888;"> http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%E2%80%93%20ORACLE%20%2011g%20%3A%20Part-1</span></span><br />
<span style="color: #888888;"> </span><span class="yiv700228752HOEnZb"><span style="color: #888888;"> </span></span><br />
<span class="yiv700228752HOEnZb"><span style="color: #888888;">SQL PLAN MANAGEMENT PART-II </span></span><br />
<span class="yiv700228752HOEnZb"><span style="color: #888888;">http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%20%E2%80%93%20ORACLE%2011g%20%3A%20Part-2<br />-- </span></span></div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com0tag:blogger.com,1999:blog-5330686748982593370.post-56113239837707931302012-09-21T03:36:00.001-07:002012-10-04T03:01:09.205-07:00HOW TO CALL AN EXTERNAL C FUNCTION FROM WITHIN ORACLE<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
<h3>
How to call an external C function from within Oracle</h3>
<h3>
-------------------------------------------------------------------------</h3>
<br />
One very useful feature of Oracle is its ability to call external C procedures from within the database. <br />
It's handy for creating interfaces to legacy systems.<br />
The following procedure will demonstrate how to compile a simple C program, and how to configure the database to call it. <br />
The C program will contain a single procedure for converting strings into uppercase.<br />
<br />
<b><span style="color: purple;">Several layers of objects and configuration will be required to make this work:</span></b><br />
C Program/library<br />
(andy_lib.so)<br />
|<br />
Listener<br />
(extproc)<br />
|<br />
Database library object<br />
(andy_lib)<br />
|<br />
Database function<br />
(andy_lib_upper)<br />
<br />
This might seem a little daunting and over complicated, but it's actually quite logical and very simple. <br />
To simplify the process, we will construct the test case in the same order as the diagram above.<br />
<br />
<b><span style="color: purple;">To build this example you will need the following:</span></b><br />
An oracle database (9i or later)<br />
A working listener configuration<br />
C compiler (gcc is used in the example)<br />
A database user with 'create procedure' and 'create library' privileges<br />
<br />
<b style="color: purple;">STEPS<br />--------</b><br />
<br />
<b style="color: blue;">1. Create the C program</b><br />
Using a text editor, create a file named andy_lib.c and paste the following C code into it:<br />
<span style="background-color: #eeeeee;">#include <ctype.h></span><br />
<span style="background-color: #eeeeee;">int andy_upper(char *istr, char *ostr)</span><br />
<span style="background-color: #eeeeee;">{</span><br />
<span style="background-color: #eeeeee;"> int i = 0;</span><br />
<span style="background-color: #eeeeee;"> while(istr[i])</span><br />
<span style="background-color: #eeeeee;"> {</span><br />
<span style="background-color: #eeeeee;"> ostr[i] = toupper(istr[i]);</span><br />
<span style="background-color: #eeeeee;"> i++;</span><br />
<span style="background-color: #eeeeee;"> }</span><br />
<span style="background-color: #eeeeee;"> return 0;</span><br />
<span style="background-color: #eeeeee;">}</span><br />
<br />
-------------------------------------------------------------<br />
<br />
<b><span style="color: blue;">2. Compile the shared library and copy it to the Oracle home</span></b><br />
To compile and link the library run these commands:<br />
<br />
<span style="background-color: #eeeeee;">gcc -c andy_lib.c</span><br />
<br style="background-color: #eeeeee;" />
<span style="background-color: #eeeeee;">ld -shared -o andy_lib.so andy_lib.o</span><br />
<br />
The linker will probable create the library with rather excessive permissions. <br />
I'd advise changing them:<br />
<br />
<span style="background-color: #eeeeee;">chmod 600 andy_lib.so</span><br />
<br />
Now, copy the shared library to the Oracle home:<br />
<br />
<span style="background-color: #eeeeee;">cp andy_lib.so $ORACLE_HOME/bin/</span><br />
<br />
---------------------------------------------------------------<br />
<br />
<b style="color: blue;">3. Configure the listener and tnsnames</b><br />
The listener will need to be configured to handle external procedures (extproc). My listener.ora looks like this:<br />
SID_LIST_LISTENER =<br />
(SID_LIST =<br />
(SID_DESC =<br />
(SID_NAME = PLSExtProc)<br />
(ORACLE_HOME =/u01/app/oracle/product/11.2.0)<br />
(PROGRAM = extproc)<br />
)<br />
)<br />
<br />
LISTENER =<br />
(DESCRIPTION_LIST =<br />
(DESCRIPTION =<br />
(ADDRESS = (PROTOCOL = TCP)(HOST = fermat)(PORT = 1521))<br />
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))<br />
)<br />
)<br />
<br />
You will also need to add the following entry to your tnsnames.ora:<br />
<br />
EXTPROC_CONNECTION_DATA =<br />
(DESCRIPTION =<br />
(ADDRESS_LIST =<br />
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))<br />
)<br />
(CONNECT_DATA =<br />
(SID = PLSExtProc)<br />
(PRESENTATION = RO)<br />
)<br />
)<br />
<br />
Restart the listener and test the configuration with tnsping:<br />
<br />
lsnrctl stop;<br />
lsnrctl start;<br />
tnsping EXTPROC_CONNECTION_DATA<br />
<br />
----------------------------------------------------------<br />
<br />
<b style="color: blue;">4. Create a database library object</b><br />
<br />
The library object is a pointer to the library file that we copied into the Oracle home. <br />
Run the following SQL to create it:<br />
<br />
<span style="background-color: #eeeeee;">sql>create or replace library andy_lib</span><br />
<span style="background-color: #eeeeee;"> as '/app/oracle/product/11.2.0/bin/andy_lib.so';</span><br />
<span style="background-color: #eeeeee;"> /</span><br />
<br />
----------------------------------------------------------<br />
<br />
<b style="color: blue;">5. Create a database function</b><br />
<br />
The C library in this example contains a single function, but in reality your library might contain several. <br />
We need to create function objects that map onto each of the procedures in the C library:<br />
<br />
<span style="background-color: #eeeeee;">create or replace function andy_lib_upper(p_istr in varchar2, p_ostr out varchar2)</span><br />
<span style="background-color: #eeeeee;"> return binary_integer</span><br />
<span style="background-color: #eeeeee;"> as external</span><br />
<span style="background-color: #eeeeee;">library andy_lib</span><br />
<span style="background-color: #eeeeee;">name "andy_upper"</span><br />
<span style="background-color: #eeeeee;">language c</span><br />
<span style="background-color: #eeeeee;">parameters (p_istr string, p_ostr string);</span><br />
<span style="background-color: #eeeeee;">/</span><br />
<br />
--------------------------------------------------<br />
<br />
<b style="color: blue;">6. Test it</b><br />
<br />
Cut and paste the following pl/sql into sqlplus. <br />
It will pass a lowercase string into the C function...<br />
<br />
<span style="background-color: #eeeeee;">set serveroutput on size 9999</span><br />
<span style="background-color: #eeeeee;">declare</span><br />
<span style="background-color: #eeeeee;">res binary_integer;</span><br />
<span style="background-color: #eeeeee;">v_in CHAR(100);</span><br />
<span style="background-color: #eeeeee;">v_out CHAR(100);</span><br />
<span style="background-color: #eeeeee;">begin</span><br />
<span style="background-color: #eeeeee;">v_in := 'hello world';</span><br />
<span style="background-color: #eeeeee;">res := andy_lib_upper(v_in, v_out);</span><br />
<span style="background-color: #eeeeee;">dbms_output.put_line(res);</span><br />
<span style="background-color: #eeeeee;">dbms_output.put_line(v_in);</span><br />
<span style="background-color: #eeeeee;">dbms_output.put_line(v_out);</span><br />
<span style="background-color: #eeeeee;">end;</span><br />
<span style="background-color: #eeeeee;">/</span><br />
<br />
it works you will see the following:<br />
hello world<br />
HELLO WORLD<br />
-------------------------------------------------------------------------<br />
----------------------------*****************------------------------</div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com1tag:blogger.com,1999:blog-5330686748982593370.post-71227370863716469752012-08-21T21:31:00.002-07:002012-10-04T03:10:51.443-07:00AUTOMATIC IMPORT USING FILEWATCHER<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal" style="background-color: white; margin-bottom: 14pt;">
<b><span style="font-family: Arial, sans-serif; font-size: 12pt;"> DATA IMPORT IN DATABASE USING FILE WATCHER<o:p></o:p></span></b></div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">We want oracle to import all the objects belonging to HR schema automatically whenever a .dmp file arrives in a specified folder on a system. To implement it we will use filewatcher which is a new scheduler object in oracle 11g. It enables a new type of event-based job that is triggered by the arrival of a file in a specified location. File watchers can be defined to monitor locations on the local server and remote servers, provided they have an agent installed on them.<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">-- OVERVIEW --<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">- Setup<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">- Create a file watcher<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">- C</span><span style="font-family: Arial, sans-serif; font-size: 10pt;">reate a scheduler program to access the event raised by the file watcher.<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">- C</span><i><span style="font-family: Arial, sans-serif; font-size: 10pt;">reate directory object named</span></i><span style="font-family: Arial, sans-serif; font-size: 10pt;"> FILE_WATCHER which maps to os path '</span><span style="font-family: 'Courier New'; font-size: 10pt;">/tmp/test'<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">- Copy the .dmp file in /tmp/test location<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">- Check that all objects belonging to HR schema have been imported into database.<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">- IMPLEMENTATION -<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">- SETUP -<o:p></o:p></span></div>
<div style="background: #f2f1f2; border-bottom: white 1pt solid; border-left: white 1pt solid; border-right: white 1pt solid; border-top: white 1pt solid; mso-border-alt: solid white .5pt; mso-element: para-border-div; padding-bottom: 8pt; padding-left: 8pt; padding-right: 8pt; padding-top: 8pt;">
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">HR>CREATE TABLE TEST AS SELECT * FROM EMPLOYEES;<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<br /></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">$mkdir /u01/test<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">$mkdir /tmp/test<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<br /></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">SYS>CREATE DIRECTORY ABC AS '/u01/test';<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> GRANT READ, WRITE ON DIRECTORY ABC TO HR;<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">Now export hr schema to a dump file .<o:p></o:p></span></div>
<div style="background: #f2f1f2; border-bottom: white 1pt solid; border-left: white 1pt solid; border-right: white 1pt solid; border-top: white 1pt solid; mso-border-alt: solid white .5pt; mso-element: para-border-div; padding-bottom: 8pt; padding-left: 8pt; padding-right: 8pt; padding-top: 8pt;">
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">$ expdp hr/hr directory=abc dumpfile=hr_Schema.dmp logfile=abc.log reuse_dumpfiles=true<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">-- CREATE FILE WATCHER<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">By default, file watchers only check for the arrival of files every 10 minutes, but this default interval can be changed by issuing the following statement.<o:p></o:p></span></div>
<div style="background: #f2f1f2; border-bottom: white 1pt solid; border-left: white 1pt solid; border-right: white 1pt solid; border-top: white 1pt solid; mso-border-alt: solid white .5pt; mso-element: para-border-div; padding-bottom: 8pt; padding-left: 8pt; padding-right: 8pt; padding-top: 8pt;">
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">CONN / AS SYSDBA<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<br /></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">BEGIN<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> DBMS_SCHEDULER.set_attribute(<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> 'file_watcher_schedule',<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> 'repeat_interval',<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> 'freq=minutely; interval=1');<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">END;<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">/<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">I've set the interval to 1 minute for these tests, but I would probably not set it that low in a production system.<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">The file watcher will need access to the OS to check for files, so we must create a credential for it to log on with. I'm going to use the Oracle software owner, but for a real system I would advise using the lowest privileged user possible.<o:p></o:p></span></div>
<div style="background: #f2f1f2; border-bottom: white 1pt solid; border-left: white 1pt solid; border-right: white 1pt solid; border-top: white 1pt solid; mso-border-alt: solid white .5pt; mso-element: para-border-div; padding-bottom: 8pt; padding-left: 8pt; padding-right: 8pt; padding-top: 8pt;">
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">BEGIN<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> DBMS_SCHEDULER.create_credential(<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> credential_name => 'local_credential',<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> username => 'oracle',<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> password => 'oracle');<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">END;<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">/<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">Next we create the file watcher itself. Using a "?" in the</span><span style="font-family: Arial, sans-serif; font-size: 10pt;"> </span><span style="font-family: 'Courier New'; font-size: 10pt;">directory_path</span><span style="font-family: Arial, sans-serif; font-size: 10pt;"> </span><span style="font-family: Arial, sans-serif; font-size: 10pt;">parameter signifies the ORACLE_HOME. The</span><span style="font-family: Arial, sans-serif; font-size: 10pt;"> </span><span style="font-family: 'Courier New'; font-size: 10pt;">file_name</span><span style="font-family: Arial, sans-serif; font-size: 10pt;"> </span><span style="font-family: Arial, sans-serif; font-size: 10pt;">parameter can reference a specific file name or a wildcard. Setting the </span><span style="font-family: 'Courier New'; font-size: 10pt;">destination</span><span style="font-family: Arial, sans-serif; font-size: 10pt;"> </span><span style="font-family: Arial, sans-serif; font-size: 10pt;">parameter to NULL indicates the local server. For remote servers set it to a valid external destination, as shown by the</span><span style="font-family: Arial, sans-serif; font-size: 10pt;"> </span><span style="font-family: 'Courier New'; font-size: 10pt;">ALL_SCHEDULER_EXTERNAL_DESTS</span><span style="font-family: Arial, sans-serif; font-size: 10pt;"> </span><span style="font-family: Arial, sans-serif; font-size: 10pt;">view.<o:p></o:p></span></div>
<div style="background: #f2f1f2; border-bottom: white 1pt solid; border-left: white 1pt solid; border-right: white 1pt solid; border-top: white 1pt solid; mso-border-alt: solid white .5pt; mso-element: para-border-div; padding-bottom: 8pt; padding-left: 8pt; padding-right: 8pt; padding-top: 8pt;">
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">BEGIN<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> DBMS_SCHEDULER.create_file_watcher(<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> file_watcher_name => 'test_file_watcher',<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> directory_path => '/tmp/test',<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> file_name => '*.dmp',<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> credential_name => 'local_credential',<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> destination => NULL,<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> enabled => FALSE);<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">END;<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">/<o:p></o:p></span></div>
</div>
<div style="background: white; line-height: 11.4pt;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">-- CREATE A SCHEDULER PROGRAM TO ACCESS THE EVENT RAISED BY FILE WATCHER<o:p></o:p></span></div>
<div style="background: white; line-height: 11.4pt;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;"> The program must reference the event_message to retrieve information about the file, such as its name.Through a metadata argument, the Scheduler can pass to an event-based job the message content of the event that started the job. The following rules apply<o:p></o:p></span></div>
<ul type="disc">
<li class="MsoNormal" style="background-color: white; line-height: 11.4pt;"><span style="font-family: "Arial","sans-serif"; font-size: 10pt; mso-fareast-font-family: 'Times New Roman';">The job must use a named program of type STORED_PROCEDURE.<o:p></o:p></span></li>
<li class="MsoNormal" style="background-color: white; line-height: 11.4pt;"><span style="font-family: "Arial","sans-serif"; font-size: 10pt; mso-fareast-font-family: 'Times New Roman';">One of the named program's arguments must be a metadata argument with metadata_attribute set to EVENT_MESSAGE.<o:p></o:p></span></li>
<li class="MsoNormal" style="background-color: white; line-height: 11.4pt;"><span style="font-family: "Arial","sans-serif"; font-size: 10pt; mso-fareast-font-family: 'Times New Roman';">The stored procedure that implements the program must have an argument at the position corresponding to the named program's metadata argument. The argument type must be the data type of the queue where your application queues the job-start event.<o:p></o:p></span></li>
</ul>
<div class="MsoNormal" style="background: white; line-height: 11.4pt; mso-hyphenate: auto; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">If you use the RUN_JOB procedure to manually run a job that has an EVENT_MESSAGE metadata argument, the value passed to that argument is NULL.<o:p></o:p></span></div>
<div style="background: #f2f1f2; border-bottom: white 1pt solid; border-left: white 1pt solid; border-right: white 1pt solid; border-top: white 1pt solid; mso-border-alt: solid white .5pt; mso-element: para-border-div; padding-bottom: 8pt; padding-left: 8pt; padding-right: 8pt; padding-top: 8pt;">
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">BEGIN<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> DBMS_SCHEDULER.create_program(<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> program_name => 'file_watcher_test_prog',<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> program_type => 'stored_procedure',<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> program_action => 'file_watcher_test_proc',<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> number_of_arguments => 1,<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> enabled => FALSE);<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">END;<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">/<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<br /></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">BEGIN<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> DBMS_SCHEDULER.define_metadata_argument(<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> program_name => 'file_watcher_test_prog',<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> metadata_attribute => 'event_message',<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> argument_position => 1);<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">END;<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">/<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">Next we define the stored procedure that we referenced in the program definition. It must accept and argument of the</span><span style="font-family: Arial, sans-serif; font-size: 10pt;"> </span><a href="http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10577/d_sched.htm#BABFJBDG"><span style="font-family: "Arial","sans-serif"; mso-bidi-font-family: Calibri;">SCHEDULER_FILEWATCHER_RESULT</span></a><span style="font-family: Arial, sans-serif; font-size: 10pt;"> </span><span style="font-family: Arial, sans-serif; font-size: 10pt;">type. the procedure created here will import all the hr user objects from export file in hr user schema </span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div style="background: #f2f1f2; border-bottom: white 1pt solid; border-left: white 1pt solid; border-right: white 1pt solid; border-top: white 1pt solid; mso-border-alt: solid white .5pt; mso-element: para-border-div; padding-bottom: 8pt; padding-left: 8pt; padding-right: 8pt; padding-top: 8pt;">
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">create or replace procedure file_watcher_test_proc(p_sfwr sys.scheduler_filewatcher_result)<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">as<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">file_name varchar2(98);<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">handle number;<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">begin<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">file_name:=p_sfwr.actual_file_name;<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">handle := dbms_datapump.open('IMPORT','SCHEMA');<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> dbms_datapump.add_file(handle,file_name,'FILE_WATCHER');<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> dbms_datapump.metadata_filter(handle,'SCHEMA_EXPR','= ''HR''');<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> dbms_datapump.set_parallel(handle,4);<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> dbms_datapump.start_job(handle);<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> dbms_datapump.detach(handle);<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">end;<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">/<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">Next we create a job that references the objects we've just created. The</span><span style="font-family: Arial, sans-serif; font-size: 10pt;"> </span><span style="font-family: 'Courier New'; font-size: 10pt;">queue_spec</span><span style="font-family: Arial, sans-serif; font-size: 10pt;"> </span><span style="font-family: Arial, sans-serif; font-size: 10pt;">parameter is set to the name of the file watcher, while the</span><span style="font-family: Arial, sans-serif; font-size: 10pt;"> </span><span style="font-family: 'Courier New'; font-size: 10pt;">program_name</span><span style="font-family: Arial, sans-serif; font-size: 10pt;"> </span><span style="font-family: Arial, sans-serif; font-size: 10pt;">parameter is set to the name of the program object we defined, not the procedure name.<o:p></o:p></span></div>
<div style="background: #f2f1f2; border-bottom: white 1pt solid; border-left: white 1pt solid; border-right: white 1pt solid; border-top: white 1pt solid; mso-border-alt: solid white .5pt; mso-element: para-border-div; padding-bottom: 8pt; padding-left: 8pt; padding-right: 8pt; padding-top: 8pt;">
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">BEGIN<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> DBMS_SCHEDULER.create_job(<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> job_name => 'file_watcher_test_job',<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> program_name => 'file_watcher_test_prog',<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> event_condition => NULL,<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> queue_spec => 'test_file_watcher',<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> auto_drop => FALSE,<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> enabled => FALSE);<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">END;<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">/<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">By default, the arrival of new files will be ignored if the job is already running. If you need the job to fire for each new arrival, regardless of whether the job is already running or not, set the</span><span style="font-family: 'Courier New'; font-size: 10pt;">PARALLEL_INSTANCES</span><span style="font-family: Arial, sans-serif; font-size: 10pt;"> </span><span style="font-family: Arial, sans-serif; font-size: 10pt;">attribute for the job to true. The job will then be run as a lightweight job.<o:p></o:p></span></div>
<div style="background: #f2f1f2; border-bottom: white 1pt solid; border-left: white 1pt solid; border-right: white 1pt solid; border-top: white 1pt solid; mso-border-alt: solid white .5pt; mso-element: para-border-div; padding-bottom: 8pt; padding-left: 8pt; padding-right: 8pt; padding-top: 8pt;">
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">BEGIN<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> DBMS_SCHEDULER.set_attribute('file_watcher_test_job','parallel_instances',TRUE);<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">END;<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">/<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">With all the pieces in place, we can now enable all the objects we created.<o:p></o:p></span></div>
<div style="background: #f2f1f2; border-bottom: white 1pt solid; border-left: white 1pt solid; border-right: white 1pt solid; border-top: white 1pt solid; mso-border-alt: solid white .5pt; mso-element: para-border-div; padding-bottom: 8pt; padding-left: 8pt; padding-right: 8pt; padding-top: 8pt;">
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">EXEC DBMS_SCHEDULER.enable('test_file_watcher');<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">EXEC DBMS_SCHEDULER.enable('file_watcher_test_prog');<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">EXEC DBMS_SCHEDULER.enable('file_watcher_test_job');<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">- CREATE DIRECTORY OBJECT NAMED FILE_WATCHER WHICH MAPS TO OS PATH '</span><span style="font-family: 'Courier New'; font-size: 10pt;">/tmp/test'</span><span style="font-family: Arial, sans-serif; font-size: 10pt;"><o:p></o:p></span></div>
<div style="background: #f2f1f2; border-bottom: white 1pt solid; border-left: white 1pt solid; border-right: white 1pt solid; border-top: white 1pt solid; mso-border-alt: solid white .5pt; mso-element: para-border-div; padding-bottom: 8pt; padding-left: 8pt; padding-right: 8pt; padding-top: 8pt;">
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">create directory file_watcher as '/tmp/test';<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">Information about file watchers is available from the</span><span style="font-family: Arial, sans-serif; font-size: 10pt;"> </span><span style="font-family: 'Courier New'; font-size: 10pt;">*_SCHEDULER_FILE_WATCHERS</span><span style="font-family: Arial, sans-serif; font-size: 10pt;"> </span><span style="font-family: Arial, sans-serif; font-size: 10pt;">views.<o:p></o:p></span></div>
<div style="background: #f2f1f2; border-bottom: white 1pt solid; border-left: white 1pt solid; border-right: white 1pt solid; border-top: white 1pt solid; mso-border-alt: solid white .5pt; mso-element: para-border-div; padding-bottom: 8pt; padding-left: 8pt; padding-right: 8pt; padding-top: 8pt;">
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">SET LINESIZE 100<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">COLUMN file_watcher_name FORMAT A20<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">COLUMN destination FORMAT A15<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">COLUMN directory_path FORMAT A15<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">COLUMN file_name FORMAT A10<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">COLUMN credential_name FORMAT A20<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<br /></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">SELECT file_watcher_name, destination, directory_path, file_name, credential_name <o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">FROM user_scheduler_file_watchers;<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<br /></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">FILE_WATCHER_NAME DESTINATION DIRECTORY_PATH FILE_NAME CREDENTIAL_NAME<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">-------------------- --------------- --------------- ---------- --------------------<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">TEST_FILE_WATCHER /tmp/test *.txt LOCAL_CREDENTIAL<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<br /></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">SQL><o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">-- TESTING<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">- Drop test table from hr schema and verify that the table does not exist<o:p></o:p></span></div>
<div style="background: #f2f1f2; border-bottom: white 1pt solid; border-left: white 1pt solid; border-right: white 1pt solid; border-top: white 1pt solid; mso-border-alt: solid white .5pt; mso-element: para-border-div; padding-bottom: 8pt; padding-left: 8pt; padding-right: 8pt; padding-top: 8pt;">
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">HR>DROP TABLE TEST PURGE;<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> SELECT TABLE_NAME <o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> FROM USER_TABLES<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> WHERE TABLE_NAME = 'TEST';<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">no rows selected<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<br /></div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">Now copy hr schema dumpfile to directory /tmp/test<o:p></o:p></span></div>
<div style="background: #f2f1f2; border-bottom: white 1pt solid; border-left: white 1pt solid; border-right: white 1pt solid; border-top: white 1pt solid; mso-border-alt: solid white .5pt; mso-element: para-border-div; padding-bottom: 8pt; padding-left: 8pt; padding-right: 8pt; padding-top: 8pt;">
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<br /></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">$cp /u01/test/hr_Schema.dmp /tmp/test/hr_sch.dmp<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">- Verify that the table test has been imported automatically.<o:p></o:p></span></div>
<div style="background: #f2f1f2; border-bottom: white 1pt solid; border-left: white 1pt solid; border-right: white 1pt solid; border-top: white 1pt solid; mso-border-alt: solid white .5pt; mso-element: para-border-div; padding-bottom: 8pt; padding-left: 8pt; padding-right: 8pt; padding-top: 8pt;">
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">HR> SELECT TABLE_NAME <o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> FROM USER_TABLES<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> WHERE TABLE_NAME = 'TEST';<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">TABLE_NAME<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">------------------------------<o:p></o:p></span></div>
<div class="MsoNormal" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 5pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">TEST<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="background-color: white; margin: 14pt 0in;">
<br />
<div style="margin: 0px;">
---------------------------------------------------------------------------------------------</div>
<div>
<div style="margin: 0px;">
Related links :</div>
<div style="margin: 0px;">
<br /></div>
<div style="margin: 0px;">
</div>
<div style="margin: 0px;">
HOME</div>
<div style="margin: 0px;">
<a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></div>
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com3tag:blogger.com,1999:blog-5330686748982593370.post-83957990467198343082012-08-03T02:08:00.001-07:002012-09-07T09:18:12.942-07:00Applications Database<div dir="ltr" style="text-align: left;" trbidi="on">
For more information on Applications Database visit :<br />
http://asteriskora.blogspot.in/<br />
<br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
---------------------------------------------------------------------------------------------</div>
<div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
Related links :</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
HOME</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com0tag:blogger.com,1999:blog-5330686748982593370.post-45284683007882052182012-07-24T00:18:00.000-07:002012-10-18T03:28:54.871-07:0011g R2 RAC : PROBLEMS DISCOVERED AND SOLUTIONS<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial;"></span><br />
<br />
11G R2 RAC PROBLEMS AND SOLUTIONS<br />
<br />
I discovered some issues while working with 11g R2 RAC. I would like to share them with u all.<br />
<br />
- During c/w installation, If kernel parameters are not set to<br />
appropriate values and runfixup.sh is run, kernel.sem parameter<br />
is set for running machine only. It's value is reset on next<br />
reboot and will have to be set manually to<br />
<br />
kernel.sem = 250 32000 100 128<br />
<br />
-------------------------------------------------------------<br />
<br />
- Whenver there is any problemwith ASM, it could be due to<br />
following reasons<br />
<br />
- parameter kernel.sem not set to appropriate value<br />
- Inappropriate permissions on /u01/app/11.2.0/grid/bin/oracle<br />
- Inappropriate permissions on /u01/app/oracle/product/11.2.0/dbhome_1/bin<br />
<br />
<br />
------------------------------------------------------<br />
- parameter kernel.sem not set to appropriate value<br />
-------------------------------------------------------<br />
<br />
soln:<br />
<br />
- add following line to /etc/sysctl.conf<br />
<br />
kernel.sem = 250 32000 100 128<br />
<br />
- #sysctl -p<br />
<br />
-------------------------------------------------------<br />
- Inappropriate permissions on /u01/app/11.2.0/grid/bin/oracle<br />
-------------------------------------------------------<br />
<br />
- Check that Permission on file /u01/app/11.2.0/grid/bin/oracle<br />
shd be<br />
<br />
# ls -lr /u01/app/11.2.0/grid/bin/oracle<br />
<br />
-rwsr-s--x 1 grid oinstall 152462728 Apr 4 08:45 oracle<br />
<br />
soln:<br />
<br />
- if permissions are not appropriate, change them<br />
<br />
#chmod 6751 /u01/app/11.2.0/grid/bin/oracle<br />
<br />
chown grid:oinstall /u01/app/11.2.0/grid/bin/oracle<br />
<br />
-------------------------------------------------------<br />
- Inappropriate permissions on /u01/app/oracle/product/11.2.0/dbhome_1/bin<br />
-------------------------------------------------------<br />
<br />
- Check that Permission on file<br />
/u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle shd be<br />
<br />
#ls -lr oracle<br />
<br />
-r-sr-s--x 1 oracle asmadmin 173515905 Apr 10 23:29 oracle<br />
<br />
soln:<br />
<br />
- if permissions are not appropriate, change them<br />
<br />
#chmod 6751 /u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle<br />
<br />
chown oracle:asmadmin /u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle<br />
<br />
<br />
------------------------------------------------------------------------<br />
<br />
IF CRS SERVICE IS NOT STARTING ON A NODE AND CRSD.LOG HAS AN ENTRY<br />
LIKE<br />
<br />
hash-id does not match<br />
<br />
It implies that OCR info on that node is not compatible with<br />
other nodes. This could be the case when OCR was reconfigured<br />
(add/delete/replace a location) and the affected node was not<br />
online so that it's ocr.loc was not updated.<br />
<br />
Soln: Copy /etc/oracle/ocr.loc from a runnning node to the<br />
affected node and try to restart crs<br />
<br />
-------------------------------------------------------------------<br />
RCONFIG<br />
<br />
IF WE USE RCONFIG TO ADD AN INSTANCE, ENTRIES ARE NOT AUTOMATICALLY<br />
ADDED TO THE TNSNAMES.ORA ON THE NEWLY ADDED NODE. THEY HAVE TO BE<br />
ADDED MANUALLY. <br />
<br />
RCONFIG WILL AUTOMATICALLY ADD REDO THREADS FOR THE ALL THE RUNNING NODES IN THE CLUSTER. FOR EXAMPLE, IF WE HAVE<br />
- A SINGLE INSTANCE DATABASE (NODE1)<br />
- 5 NODES IN THE CLUSTER AND<br />
- 3 RUNNING NODES (NODE1, NODE2, NODE3)<br />
<br />
IF WE USE RCONFIG TO ADD ANOTHER INSTANCE ON ONE OF THE REMAINING RUNNING NODES (NODE2), IT WILL AUTOMATICALLY ADD 2 SETS OF REDO THREADS, ONE FOR NODE2 AND ANOTHER FOR NODE3.<br />
<br />
--------------------------------------------------------------------<br />
<br />
IF A NODE IS DELETED USING ROOTCRS.PL etc. procedure (steps 3,4 and 7)<br />
GRID HOME IS NOT DELETED FROM THE DELETED NODE.<br />
<br />
TO ADD BACK SUCH NODE,<br />
<br />
- RUN ADDNODE.SH WITH NOCOPY OPTION<br />
<br />
It will update the inventories on all existing nodes and<br />
instantiates scripts on local node<br />
<br />
#cd grid_home/oui/bin<br />
<br />
addNode.sh -silent -noCopy ORACLE_HOME=$ORACLE_HOME "CLUSTER_NEW_NODES={host03}" "CLUSTER_NEW_VIRTUAL_HOSTNAMES={host03-vip}"<br />
<br />
<br />
- RUN ROOT.SH<br />
<br />
In case it is not available in grid home, copy root.sh<br />
from any of the existing nodes<br />
<br />
#cd /u01/app/11.2.0/grid<br />
<br />
./root.sh<br />
<br />
---------------------------------------------------------------------------------------------<br />
<br />
WHEN AN INSTANCE IS ADDED TO A RAC DATABASE USING DBCA, TNSNAMES.ORA<br />
ON NEWLY ADDED INSTANCE IS NOT UPDATED.<br />
<br />
Soln: Copy entry for the database from tnsnames.ora from existing node to the newly added node. <br />
<br />
---------------------------------------------------------------------------------------------<br />
Problem:<br />
<br />
After adding a node to the cluster, sometimes the node is visible to the cluster i.e. it appears when<br />
crsctl stat res -t is issued but it is not listed in DBCA. The reason is that its information is not updated<br />
in the inventory of existing nodes. <br />
<div>
<div style="margin: 0px;">
<br />
Solution:<br />
<br />
Add the entry of the newly added node in the inventory of the existing nodes for database home.<br />
<br />
$cd /u01/app/oraInventory/ContentsXML<br />
vi inventory.xml<br />
i.e.<br />
<br />
<HOME NAME="OraDb11g_home1" LOC="/u01/app/oracle/product/11.2.0/dbhome_1" TYPE="O" IDX="2"><br />
<NODE_LIST><br />
<NODE NAME="host01"/><br />
<NODE NAME="host02"/><br />
<NODE NAME="host03"/><br />
<br />
--------------------------------------------------------------------------------------------------------<br />
<br />
If a serverpool is created using srvctl e.g. test and we want to see its status, we can see it using srvctl or crsctl.<br />
If we query using srvctl status serverpool -g test, it will display its status<br />
If we query using crsctl status serverpool test, it will not recognize test serverpool but<br />
if we query using crsctk status serverpool ora.test, it displays the status.<br />
<br />
<div style="color: blue;">
<b>Hence, the name of the serverpool created using srvctl should be prefixed by ora. for crsctl to recognize it. </b></div>
<div style="color: blue;">
<br /></div>
Another issue related to the same problem is that DBCA recognizes only the pools prefixed with ora. Hence if we want to create a policy managed database ,<br />
- create the corresponding serverpool using srvctl<br />
- if we create serverpool using crsctl and prefix the name with .ora. i.e crsctl create serverpool ora.test , DBCA will recognize the pool but the database created using this pool will be listed as ADMIN MANAGED when its configuration is checked using srvctl although it runs in the sreverpool.<br />
<br />
<b style="color: blue;">Hence we should use srvctl to create a serverpool if we want a database to run in that pool. </b><br />
<br />
-------------------------------------------------------------------------------------------------------------<br />
<br />
In case of an admin managed database , names of the instances have the format db1, db2 etc.<br />
In case of an policy managed database , names of the instances have the format db_1, db_2 etc.<br />
/etc/oratab should have entries for all the instances so that we can invoke EM.<br />
To invoke EM:<br />
$export ORACLE_UNQNAME=db<br />
-- check which is instance is running on current node<br />
#srvctl status database -d db<br />
-- set ORACLE_SID to the instance running on current node<br />
#export ORACLE_SID=db_n<br />
$emctl start dbconsole<br />
<br />
<br />
------------------------------------------------------------------------------------------------------<br />
<br />
Related links :</div>
<div style="margin: 0px;">
<br /></div>
<div style="margin: 0px;">
</div>
<div style="margin: 0px;">
HOME</div>
<div style="margin: 0px;">
<a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></div>
<div style="margin: 0px;">
<br /></div>
</div>
11.2 RAC GOODIES AND SERVERPOOLS<br />
<div>
<span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/11.2%20RAC%20GOODIES%20AND%20SERVERPOOLS" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/11.2%20RAC%20GOODIES%20AND%20SERVERPOOLS</a></span><br />
<br /></div>
<div>
</div>
<div id="yui_3_2_0_1_134587371257817462">
<span dir="ltr" id="yui_3_2_0_1_134587371257817461">11G R2 RAC PROBLEMS AND SOLUTIONS</span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/11G%20R2%20RAC%20PROBLEMS%20AND%20SOLUTIONS" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/11G%20R2%20RAC%20PROBLEMS%20AND%20SOLUTIONS</a></span></span><br />
<span dir="ltr"><br /></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr">CLONE DATABASE HOME IN 11GR2 RAC</span> </span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/CLONE%20DATABASE%20HOME%20IN%2011GR2%20RAC" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/CLONE%20DATABASE%20HOME%20IN%2011GR2%20RAC</a></span></span><br />
<span dir="ltr"><br /></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr">NIC BONDING IN 11G R2 RAC</span> </span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/NIC%20BONDING%20IN%2011G%20R2%20RAC" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/NIC%20BONDING%20IN%2011G%20R2%20RAC</a></span></span><br />
<span dir="ltr"><br /></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr">PREREQUISITE TO CONFIGURE GNS AND GPNP IN 11G R2 RAC</span> </span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/PREREQUISITE%20TO%20CONFIGURE%20GNS%20AND%20GPNP%20IN%2011G%20R2%20RAC" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/PREREQUISITE%20TO%20CONFIGURE%20GNS%20AND%20GPNP%20IN%2011G%20R2%20RAC</a></span></span><br />
<span dir="ltr"><br /></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr">SERVICES CONFUSIONS CLEARED</span></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr"><span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/SERVICES%20CONFUSIONS%20CLEARED" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/SERVICES%20CONFUSIONS%20CLEARED</a></span></span></span><br />
<span dir="ltr"><span dir="ltr"><br /></span></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr"><span dir="ltr">SETUP 10G RAC ON YOUR LAPTOP</span> </span></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr"><span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/SETUP%2010G%20RAC%20ON%20YOUR%20LAPTOP" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/SETUP%2010G%20RAC%20ON%20YOUR%20LAPTOP</a></span></span></span><br />
<span dir="ltr"><span dir="ltr"><br /></span></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr"><span dir="ltr">SETUP AND PLAY WITH 11G R2 RAC AT YOUR HOME PC</span> </span></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<a href="http://koenigocm.blogspot.in/search/label/SETUP%20AND%20PLAY%20WITH%2011G%20R2%20RAC%20AT%20YOUR%20HOME%20PC" rel="nofollow" target="_blank"><span dir="ltr"><span dir="ltr"></span></span><span dir="ltr"><span dir="ltr"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SETUP%20AND%20PLAY%20WITH%2011G%20R2%20RAC%20AT%20YOUR%20HOME%20PC</span></span></span></a><br />
<br />
<span dir="ltr">11g R2 RAC - ADD INSTANCE MANUALLY</span> </div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<a href="http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%20-%20ADD%20INSTANCE%20MANUALLY">http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%20-%20ADD%20INSTANCE%20MANUALLY</a><br />
<br />
<span dir="ltr">11g R2 RAC - LOCAL ARCHIVE WITH NFS</span><br />
<span dir="ltr"> </span> http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%20-%20LOCAL%20ARCHIVE%20WITH%20NFS<br />
<br />
<span dir="ltr">11g R2 RAC : CACHE FUSION DEMONSTRATED</span><br />
<span dir="ltr"> http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%20%3A%20CACHE%20FUSION%20DEMONSTRATED</span><br />
<br />
<span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: small;"></span><br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 15px;">11G R2 RAC : DYNAMIC REMASTERING DEMONSTRATED</span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 15px;"><a href="http://koenigocm.blogspot.in/search/label/11G%20R2%20RAC%20%3A%20DYNAMIC%20REMASTERING%20DEMONSTRATED">http://koenigocm.blogspot.in/search/label/11G%20R2%20RAC%20%3A%20DYNAMIC%20REMASTERING%20DEMONSTRATED</a></span></div>
<div>
<br />
<span dir="ltr">11gR2 RAC : USE RCONFIG TO CONVERT NON RAC DATABASE TO RAC DATABASE</span>
<span dir="ltr"></span><br />
http://koenigocm.blogspot.in/search/label/11gR2%20RAC%20%3A%20USE%20RCONFIG%20TO%20CONVERT%20NON%20RAC%20DATABASE%20TO%20%20RAC%20DATABASE<br />
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;"><span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 15px;"></span><span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: xx-small;"><span class="Apple-style-span" style="line-height: 15px;"><br /></span></span><span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: xx-small;"><span class="Apple-style-span" style="line-height: 15px;"><span class="Apple-style-span" style="font-size: 13px;">11g R2 RAC : RECOVER VOTING DISK - A SCENARIO</span></span></span><br /><span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: xx-small;"><span class="Apple-style-span" style="line-height: 15px;"><span class="Apple-style-span" style="font-size: 13px;"><a href="http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%20%3A%20RECOVER%20VOTING%20DISK%20-%20A%20SCENARIO" style="color: #cc3300; text-decoration: none;">http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%20%3A%20RECOVER%20VOTING%20DISK%20-%20A%20SCENARIO</a></span></span></span></span><br />
<br />
<span dir="ltr">11g R2 RAC : TRACING SERVICES IN A RAC DATABASE</span><br />
<span dir="ltr"> http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%20%3A%20TRACING%20SERVICES%20%20IN%20A%20RAC%20DATABASE</span><br />
<br />
<div class="MsoNormal" style="font-family: "Trebuchet MS",sans-serif;">
<span dir="ltr">11G R2 RAC: INSTANCE RECOVERY</span><br />
<span dir="ltr"> http://koenigocm.blogspot.in/search/label/11G%20R2%20RAC%3A%20INSTANCE%20RECOVERY</span><br />
<br />
<span dir="ltr">11g R2 RAC: MANAGING THIRD PARTY APPLICATIONS USING APPLICATION VIP</span><br />
<span dir="ltr"> http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%3A%20MANAGING%20THIRD%20PARTY%20APPLICATIONS%20USING%20APPLICATION%20VIP</span><br />
<br /></div>
<span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: small;">
</span></div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com7tag:blogger.com,1999:blog-5330686748982593370.post-8672293563061334012012-07-02T00:40:00.000-07:002012-10-04T09:43:30.022-07:00ORACLE DATABASE BUFFER CACHE<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
<br />
BUFEFR CACHE ARCHITECTURE<br />
<br />
<br />
<br />
Database buffer cache is a memory structure in SGA. Buffers in DB cache are used to hold blocks of data read from the data files.Each buffer is sized to hold one database block. Oracle allows for a total of 8 different caches :<br />
<br />
- 5 caches to allow different block sizes<br />
- 3 caches to allow different behaviour<br />
<br />
BUFFERS TO ALLOW DIFFRENT BLOCK SIZES :<br />
<br />
- DEFAULT CACHE : To hold blocks of size DB_BLOCK_SIZE. Its size is determined by the parameter DB_CACHE_SIZE<br />
<br />
- DB NK CACHE : To hold blocks of size = nK where n = 2,4,8,16,32 where n is not equal the size of the default block (DB_BLOCK_SIZE). Its size is determined by the parameter DB_NK_CACHE_SIZE<br />
<br />
BUFFERS TO ALLOW DIFFRENT BEHAVIOUR :<br />
<br />
- DEFAULT CACHE : Cache where blocks of those objects are stored which are not assigned to keep or recycle cache or assigned default cache.<br />
<br />
- KEEP CACHE : Cache to hold blocks of small sized objects for a longer time.Its size is determined by the parameter DB_KEEP_CACHE_SIZE.<br />
<br />
<span style="background-color: white;">- RECYCLE CACHE : Cache designed to quickly age out blocks of rarely accessed large sized objects. Its size is determined by the parameter DB_RECYCLE_CACHE_SIZE.</span><br />
<br />
Each buffer in any of the above caches can be in any of the following states :<br />
<br />
- FREE : Free buffers can be further of two kinds:<br />
- Empty or unused<br />
- Buffers which are identical to the blocks on disk because<br />
. they have not been dirtied or<br />
. they were dirtied and have been written to disk<br />
<br />
- PINNED : A buffer being accessed (read/written) by a process.<br />
<br />
- DIRTY : A buffer which holds a block that has been changed by a server process and hence needs to be writted to the disk before it can be reused.<br />
<br />
Buffer headers store metadata about contents of the buffers and are used to manage the cache.The metadata includes information like Data block address (DBA) of the block, type of block (data,undo), touch count, pointer to the buffer, pointers to previous/next buffer in cache bufferchain etc. There is one row in V$BH for every buffer. Buffer headers keep track of various attributes and state of the buffers in buffer cache. The blocks are placed in the buffer cache in the form of linked lists (cache buffer chains) in different hash buckets. While searching for blocks in buffer cache oracle does not look at them buffer by buffer as it will bring down the performance drastically. Let us take the example of a library where we are looking for a blook. If we search the whole library book by book it will take very long but if the books are placed subject wise, we first need to go the rack containing books of the desired subject and then we search for the book we want. Our search will be over rather quickly. In the same manner, buffers are placed in different hash buckets depending upon the hash value of the data block address (DBA). While searching for a particular block, Oracle first hashes the DBA of the desired block, locates the hash bucket containing the block and then searches the blocks in that hash bucket. Different DBAs can hash to the same value (similar to modulus function i.e mod (5,4) = mod (9,4) = mod(13,4)....). Hence, one hash bucket can contain blocks with different DBA's. Each hash chain is protected by a latch. Processes need to get the relevant latch to allow them to scan a hash chain for a buffer so that while searching, the linked list underneath does not change. These latches are called cache buffer chain latches CBC latches). One CBC latch protects multiple hash buckets.<br />
<br />
To implement read consistency, a hash chain can also contain multiple versions of the same block (DBA). For each DBA in a bucket, there is at least one current block which contains all the committed/uncommitted changes in different rows in that block made by different users. When a user requests a row from that block, he should receive a read consistent copy of the block i.e. the copy should have all the changes (committed / uncommitted) made by him and only the committed changes made by other users. If the desired read consistent clone is already there, it is read and the user gets to see the results. If the read consistent clone is not there, a copy of the current block is made and marked as clone. Changes are rolled back on the clone after reading undo and then the user os displayed the results. In this case, No. of consistent gets are higher. If a block is rapidly changed and is rapidly queried, multiple CR copies can exist in buffer cache. Such a block is called a hot block. All CR copies have the same DBA and hence go to the same hash bucket (CBC). The CBC gets longer and hence takes longer to scan. Multiple users trying to scan the CBC chain may have to wait to obtain the latch on the hash bucket. This can result in contention on CBC latch.<br />
<br />
CBC latch Hash bucket Buffer hash chains of Buffers<br />
buffer headers<br />
<br />
L1 +------- B1 ----------------- A <-> C A<br />
| B<br />
+------- B2 ----------------- B <-> F <-> E <-> B C<br />
|_____________| D<br />
| E<br />
CR CLONES F<br />
<br />
L2 +------- B3<br />
|<br />
+------- B4<br />
<br />
L3 +------- B5<br />
|<br />
+------- B6<br />
<br />
No. of buckets protected by each latch = 32 - is high so that<br />
<br />
1. Hash chains linked to a bucket will be smaller.<br />
<br />
2. No. of latches will be less since latch is a fairly large structure with along code path.<br />
<br />
No. of hash buckets is decided by an uncodumented parameter _db_block_hash_buckets<br />
<br />
<br />
Whenever any block is modified, changes are always made on the current copy of the block and the statistic db block gets is incremented. Th information in hash buckets is actually the linked list of buffer headers pointing to blocks in DB buffercache. The latch on the hash chain can be obtained in<br />
<br />
- SHARED MODE: to scan the buffers<br />
<br />
- EXCLUSIVE MODE: To link/delink blocks to/from the chain<br />
<br />
To know more about consistent reads in oracle click the following link: <a href="http://koenigocm.blogspot.in/search/label/CONSISTENT%20READS%20IN%20ORACLE">http://koenigocm.blogspot.in/search/label/CONSISTENT%20READS%20IN%20ORACLE</a><br />
<br />
ALGORITHM FOR HASH LOOKUP<br />
---------------------------------------<br />
<br />
1. Hash the DBA (Tablespace-id + File-id + Block-id)<br />
<br />
2. Find the corresponding hash bucket .<br />
<br />
3. Try to get the latch protecting the hash bucket<br />
<br />
If not success<br />
<br />
- Spin for spin count times<br />
<br />
. If latch was not got while spinnning,<br />
then sleep, wakeup and go to step 3(try to get latch)<br />
<br />
else (latch obtained)<br />
go to step 4(walk the chain)<br />
<br />
else ( latch obtained)<br />
Go to step 4 (walk the chain)<br />
<br />
4. Walk the chain, reading buffer headers to see if specific version of the buffer is already in the chain.<br />
<br />
If found (logical I/O)<br />
<br />
Access the buffer in buffer cache with protection of buffer pin/unpin action.<br />
<br />
else (not found) (Physical I/O)<br />
<br />
- find a free buffer in buffer cache (obtain LRU latch)<br />
- unlink the buffer header for that buffer from its current chain (LRU chain)<br />
- Link that buffer header with this buffer chain<br />
- Release the latch and read the block into that free buffer with buffer header unpinned.<br />
<br />
WORKING SETS<br />
<br />
Buffers in the buffer cache are divided into working sets to improve scalability of common buffer cache operation. Each working set has its own LRU list and two check point queues.<br />
<br />
- One DB writer may be responsible to write buffers in multiple working sets. Therefore, write I/O workload can be distributed among various DB writers.<br />
<br />
- Since each working set has its own LRU list, competition between processes trying to look for free buffers is reduced as differebt readers pick buffers from different working sets.<br />
<br />
No. of working sets in 11g R2 = CPU_COUNT<br />
No. of DB writers in 11g R2 = CPU_COUNT/8<br />
<br />
Buffers in DB buffer cache are managed using various doubly linked lists:<br />
<br />
- LRU list : contains list of free / dirty / pinned buffers. It has a<br />
<br />
. Least Recently used (LRU) end which has cold buffers which have not been accessed for a long time.<br />
<br />
. Most recently used (MRU) end which have hot buffers which have been recently accessed.<br />
<br />
When a block is first read into the buffer, it is placed in the middle of the LRU list and moved to the LRU/MRU end depeneding upon how frequently and how recently it has been accessed which is further decided by a buffer's touch count. The touch count of a buffer is stored in its header .When a server process scans the LRU list to find free buffers, it moves the buffers to the MRU/LRU end depending upon its touch count. Hence, it is possible that some buffers on the LRU end might not be really cold. They may be there because they have not been searched by a server process yet.<br />
<br />
As instance activity increases, dirty buffers on LRU need to be flushed to the disk so that they can be reused. Since blocks need to be written to disk in the order in which they were dirtied, anothet list is maintained i.e.e checkpoint queue which contains dirty blocks in the order of SCN#.<br />
<span style="background-color: white;"><br /></span>
<span style="background-color: white;">- Checkpoint queue : contains dirty buffers in the order in which they were dirtied (SCN#). Whenever a block is dirtied, it is attached here. A buffer can be simlultaneously in both LRU list and checkpoint queue.</span><br />
<br />
- Write list - Main : contains dirty buffers which have to be written by DB writer to free some buffers in the buffer cache. When a Server process is scanning LRU list for a free buffer, dirty buffers in LRU list are delinked from LRU list before linking them to this list.<br />
<br />
- Write list - Aux : contains dirty buffers to which have already been written to the online redo log files and are currently being written by DB writer to data files.<br />
<br />
In the next article I will discuss about checkpointing.<br />
----------------------------------------------------------------------------------------------------------<br />
<br />
Related links:<br />
<br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
HOME</div>
</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></div>
</div>
<br />
BUFFER CACHE WAIT EVENTS<br />
<div id="yui_3_2_0_18_1346254896797830">
<a href="http://koenigocm.blogspot.in/search/label/BUFFER%20CACHE%20WAIT%20EVENTS" rel="nofollow" style="color: blue !important; cursor: text !important;" target="_blank">http://koenigocm.blogspot.in/search/label/BUFFER%20CACHE%20WAIT%20EVENTS</a><br />
<br /></div>
<div>
</div>
<div>
<span dir="ltr">CASE STUDY ON BUFFER BUSY WAIT EVENT</span></div>
<div>
<a href="http://koenigocm.blogspot.in/search/label/CASE%20STUDY%20ON%20BUFFER%20BUSY%20WAIT%20EVENT" rel="nofollow" style="color: blue !important; cursor: text !important;" target="_blank">http://koenigocm.blogspot.in/search/label/CASE%20STUDY%20ON%20BUFFER%20BUSY%20WAIT%20EVENT</a><br />
<br /></div>
<div>
</div>
<div>
<span dir="ltr">CHECKPOINTS CONFUSIONS CLEARED</span></div>
<div>
<span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/CHECKPOINTS%20CONFUSIONS%20CLEARED%20FROM%20KARAN" rel="nofollow" style="color: blue !important; cursor: text !important;" target="_blank">http://koenigocm.blogspot.in/search/label/CHECKPOINTS%20CONFUSIONS%20CLEARED%20FROM%20KARAN</a></span><br />
<br /></div>
<div>
</div>
<div>
<span dir="ltr">ORACLE CHECKPOINTS</span></div>
<div>
<span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/ORACLE%20CHECKPOINTS" rel="nofollow" style="color: blue !important; cursor: text !important;" target="_blank">http://koenigocm.blogspot.in/search/label/ORACLE%20CHECKPOINTS</a></span><br />
<br /></div>
<div>
</div>
<div class="yui_3_2_0_18_1346254896797213" style="font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span dir="ltr">ORACLE DATABASE BUFFER CACHE</span></div>
<div class="yui_3_2_0_18_1346254896797215" style="font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/ORACLE%20DATABASE%20BUFFER%20CACHE" rel="nofollow" style="color: blue !important; cursor: text !important;" target="_blank">http://koenigocm.blogspot.in/search/label/ORACLE%20DATABASE%20BUFFER%20CACHE</a></span><br />
<br /></div>
<div class="yui_3_2_0_18_1346254896797217" id="yui_3_2_0_18_1346254896797831" style="font-family: arial, helvetica, sans-serif; font-size: 16px;">
</div>
<div class="yui_3_2_0_18_1346254896797219" style="font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span dir="ltr">SIMULATE BUFFER BUSY WAIT AND IDENTIFY HOT OBJECT</span></div>
<div class="yui_3_2_0_18_1346254896797221" style="font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/SIMULATE%20BUFFER%20BUSY%20WAIT%20AND%20IDENTIFY%20HOT%20OBJECT" rel="nofollow" style="color: blue !important; cursor: text !important;" target="_blank">http://koenigocm.blogspot.in/search/label/SIMULATE%20BUFFER%20BUSY%20WAIT%20AND%20IDENTIFY%20HOT%20OBJECT</a></span><br />
<br /></div>
<div class="yui_3_2_0_18_1346254896797223" style="font-family: arial, helvetica, sans-serif; font-size: 16px;">
</div>
<div class="yui_3_2_0_18_1346254896797225" style="font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span dir="ltr"></span> <span class="yiv1053434995Apple-style-span" style="color: #333333; line-height: 20px;">CONSISTENT READS IN ORACLE PART-I</span></div>
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;"><a href="http://koenigocm.blogspot.in/search/label/CONSISTENT%20READS%20IN%20ORACLE" rel="nofollow" style="color: blue !important; cursor: text !important;" target="_blank">http://koenigocm.blogspot.in/search/label/CONSISTENT%20READS%20IN%20ORACLE</a></span><span class="yiv1053434995Apple-style-span yui_3_2_0_18_1346254896797655" id="yui_3_2_0_18_1346254896797782" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;"></span><br />
<span class="yiv1053434995Apple-style-span yui_3_2_0_18_1346254896797655" id="yui_3_2_0_18_1346254896797782" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;">
</span>
<br />
<div style="background-color: white;">
<span class="yiv1053434995Apple-style-span yui_3_2_0_18_1346254896797655" id="yui_3_2_0_18_1346254896797782" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;"><br /></span></div>
<span class="yiv1053434995Apple-style-span yui_3_2_0_18_1346254896797655" id="yui_3_2_0_18_1346254896797782" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;">
</span>
<br />
<div class="yui_3_2_0_18_1346254896797231">
<span class="yiv1053434995Apple-style-span yui_3_2_0_18_1346254896797655" id="yui_3_2_0_18_1346254896797782" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;"><span style="background-color: #c0a154; font-size: 13px; line-height: 15px;">CONSISTENT READS IN ORACLE PART-II</span> </span></div>
<span class="yiv1053434995Apple-style-span yui_3_2_0_18_1346254896797655" id="yui_3_2_0_18_1346254896797782" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;">
</span>
<div class="yui_3_2_0_18_1346254896797233" id="yui_3_2_0_18_1346254896797774">
<span class="yiv1053434995Apple-style-span yui_3_2_0_18_1346254896797655" id="yui_3_2_0_18_1346254896797782" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;"><a href="http://koenigocm.blogspot.in/search/label/CONSISTENT%20READS%20IN%20ORACLE%20PART-II" rel="nofollow" style="color: blue !important; cursor: text !important;" target="_blank">http://koenigocm.blogspot.in/search/label/CONSISTENT%20READS%20IN%20ORACLE%20PART-II</a> </span></div>
<span class="yiv1053434995Apple-style-span yui_3_2_0_18_1346254896797655" id="yui_3_2_0_18_1346254896797782" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;">
<div class="yui_3_2_0_18_1346254896797233" id="yui_3_2_0_18_1346254896797774">
<br id="yui_3_2_0_18_1346254896797823" /></div>
<div class="yui_3_2_0_18_1346254896797233" id="yui_3_2_0_18_1346254896797774">
FLUSH BUFFER CACHE</div>
<div class="yui_3_2_0_18_1346254896797233" id="yui_3_2_0_18_1346254896797774">
<a href="http://koenigocm.blogspot.in/search/label/FLUSH%20BUFFER%20CACHE" style="color: blue !important; cursor: text !important;">http://koenigocm.blogspot.in/search/label/FLUSH%20BUFFER%20CACHE</a> </div>
<div class="yui_3_2_0_18_1346254896797233" id="yui_3_2_0_18_1346254896797774">
<br id="yui_3_2_0_18_1346254896797816" /></div>
</span></div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com4tag:blogger.com,1999:blog-5330686748982593370.post-61954647623092543662012-06-01T23:38:00.001-07:002012-10-18T03:30:10.798-07:0011.2 RAC GOODIES AND SERVERPOOLS<div dir="ltr" style="text-align: left;" trbidi="on">
Oracle RAC is designed to cater for Oracle specific applications and also non-oracle applications. These applications, both Oracle and non-Oracle, when deployed on RAC, are termed as resources and Oracle RAC can manage both kinds of resources on the clusterware stack. Examples of both oracle and non-oracle resources are: database instance, database services, xclock, Apache etc.<br />
<br />
The traditional way to manage these resources was manually. The DBA was supposed to decide on which instance (or instances) these resources would run and would set them up accordingly. An example of this can be taken when you are configuring a service which has to be present on some nodes as Preferred and on another node(s) as Available. Although this kind of management works well, it’s not something that can scale for a cluster which has got a large number of nodes in it. Think about sitting and managing the instances over a 200 nodes cluster, it wouldn’t be very exciting would it?<br />
<br />
Enter Server Pools<br />
<br />
Grid computing is a concept within Oracle database which has been there since 10g. The basic meaning of grid computing is to divide the hard coupling of the availability of a resource over the machines thus letting the resources be available on a ‘wherever and whenever’ kind of basis. This means that there shouldn’t be a restriction on a said resource which must be present on a specific machine itself or can only be accessed from a specific machine. The very same concept is enhanced in 11.2 RAC with the introduction of Server Pools.<br />
<br />
Server Pools allow the same functionality of logically dividing the cluster into small segments that can be used for varying workloads. But unlike the traditional mechanism available up to 11.1, which only allows this task by choosing the instances to run on nodes as Preferred & Available and running services using the same architecture, server pools offer a much larger list of attributes which help in the management of resources in a rather simple and transparent way. In server pools, the underlying hosts of the cluster are added (and removed) from the pools much more on-the-fly, and take the burden off the DBA’s shoulders for this task. With just a few parameters to take care of, the whole stack becomes much easier to govern and administer, while still being completely transparent yet powerful to manage all the types of different resources in the RAC clusterware environment, especially when the number of the nodes go beyond two digits.<br />
<br />
The built-in pools, Free and Generic<br />
<br />
In 11.2, with the installation of the cluster, two pools get created by default-Free & Generic.<br />
<br />
Generic Pool<br />
<br />
When you upgrade your existing version of the clusterware to 11.2, all the nodes get mapped to the in-built Generic pool. This is an internally managed server pool and the modification of the attributes of this pool is not allowed. Besides the addition of the nodes of the previous cluster, in 11.2, when you create a database which is Admin-managed, that also becomes a part of the Generic Pool as a child pool of it.<br />
<br />
Free Pool<br />
<br />
This is another pool which gets created by default with the installation of the 11.2 clusterware. If it’s going to be a fresh installation of the clusterware environment, all the nodes would be attached to this pool first of all. From this pool only, the nodes would move to the manually created server pools. As like the Generic pool, this is also an internally managed pool but still some attributes are available to be modified by the dba like IMPORTANCE.<br />
<br />
Child Pools<br />
<br />
Server pools can have the child pools under them as well. The child pools are going to have their own properties. The order in which the host allocated to them is going to be based on the IMPORTANCE parameter assigned to them. To understand the child pools, we can imagine a parent pool named as OLTP which represents the working of OLTP database. This parent pool now can have two further child pools, HR (human resource) and AP (account payable) . Now, we can have different attributes set up for the child pools depending on the importance that we want to give to each domain of the work. The hosts assigned are mutually exclusive within the parent pools. For the child pools, whether the same is possible for the child pools or not, would be based on the fact that what’s the value of the attribute EXCLUSIVE_POOL for them. If there is a string value assigned to this parameter and this is shared by two child pools, host assigned to one child pool can’t be shared by its other sibling.<br />
<br />
How the hosts are added to the server pools<br />
<br />
The allocation of the hosts is going to be happening in the following order:<br />
<br />
Generic Pool<br />
Explicitly created pool<br />
Free Pool<br />
<br />
Oracle would keep on adding the hosts to the server pools as long as they have not been equal to the values of the MIN_SIZE and MAX_SIZE on the basis of the IMPORTANCE that’s assigned to the server pools. The hosts are going to be added exclusively to the pools i.e. the hosts added to one server pool won’t be shared with the other pools. The hosts can be shared by the child pools provided that there is no value set for the parameter EXCLUSIVE_POOLS which would restrict the host sharing within the child pools as well.<br />
<br />
Database management changes in 11.2 -to use server pools<br />
<br />
To incorporate the usage of server pools, there is a change introduced in the database itself. From 11.2 onwards, there would be two types of databases available, Admin Managed and Policy Managed. Choosing either one would make you use the server pools though it would vary whether those server pools would be explicitly created by you or would be the default one available already.<br />
<br />
Admin managed database<br />
<br />
This is sort of the same as the traditional database type i.e. where a DBA is responsible to manage the allocation of the resources and instances explicitly on the available instances, and also the instances on the respective nodes. This database type would assign the instances to a child pool of the default pool available Generic pool. Having the Generic pool as the parent, no modification of the child pools of the Admin managed database’s instances would be allowed for the DBA to be done by their self. Depending on the number of nodes being chosen initially for the database, the instances would be started on each one of them. By default, with a fresh installation of 11.2 RAC, all the nodes would get added to the Generic pool and in the upgrade, all the nodes of the previous version would also be added to the Generic pool. Although this type seems to be much simpler and like the older versions and techniques of managing the instances, this can’t be used when the number of nodes pass a number which is difficult to manage by a DBA, for example 100. In that case, the next type of the 11.2 database would be helpful-Policy Managed database.<br />
<br />
Policy Managed Database<br />
<br />
This type of database administration is meant to make DBAs’ life simpler by not letting them worry about managing each of their instances on each node individually, but to use a server pool to manage the instances. By using server pools, the administrative tasks to manage the database becomes much simpler.<br />
<br />
-----------------------------------------------------------------------------------------------------------<br />
<br />
Related links:<br />
<br />
<div>
HOME<br />
<div style="margin: 0px;">
<div style="margin: 0px;">
<a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></div>
</div>
<br /></div>
<div id="yui_3_2_0_1_134587371257817462">
<br />
<span dir="ltr">11G R2 RAC PROBLEMS AND SOLUTIONS</span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/11G%20R2%20RAC%20PROBLEMS%20AND%20SOLUTIONS" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/11G%20R2%20RAC%20PROBLEMS%20AND%20SOLUTIONS</span></a></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<br />
<span dir="ltr"><span dir="ltr">CLONE DATABASE HOME IN 11GR2 RAC</span> </span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/CLONE%20DATABASE%20HOME%20IN%2011GR2%20RAC" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/CLONE%20DATABASE%20HOME%20IN%2011GR2%20RAC</span></a></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<br />
<span dir="ltr"><span dir="ltr">NIC BONDING IN 11G R2 RAC</span> </span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/NIC%20BONDING%20IN%2011G%20R2%20RAC" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/NIC%20BONDING%20IN%2011G%20R2%20RAC</span></a></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<br />
<span dir="ltr"><span dir="ltr">PREREQUISITE TO CONFIGURE GNS AND GPNP IN 11G R2 RAC</span> </span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/PREREQUISITE%20TO%20CONFIGURE%20GNS%20AND%20GPNP%20IN%2011G%20R2%20RAC" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/PREREQUISITE%20TO%20CONFIGURE%20GNS%20AND%20GPNP%20IN%2011G%20R2%20RAC</span></a></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<br />
<span dir="ltr"><span dir="ltr">SERVICES CONFUSIONS CLEARED</span></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/SERVICES%20CONFUSIONS%20CLEARED" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SERVICES%20CONFUSIONS%20CLEARED</span></a></span></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<br />
<span dir="ltr"><span dir="ltr"><span dir="ltr">SETUP 10G RAC ON YOUR LAPTOP</span> </span></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/SETUP%2010G%20RAC%20ON%20YOUR%20LAPTOP" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SETUP%2010G%20RAC%20ON%20YOUR%20LAPTOP</span></a></span></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<br />
<span dir="ltr"><span dir="ltr"><span dir="ltr">SETUP AND PLAY WITH 11G R2 RAC AT YOUR HOME PC</span> </span></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr"></span></span><span dir="ltr"><span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/SETUP%20AND%20PLAY%20WITH%2011G%20R2%20RAC%20AT%20YOUR%20HOME%20PC" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SETUP%20AND%20PLAY%20WITH%2011G%20R2%20RAC%20AT%20YOUR%20HOME%20PC</span></a></span></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<br />
<span dir="ltr">11g R2 RAC - ADD INSTANCE MANUALLY</span> <br />
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<a href="http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%20-%20ADD%20INSTANCE%20MANUALLY">http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%20-%20ADD%</a><br />
<br />
<span dir="ltr">11g R2 RAC - LOCAL ARCHIVE WITH NFS</span><br />
<span dir="ltr"> </span> http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%20-%20LOCAL%20ARCHIVE%20WITH%20NFS<br />
<br />
<span dir="ltr">11g R2 RAC : CACHE FUSION DEMONSTRATED</span><br />
<span dir="ltr"> http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%20%3A%20CACHE%20FUSION%20DEMONSTRATED</span><br />
<span dir="ltr"><br /></span>
<span dir="ltr"><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: small;"></span></span><br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span dir="ltr"><span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 15px;">11G R2 RAC : DYNAMIC REMASTERING DEMONSTRATED</span></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span dir="ltr"><span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 15px;"><a href="http://koenigocm.blogspot.in/search/label/11G%20R2%20RAC%20%3A%20DYNAMIC%20REMASTERING%20DEMONSTRATED">http://koenigocm.blogspot.in/search/label/11G%20R2%20RAC%20%3A%20DYNAMIC%20REMASTERING%20DEMONSTRATED</a></span></span></div>
<div>
<span dir="ltr"><br /></span>
<span dir="ltr">11gR2 RAC : USE RCONFIG TO CONVERT NON RAC DATABASE TO RAC DATABASE</span>
<span dir="ltr"></span><br />
http://koenigocm.blogspot.in/search/label/11gR2%20RAC%20%3A%20USE%20RCONFIG%20TO%20CONVERT%20NON%20RAC%20DATABASE%20TO%20%20RAC%20DATABASE<br />
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;"><span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 15px;"></span><span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: xx-small;"><span class="Apple-style-span" style="line-height: 15px;"><br /></span></span><span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: xx-small;"><span class="Apple-style-span" style="line-height: 15px;"><span class="Apple-style-span" style="font-size: 13px;">11g R2 RAC : RECOVER VOTING DISK - A SCENARIO</span></span></span><br /><span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: xx-small;"><span class="Apple-style-span" style="line-height: 15px;"><span class="Apple-style-span" style="font-size: 13px;"><a href="http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%20%3A%20RECOVER%20VOTING%20DISK%20-%20A%20SCENARIO" style="color: #cc3300; text-decoration: none;">http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%20%3A%20RECOVER%20VOTING%20DISK%20-%20A%20SCENARIO</a></span></span></span></span><br />
<br />
<span dir="ltr">11g R2 RAC : TRACING SERVICES IN A RAC DATABASE</span><br />
<span dir="ltr"> http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%20%3A%20TRACING%20SERVICES%20%20IN%20A%20RAC%20DATABASE</span><br />
<br />
<div class="MsoNormal" style="font-family: "Trebuchet MS",sans-serif;">
<span dir="ltr">11G R2 RAC: INSTANCE RECOVERY</span><br />
<span dir="ltr"> http://koenigocm.blogspot.in/search/label/11G%20R2%20RAC%3A%20INSTANCE%20RECOVERY</span><br />
<br />
<span dir="ltr">11g R2 RAC: MANAGING THIRD PARTY APPLICATIONS USING APPLICATION VIP</span><br />
<span dir="ltr"> http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%3A%20MANAGING%20THIRD%20PARTY%20APPLICATIONS%20USING%20APPLICATION%20VIP</span><br />
<br /></div>
</div>
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com0tag:blogger.com,1999:blog-5330686748982593370.post-50514447244161005992012-04-05T00:26:00.002-07:002012-11-10T22:20:18.310-08:0011g DATA GUARD ADMINISTRATION AND SETUP TIPS<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: Calibri;">Assume we have a production database i.e "PC01PRMY" which is keep up and running in 24x7 environment and their master DBA's has decided to setup physical standby i.e. "PC01SBY1" at remote location for disaster recover solutions as well as to make production available all the time while routine maintenance operations on production.</span></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<br /></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: Calibri;">I have already posted on our blog, how to setup physical standby database for production but this time I would like to share few tips while setup and while administrating DR site.</span></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<br /></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: Calibri;">Tips 1> Better to use Active database duplication to setup standby database in spite of using backup copy. As you know about Active database duplication where duplicate database is created using online copy of production data files and in fact it doesn't require any staging area as well and we also don't need to apply any redo logs. When you use active database duplication better to perform some log switching manually on primary side cause if there is no log switching happened so far on primary side, in this case your duplicate database failed and you have to restart it after cleanup everything.</span></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<br /></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: Calibri;">Tips 2> Configure Oracle Net properly between Primary and Standby because what I found students normally does mistakes there and later on we face lot of difficulties to resolve them, especially when your database managed by Oracle restart where we have separate grid and database home and default listener is running from grid home.</span></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<br /></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: Calibri;">Oracle Net configuration includes three main steps-</span></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<br /></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: Calibri;">Configure Listener (Keep in mind Listener home and port number)</span></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: Calibri;">Register database service with Listener (Use correct service name and Oracle database home)</span></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: Calibri;">Configure TNS alias for database service (Use correct hostname, Listener port number and database service name)</span></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<br /></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: Calibri;">Tips 3> Though LOG_ARCHIVE_DEST_STATE_N parameter default value is ENABLE but still I recommend you to set this parameter manually.</span></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<br /></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: Calibri;">Tips 4> Better to setup Standby Redo log groups in advance on primary side. (You know better why?)</span></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<br /></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: Calibri;">Tips 5> Better to configure LOCAL_LISTENER parameter manually and set the address of those Listener which we are using for Oracle Net connectivity so that PMON will register a service with the name "db_unique_name_DGB.db_domain" automatically at run time which is use by broker internally for inter-communication.</span></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<br /></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: Calibri;">Tips 6> If you are managing Data Guard using Broker then please consider followings points-</span></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<br /></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: Calibri;">=> when you remove database or entire broker configuration using REMOVE DATABASE or REMOVE CONFIGURATION better to use PRESERVE DESTINATIONS options else when you remove the database from configuration broker will reset their corresponding parameters like LOG_ARCHIVE_DEST_N, LOG_ARCHIVE_CONFIG etc.</span></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<br /></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: Calibri;">=> Use SPFILE if you are managing Data Guard using broker and modify archive dest attributes through broker only else there would be inconsistency in broker configuration and spfile settings if we modify using ALTER SYSTEM command.</span></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<br /></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: Calibri;">=> Identify inconsistent attribute settings between broker and spfile using SHOW DATABASE <DB_NAME> INCONSISTENTPROPERTIES. If you want to remove inconsistency with broker values then just disable and enable the database using broker and if you want to remove inconsistency with spfile values then update the values using EDIT DATABASE broker command.</span></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<br /></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: Calibri;">=> Sometimes we need to recreate the broker configuration but even after recreating broker reads previous broker configuration from memory. To overcome from this problem you have to change broker configuration files location just to enforce broker to read new configuration settings.</span></div>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
--------------------------------------------------------------------------------------------------------<br />
<br />
Related links:<br />
<br />
<br />
<div style="margin: 0px;">
<div style="margin: 0px;">
HOME</div>
</div>
<div style="margin: 0px;">
<div style="margin: 0px;">
<a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></div>
</div>
<br />
<br />
<div>
<span dir="ltr">11G DATA GUARD NEW FEATURES </span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span style="color: #234786;"><a href="http://koenigocm.blogspot.in/2012/03/11g-data-guard-new-features.html" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/2012/03/11g-data-guard-new-features.html</a></span></span><br />
<span dir="ltr"><br /></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr">DATA GUARD SETUP</span> </span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/DATA%20GUARD%20SETUP" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/DATA%20GUARD%20SETUP</a></span></span><br />
<span dir="ltr"><br /></span>
<span dir="ltr"><span class="Apple-style-span" style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;">11g Data Guard Configuration using Active Dataguard on RHEL/OEL- 5</span></span><br />
<span dir="ltr"><span class="Apple-style-span" style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"><a href="http://oracleinaction.blogspot.in/2012/11/DATAGUARD.html">http://oracleinaction.blogspot.in/2012/11/DATAGUARD.html</a></span></span><br />
<span dir="ltr"><br /></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<br />
RECOVERY USING STANDBY DATABASE</div>
http://koenigocm.blogspot.in/search/label/RMAN<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com1tag:blogger.com,1999:blog-5330686748982593370.post-45845195755551437672012-03-23T00:47:00.000-07:002012-11-10T22:21:42.984-08:0011G DATA GUARD NEW FEATURES<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<b>Real-Time Query.</b> In Oracle Database 8<i>i</i> it was possible to bring a standby database into <b>READ ONLY</b> mode so that it could be used for reporting purposes, but it was necessary to switch it back to standby mode for reapplication of pending change vectors from the archived redo logs transported from the primary database. Oracle Database 11<i>g</i> now lets me run queries in real time against any physical standby database without any disturbance to receipt and application of redo.<o:p></o:p><br />
<br />
<br />
<br />
<b>Snapshot Standby Databases.</b> Oracle Database 11<i>g </i>offers another intriguing prospect: the ability to open a physicalstandby database for testing or QA purposes while simultaneously collecting production changes for immediate reapplication in case disaster recovery is required. This snapshot standbydatabase still accepts redo information from its primary, but unlike the first two standby types, it does not apply the redo to the database immediately; instead, the redo is only applied when the snapshot standby database is reconverted back into a physical standby. This offers significant leverage because in theory, a QA environment that requires specifically dedicated, identical hardware is no longer required.<o:p></o:p><br />
<br />
<br />
<br />
<b>Improved Handling of Role Transitions.</b> The addition of standby snapshot databases brings the total of different Data Guard standby database types to three (physical, logical, and snapshot), so Oracle Database 11g also makes it much easier to transition between these different roles via either Data Guard Broker (DGB) command line execution or Enterprise Manager Grid Control. Role transitions are simpler to execute and complete more quickly than in earlier releases.<o:p></o:p><br />
<br />
<br />
<br />
<b>Improvements to Rolling Database Upgrades.</b>Oracle Database 11<i>g</i> supports rolling database upgrades to be performed against a <i>physical</i> standby database by first transforming it into a logical standby database with a few simple commands before the upgrade begins. Once the upgrade is done, the logical standby database is reverted to its original physical standby state. Oracle 11<i>g</i>leverages this capability as well as the improved speed and simplicity of role transitions to perform system and database patching in a fraction of the time it would’ve taken in earlier releases, and it’s especially powerful in a Real Application Clusters (RAC) database environment.<o:p></o:p><br />
<br />
<br />
<br />
<b>SQL Apply Enhancements.</b> Logical standby databases are obviously central to these new role transition features, but they use SQL Apply technology to apply change vectors to data. It therefore makes sense that Oracle Database 11g provides significant improvements to this crucial part of Data Guard architecture. SQL Apply now supports parallel DDL execution, Fine-Grained Auditing (FGA), Virtual Private Database (VPD), and Transparent Data Encryption (TDE), as well as simpler real-time SQL Apply reconfiguration and tuning.<o:p></o:p><br />
<br />
<br />
<br />
<b>Enhanced Redo Logs Transport. </b>Physical standby databases have always used archived redo logs for application of change vectors to data. Oracle Database 11g augments redo transport with some long-overdue features, including compressionand SSL authentication of redo logs while they’re being transmitted between the primary and standby sites.<o:p></o:p><br />
<br />
<br />
<br />
<b>Heterogeneous DataGuard.</b>, Oracle Database 11g allows the primary and standby databases to use different operating systems (for example, Windows 2003 Server and Oracle Enterprise Linux) as long as both operating systems support the same endianness.<o:p></o:p><br />
<br />
<br />
<br />
<b>Fast Start Failover Improvements.</b> Oracle introduced this feature set in Release 10<i>g</i>R2, but it’s been enhanced significantly in Oracle 11<i>g</i> to permit much finer-grained control over the conditions under which a fast-start failover would be initiated.<o:p></o:p><br />
<br />
<br />
<br />
<b>“Live Cloning” of Standby Databases.</b> Finally, Oracle 11g has made it extremely simple to set up a standby database environment because Recovery Manager(RMAN) now supports the ability to clone the existing primary database directly to the intended standby database site over the network via the DUPLICATE DATABASE command set while the target database is active. This means it’s no longer necessary to first generate, then transmit, and finally restore and recover RMAN backups of the primary database on the standby site via tedious (and possibly error-prone!) manual methods; instead, RMAN automatically generates a conversion script in memory on the primary site and uses that script to manage the cloning operation on the standby site with virtually no DBA intervention required. <o:p></o:p><br />
------------------------------------------------------------------------------------------------------------<br />
<br />
Related links:<br />
<br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
HOME</div>
</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></div>
</div>
<br />
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr"></span></span><br />
<div id="yui_3_2_0_1_134587371257817541">
<span dir="ltr"><span dir="ltr"><span dir="ltr" id="yui_3_2_0_1_134587371257817540">11g DATA GUARD ADMINISTRATION AND SETUP TIPS</span></span></span></div>
<span dir="ltr"><span dir="ltr">
</span></span>
<br />
<div id="yui_3_2_0_1_134587371257817526" style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr"><span dir="ltr" id="yui_3_2_0_1_134587371257817525"><span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/11g%20DATA%20GUARD%20ADMINISTRATION%20AND%20SETUP%20TIPS" id="yui_3_2_0_1_134587371257817524" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/11g%20DATA%20GUARD%20ADMINISTRATION%20AND%20SETUP%20TIPS</a></span></span></span></span><br />
<span dir="ltr"><span dir="ltr"><span dir="ltr" id="yui_3_2_0_1_134587371257817525"><br /></span></span></span></div>
<span dir="ltr"><span dir="ltr">
</span></span>
<br />
<div>
</div>
<span dir="ltr"><span dir="ltr">
</span></span>
<br />
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr"><span dir="ltr"><span dir="ltr">DATA GUARD SETUP</span> </span></span></span></div>
<span dir="ltr">
</span>
<br />
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr"><span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/DATA%20GUARD%20SETUP" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/DATA%20GUARD%20SETUP</a></span></span></span><br />
<span dir="ltr"><span dir="ltr"><br /></span></span>
<span dir="ltr"><span dir="ltr"><span class="Apple-style-span" style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;">11g Data Guard Configuration using Active Dataguard on RHEL/OEL- 5</span></span></span><br />
<span dir="ltr"><span dir="ltr"><a href="http://oracleinaction.blogspot.in/2012/11/DATAGUARD.html">http://oracleinaction.blogspot.in/2012/11/DATAGUARD.html</a></span></span></div>
<span dir="ltr">
</span>
<br />
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<span dir="ltr">
</span><span dir="ltr"></span> </div>
<br />
RECOVERY USING STANDBY DATABASE<br />
http://koenigocm.blogspot.in/search/label/RMAN<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com0tag:blogger.com,1999:blog-5330686748982593370.post-91110461678667128502012-02-24T03:16:00.001-08:002012-10-04T09:45:15.487-07:00ORACLE 11GR2 DATABASE FLASH CACHE <div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">Hi Dba's I was working on Database flash cache and found it very interesting feature of 11G so thought to share with you as well. well database flash cache works as l2 level of cache for database and is very useful when memory become a bottleneck in oltp-kinda database by these feature we can configure a flash drive(either cheap as pen drive or may be expensive high quality flash drive) to store clean buffer that aged out from db_buffer cache <o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="background-color: white; color: #666666; font-family: Georgia, serif; font-size: 10pt; line-height: 14.25pt;">NOTE:-Database flash cache feature can only be configured in ORALCE ENTERPRISES LINUX or SOLARIS.</span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<b><span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">TO be able to use database flash cache you should follow these steps.<o:p></o:p></span></b></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">1.login to database and shutdown the system in normal mode.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">sql>shutdown immediate<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">2. Install Patch 9352237 by using opatch utility <o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">[oracle@node1 9352237]$/u01/app/oracle/product/11.2.0/db_home/Opatch/opatch apply.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">3.Install patch 8974084 which allows you to use the database flash cache on Oracle Enterprise Linux even if you don't have exadata storage. The patch is named:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-left: 0in; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;">
<span style="color: #666666; font-family: Wingdings; font-size: 10pt;">§<span style="font-family: 'Times New Roman'; font-size: 7pt; line-height: normal;"> </span></span><span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;"> 8974084:META BUG FOR FLASH CACHE 11.2PL BUGS TO BACKPORT TO 11.2.0.1 OEL<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;"><br />
</span><br />
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">Once you install the patch you can use any old flash device as a database flash cache if you just want to experiment using an USB flash device, then you first need to get that device mounted. On my test machine I created a directory "/mnt/usbflash" then created an /etc/fstab entry like this:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;"> /dev/sda1 /mnt/usbflash vfat noauto,users,rw,umask=0 0 0<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">On your system you might need to change "/dev/sda1" to another device depending on how your fixed disks are configured. You should then be able to mount the flashdrive by typiing "mount /dev/sda1". Make sure that the mount point is writable by oracle (chmod 777 /mnt/usbflash). <o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">Once mounted, you configure the flash cache by setting the parameters DB_FLASH_CACHE_FILE and DB_FLASH_CACHE_SIZE <o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">alter system set db_flash_cache_size='/mnt/usbflash/oraflashcache.dat;'<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">alter system set db_flash_cache_size=1000M;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">Note that the value of DB_FLASH_CACHE_FILE needs to be a file on the flash drive, not the flash drive mount point itself.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">Once these parameters are set, the flash cache will be enabled and will act as a secondary cache to the buffer cache. When a block is removed from the primary cache, it will still exist in the flash cache, and can be read back without a physical read to the spinning disk.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; margin-bottom: .0001pt; margin-bottom: 0in; mso-line-height-alt: 14.25pt; mso-outline-level: 2;">
<u><span style="font-family: Arial, sans-serif; font-size: 18pt; letter-spacing: -0.75pt;">Monitoring<o:p></o:p></span></u></div>
<div class="MsoNormal" style="background: white; margin-bottom: .0001pt; margin-bottom: 0in; mso-line-height-alt: 14.25pt; mso-outline-level: 2;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">There's a few ways to examine how the flash cache is being used. Firstly, V$SYSSTAT contains some new statistics showing the number of blocks added to the cache and the number of "hits" that were satisfied from cache:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">SELECT name,value FROM v$sysstat WHERE name IN ('physical read flash cache hits',<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;"> 'physical reads', 'consistent gets', 'db block gets', 'flash cache inserts')<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">Although the flash reads save time when compared to db file sequential reads, the overhead of maintaining the cache can be high because flash based SSD has a relatively severe write penalty.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">All flash-based Solid State Disk have issues with write performance. However, cheap Multi Level Cell (MLC) flash take about 3 times as long to write as the more expensive Single Level Cell (SLC). When flash drives are new, the empty space can be written to in single page increments (usually 4KB). However, when the flash drive is older, writes typically require erasing a complete 128 page block which is very much slower. My cheap USB drive was old and MLC, so it had very poor write performance. But even the best flash based SSD is going to be much slower for writes than for reads, and in some cases using a flash cache might slow a database down as a result. So monitoring is important.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">There's a couple of other V$SYSSTAT statistics of interest:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">select name,value from v$sysstat where name like '%flash cache%'<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">To examine the contents of the cache, we can examine the V$BH view. Buffers in the flash cache have STATUS values such as 'flashcur', allowing us to count the buffers from each object in the main buffer cache and in the flash cache <o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;"> SELECT owner || '.' || object_name object, SUM (CASE WHEN b.status LIKE 'flash%' THEN 1 END) flash_blocks,SUM (CASE WHEN b.status LIKE 'flash%' THEN 0 else 1 END) cache_blocks,count(*) total_blocks FROM v$bh b JOIN dba_objects ON (objd = object_id) GROUP BY owner, object_name order by 4 desc<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; margin-bottom: 12.0pt; mso-line-height-alt: 14.25pt;">
<span style="font-family: Arial, sans-serif; font-size: 18pt; letter-spacing: -0.75pt;">Conclusion</span><span style="font-family: Georgia, serif; font-size: 18pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-bottom: 12.0pt;">
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;"> We should be cautious however, because the flash write penalty may result in performance problems.<o:p></o:p></span><br />
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;"><br /></span>
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;">Related links:</span><br />
<span class="Apple-style-span" style="line-height: normal;"><br /></span>
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;"></span><span class="Apple-style-span" style="line-height: normal;">HOME</span><br />
<span class="Apple-style-span" style="line-height: normal;"></span><br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="line-height: normal;"><a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></span></div>
</div>
<span class="Apple-style-span" style="line-height: normal;">
</span><span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;"><br /></span>
<span style="color: #666666; font-family: Georgia, serif; font-size: 10pt;"><br /></span></div>
</div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com0tag:blogger.com,1999:blog-5330686748982593370.post-29139361816809426332012-01-21T04:04:00.000-08:002012-10-04T09:45:31.194-07:00I/O CALIBRATION IN 11G<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
A very good evening from chandigarh (INDIA) ... Here in koenig we come with another powerful post for 11G Oracle database's one of the most helpful goodies known as I/O calibration. In this post i have focused to make understand a DBA the concept of this calibration and how he can exploit such a wonderfull tool, I first got to know about this tool last year when i first read a blog of Vinay Pandey (The Oracle Security Vault Administrator) .. So here is my explanation for this feature...<br />
<br />
At any given time a DBA is looking to establish a solid I/O subsystem for an applocation. If any component in the I/O stack is limited in throughput, it will become the weakest link in the I/O flow. The I/O stack offcourse includes the physical disks, the storage array, the storage switches, the HBA's.<br />
<br />
I/O Calibration is a modified version of ORION tool and is based on the asynchronous library. This feature is based on the PL/SQL function called DBMS_RESOURCE_MANAGER.CALIBRATE_IO(). It is used to evaluate the performance of the storage subsystem and determine whether I/O performance problems comes from the database host or the storage subsystem. When it is invoked it will generate I/O intensive read-only random I/O and large-block(1MB) sequential I/O workloads. Unlike other tools, this tool uses oracle code stack the software libraries to drive the I/O; not some generic I/O generator. This capability is important - you are testing the I/O for an Oracle database right ?<br />
<br />
Finally when the job is finished you can view the results in DBA_RSRC_IO_CALIBRATE view or the I/O calibration page: maximum I/O per second, maximum megabytes per second, and average actual latency metrics.<br />
<br />
This calibrate I/O procedure will have 2 input variables and 3 output variables.<br />
<br />
the input variables are NUM_DISKS and MAX_LATENCY.<br />
<br />
NUM_DISKS = To get the most accurate results, its best to provide the actual number of physical disks that are used for this database. The Storage Administrator can provide this value. Keep in mind that when ASM is used to manage the database files, say in the DATA diskgroup, then only physical disks that make up the DATA diskgroup should be used for the NUM_DISKS variable; i.e.; do not include the disks from the FRA diskgroup.<br />
<br />
LATENCY – This should be set to the defined response time given by your service level agreement for your application. for example your 95th percentile response time SLA is 10secs. I hope you are aware of significance level thresholds.<br />
<br />
Now the 3 output variables are MAX_IOPS,MAX_MBPS, ACTUAL_LATENCY<br />
<br />
MAX_IOPS - the maximum number of I/O Operations per second<br />
MAX_MBPS - the maximum Megabytes per second<br />
ACTUAL_LATENCY - the actual latency observed during the test<br />
<br />
To run I/O calibration and assess the I/O capability of the storage subsystem used by Oracle Database, use the <br />
<br />
DBMS_RESOURCE_MANAGER.CALIBRATE_IO procedure:<br />
<br />
SET SERVEROUTPUT ON<br />
DECLARE<br />
lat INTEGER;<br />
iops INTEGER;<br />
mbps INTEGER;<br />
BEGIN<br />
-- DBMS_RESOURCE_MANAGER.CALIBRATE_IO (<DISKS>, <MAX_LATENCY>, iops, mbps, lat);<br />
DBMS_RESOURCE_MANAGER.CALIBRATE_IO (2, 10, iops, mbps, lat);<br />
<br />
DBMS_OUTPUT.PUT_LINE ('max_iops = ' || iops);<br />
DBMS_OUTPUT.PUT_LINE ('latency = ' || lat);<br />
dbms_output.put_line('max_mbps = ' || mbps);<br />
end;<br />
/<br />
<br />
When running the DBMS_RESOURCE_MANAGER.CALIBRATE_IO procedure, consider the following:<br />
<br />
<br />
# Do not run the procedure multiple times across separate databases that use the same storage subsystem<br />
<br />
# Quiesce the database to minimize I/O on the instance<br />
<br />
# For Oracle Real Application Clusters (RAC) configurations, ensure that all instances are opened to calibrate the storage subsystem across nodes<br />
<br />
# The execution time of the procedure is dependent on the number of disks in the storage subsystem and increases with the number of nodes in the database<br />
<br />
# In some cases, asynchronous I/O is permitted for datafiles, but the I/O subsystem for submitting asynchronous I/O may be maximized, and I/O calibration cannot continue. In such cases, refer to the port-specific documentation for information about checking the maximum limit for asynchronous I/O on the system. The calibration will run in different phases. In the first phase, small block random I/O workload is performed on each node and then concurrently on all nodes. The second phase will generate large block sequential I/O on each node. Note, that the Calibrate I/O is expecting that a datafile is spread across all disks specified in NUM_DISKS variable. Furthermore, offline files are not considered for file I/O.<br />
<br />
I also felt the need to explain the following metrics which were just thrown above :=<br />
<br />
IOPS (I/O per second):= This metric represents the number of small random I/O that can be serviced in a second. The IOPS rate mainly depends on how fast a disk media can spin.<br />
<br />
MBPS (megabytes per second) := The rate at which data can be transferred between the computing server node and the storage array depends on the capacity of I/O channel that is used to transfer data. More data can be transferred through a wider pipe.<br />
<br />
I/O Latency: Traditionally it means the time it takes to access a particular sector on the disk. But from database point of view it means all the time it takes for a submitted I/O request to be serviced by the storage. A high latency usually indicates an overloaded system.<br />
<br />
<br />
<br />
<br />
Have a nice day !!!<br />
<br />
Related links:<br />
<br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
HOME</div>
</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com2tag:blogger.com,1999:blog-5330686748982593370.post-66189115296556241852012-01-16T20:37:00.000-08:002012-09-12T00:23:05.099-07:00MMON WILL TRY TO PURGE OLD DATA FROM SYSAUX<div dir="ltr" style="text-align: left;" trbidi="on">
Hello DBA's, specially Karan, <b><u><span style="color: blue;">Well i just had a strong sweet coffee and feeling good </span></u></b><br />
<br />
today I found a very interesting thing in Alert log file that indicating that <b><span style="color: red;">whenever SYSAUX tablespace becomes full then MMON will try to purge old data from SYSAUX tablespace to make free space for other data.</span></b><br />
<br />
<b><span style="color: blue;">Please look the contents that I found in Alert Log file :</span></b><br />
<b><span style="color: blue;">---------------------------------------------------------------</span></b><br />
<br />
<br />
Tue Jan 17 10:00:03 2012<br />
<span style="color: #990000;"><b>ORA-1688: unable to extend table SYS.WRH$_ACTIVE_SESSION_HISTORY partition WRH$_ACTIVE_2503051407_14753 by 128 in tablespace SYSAUX<br />MMON Flush encountered SYSAUX out of space error(1688).<br />MMON (emergency) purge of WR snapshots (14690) and older</b></span><b><br /></b><br />
<span style="color: #990000;"><b><br /></b></span><span style="color: #990000;"><b>Related links:</b></span><br />
<span style="color: #990000;"><b><br /></b></span><span style="color: #990000;"><b><span class="Apple-style-span" style="color: black; font-weight: normal;"></span></b></span>
<div style="margin: 0px;">
<div style="margin: 0px;">
<span style="color: #990000;"><b>HOME</b></span></div>
</div>
<div style="margin: 0px;">
<div style="margin: 0px;">
<span style="color: #990000;"><b><a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></b></span></div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com0tag:blogger.com,1999:blog-5330686748982593370.post-31857110871260524352012-01-13T20:02:00.000-08:002012-10-04T09:45:48.088-07:00MUTEXES AND LATCHES<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Well my friend ashish (A dangerous DBA at koenig) was literally asking me everyday to post some stuff on why oracle is switching to mutexes, so here i come with my post on mutexes and latches too, I have made this post simpler while not going much into details so that beginners can also cherish every moment too and also its a nice sunshine in new delhi despite its cold here, but no coffee here its sad though.. Here we go ..<br />
<br />
As we know that mutex is a mutual exclusion and they are the concept of multiple threads, both latches and mutexes are used for low level locking, mutexes again are used to serialize access to shared structures, most importantly they can be taken in shared or exclusive mode and also getting a mutex can de done in wait or no-wait mode.<br />
<br />
Let me post few of my notes on mutexes which i discussed with Rajeev Ranjan and also from Tanel Poder at the oracle forum :=<br />
<br />
1) The advantages over latches is that mutexes requires less memory and are faster to get and release.<br />
2) Why faster ? Because the code path to get and release is shorter<br />
3) Acquired in the same mode of immediate or willing to wait as latches ? The answer is (YES)<br />
4) To me and Mr. RANJEEV RANJAN it seams that since mutexes can do the same things as latches do by using less memory and in a more performant way, there are already enough good reason for using them....<br />
<br />
Some notes from TANEL PODER (An Oracle GURU)<br />
<br />
1) Library cache latching is still needed for parsing etc, the mutexes address only the pinning issue in library cache<br />
2) Mutexes are currently used for library cache cursors (not other objects like PL/SQL stored procs, table defs etc)<br />
3) As mutexes are a generic mechanism (not library cache specific) they're used in V$SQLSTATS underlying structures too<br />
4) When mutexes are enabled, you won't see cursor pins from X$KGLPN anymore (as X$KGLPN is a fixed table based on the KGL pin array which wouldn't be used for cursors anymore)<br />
<br />
AS for now few DBA's must be still not be convinced i guess if you really know how object handles,cursors,child cursors, pinning work in the shared pool, for them i have written the following lines<br />
<br />
# The actual benefit comes is that for each child cursor handle mutex actually acts as a cursor pin structure, so if you have a cursor open (cached in session cursor cache) you dont need to get the library cache latch (which was previosuly needed for chaning cursor pin status), but you can modify the cursor's mutex refcount directly (with help of pointers in open cursor state area in sessions UGA). Therfore you have much higher scalability when pinning/unpinning cursors (no library cache/library cache pin latching needed, therfore no false contention) and no separate pin structure need to be allocated/maintained.<br />
<br />
If you have understood what i just said above, yes it can be leading to an assumption to a false contention thing like suppose there are lots of sessions looking for statements in the shared pool then the library cache will come under contention, now this is a false contention if we just look at if sessions are looking for soft parsed cursor then its a good thing but because the looking mechanism, latch is not available so its actually under contention which will be removed with the help of mutexes as they will be allocated as per structure so there wont be any starvation issue like in latches.<br />
<br />
In Oracle 10.2.0.2+ the library cache pin latch usage was replaced with mutexes whenever _kks_use_mutex_pin was true, also few other things like V$SQLSTATS arrays and parent cursor examination were protected by mutexes.<br />
<br />
In 11g all library cache related latches except “library cache load lock” are gone and corresponding operations are protected by mutexes instead. The “library cache” latches have been replaced by “Library Cache” mutexes for example.<br />
<br />
The proof is<br />
<br />
SQL> select name from v$latch where lower(name) like '%library%';<br />
<br />
NAME<br />
----------------------------------------------------------------<br />
library cache load lock<br />
<br />
<br />
At the end of this post i would again like to write some basic concepts if some of you need a revision sort of thing ...<br />
<br />
Mutexes, Yes they have less potential for false contention because latches typically protect multiple objects. When a latch protects one or more hot objects, the latch itself becomes a serialization point when accessing any of the objects protected by that latch. This can be a false contention point where the contention is for protection mechanism (LATCH) rather than the target object, Because mutexes can be created for each structure protected false contention is less likely.<br />
<br />
A mutex can ce concurrently referenced by many sessions, provided all sessions refer to it in S (Shared mode). Total numver of sessions referencing a mutex in S mode is called reference count (REF COUNT). For exclusive it is X (exclusive mode) which can be held by only 1 session. Mutexes have a dual nature, they can act as a serialization mechanism like latch and also a pin (for eg:= preventing an object from aging out). the ref count of a mutex is a replacement for library cache pin, instead of each session creating and then deleting a library cache pin when executing a cursor, each session increments and decrements the ref count (so the ref count replaces n distinct pins).... Have a nice day<br />
<br />
--------------------------------------------------------------------------------------------------------<br />
<br />
<div>
Related links :<br />
<br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
HOME</div>
</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></div>
</div>
<br />
<br />
<span dir="ltr">LATCHES LOCKS PINS AND MUTEXES</span><br />
<div>
<div>
<span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/LATCHES%20LOCKS%20PINS%20AND%20MUTEXES" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/LATCHES%20LOCKS%20PINS%20AND%20MUTEXES</a></span><br />
<br /></div>
<div>
</div>
<div id="yui_3_2_0_1_134587371257814690">
<span dir="ltr" id="yui_3_2_0_1_134587371257814689">MUTEXES AND LATCHES</span></div>
<div>
<span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/MUTEXES%20AND%20LATCHES" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/MUTEXES%20AND%20LATCHES</a></span><br />
<br /></div>
<div>
</div>
<div>
<span dir="ltr">PARENT AND CHILD CURSORS IN ORACLE</span></div>
<div>
<span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/PARENT%20AND%20CHILD%20CURSORS%20IN%20ORACLE" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/PARENT%20AND%20CHILD%20CURSORS%20IN%20ORACLE</a></span><br />
<br /></div>
<div>
</div>
<div>
<span style="color: red;"><span style="color: black;">QUICK OVERVIEW OF SHARED POOL TUNING</span></span></div>
<div>
<span style="color: red;"><span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/QUICK%20OVERVIEW%20OF%20SHARED%20POOL%20TUNING" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/QUICK%20OVERVIEW%20OF%20SHARED%20POOL%20TUNING</a></span></span><br />
<span style="color: red;"><br /></span></div>
<div>
</div>
<div>
<span style="color: red;"><span dir="ltr"><span style="color: black;">SHARED POOL ARCHITECTURE</span></span></span></div>
<div>
<span style="color: red;"><a href="http://koenigocm.blogspot.in/search/label/SHARED%20POOL%20ARCHITECTURE" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SHARED%20POOL%20ARCHITECTURE</span></a></span></div>
<div>
</div>
<span style="color: red;"></span><br />
<div class="yiv10892242post-title yiv10892242entry-title" style="color: red; font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span style="color: red;"><span dir="ltr"><span dir="ltr"><span style="color: red;"><span dir="ltr"><span style="color: black;">SQL PLAN MANAGEMENT – ORACLE 11g : Part-1</span></span></span></span></span></span></div>
<span style="color: red;"> <a href="http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%E2%80%93%20ORACLE%20%2011g%20%3A%20Part-1" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%E2%80%93%20ORACLE%20%2011g%20%3A%20Part-1</span></a></span><br />
<br />
<span style="color: red;"></span><br />
<div class="yiv10892242post-title yiv10892242entry-title" style="color: black; font-family: arial, helvetica, sans-serif; font-size: 16px;">
</div>
<span style="color: red;">
</span>
<br />
<div class="yiv10892242post-title yiv10892242entry-title" style="color: red; font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span style="color: red;"></span><span style="color: red;"><span dir="ltr"><span dir="ltr"><span style="color: red;"><span dir="ltr"><span dir="ltr"><span style="color: black;">SQL PLAN MANAGEMENT – ORACLE 11g : Part-2</span></span></span></span></span></span></span></div>
<div class="yiv10892242post-title yiv10892242entry-title" style="color: red; font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span dir="ltr"><span dir="ltr"><span style="color: red;"><span dir="ltr"></span></span></span></span> <a href="http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%20%E2%80%93%20ORACLE%2011g%20%3A%20Part-2" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%20%E2%80%93%20ORACLE%2011g%20%3A%20Part-2</span></a><br />
<br />
<span style="color: red;"><span dir="ltr"><span style="color: black;">CURSOR_SHARING DEMYSTIFIED</span></span></span></div>
<div class="yiv10892242post-title yiv10892242entry-title" style="color: red; font-family: arial, helvetica, sans-serif; font-size: 16px;">
<a href="http://koenigocm.blogspot.in/search/label/CURSOR_SHARING%20DEMYSTIFIED">http://koenigocm.blogspot.in/search/label/CURSOR_SHARING%20DEMYSTIFIED</a></div>
</div>
<br />
<span id="yui_3_2_0_18_1346273642331899" style="color: red;"><span id="yui_3_2_0_18_1346273642331898"> <span style="background-color: #c0a154; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 15px;">LIBRARY CACHE LOCK/PIN DEMONSTRATED</span></span></span><br />
<div id="yui_3_2_0_18_1346273642331834" style="font-family: arial, helvetica, sans-serif; font-size: 16px;">
</div>
</div>
</div>
<span style="color: red;"> <a href="http://koenigocm.blogspot.in/search/label/LIBRARY%20CACHE%20LOCK%2FPIN%20DEMONSTRATED" style="color: blue !important; cursor: text !important; font-size: 12pt;">http://koenigocm.blogspot.in/search/label/LIBRARY%20CACHE%20LOCK%2FPIN%20DEMONSTRATED</a></span>
<br />
<span style="background-color: white; font-family: arial, helvetica, sans-serif; font-size: 16px;"></span><br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 15px;">SHARED POOL TUNING - A DEMONSTRATION</span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<a href="http://koenigocm.blogspot.in/search/label/SHARED%20POOL%20TUNING%20-%20A%20DEMONSTRATION">http://koenigocm.blogspot.in/search/label/SHARED%20POOL%20TUNING%20-%20A%20DEMONSTRATION</a></div>
<br />
<br />
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com0tag:blogger.com,1999:blog-5330686748982593370.post-54074610074937683912012-01-12T22:57:00.000-08:002012-10-04T09:46:02.385-07:00SOME IMPORTANT TUNING TIPS<div dir="ltr" style="text-align: left;" trbidi="on">
<strong>UGA and Oracle Shared Server</strong>: The point about UGA is that Shared server sessions take space from the available space in the shared pool for SQL and PL/SQL objects. Example the Shared pool may be tuned properly with 20 users but not large enough for 200 users. The space in the large pool can be set aside for the UGA eliminating this tuning factor. The streams pool should be configured if you are using Oracle Streams. If the streams pool is NOT configured Streams will use the Shared pool, When streams uses 10% of the shared pool Streams starts spilling to disk, so Streams could use more than than 10% of the shared pool. To avoid the memory sizing problems, fragmentation, and contention, configure the Streams Pool.<br />
<br />
<strong>Large Pool</strong>: RMAN only uses the Large pool when BACKUP_TAPE_IO_SLAVE=TRUE<br />
<br />
<strong>Database High Availability: Best Practices</strong>: Flashback Database can have a 1-2% overhead on write intensive systems.<br />
<br />
<strong>Database High Availability: Best Practices</strong>: These practice are high recommended for HA databases, and are often implemented in other databases: Block Checking includes two parameters DB_BLOCK_CHECKSUM and DB_BLOCK_CHECKING. Major difference is that DB_BLOCK_CHECKSUM calculates the checksum to discover corruptions in block transfers (I/O), DB_BLOCK_CHECKING checks the internal consistancy of the block, by going through the data in the block, and can discover other types of corruptions. From Metalink Note: 336194.1 DB_BLOCK_CHECKSUM can be OFF (or) TYPICAL (or) FULL. OFF - DBWn calculates checksums only for the SYSTEM tablespace, but not for user tablespaces. TYPICAL (default) - Turning on this feature in TYPICAL mode causes only an additional 1% to 2% overhead. Oracle recommends that you set DB_BLOCK_CHECKSUM to TYPICAL. For backward compatibility we preserve use of TRUE (implying TYPICAL) and FALSE (implying OFF) values. FULL – In FULL mode setting Oracle will compute the checksum before any change and compare the checksum to the stored value and it causes 4% to 5% overhead. This approach uncovers any data corruption in the memory itself and reports errors at that point—which is highly useful for preventing data corruption at the disk level as well as its propagation to the standby database.<br />
<br />
From the Reference guide DB_BLOCK_CHECKING controls whether or not Oracle performs block checking for database blocks. The checking that is performed depends on the value you supply, as follows: OFF (default) - no block checking is performed for blocks in the user tablespaces. However, semantic block checking for SYSTEM tablespace blocks is always turned on. LOW - basic block header checks are performed after block contents change in memory (for example, after UPDATE or INSERT statements, on-disk reads, or inter-instance block transfers in RAC) MEDIUM - all LOW checks are performed, as well as semantic block checking for all non-index-organized table blocks FULL - all LOW and MEDIUM checks are performed, as well as semantic checks for index blocks (that is, blocks of subordinate objects that can actually be dropped and reconstructed when faced with corruption) Oracle checks a block by going through the data in the block, making sure it is logically self-consistent. Block checking can often prevent memory and data corruption. Block checking typically causes 1% to 10% overhead, depending on workload and the parameter value. The more updates or inserts in a workload, the more expensive it is to turn on block checking. You should set DB_BLOCK_CHECKING to FULL if the performance overhead is acceptable. For backward compatibility the use of FALSE (implying OFF) and TRUE (implying FULL) is preserved.<br />
<br />
<strong>Internal Fragmentation Considerations</strong>: The problem with all of these scenarios in the first set of bullets is that they leave empty space below the HWM. If PCTFREE is set too high the space is never used, too low and you get migrated rows. LOBs use space inside the LOB for versioning instead of undo. The amount of space that is used depends on PCTVERSION and RETENTION. PCTVERSION integer - Specify the maximum percentage of overall LOB storage space used for maintaining old versions of the LOB. The default value is 10, meaning that older versions of the LOB data are not overwritten until they consume 10% of the overall LOB storage space. You can specify the PCTVERSION parameter whether the database is running in manual or automatic undo mode. PCTVERSION is the default in manual undo mode. RETENTION is the default in automatic undo mode. You cannot specify both PCTVERSION and RETENTION. RETENTION: Use this clause to indicate that Oracle Database should retain old versions of this LOB column for an amount of time. Oracle Database uses the value of the UNDO_RETENTION initialization parameter to determine the amount of committed undo data to retain in the database. You can specify the RETENTION parameter only if the database is running in automatic undo mode. In this mode, RETENTION is the default value unless you specify PCTVERSION. You cannot specify both PCTVERSION and RETENTION. If there is significant update activity on LOBs the amount of space used by old versions of the LOBs can be large. Direct loads insert above the HWM, when the load is complete the HWM is moved. Deletes remove rows below the HWM. Unless there are standard INSERTs the space released by the deletes will never be used. Update and deletes on indexed colums produce deleted leaf rows in the index. These occupy reusable space in the index, but if there are few or no inserts the space will not be used.<br />
<br />
<strong>Sizing the Redo Log Buffer</strong>: From 10gR2 onward there is a separate log buffer per cpu. There are possibly multiple redo allocation latches because each log buffer requires an allocation latch. So now there are multiple redo allocation latch children and not one single latch. The log file sync wait event P1 has the buffer number experiencing the wait.<br />
<br />
Related links:<br />
<br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
HOME</div>
</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com0tag:blogger.com,1999:blog-5330686748982593370.post-60213108967463234332012-01-12T22:51:00.000-08:002012-10-04T09:46:18.552-07:00FIX CONTROL<div dir="ltr" style="text-align: left;" trbidi="on">
<h2>
Oracle has introduced a fix control mechanism in 10.2 which allows customers to turn off fixes for optimizer related bugs. This is governed by the underscore parameter _fix_control. The bugs for which fixes can be turned off are listed in v$session_fix_control and v$system_fix_control and can also be seen in a 10053 output.<br />
<br />
On a 10.2.0.2 database<br />
<br />
SQL> select distinct bugno from v$session_fix_control;<br />
<br />
BUGNO<br />
----------<br />
3499674<br />
4556762<br />
4569940<br />
3118776<br />
4519016<br />
4175830<br />
4663698<br />
4631959<br />
4550003<br />
4584065<br />
4487253<br />
4611850<br />
4663804<br />
4602374<br />
4728348<br />
4723244<br />
4554846<br />
4545833<br />
4488689<br />
4519340<br />
<br />
20 rows selected.<br />
<br />
SQL> select distinct sid from v$mystat;<br />
<br />
SID<br />
----------<br />
143<br />
<br />
SQL> alter session set "_fix_control"='4728348:OFF';<br />
<br />
Session altered.<br />
<br />
SQL> select * from v$session_fix_control where session_id=143 and bugno=4728348;<br />
<br />
SESSION_ID BUGNO VALUE DESCRIPTION OPTIMIZER_FEATURE_ENABLE EVENT IS_DEFAULT<br />
---------- ---------- ---------- ---------------------------------------------------------------- --<br />
143 4728348 0 consider mjc if equi-joined pred is dropped in kkoipt 10.2.0.2 <br />
<br />
A value of 0 indicates the fix is off. <br />
<br />
SQL> alter session set "_fix_control"='4728348:ON';<br />
<br />
Session altered.<br />
<br />
SQL> select * from v$session_fix_control where session_id=143 and bugno=4728348;<br />
<br />
SESSION_ID BUGNO VALUE DESCRIPTION OPTIMIZER_FEATURE_ENABLE EVENT IS_DEFAULT<br />
---------- ---------- ---------- ---------------------------------------------------------------- --<br />
143 4728348 1 consider mjc if equi-joined pred is dropped in kkoipt 10.2.0.2 <br />
<br />
It appears to me that if you need two fixes off in a session you have to specify them together else you lose the first change.<br />
<br />
SQL> alter session set "_fix_control"='4728348:OFF';<br />
<br />
Session altered.<br />
<br />
SQL> alter session set "_fix_control"='4663698:OFF';<br />
<br />
Session altered.<br />
<br />
SQL> select * from v$session_fix_control where session_id=143 and bugno in (4728348,4663698);<br />
<br />
SESSION_ID BUGNO VALUE DESCRIPTION OPTIMIZER_FEATURE_ENABLE EVENT IS_DEFAULT<br />
---------- ---------- ---------- ---------------------------------------------------------------- --<br />
143 4663698 0 for cached NL table set tab_cost_io to zero 10.2.0.2 0 0<br />
143 4728348 1 consider mjc if equi-joined pred is dropped in kkoipt 10.2.0.2 <br />
<br />
Hence if you need more than one fix OFF you need to supply both bug numbers in the same command<br />
<br />
SQL> alter session set "_fix_control"='4728348:OFF','4663698:OFF';<br />
<br />
Session altered.<br />
<br />
SQL> select * from v$session_fix_control where session_id=143 and bugno in (4728348,4663698);<br />
<br />
SESSION_ID BUGNO VALUE DESCRIPTION OPTIMIZER_FEATURE_ENABLE EVENT IS_DEFAULT<br />
---------- ---------- ---------- ---------------------------------------------------------------- --<br />
143 4663698 0 for cached NL table set tab_cost_io to zero 10.2.0.2 0 0<br />
143 4728348 0 consider mjc if equi-joined pred is dropped in kkoipt 10.2.0.2</h2>
<div style="clear: both; padding-bottom: 0.25em;">
----------------------------------------------------------------------------------------------------------<b></b></div>
<div style="clear: both; padding-bottom: 0.25em;">
<br /></div>
<div style="clear: both; padding-bottom: 0.25em;">
Related links:</div>
<div style="clear: both; padding-bottom: 0.25em;">
<br /></div>
<div style="clear: both; padding-bottom: 0.25em;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
HOME</div>
</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com0tag:blogger.com,1999:blog-5330686748982593370.post-46970772320956846912012-01-11T22:23:00.001-08:002012-10-04T09:46:36.680-07:00SQL PLAN MANAGEMENT – ORACLE 11g : Part-2<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<h1>
<span style="text-decoration: underline;"><span style="color: navy;"><b><b>SQL Plan Management – Oracle Database 11g</b></b></span></span></h1>
In SPM part 1 we saw information about SPM and how to automatically capture the baseline.<br />
In this part we will see how to manually capture the baseline and the affect of using FIXED variable.<br />
<h2>
<span style="color: navy;">Capturing Baseline Manually</span></h2>
Occasionally we have to to capture the baseline manually. This could happen while tuning the query in our database where we have optimizer_capture_sql_plan_baselines parameter set to FALSE.<br />
We have 2 procedures available for capturing the baselines manually.<br />
<ol>
<li><h4>
<span style="color: navy;">LOAD_PLANS_FROM_SQLSET</span></h4>
</li>
<li><h4>
<span style="color: navy;">LOAD_PLANS_FROM_CURSOR_CACHE</span></h4>
</li>
</ol>
Above procedures are part of DBMS_SPM packages.<br />
<b>LOAD_PLANS_FROM_SQLSET</b> procedure is used mainly while doing the upgrade from Oracle database 10g to Oracle database 11g.<br />
The procedure is to<br />
<ol>
<li>create a SQL Tuning set in 10g and pack all the SQLs in the library cache along with there plans into SQL tuning set – Procedure DBMS_SQLTUNE.CREATE_SQLSET and DBMS_SQLTUNE.LOAD_SQLSET</li>
<li>Then to create a staging table and load this SQL tuning set into the staging table – Procedure DBMS_SQLTUNE.CREATE_STGTAB_SQLSET and DBMS_SQLTUNE.PACK_STGTAB_SQLSET</li>
<li>Update database to 11g</li>
<li>Unpack the staging table into SQL Tuning set you created before – Procedure DBMS_SQLTUNE.UNPACK_STGTAB_SQLSET</li>
<li>Create SQL Baselines from the SQL tuning set – Procedure DBMS_SPM.LOAD_PLANS_FROM_SQLSET</li>
</ol>
<b>LOAD_PLANS_FROM_CURSOR_CACHE</b> is used after 11g upgrade when we have optimizer_capture_sql_plan_baselines set to false and we want to create baseline for a query in order to stablize the plan.<br />
<pre>SQL> select col1, count(1) from T group by col1;
COL1 COUNT(1)
---------- ----------
1 1
2 3
3 98304
SQL> show parameters capture
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
optimizer_capture_sql_plan_baselines boolean FALSE
SQL></pre>
Currently we dont have any baselines in the database.<br />
<pre>SQL> select sql_handle, plan_name, sql_text, enabled, accepted, fixed from dba_sql_plan_baselines;
no rows selected
SQL>
SQL> explain plan for
2 select * from T where col1 = 1;
Explained.
SQL> set line 999
SQL> set pagesize 999
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 1601196873
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 49154 | 2976K| 260 (2)| 00:00:04 |
|* 1 | TABLE ACCESS FULL| T | 49154 | 2976K| 260 (2)| 00:00:04 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("COL1"=1)
13 rows selected.
SQL></pre>
Lets create a baseline manually for this statement. For creating baselines manually we need to have the statement in cache first.<br />
Lets run the statement once and find the SQL ID.<br />
<pre>SQL> select sql_id, sql_text from v$sql where sql_text like 'select * from T where%';
SQL_ID SQL_TEXT
------------- ------------------------------------------------------------------------------------------
5pvxxjg6n7mrp select * from T where col1 = 1
Now we will use LOAD_PLANS_FROM_CURSOR_CACHE to create a baseline
SQL> DECLARE
2 l_plans_loaded PLS_INTEGER;
3 BEGIN
4 l_plans_loaded := DBMS_SPM.load_plans_from_cursor_cache(
5 sql_id => '5pvxxjg6n7mrp');
6 END;
7 /
PL/SQL procedure successfully completed.
SQL> select sql_handle, plan_name, sql_text, enabled, accepted, fixed from dba_sql_plan_baselines;
SQL_HANDLE PLAN_NAME SQL_TEXT ENA ACC FIX
------------------------------ ------------------------------ -------------------------------- --- --- ---
SYS_SQL_1447ba3a1d83920f SYS_SQL_PLAN_1d83920f94ecae5c select * from T where col1 = 1 YES YES NO
SQL></pre>
So we can see that SQL Plan baseline is created as well as accepted.<br />
We will check out the plan from baseline now, but it should be full table scan.<br />
<pre>SQL> SET LONG 10000
SQL> select * from TABLE(DBMS_XPLAN.display_sql_plan_baseline(plan_name=>'SYS_SQL_PLAN_1d83920f94ecae5c'));
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------
SQL handle: SYS_SQL_1447ba3a1d83920f
SQL text: select * from T where col1 = 1
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Plan name: SYS_SQL_PLAN_1d83920f94ecae5c
Enabled: YES Fixed: NO Accepted: YES Origin: MANUAL-LOAD
--------------------------------------------------------------------------------
Plan hash value: 1601196873
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 49154 | 2976K| 260 (2)| 00:00:04 |
|* 1 | TABLE ACCESS FULL| T | 49154 | 2976K| 260 (2)| 00:00:04 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("COL1"=1)
24 rows selected.
SQL>
Now lets create an index on the table on COL1.
SQL> create index T_IDX on T(COL1);
Index created.
SQL></pre>
Now since the baseline is used, same query will go for a full table scan even after creating an index.<br />
<pre>SQL> explain plan for
2 select * from T where col1 = 1;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 1601196873
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 49154 | 2976K| 260 (2)| 00:00:04 |
|* 1 | TABLE ACCESS FULL| T | 49154 | 2976K| 260 (2)| 00:00:04 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("COL1"=1)
Note
-----
- SQL plan baseline "SYS_SQL_PLAN_1d83920f94ecae5c" used for this statement
17 rows selected.
SQL></pre>
So as you can see we have a baseline SYS_SQL_PLAN_1d83920f94ecae5c getting used for this query.<br />
Lets go ahead and try creating another baseline for this SQL. May be this time we will get better plan.<br />
SQL ID remains the same.<br />
<pre>SQL> DECLARE
2 l_plans_loaded PLS_INTEGER;
3 BEGIN
4 l_plans_loaded := DBMS_SPM.load_plans_from_cursor_cache(
5 sql_id => '5pvxxjg6n7mrp');
6 END;
7 /
PL/SQL procedure successfully completed.
SQL> select sql_handle, plan_name, sql_text, enabled, accepted, fixed from dba_sql_plan_baselines;
SQL_HANDLE PLAN_NAME SQL_TEXT ENA ACC FIX
------------------------------ ------------------------------ -------------------------------- --- --- ---
SYS_SQL_1447ba3a1d83920f SYS_SQL_PLAN_1d83920f94ecae5c select * from T where col1 = 1 YES YES NO
SYS_SQL_1447ba3a1d83920f SYS_SQL_PLAN_1d83920fae82cf72 select * from T where col1 = 1 YES NO NO</pre>
And yes, we can see Oracle has created another baseline here. But ACCEPTED is still NO for the new plan.<br />
This is because we haven’t evaluated the plan yet. If we would have set optimizer_capture_sql_plan_baselines parameter to true, it would have automatically captured and made ACCEPTED=YES after doing automatic evaluation.<br />
Since this is false, we have to evaluate whether new plan is better or not. This process of evaluating new baseline is called evolving.<br />
Evolving a plan actually compares the cost and several other factors like DISK_READS, BUFFER_GETS, ELAPSED_TIME etc for all the plans that are available in DBA_SQL_PLAN_BASELINES table for that particular SQL HANDLE.<br />
So in our case when we evolve the plan it will compare plan SYS_SQL_PLAN_1d83920f94ecae5c and SYS_SQL_PLAN_1d83920fae82cf72<br />
Just to be certain we will display the plan SYS_SQL_PLAN_1d83920fae82cf72<br />
<pre>SQL> select * from TABLE(DBMS_XPLAN.display_sql_plan_baseline(plan_name=>'SYS_SQL_PLAN_1d83920fae82cf72'));
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------
SQL handle: SYS_SQL_1447ba3a1d83920f
SQL text: select * from T where col1 = 1
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Plan name: SYS_SQL_PLAN_1d83920fae82cf72
Enabled: YES Fixed: NO Accepted: NO Origin: AUTO-CAPTURE
--------------------------------------------------------------------------------
Plan hash value: 470836197
-------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 49154 | 2976K| 6 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| T | 49154 | 2976K| 6 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | T_IDX | 49154 | | 1 (0)| 00:00:01 |
-------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("COL1"=1)
25 rows selected.
SQL></pre>
So it is indeed using the index on the table.<br />
Here there are 2 things again.<br />
<ol>
<li>Evolving the plan automatically – Using procedure DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE</li>
<li>Manually accepting the plan – Using procedure ALTER_SQL_PLAN_BASELINE setting ACCEPTED=>YES</li>
</ol>
In the first method optimizer will evaluate based on all the factors (we will see those factors below) and “selects” the best plan. I have highlighted select here because optimizer is going to select from the set of existing plans, its not going to parse and create a whole other plan.<br />
So its upto the optimizer to decide which plan is best among the available plan.<br />
In method 2, we can decide and select which ever plan we think is correct. This based on our knowledge of the type of SQL we are running and what resources we have with us.<br />
<h2>
<span style="color: navy;">Can we have 2 plans in ACCEPTED status for a query?</span></h2>
Yes we can.<br />
<h2>
<span style="color: navy;">Which plan optimizer will choose out of the two?</span></h2>
Always the best among the two. If more than 1 plan is ACCEPTED than optimizer will choose the best plan to be used for the query.<br />
Example if we use a query “select * from T where col = :B1″<br />
Here we have used a bind variable. Lets say we have 2 plans with us right now<br />
Plan 1) Full table scan<br />
Plan 2) Index Range scan<br />
Which plan optimizer will choose depends upon the value of bind variable.<br />
Yes, in 11g we have something called “Adaptive Cursor Sharing”, but this is little off the topic. We will cover “Adaptive Cursor Sharing” in different article.<br />
So if we supply value as 1 or 2 and since there is only 1 row with col1=1 and 3 rows with col1=2, optimizer will use Plan 2) Index Range Scan.<br />
If we supply value as 3, optimizer will use Plan 1) Full table scan.<br />
So imagine a case where we have 5-6 plans based on selectivity of different tables involved in a complex query, in that case its a good idea to keep all those plans as ACCEPTED. Optimizer will always choose the best among those based on selectivity of the data.<br />
We have seen evolving the plan in Part 1 – http://avdeo.com/2011/06/02/oracle-sql-plan-management-part-1/<br />
Lets set ACCEPTED=TRUE manually now.<br />
<pre>SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 l_plans_altered PLS_INTEGER;
3 BEGIN
4 l_plans_altered := DBMS_SPM.alter_sql_plan_baseline(
5 sql_handle => 'SYS_SQL_1447ba3a1d83920f',
6 plan_name => 'SYS_SQL_PLAN_1d83920fae82cf72',
7 attribute_name => 'ACCEPTED',
8 attribute_value => 'YES');
9
10 DBMS_OUTPUT.put_line('Plans Altered: ' || l_plans_altered);
11 END;
12 /
Plans Altered: 1
PL/SQL procedure successfully completed.
SQL>
SQL> select sql_handle, plan_name, sql_text, enabled, accepted, fixed from dba_sql_plan_baselines;
SQL_HANDLE PLAN_NAME SQL_TEXT ENA ACC FIX
------------------------------ ------------------------------ -------------------------------- --- --- ---
SYS_SQL_1447ba3a1d83920f SYS_SQL_PLAN_1d83920f94ecae5c select * from T where col1 = 1 YES YES NO
SYS_SQL_1447ba3a1d83920f SYS_SQL_PLAN_1d83920fae82cf72 select * from T where col1 = 1 YES YES NO
SQL></pre>
Lets check the explain plan for value 1.<br />
<pre>SQL> explain plan for
2 select * from T where col1 = 1;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 470836197
-------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 49154 | 2976K| 56 (2)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| T | 49154 | 2976K| 56 (2)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | T_IDX | 49154 | | 10 (0)| 00:00:01 |
-------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("COL1"=1)
Note
-----
- SQL plan baseline "SYS_SQL_PLAN_1d83920fae82cf72" used for this statement
18 rows selected.
SQL></pre>
So its using SYS_SQL_PLAN_1d83920fae82cf72 baselines.<br />
<h2>
<span style="color: navy;">What is the affect of using FIXED=YES ?</span></h2>
Fixed attribute will fix the plan for a query. So even if we have a better plan, the query will still not be using it. It is like disabling (ENABLED=NO, ACCEPTED=NO) all the plans for that SQL Handle.<br />
Let make FIXED=YES for the first baseline (SYS_SQL_PLAN_1d83920f94ecae5c) which does full table scan.<br />
To change this attribute we can again use DBMS_SPM.ALTER_SQL_PLAN_BASELINE procedure<br />
<pre>SQL> set serveroutput on
SQL> DECLARE
2 l_plans_altered PLS_INTEGER;
3 BEGIN
4 l_plans_altered := DBMS_SPM.alter_sql_plan_baseline(
5 sql_handle => 'SYS_SQL_1447ba3a1d83920f',
6 plan_name => 'SYS_SQL_PLAN_1d83920f94ecae5c',
7 attribute_name => 'FIXED',
8 attribute_value => 'YES');
9
10 DBMS_OUTPUT.put_line('Plans Altered: ' || l_plans_altered);
11 END;
12 /
Plans Altered: 1
PL/SQL procedure successfully completed.
SQL>
SQL> select sql_handle, plan_name, sql_text, enabled, accepted, fixed from dba_sql_plan_baselines;
SQL_HANDLE PLAN_NAME SQL_TEXT ENA ACC FIX
------------------------------ ------------------------------ -------------------------------------------------- --- --- ---
SYS_SQL_1447ba3a1d83920f SYS_SQL_PLAN_1d83920f94ecae5c select * from T where col1 = 1 YES YES YES
SYS_SQL_1447ba3a1d83920f SYS_SQL_PLAN_1d83920fae82cf72 select * from T where col1 = 1 YES YES NO
SQL></pre>
Lets check out the explain plan for “select * from T where col1 = 1″ query<br />
<pre>SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 1601196873
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 49154 | 2976K| 260 (2)| 00:00:04 |
|* 1 | TABLE ACCESS FULL| T | 49154 | 2976K| 260 (2)| 00:00:04 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("COL1"=1)
Note
-----
- SQL plan baseline "SYS_SQL_PLAN_1d83920f94ecae5c" used for this statement
17 rows selected.
SQL></pre>
So if you see now, same query which was earlier using index scan has now shifted to full table scan. Thats the magic of SPM !!<br />
I would recommend not using FIXED attribute at all. You are just killing the functionality provided by 11g.<br />
However, if we make both plans as FIXED then ??<br />
<pre>set serveroutput on
DECLARE
l_plans_altered PLS_INTEGER;
BEGIN
l_plans_altered := DBMS_SPM.alter_sql_plan_baseline(
sql_handle => 'SYS_SQL_1447ba3a1d83920f',
plan_name => 'SYS_SQL_PLAN_1d83920fae82cf72',
attribute_name => 'FIXED',
attribute_value => 'YES');
DBMS_OUTPUT.put_line('Plans Altered: ' || l_plans_altered);
END;
/
SQL> select sql_handle, plan_name, sql_text, enabled, accepted, fixed from dba_sql_plan_baselines;
SQL_HANDLE PLAN_NAME SQL_TEXT ENA ACC FIX
------------------------------ ------------------------------ -------------------------------------------------- --- --- ---
SYS_SQL_1447ba3a1d83920f SYS_SQL_PLAN_1d83920f94ecae5c select * from T where col1 = 1 YES YES YES
SYS_SQL_1447ba3a1d83920f SYS_SQL_PLAN_1d83920fae82cf72 select * from T where col1 = 1 YES YES YES
SQL> explain plan for
2 select * from T where col1 = 1;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 470836197
-------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 49154 | 2976K| 6 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| T | 49154 | 2976K| 6 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | T_IDX | 49154 | | 1 (0)| 00:00:01 |
-------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("COL1"=1)
Note
-----
- SQL plan baseline "SYS_SQL_PLAN_1d83920fae82cf72" used for this statement
18 rows selected.
SQL></pre>
<br />
It will again go back to best among the fixed plans.<br />
<br />
In the next part, I will cover how to transfer the baseline from one database to another and also how to set a specific plan for a query using hint and then creating baseline for that.<br />
<br />
Hope this helps !!<br />
<br />
-----------------------------------------------------------------------------------------------------------<br />
<br />
<div>
Related links :<br />
<br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
HOME</div>
</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
</div>
</div>
<br />
<span dir="ltr">LATCHES LOCKS PINS AND MUTEXES</span><br />
<div>
<div>
<span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/LATCHES%20LOCKS%20PINS%20AND%20MUTEXES" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/LATCHES%20LOCKS%20PINS%20AND%20MUTEXES</a></span><br />
<br /></div>
<div>
</div>
<div id="yui_3_2_0_1_134587371257814690">
<span dir="ltr" id="yui_3_2_0_1_134587371257814689">MUTEXES AND LATCHES</span></div>
<div>
<span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/MUTEXES%20AND%20LATCHES" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/MUTEXES%20AND%20LATCHES</a></span><br />
<br /></div>
<div>
</div>
<div>
<span dir="ltr">PARENT AND CHILD CURSORS IN ORACLE</span></div>
<div>
<a href="http://koenigocm.blogspot.in/search/label/PARENT%20AND%20CHILD%20CURSORS%20IN%20ORACLE" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/PARENT%20AND%20CHILD%20CURSORS%20IN%20OR</span></a><br />
<span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/PARENT%20AND%20CHILD%20CURSORS%20IN%20ORACLE" rel="nofollow" target="_blank">ACLE</a></span><br />
<br /></div>
<div>
</div>
<div>
<span style="color: red;"><span style="color: black;">QUICK OVERVIEW OF SHARED POOL TUNING</span></span></div>
<div>
<span style="color: red;"><span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/QUICK%20OVERVIEW%20OF%20SHARED%20POOL%20TUNING" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/QUICK%20OVERVIEW%20OF%20SHARED%20POOL%20TUNING</a></span></span><br />
<span style="color: red;"><br /></span></div>
<div>
</div>
<div>
<span style="color: red;"><span dir="ltr"><span style="color: black;">SHARED POOL ARCHITECTURE</span></span></span></div>
<div>
<span style="color: red;"><a href="http://koenigocm.blogspot.in/search/label/SHARED%20POOL%20ARCHITECTURE" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SHARED%20POOL%20ARCHITECTURE</span></a></span></div>
<div>
</div>
<span style="color: red;"></span><br />
<div class="yiv10892242post-title yiv10892242entry-title" style="color: red; font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span style="color: red;"><span dir="ltr"><span dir="ltr"><span style="color: red;"><span dir="ltr"><span style="color: black;">SQL PLAN MANAGEMENT – ORACLE 11g : Part-1</span></span></span></span></span></span></div>
<span style="color: red;"> <a href="http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%E2%80%93%20ORACLE%20%2011g%20%3A%20Part-1" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%E2%80%93%20ORACLE%20%2011g%20%3A%20Part-1</span></a></span><br />
<br />
<span style="color: red;"></span><br />
<div class="yiv10892242post-title yiv10892242entry-title" style="color: black; font-family: arial, helvetica, sans-serif; font-size: 16px;">
</div>
<span style="color: red;">
</span>
<br />
<div class="yiv10892242post-title yiv10892242entry-title" style="color: red; font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span style="color: red;"></span><span style="color: red;"><span dir="ltr"><span dir="ltr"><span style="color: red;"><span dir="ltr"><span dir="ltr"><span style="color: black;">SQL PLAN MANAGEMENT – ORACLE 11g : Part-2</span></span></span></span></span></span></span></div>
<div class="yiv10892242post-title yiv10892242entry-title" style="color: red; font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span dir="ltr"><span dir="ltr"><span style="color: red;"><span dir="ltr"></span></span></span></span> <a href="http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%20%E2%80%93%20ORACLE%2011g%20%3A%20Part-2" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%20%E2%80%93%20ORACLE%2011g%20%3A%20Part-2</span></a><br />
<br />
<span style="color: red;"><span dir="ltr"><span style="color: black;">CURSOR_SHARING DEMYSTIFIED</span></span></span></div>
<div class="yiv10892242post-title yiv10892242entry-title" style="color: red; font-family: arial, helvetica, sans-serif; font-size: 16px;">
<a href="http://koenigocm.blogspot.in/search/label/CURSOR_SHARING%20DEMYSTIFIED">http://koenigocm.blogspot.in/search/label/CURSOR_SHARING%20DEMYSTIFIED</a></div>
</div>
<br />
<span id="yui_3_2_0_18_1346273642331899" style="color: red;"><span id="yui_3_2_0_18_1346273642331898"> <span style="background-color: #c0a154; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 15px;">LIBRARY CACHE LOCK/PIN DEMONSTRATED</span></span></span><br />
<div id="yui_3_2_0_18_1346273642331834" style="font-family: arial, helvetica, sans-serif; font-size: 16px;">
</div>
</div>
</div>
<span style="color: red;"> <a href="http://koenigocm.blogspot.in/search/label/LIBRARY%20CACHE%20LOCK%2FPIN%20DEMONSTRATED" style="color: blue !important; cursor: text !important; font-size: 12pt;">http://koenigocm.blogspot.in/search/label/LIBRARY%20CACHE%20LOCK%2FPIN%20DEMONSTRATED</a></span>
<br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 15px;">SHARED POOL TUNING - A DEMONSTRATION</span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<a href="http://koenigocm.blogspot.in/search/label/SHARED%20POOL%20TUNING%20-%20A%20DEMONSTRATION">http://koenigocm.blogspot.in/search/label/SHARED%20POOL%20TUNING%20-%20A%20DEMONSTRATION </a><br />
<br />
MIGRATE OUTLINES TO SQL MANAGEMENT BASE<br />
http://koenigocm.blogspot.in/search/label/MIGRATE%20OUTLINES%20TO%20SQL%20MANAGEMENT%20BASE</div>
<br />
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com0tag:blogger.com,1999:blog-5330686748982593370.post-11373676986923410962012-01-11T21:40:00.000-08:002012-10-04T09:46:50.794-07:00SQL PLAN MANAGEMENT– ORACLE 11g : Part-1<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 1;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">SQL Plan Management or SPM is a new feature introduced in 11g. We will take a detailed look at SPM in the following sessions.<br />Before starting with practical example lets see some theory.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 2;">
<b><span style="color: navy; font-family: "Times New Roman", "serif"; font-size: 18pt;">What is SQL Plan Management?</span></b></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">SPM is a new feature introduced in Oracle database 11g which stores the baseline (Plans + Hints) inside database.<br />SPM allows an Oracle DBA to capture and preserve the most efficient execution plans for any SQL statement, thus limiting the impact of refreshed optimizer statistics, changes to existing applications, and even upgraded database versions</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 2;">
<b><span style="color: navy; font-family: "Times New Roman", "serif"; font-size: 18pt;">Why do we need SPM?</span></b></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">SPM is basically used for plan stability. If you have a database environment with several queries running, you always want your queries to run the way they are running irrespective of the changes that you make in your environment.<br />Example, If you upgrade your database, your queries might behave differently because of the change in optimizer or change in environment and at initial run you have to fix many queries in your production DB because of the upgrade or change in the env.<br />To avoid this, SPM is introduce to give you plan stability. So even after change in the environment, your queries will use same plan as it was before. More plans (Better or worse) could exists in the new environment, but optimizer is not allowed to use those plans without you confirming the plan change.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 2;">
<b><span style="color: navy; font-family: "Times New Roman", "serif"; font-size: 18pt;">What was wrong with outlines?</span></b></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Well, outlines are more about fixing the plan for a query that optimizer will use. So if there is change in environment, the plan would still be the same.<br />There are certain situations where you want the plan to change with change in lets say data. What if your data gets skewed over time.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Intially you had 100 of entries for month “DEC” out of total 150 entries. So it was using FTS. Now with increase in the data, there are 1 million records and entries for month “DEC” are around 1000. In that case it makes sense for optimizer to change plan and start using Index scan instead of FTS.<br />But since you used outline, you are forcing optimizer to go for a FTS. This is just an example situation and things can change in your environment and so outline is not a very good approach for such situations.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="color: navy; font-family: "Times New Roman", "serif"; font-size: 12pt;">What was wrong with profile?</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Profile is another feature introduced in 10g and can be implemented at SQL level. Profiles are better than outlines in that they are not fixing a plan through out the life of SQL. With change in the environment the plans can change even if the profile is used.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 2;">
<b><span style="color: navy; font-family: "Times New Roman", "serif"; font-size: 18pt;">So whats the difference between profile and SQL plan baselines?</span></b></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Profile is more of a advisors. They give advice to optimizer while executing the query. They provide optimizer with all the precise estimates. Profiles are more abount correcting optimizer to use correct plan when the underlying data is skewed and changed drastically.<br />The goal is to create best execution plan for the SQL by giving the very precise data to the optimizer. Its the optimizer who will decide what should be the explain plan based on the information/hints it has received from profile.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">SQL Plan baselines works differently. It enforces the plan to be used for a SQL. Baseline does not provide and estimates or it does not help optimizer in anyway. It just tells optimizer to ignore everything and use the plan that we are giving you.<br />Optimizer just followes the plan provided by baselines. So here baseline is the driving mechanism for getting the correct plan.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 2;">
<b><span style="color: navy; font-family: "Times New Roman", "serif"; font-size: 18pt;">Finally how baselines are different then outline then?</span></b></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Well, baseline always keeps the optimized plans for your SQL. If there is a change in the environment you will have a new baseline created for the same SQL. Oracle will stop that baseline in the baseline history.<br />Depending on the baseline parameters setting in your environment, new plan will be automatically used or you have to evolve the new plan for optimizer to use it.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">So in a way SQL baselines are combination of outlines and profiles. It gives the stability of plan similar to outlines and it also allows capturing better plans in case the environment changes.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Not only that, SQL Baselines give the complete control to the DBA on</span></div>
<ol type="1">
<li class="MsoNormal" style="line-height: normal; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Whether to capture the new and better plans?</span></li>
<li class="MsoNormal" style="line-height: normal; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Whether to use the new plans automaticallly without DBA’s intervention.</span></li>
</ol>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">So DBAs have complete control of the environment now. Far better than profiles and outlines.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<b><u><span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">SQL Plan Baseline Parameters:</span></u></b></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Before we check how to use SQL Plan baselines, lets consider the significance of 2 important baseline parameters</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 3;">
<b><span style="color: navy; font-family: "Times New Roman", "serif"; font-size: 13.5pt;">1) optimizer_capture_sql_plan_baselines – Default “FALSE”</span></b></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">This parameter is responsible for automatic capturing the baselines for SQLs. If we set this parameter to TRUE we are asking oracle to automatically gather the baselines for the SQL.<br />When you run the query for the first time (and parsed version is not present in shared_pool), oracle consider that as a fresh new query and does not create a baseline.<br />When you run the query for second time, oracle will consider the query as repetative and will automatically create the baseline.<br />These baseline are stored in DBA_SQL_PLAN_BASELINES table.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">If this parameter is set to FALSE, then we (DBA) has to create baselines for the SQL manually. There are 2 procedure available for creating baselines manually.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 5;">
<b><span style="color: black; font-family: "Times New Roman", "serif"; font-size: 10pt;">1) Using DBMS_SPM.LOAD_PLANS_FROM_SQLSET</span></b></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">This procedure is usually used when we create SQL tuning set and store our SQLs into the tuning sets. Normally done before we upgrade the database to 11g. In our 10g database we create SQL tuning set and store all our SQL. Once we upgrade to 11g, we can create baselines for all our plans in SQL tuning set. That why what ever plans were effective in 10g, same will be used in 11g and there wont be any plan flips.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 5;">
<b><span style="color: black; font-family: "Times New Roman", "serif"; font-size: 10pt;">2) Using DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE</span></b></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">This is used when we want to fix one of the SQL currently running in our 11g database. We just load the plans from cursor cache (shared_pool) and create baseline out of that. We need to give SQL ID as input to this procedure.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">We will see how to create baseline using manual method at later point of time.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 3;">
<b><span style="color: navy; font-family: "Times New Roman", "serif"; font-size: 13.5pt;">2) optimizer_use_sql_plan_baselines – Default “TRUE”</span></b></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">This parameter will allow optimizer to use the baselines present in DBA_SQL_PLAN_BASELINES table. If you set this parameter to FALSE, then your 11g DB will start behaving same as 10g DB.<br />If there is any change in environment then it might flip the plan. Keeping this parameter TRUE is important in 11g.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 2;">
<b><span style="color: navy; font-family: "Times New Roman", "serif"; font-size: 18pt;">How to use SQL Plan Management baselines ?</span></b></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Lets take an example in a test database.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Table T with 1540 records.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> select count(1) from t;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> COUNT(1)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">----------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 1540</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Data is skewed and distribution is as given below.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> select col1, count(1) from t group by col1;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> COL1 COUNT(1)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">---------- ----------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 1 1</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 2 3</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 3 1536</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Gather the stats on the table</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> exec dbms_stats.gather_table_stats(OWNNAME=> 'ADVAITD_DBA',TABNAME => 'T', DEGREE => 6, GRANULARITY => 'ALL' ,CASCADE => TRUE , METHOD_OPT => 'FOR ALL INDEXED COLUMNS SIZE 254');</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Currently I dont have any baseline.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> select count(1) from dba_sql_plan_baselines;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> COUNT(1)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">----------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 0</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL></span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">My baseline parameters setting is as below.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> show parameters baselines</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">NAME TYPE VALUE</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">------------------------------------ ----------- ------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">optimizer_capture_sql_plan_baselines boolean FALSE</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">optimizer_use_sql_plan_baselines boolean TRUE</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL></span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Let us first consider the auto capture utility for baselines.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 2;">
<b><span style="color: navy; font-family: "Times New Roman", "serif"; font-size: 18pt;">AUTO Capture of baseline</span></b></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> alter session set optimizer_capture_sql_plan_baselines=TRUE;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Session altered.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL></span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">As mention earlier, we need to run the query 2 times in order to automatically create the baseline.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> select * from t where col1 = 1;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> COL1 COL2 COL3</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">---------- -------------------------------------------------- -----------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 01-JUN-2011</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> select * from t where col1 = 1;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> COL1 COL2 COL3</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">---------- -------------------------------------------------- -----------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 01-JUN-2011</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">If we check DBA_SQL_PLAN_BASELINES we will see a sql baseline created.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> select SQL_HANDLE, PLAN_NAME, ENABLED, ACCEPTED, FIXED</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 2 from dba_sql_plan_baselines</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 3 WHERE sql_text like 'select * from t%';</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL_HANDLE PLAN_NAME ENA ACC FIX</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">------------------------------ ------------------------------ --- --- ---</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SYS_SQL_1447ba3a1d83920f SYS_SQL_PLAN_1d83920f94ecae5c YES YES NO</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Turning off auto SQL plan baseline capture</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> alter session set optimizer_capture_sql_plan_baselines=FALSE;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Session altered.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL></span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Following statement gives the plan stored in the baseline. DBMS_XPLAN has a new procedure DISPLAY_SQL_PLAN_BASELINE which will display the baseline.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> set line 999</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> set pagesize 999</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> select * from table(dbms_xplan.display_sql_plan_baseline(plan_name=>'SYS_SQL_PLAN_1d83920f94ecae5c'));</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">PLAN_TABLE_OUTPUT</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">--------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL handle: SYS_SQL_1447ba3a1d83920f</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL text: select * from t where col1 = 1</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">--------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">--------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Plan name: SYS_SQL_PLAN_1d83920f94ecae5c</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Enabled: YES Fixed: NO Accepted: YES Origin: AUTO-CAPTURE</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">--------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Plan hash value: 1601196873</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">--------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">--------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">| 0 | SELECT STATEMENT | | 15 | 735 | 9 (0)| 00:00:01 |</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">|* 1 | TABLE ACCESS FULL| T | 15 | 735 | 9 (0)| 00:00:01 |</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">--------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Predicate Information (identified by operation id):</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">---------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 1 - filter("COL1"=1)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">24 rows selected.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL></span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Origin: AUTO-CAPTURE shown above tell us that this baseline is captured automatically.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Lets now create an index and gather stats over index.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> create index t_idx on t(col1);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Index created.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> exec DBMS_STATS.GATHER_INDEX_STATS(OWNNAME => 'ADVAITD_DBA', INDNAME=>'T_IDX');</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Run the same query now, since the index is created, we expect the query to use the index.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> explain plan for</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 2 select * from t where col1 = 1;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Explained.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> select * from table(dbms_xplan.display);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">PLAN_TABLE_OUTPUT</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Plan hash value: 1601196873</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">--------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">--------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">| 0 | SELECT STATEMENT | | 15 | 735 | 9 (0)| 00:00:01 |</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">|* 1 | TABLE ACCESS FULL| T | 15 | 735 | 9 (0)| 00:00:01 |</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">--------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Predicate Information (identified by operation id):</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">---------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 1 - filter("COL1"=1)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Note</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">-----</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> - SQL plan baseline "SYS_SQL_PLAN_1d83920f94ecae5c" used for this statement</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">17 rows selected.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL></span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">The reason we are seeing full table scan is because of the NOTE at the end, which says “SQL plan baseline “SYS_SQL_PLAN_1d83920f94ecae5c” used for this statement”</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Since we have a baseline created for this SQL, it will not allow the plan to be changed. This is the kind of stability that SQL Plan baseline gives.<br />But using an index will be beneficial in our case.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">If we check DBA_SQL_PLAN_BASELINES we can see a new plan has been created (PLAN_NAME = SYS_SQL_PLAN_1d83920fae82cf72), but it is not yet ACCEPTED. The plan is enabled though.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> select SQL_HANDLE, PLAN_NAME, ENABLED, ACCEPTED, FIXED</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 2 from dba_sql_plan_baselines</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 3 WHERE sql_text like 'select * from t%';</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL_HANDLE PLAN_NAME ENA ACC FIX</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">------------------------------ ------------------------------ --- --- ---</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SYS_SQL_1447ba3a1d83920f SYS_SQL_PLAN_1d83920f94ecae5c YES YES NO</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SYS_SQL_1447ba3a1d83920f SYS_SQL_PLAN_1d83920fae82cf72 YES NO NO</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">We can check what the new plan looks like using dbms_xplan.display_sql_plan_baseline</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> select * from table(dbms_xplan.display_sql_plan_baseline(plan_name=>'SYS_SQL_PLAN_1d83920fae82cf72'));</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">PLAN_TABLE_OUTPUT</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">--------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL handle: SYS_SQL_1447ba3a1d83920f</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL text: select * from t where col1 = 1</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">--------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">--------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Plan name: SYS_SQL_PLAN_1d83920fae82cf72</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Enabled: YES Fixed: NO Accepted: NO Origin: AUTO-CAPTURE</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">--------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Plan hash value: 470836197</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">-------------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">-------------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">| 0 | SELECT STATEMENT | | 15 | 735 | 1 (0)| 00:00:01 |</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">| 1 | TABLE ACCESS BY INDEX ROWID| T | 15 | 735 | 1 (0)| 00:00:01 |</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">|* 2 | INDEX RANGE SCAN | T_IDX | 6 | | 1 (0)| 00:00:01 |</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">-------------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Predicate Information (identified by operation id):</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">---------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 2 - access("COL1"=1)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">25 rows selected.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL></span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">As seen above, new plan uses index. Lets evolve this plan now.<br />Evolving a plan includes evaluating the cost of the plan and accepting if the plan seems to be better than all accepted plan for this query.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> SELECT DBMS_SPM.evolve_sql_plan_baseline(sql_handle => 'SYS_SQL_1447ba3a1d83920f') from dual;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE(SQL_HANDLE=>'SYS_SQL_1447BA3A1D83920F')</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">--------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">-------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> Evolve SQL Plan Baseline Report</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">-------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Inputs:</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">-------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> SQL_HANDLE = SYS_SQL_1447ba3a1d83920f</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> PLAN_NAME =</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> TIME_LIMIT = DBMS_SPM.AUTO_LIMIT</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> VERIFY = YES</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> COMMIT = YES</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Plan: SYS_SQL_PLAN_1d83920fae82cf72</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">-----------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> Plan was verified: Time used .01 seconds.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> Passed performance criterion: Compound improvement ratio >= 7.33</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> Plan was changed to an accepted plan.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> Baseline Plan Test Plan Improv. Ratio</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> ------------- --------- -------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> Execution Status: COMPLETE COMPLETE</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> Rows Processed: 1 1</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> Elapsed Time(ms): 0 0</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> CPU Time(ms): 0 0</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> Buffer Gets: 22 3 7.33</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> Disk Reads: 0 0</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> Direct Writes: 0 0</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> Fetches: 0 0</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> Executions: 1 1</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">-------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> Report Summary</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">-------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Number of SQL plan baselines verified: 1.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Number of SQL plan baselines evolved: 1.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Sometimes, your plan may not get evolved because oracle see that there are other already ACCEPTED plans which are better than the plan you are trying to evolve.<br />But if you know your plan will be better and still want to deploy the same, you can do so by manually changing the attributes ACCEPTED and ENABLED as shown below.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SET SERVEROUTPUT ON</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">DECLARE</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> l_plans_altered PLS_INTEGER;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">BEGIN</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> l_plans_altered := DBMS_SPM.alter_sql_plan_baseline(</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> sql_handle => 'SYS_SQL_1447ba3a1d83920f',</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> plan_name => 'SYS_SQL_PLAN_1d83920fae82cf72',</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> attribute_name => 'ENABLED',</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> attribute_value => 'YES');</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> DBMS_OUTPUT.put_line('Plans Altered: ' || l_plans_altered);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">END;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">/</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SET SERVEROUTPUT ON</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">DECLARE</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> l_plans_altered PLS_INTEGER;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">BEGIN</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> l_plans_altered := DBMS_SPM.alter_sql_plan_baseline(</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> sql_handle => 'SYS_SQL_1447ba3a1d83920f',</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> plan_name => 'SYS_SQL_PLAN_1d83920fae82cf72',</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> attribute_name => 'ACCEPTED',</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> attribute_value => 'YES');</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> DBMS_OUTPUT.put_line('Plans Altered: ' || l_plans_altered);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">END;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">/</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">You can also set the value of attribute FIXED using the above function. Here is the meaning of ENABLED, ACCPETED and FIXED</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in;">
<i><span style="color: navy; font-family: "Times New Roman", "serif"; font-size: 12pt;">ENABLED – ‘YES’ means the plan is available for use by the optimizer. It may or may not be used depending on accepted status.</span></i><i><span style="font-family: "Times New Roman", "serif"; font-size: 12pt;"><br /><span style="color: navy;">ACCPETED – ‘YES’ means the plan will be used by optimizer while running the query. ‘NO’ means optimizer will not use the plan.</span><br /><span style="color: navy;">FIXED – ‘YES’ means the SQL plan baseline is not evolved over time. A fixed plan takes precedence over a non-fixed plan.</span></span></i></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Once you evolve the plan, you can see that plan is ACCEPTED now.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> select SQL_HANDLE, PLAN_NAME, ENABLED, ACCEPTED, FIXED</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 2 from dba_sql_plan_baselines</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 3 WHERE sql_text like 'select * from t%';</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL_HANDLE PLAN_NAME ENA ACC FIX</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">------------------------------ ------------------------------ --- --- ---</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SYS_SQL_1447ba3a1d83920f SYS_SQL_PLAN_1d83920f94ecae5c YES YES NO</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SYS_SQL_1447ba3a1d83920f SYS_SQL_PLAN_1d83920fae82cf72 YES YES NO</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Now if you run the explain plan you can see Index T_IDX is getting used.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> explain plan for</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 2 select * from t where col1 = 1;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Explained.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL> select * from table(dbms_xplan.display);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">PLAN_TABLE_OUTPUT</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Plan hash value: 470836197</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">-------------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">-------------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">| 0 | SELECT STATEMENT | | 15 | 735 | 1 (0)| 00:00:01 |</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">| 1 | TABLE ACCESS BY INDEX ROWID| T | 15 | 735 | 1 (0)| 00:00:01 |</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">|* 2 | INDEX RANGE SCAN | T_IDX | 6 | | 1 (0)| 00:00:01 |</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">-------------------------------------------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Predicate Information (identified by operation id):</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">---------------------------------------------------</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> 2 - access("COL1"=1)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">Note</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">-----</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;"> - SQL plan baseline "SYS_SQL_PLAN_1d83920fae82cf72" used for this statement</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">18 rows selected.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10pt;">SQL></span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "Times New Roman", "serif"; font-size: 12pt;"><br /></span><span style="font-family: "Times New Roman", "serif"; font-size: 12pt;">Well !! DBAs, Hope this helps .</span><br />
<span style="font-family: Times New Roman, serif;">-----------------------------------------------------------------------------------------------------------</span><br />
<span style="font-family: Times New Roman, serif;"></span><br />
<div>
<span style="font-family: Times New Roman, serif;">Related links :</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span><span style="font-family: Times New Roman, serif;"><span class="Apple-style-span" style="font-family: 'Times New Roman';"></span></span>
<br />
<div style="margin: 0px;">
<div style="margin: 0px;">
<span style="font-family: Times New Roman, serif;">HOME</span></div>
</div>
<div style="margin: 0px;">
<div style="margin: 0px;">
<span style="font-family: Times New Roman, serif;"><a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></span></div>
<div style="margin: 0px;">
</div>
</div>
<span style="font-family: Times New Roman, serif;"><span dir="ltr">LATCHES LOCKS PINS AND MUTEXES</span></span><br />
<div>
<div>
<span style="font-family: Times New Roman, serif;"><span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/LATCHES%20LOCKS%20PINS%20AND%20MUTEXES" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/LATCHES%20LOCKS%20PINS%20AND%20MUTEXES</a></span></span><br />
<span style="font-family: Times New Roman, serif;"><br /></span></div>
<div>
</div>
<div id="yui_3_2_0_1_134587371257814690">
<span style="font-family: Times New Roman, serif;"><span dir="ltr" id="yui_3_2_0_1_134587371257814689">MUTEXES AND LATCHES</span></span></div>
<div>
<span style="font-family: Times New Roman, serif;"><span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/MUTEXES%20AND%20LATCHES" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/MUTEXES%20AND%20LATCHES</a></span></span><br />
<span style="font-family: Times New Roman, serif;"><br /></span></div>
<div>
</div>
<div>
<span style="font-family: Times New Roman, serif;"><span dir="ltr">PARENT AND CHILD CURSORS IN ORACLE</span></span></div>
<div>
<span style="font-family: Times New Roman, serif;"><span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/PARENT%20AND%20CHILD%20CURSORS%20IN%20ORACLE" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/PARENT%20AND%20CHILD%20CURSORS%20IN%20ORACLE</a></span></span><br />
<span style="font-family: Times New Roman, serif;"><br /></span></div>
<div>
</div>
<div>
<span style="font-family: Times New Roman, serif;"><span style="color: red;"><span style="color: black;">QUICK OVERVIEW OF SHARED POOL TUNING</span></span></span></div>
<div>
<span style="font-family: Times New Roman, serif;"><span style="color: red;"><span style="color: #234786;"><a href="http://koenigocm.blogspot.in/search/label/QUICK%20OVERVIEW%20OF%20SHARED%20POOL%20TUNING" rel="nofollow" target="_blank">http://koenigocm.blogspot.in/search/label/QUICK%20OVERVIEW%20OF%20SHARED%20POOL%20TUNING</a></span></span></span><br />
<span style="font-family: Times New Roman, serif;"><span style="color: red;"><br /></span></span></div>
<div>
</div>
<div>
<span style="font-family: Times New Roman, serif;"><span style="color: red;"><span dir="ltr"><span style="color: black;">SHARED POOL ARCHITECTURE</span></span></span></span></div>
<div>
<span style="font-family: Times New Roman, serif;"><span style="color: red;"><a href="http://koenigocm.blogspot.in/search/label/SHARED%20POOL%20ARCHITECTURE" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SHARED%20POOL%20ARCHITECTURE</span></a></span></span></div>
<div>
</div>
<span style="font-family: Times New Roman, serif;"><span style="color: red;"></span><br /></span>
<br />
<div class="yiv10892242post-title yiv10892242entry-title" style="color: red; font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span style="font-family: Times New Roman, serif;"><span style="color: red;"><span dir="ltr"><span dir="ltr"><span style="color: red;"><span dir="ltr"><span style="color: black;">SQL PLAN MANAGEMENT – ORACLE 11g : Part-1</span></span></span></span></span></span></span></div>
<span style="font-family: Times New Roman, serif;"><span style="color: red;"> <a href="http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%E2%80%93%20ORACLE%20%2011g%20%3A%20Part-1" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%E2%80%93%20ORACLE%20%2011g%20%3A%20Part-1</span></a></span></span><br />
<span style="font-family: Times New Roman, serif;"><br /></span><span style="font-family: Times New Roman, serif;"><span style="color: red;"></span></span>
<br />
<div class="yiv10892242post-title yiv10892242entry-title" style="color: black; font-family: arial, helvetica, sans-serif; font-size: 16px;">
</div>
<span style="font-family: Times New Roman, serif;"><span style="color: red;"></span><br /></span>
<br />
<div class="yiv10892242post-title yiv10892242entry-title" style="color: red; font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span style="font-family: Times New Roman, serif;"><span style="color: red;"></span><span style="color: red;"><span dir="ltr"><span dir="ltr"><span style="color: red;"><span dir="ltr"><span dir="ltr"><span style="color: black;">SQL PLAN MANAGEMENT – ORACLE 11g : Part-2</span></span></span></span></span></span></span></span></div>
<span style="font-family: Times New Roman, serif;"></span><br />
<div class="yiv10892242post-title yiv10892242entry-title" style="color: red; font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span style="font-family: Times New Roman, serif;"><span dir="ltr"><span dir="ltr"><span style="color: red;"><span dir="ltr"></span></span></span></span> <a href="http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%20%E2%80%93%20ORACLE%2011g%20%3A%20Part-2" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%20%E2%80%93%20ORACLE%2011g%20%3A%20Part-2</span></a></span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;"><span style="color: red;"><span dir="ltr"><span style="color: black;">CURSOR_SHARING DEMYSTIFIED</span></span></span></span></div>
<span style="font-family: Times New Roman, serif;">
</span>
<br />
<div class="yiv10892242post-title yiv10892242entry-title" style="color: red; font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span style="font-family: Times New Roman, serif;"><a href="http://koenigocm.blogspot.in/search/label/CURSOR_SHARING%20DEMYSTIFIED">http://koenigocm.blogspot.in/search/label/CURSOR_SHARING%20DEMYSTIFIED</a></span></div>
<span style="font-family: Times New Roman, serif;">
</span></div>
<span style="font-family: Times New Roman, serif;"><br /></span><span style="font-family: Times New Roman, serif;"><span id="yui_3_2_0_18_1346273642331899" style="color: red;"><span id="yui_3_2_0_18_1346273642331898"> <span style="background-color: #c0a154; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 15px;">LIBRARY CACHE LOCK/PIN DEMONSTRATED</span></span></span></span><br />
<div id="yui_3_2_0_18_1346273642331834" style="font-family: arial, helvetica, sans-serif; font-size: 16px;">
</div>
</div>
<span style="font-family: Times New Roman, serif;"></span></div>
</div>
<span style="color: red;"> <a href="http://koenigocm.blogspot.in/search/label/LIBRARY%20CACHE%20LOCK%2FPIN%20DEMONSTRATED" style="color: blue !important; cursor: text !important; font-size: 12pt;">http://koenigocm.blogspot.in/search/label/LIBRARY%20CACHE%20LOCK%2FPIN%20DEMONSTRATED</a></span> <br />
<span style="background-color: white; font-family: arial, helvetica, sans-serif; font-size: 16px;"></span><br />
<span style="background-color: white; font-family: arial, helvetica, sans-serif; font-size: 16px;"></span><br />
<div style="margin: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 15px;">SHARED POOL TUNING - A DEMONSTRATION</span></div>
<div style="margin: 0px;">
<a href="http://koenigocm.blogspot.in/search/label/SHARED%20POOL%20TUNING%20-%20A%20DEMONSTRATION">http://koenigocm.blogspot.in/search/label/SHARED%20POOL%20TUNING%20-%20A%20DEMONSTRATION</a></div>
<br />
MIGRATE OUTLINES TO SQL MANAGEMENT BASE<br />
<br />
http://koenigocm.blogspot.in/search/label/MIGRATE%20OUTLINES%20TO%20SQL%20MANAGEMENT%20BA<br />
<div class="MsoNormal">
<br /></div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com2tag:blogger.com,1999:blog-5330686748982593370.post-4880705443688314102012-01-11T13:51:00.000-08:002012-10-04T09:47:04.436-07:00JOIN TECHNIQUES CONCEPTS IN ORACLE<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
This article is for the DBA's who are not familiar with the basics of join techniques like HASH Join, Nested Loops and SORT MERGE. Because any DBA who doesnt know how a join is happening in the background cannot work with the join order so understanding the concept is more important first. As it is an article on to explain the concepts so we will not go deep into it as of now. On this cold night here in New Delhi with some hot sweet corn soup on the table, oh im sorry let me come to the point now...<br />
<br />
HASH JOINS<br />
<br />
Lets start with hash join. As we know that the optimizer looks into the access path , join method and then the join order respectively, so yes hash join is a join method. The database uses hash joins to join large data sets. The optimizer uses the smaller of two tables or data sources to build a hash table on the join key in memory. It then scans the larger table, probing the hash table to find the joined rows. This method is best available when the hash table is able to fit in memory. This method is best when the smaller table fits in available memory. The cost is then limited to a single read pass over the data for the two tables.<br />
<br />
The optimizer shall use hash join when you are joining large data sets or large fraction of a small table must be joined. Use the USE_HASH hint to instruct the optimizer to use a hash join when joining two tables together.<br />
<br />
However, in a production database with very large tables, it is not always easy to get your database to invoke hash joins without increasing the RAM regions that control hash joins. For large tables, hash joins requires lots of RAM. Make sure that the smaller table is the driving table (the first table in the from clause when using the ordered hint). This is because a hash join builds the memory array using the driving table.<br />
<br />
Make sure that you have the proper settings for optimizer_index_cost_adj and optimizer_max_permutations (Oracle9i and earlier) to limit the number of table join evaluations. Also check your values for hash_area_size and hash_multiblock_io_count. If using pga_aggregate_target, remember that it will not use more than 5% of the space for any hash join and you may need to override it.<br />
<br />
SORT MERGE JOINS<br />
<br />
Sort merge joins can join rows from two independent sources. Hash joins generally perform better than sort merge joins. However, sort merge joins can perform better than hash joins if the row sources are already sorted and a sort operation will not at all be performed. Do keep in mind that there is no concept of driving table in sort merge join. As this post is only for basic understanding, the final thing i will say it is that this technique has two steps := SORT is done for both the inputs and then both the sorted lists are MERGED together. If the input is sorted by the join column, then a sort join operation is not performed for that row source. However, a sort merge join always creates a positionable sort buffer for the right side of the join so that it can seek back to the last match in the case where duplicate join key values come out of the left side of the join. Use USE_MERGE hint to instruct the optimizer to go for sort merge join.<br />
<br />
Sort merge joins are useful when the join condition between two tables is an inequality condition (but not a nonequality) like <, <=, >, or >=. Sort merge joins perform better than nested loop joins for large data sets. You cannot use hash joins unless there is an<br />
equality condition.<br />
<br />
NESTED LOOP JOINS<br />
<br />
This type of join should always be used when small subsets of data is being joined by the database and also if the join condition is an efficient way of accessing the second table. Hold on here... By second table here i mean is the driven table. So there is a driving table which drives the driven table in the nested loops offcourse. It is very important that inner table which is driven should have dependent data on the driving table otherwise if the access path of driving and driven table is independent then for every iteration for the outer loop the same rows will be retrived degrading performance considerably. It works something like this, well not exactly as a cartesion product, but yes if access path is independent then for every row of outer loop an inner loop row is evaluated which hits the performance badly if joining large data sets. <br />
<br />
Oracle Database 11g introduces a new implementation for nested loop joins to reduce overall latency for physical I/O. When an index or a table block is not in the buffer cache and is needed to process the join, a physical I/O is required. Oracle Database 11g can batch multiple physical I/O requests and process them using a vector I/O instead of processing them one at a time.<br />
<br />
Well the optimizer will always work on the stats which it has as it is a mathematical function and it works on numbers. What im trying to say is that lets say for example A larger multiblock read count is likely to decrease the cost for a sort merge join in relation to a nested loop join. If the database can read a large number of sequential blocks from disk in a single I/O, then an index on the inner table for the nested loop join is less likely to improve performance over a full table scan. The multiblock read count is specified by the initialization parameter DB_FILE_MULTIBLOCK_READ_COUNT.<br />
<br />
Have a nice day ahead DBA's ..... My next post shall be more on how to improve the cost of joins as it is very important task for a DBA specially when it comes to determine the join order.<br />
<br />
Related links:<br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
HOME</div>
</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com0tag:blogger.com,1999:blog-5330686748982593370.post-75476459768181141482012-01-11T07:38:00.000-08:002012-09-07T09:39:08.022-07:00TO SEE INTERNALS OF BACKGROUND PROCESSES<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="bki-p">
To really see what DBWR, LGWR, and other backgound processes are doing set event 10046 level 12 for the background processes. DO NOT do this on a production database. </div>
<div class="bki-p">
<br /></div>
<div class="bki-p">
Find the PID</div>
<pre class="bki-pre">SELECT * FROM v$process WHERE background is not null;
</pre>
<div class="bki-p">
</div>
<pre class="bki-pre">ORADEBUG SETORAPID 5
</pre>
<div class="bki-p">
</div>
<pre class="bki-pre">ORADEBUG EVENT 10046 trace name context forever, level 12
</pre>
<div class="bki-p">
</div>
<div class="bki-p">
Turn off tracing with:</div>
<pre class="bki-pre">oradebug event 10046 trace name context off
</pre>
<div class="bki-p">
</div>
<div class="bki-p">
The trace file will be in the DAIG_TRACE directory for all processes. The SET EVENT command can have serious consequences in a database. Events should NOT be set except at the direction of Oracle Support.</div>
<div class="bki-p">
In Oracle Database 11g, all trace files are located in the Automatic Diagnostics Repository, a set of directories. The default location for traces file is $ORACLE_BASE/diag/rdbms/<db_name>/<instance_name>/trace.</div>
<div class="bki-p">
<br /></div>
<div class="bki-p">
<br /></div>
<div class="bki-p">
I will post another article very soon How to read SQL trace file.<br />
<br />
---------------------------------------------------------------------------<br />
<br />
Related links:<br />
<br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
HOME</div>
</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<a href="http://koenigocm.blogspot.in/">http://koenigocm.blogspot.in/</a></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com0tag:blogger.com,1999:blog-5330686748982593370.post-44718757553604058352012-01-10T22:58:00.000-08:002012-10-04T09:47:17.790-07:00A DIFFERENT CLOSE LOOK AT ASH<div dir="ltr" style="text-align: left;" trbidi="on">
Its good to know about ASH basic usage, but there are some things which every DBA must need to know.<br />
<br />
Let me first compare ASH with SQLTRACE<br />
<br />
Comparison of ASH with SQL TRACE<br />
<br />
ASH and SQL*Trace are not the same thing, but both are valuable tools for finding out about where processes spend time. SQL*Trace (or event 10046 as we used to call it) has been my weapon of choice for solving performance issues for a very long time, and it is extremely effective, and there is still a place for it.<br />
<br />
There are difficulties with using SQL trace, especially in a production environment.<br />
<br />
Firstly, it does have a run time overhead. You could afford to trace a single process, but you certainly couldn’t trace the entire database.<br />
<br />
1) You have to work with trace in a reactive way. You will probably not already be tracing a process when you experience a performance problem, so you need to run the process again and reproduce the poor performance with trace.<br />
<br />
2) Trace will tell you if a session is blocked waiting on a lock. However, it will not tell you who is blocking you. ASH will do this (although there are limitations).<br />
<br />
3) A trace file records everything that happens in a session, whereas ASH data samples the session every seconds. Short-lived events will be missed, so the data has to be handled statistically.<br />
<br />
4) There are problems with both approaches if you have the kind of application where you have lots of different SQL statements because the application uses literal values rather than bind variables (and cursor sharing is EXACT).<br />
<br />
5) Oracle’s TKPROF trace file profiler cannot aggregate these statements, but I have found another called ORASRP www.oracledba.ru/orasrp) that can. With ASH, you will see different SQL_IDs, but it can be effective to group statements with the same execution plan.<br />
<br />
6) You may have trouble finding the SQL text in the SGA (or via the DBMS_XPLAN package) because it has already been aged out of the library cache. You may have similar problems with historical ASH data because the statement had been aged out when the AWR snapshot was taken.<br />
<br />
7) A trace file, with STATISTICS_LEVEL set to ALL, will give you timings for each operation in the execution plan. So, you can see where in the execution plan the time was spent. ASH will only tell you how long the whole statement takes to execute, and how long was spent on which wait event.<br />
<br />
IF you see my blog http://karandba.blogspot.com/2011/11/actual-use-of-active-session-history.html<br />
you will also come to know how to find top SQL's spent more on CPU/WAIT/I/O <br />
<br />
<br />
<br />
<br />
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com0tag:blogger.com,1999:blog-5330686748982593370.post-23409125969331583612012-01-10T20:25:00.001-08:002012-10-18T03:30:49.801-07:00SERVICES CONFUSIONS CLEARED<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial;"></span><br />
ORACLE SERVICES<br />
<br />
Well i was buzzed on my email by one of my close client, and he asks what is actually a service in RAC, so i decided to post on this. Well now lets get to the point, to manage workloads efficiently we define services to a particular application or to a subset of an application's operations. You can also group work by type under services. For example, online users can be a service while batch processing can be another and reporting can be yet another service type.<br />
<br />
When you define a service, you specify which instances support that service. These are known as the PREFERRED instances. You can also define other instances to support a service if the service's preferred instance fails. These are known as AVAILABLE instances.<br />
<br />
When you specify PREFERRED instances, you are specifying the number of instances on which a service will normally run. The Oracle Clusterware attempts to ensure that the service always runs on the number of nodes for which you have configured the service. Afterwards, due to either instance failure or planned service relocations, a service may be running on an AVAILABLE instance.<br />
<br />
Services are integrated with Resource Manager which enables you to restrict the resources that are used by a service within an instance. The Resource Manager enables you to map a consumer group to a service so that users who connect with the service are members of the specified consumer group. Also, the Automatic Workload Repository (AWR) enables you to monitor performance by service.<br />
<br />
Oracle Net Services provides connection load balancing to enable you to spread user connections across all of the instances that are supporting a service. For each service, you can define the method that you want the listener to use for load balancing by setting the connection load balancing goal, CLB_GOAL. You can also specify a single TAF policy for all users of a service by defining the FAILOVER_METHOD, FAILOVER_TYPE, and so on. Oracle RAC uses FAN to notify applications about configuration changes and the current service level that is provided by each instance where the service is enabled.<br />
<br />
Oracle Net Services provides the ability to balance client connections across the instances in an Oracle RAC configuration. There are two types of load balancing that you can implement: client-side and server-side load balancing. Client-side load balancing balances the connection requests across the Listeners. With server-side load balancing, the Listener directs a connection request to the best instance currently providing the service by using the load balancing advisory. <br />
<br />
In an Oracle RAC database, client connections should use both types of connection load balancing.<br />
<br />
FAN, FCF, and the load balancing advisory depend on an accurate connection load balancing configuration that includes setting the connection load balancing goal for the service. You can use a goal of either long or short for connection load balancing. These goals have the following characteristics:<br />
<br />
Long := Use the LONG connection load balancing method for applications that have long-lived connections. This is typical for connection pools and SQL*Forms sessions. Long is the default connection load balancing goal. The following is an example of modifying a service, POSTMAN, with the PL/SQL DBMS_SERVICE package and the CLB_GOAL_LONG package constant to define the connection load balancing goal for long-lived sessions:<br />
<br />
EXECUTE DBMS_SERVICE.MODIFY_SERVICE (service_name => 'POSTMAN', clb_goal => DBMS_SERVICE.CLB_GOAL_LONG);<br />
<br />
Short := Use the SHORT connection load balancing method for applications that have short-lived connections. The following example modifies the service known as ORDER, using the DBMS_SERVICE.CLB_GOAL_SHORT package constant to set the goal to short:<br />
<br />
EXECUTE DBMS_SERVICE.MODIFY_SERVICE (service_name => 'ORDER', CLB_GOAL => DBMS_SERVICE.CLB_GOAL_SHORT);<br />
<br />
<br />
<br />
To make things simple let me explain you what actually FAN is := <br />
<br />
FAN (FAST APPLICATION NOTIFICATION) := It is nothing but a notification mechanism which RAC uses to quickly alert applications about configuration and workload service level changes.<br />
<br />
On the other hand LBA (Load balancing advisory) := For LBA the concept is simple, it makes recommendations to applications about where to direct application requests to obtain the best service based on the policy that you have defined for that service.<br />
<br />
Finally FCF (Fast Connection Failover) is the ability of oracle clients to provide a rapid failover of connections by subscribing to FAN events.<br />
<br />
One last thing but not the least := There are 2 types of service level goals := 1) Service Time 2) Throughput<br />
<br />
Service Time attempts to direct work requests to instances according to response time. Because LBA stats are based on elapsed time for work done in the service plus available bandwidth to the service.<br />
<br />
Throughput attempts to direct work requests according to throughput. LBA stats are based on the rate that work is completed in the service plus available bandwidth to the service<br />
<br />
In this post im not gonna deal more about RAC concepts as the question was only for a service. But i shall be posting more on RAC in this blog as i love RAC infact every DBA loves RAC.<br />
<br />
-----------------------------------------------------------------------------------------------------------<br />
<br />
Related links:<br />
<div>
<span dir="ltr">11.2 RAC GOODIES AND SERVERPOOLS</span></div>
<div>
<a href="http://koenigocm.blogspot.in/search/label/11.2%20RAC%20GOODIES%20AND%20SERVERPOOLS" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/11.2%20RAC%20GOODIES%20AND%20SERVERPOOLS</span></a></div>
<div>
</div>
<div id="yui_3_2_0_1_134587371257817462">
<br />
<span dir="ltr" id="yui_3_2_0_1_134587371257817461">11G R2 RAC PROBLEMS AND SOLUTIONS</span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/11G%20R2%20RAC%20PROBLEMS%20AND%20SOLUTIONS" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/11G%20R2%20RAC%20PROBLEMS%20AND%20SOLUTIONS</span></a></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<br />
<span dir="ltr"><span dir="ltr">CLONE DATABASE HOME IN 11GR2 RAC</span> </span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/CLONE%20DATABASE%20HOME%20IN%2011GR2%20RAC" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/CLONE%20DATABASE%20HOME%20IN%2011GR2%20RAC</span></a></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<br />
<span dir="ltr"><span dir="ltr">NIC BONDING IN 11G R2 RAC</span> </span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/NIC%20BONDING%20IN%2011G%20R2%20RAC" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/NIC%20BONDING%20IN%2011G%20R2%20RAC</span></a></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<br />
<span dir="ltr"><span dir="ltr">PREREQUISITE TO CONFIGURE GNS AND GPNP IN 11G R2 RAC</span> </span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/PREREQUISITE%20TO%20CONFIGURE%20GNS%20AND%20GPNP%20IN%2011G%20R2%20RAC" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/PREREQUISITE%20TO%20CONFIGURE%20GNS%20AND%20GPNP%20IN%2011G%20R2%20RAC</span></a></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"></span> </div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr"><span dir="ltr">SETUP 10G RAC ON YOUR LAPTOP</span> </span></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/SETUP%2010G%20RAC%20ON%20YOUR%20LAPTOP" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SETUP%2010G%20RAC%20ON%20YOUR%20LAPTOP</span></a></span></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<br />
<span dir="ltr"><span dir="ltr"><span dir="ltr">SETUP AND PLAY WITH 11G R2 RAC AT YOUR HOME PC</span> </span></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<span dir="ltr"><span dir="ltr"></span></span><span dir="ltr"><span dir="ltr"><a href="http://koenigocm.blogspot.in/search/label/SETUP%20AND%20PLAY%20WITH%2011G%20R2%20RAC%20AT%20YOUR%20HOME%20PC" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SETUP%20AND%20PLAY%20WITH%2011G%20R2%20RAC%20AT%20YOUR%20HOME%20PC</span></a></span></span></div>
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
</div>
<br />
<span dir="ltr">11g R2 RAC - ADD INSTANCE MANUALLY</span> <br />
<div style="background-color: transparent; color: black; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal;">
<a href="http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%20-%20ADD%20INSTANCE%20MANUALLY">http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%20-%20ADD%</a></div>
<br />
<div>
</div>
<br />
<span dir="ltr">11gR2 RAC : USE RCONFIG TO CONVERT NON RAC DATABASE TO RAC DATABASE</span>
<span dir="ltr"></span><br />
http://koenigocm.blogspot.in/search/label/11gR2%20RAC%20%3A%20USE%20RCONFIG%20TO%20CONVERT%20NON%20RAC%20DATABASE%20TO%20%20RAC%20DATABASE<br />
<br />
<span dir="ltr">11g R2 RAC : TRACING SERVICES IN A RAC DATABASE</span><br />
<span dir="ltr"> http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%20%3A%20TRACING%20SERVICES%20%20IN%20A%20RAC%20DATABASE</span><br />
<br />
<div class="MsoNormal" style="font-family: "Trebuchet MS",sans-serif;">
<span dir="ltr">11G R2 RAC: INSTANCE RECOVERY</span><br />
<span dir="ltr"> http://koenigocm.blogspot.in/search/label/11G%20R2%20RAC%3A%20INSTANCE%20RECOVERY</span><br />
<br />
<span dir="ltr">11g R2 RAC: MANAGING THIRD PARTY APPLICATIONS USING APPLICATION VIP</span><br />
<span dir="ltr"> http://koenigocm.blogspot.in/search/label/11g%20R2%20RAC%3A%20MANAGING%20THIRD%20PARTY%20APPLICATIONS%20USING%20APPLICATION%20VIP</span><br />
<br /></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com1tag:blogger.com,1999:blog-5330686748982593370.post-65898723237674940512012-01-10T18:16:00.001-08:002012-10-04T09:47:44.605-07:00TKPROF INTERPRETATION<div dir="ltr" style="text-align: left;" trbidi="on">
<pre><span style="font-family: Courier New, Courier, mono;">Tkprof is an executable that 'parses' Oracle trace files to produce more
readable output. Remember that all the information in TkProf is available
from the base trace file.
If you have a system that is performing badly, a good way to identify
problem SQL statements is to trace a typical user session and then use TkProf
to format the output using the sort functions on the tkprof command
line.
There are a huge number of sort options that can be accessed by simply
typing 'TkProf' at the command prompt. A useful starting point is the
'fchela' sort option which orders the output by elapsed time fetching (remember
that timing information is only available with timed_statistics set to true
at the database level). The resultant .prf file will contain the most time
consuming SQL statement at the start of the file.
Another useful parameter is sys. This can be used to prevent SQL statements
run as user SYS from being displayed. This can make the output file much
shorter and easier to manage.
Again, remember to always check that the TIMED_STATISTICS parameter is set to TRUE
as otherwise no time based comparisons can be made.
Interpreting TkProf Output Guidelines
=====================================
Column Meanings
===============
call : Statisics for each cursor's activity are divided in to 3 areas:
Parse: statisitics from parsing the cursor. This
includes information for plan generation etc.
Execute: statisitics for the exection phase of a cursor
Fetch : statistics for actually fetching the rows
count : number of times we have performed a particular activity on this
particular cursor
cpu: cpu time used by this cursor
elapsed: elapsed time for this cursor
disk: This indicates the number of blocks read from disk. Generally you want
to see blocks being read from the buffer cache rather than disk.
query : This column is incremented if a buffer is read in Consistent mode.
A Consistent mode buffer is one that has been generated to give
a consistent read snapshot for a long running transaction. The buffer
actually contains this status in its header.
current: This column is incremented if a buffer found in the buffer cache
that is new enough for the current transaction and is in current mode
(and it is not a CR buffer). This applies to buffers that have been
read in to the cache as well as buffers that already exist in the
cache in current mode.
rows: Rows retrieved by this step
Explain plan
============
Firstly, we advise that the autotrace feature of SQL*Plus be used
on statements rather than using TkProf mainly because the TkProf output
can be confusing with regard to whether the Rule or Cost Based optimizer
has been used.
Because TkProf explain plan does not show any costs or statistics, it is
sometimes not possible to tell definitively which optimizer has been used.
That said, the following output from Tkprof explain plan is useful.
The Rows column next to the explain plan output shows the number of
rows processed by that particular step. The information is gathered from the
STAT lines for each cursor in the raw trace output.
Remember that if the cursor is not closed then you will not see any output.
Setting SQL_TRACE to false DOES NOT close PL/SQL child cursors.
Cursors are closed in SQL*Plus immediately after execution.
TkProf Examples and Discussion
==============================
Examples:
Step 1 - Look at the totals at the end of the tkprof output
===========================================================
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
| call | count | cpu | elapsed | disk | query | current | rows |
|---------|-------|------|---------|---------|--------|---------|--------|
| Parse | [A] 7 | 1.87 | 4.53 | 385 |[G] 553 | 22 | 0 |
| Execute | [E] 7 | 0.03 | 0.11 | [P] 0 |[C] 0 | [D] 0 | [F] 0 |
| Fetch | [E] 6 | 1.39 | 4.21 | [P] 128 |[C] 820 | [D] 3 | [F] 20 |
--------------------------------------------------------------------------
Misses in library cache during parse: 5
Misses in library cache during execute: 1
8 user SQL statements in session.
12 internal SQL statements in session.
[B] 54 SQL statements in session.
3 statements EXPLAINed in this session.
1. Compare [A] & [B] to spot over parsing. In this case we
have 7 parses for 54 statements which is ok.
2. You can use [P], [C] & [D] to determine the hit ratio.
Hit Ratio is logical reads/physical reads:
Logical Reads = Consistent Gets + DB Block Gets
Logical Reads = query + current
Logical Reads = Sum[C] + Sum[D]
Logical Reads = 0+820 + 0+3
Logical Reads = 820 + 3
Logical Reads = 823
Hit Ratio = 1 - (Physical Reads / Logical Reads)
Hit Ratio = 1 - (Sum[P] / Logical Reads)
Hit Ratio = 1 - (128 / 823)
Hit Ratio = 1 - (0.16)
Hit Ratio = 0.84 or 84%
3. We want fetches to be less than the number of rows as this
will mean we have done less work (array fetching).
To see this we can compare [E] and [F].
[E] = 6 = Number of Fetches
[F] = 20 = Number of Rows
So we are doing 6 fetches to retrieve 20 rows - not too bad.
If arrayfetching was configured then rows could be retrieved with
less fetches.
Remember that an extra fetch will be done at the end to check that
the end of fetch has been reached.
4. [G] Shows reads on the Dictionary cache for the statements.
- this should not be a problem on Oracle7.
In this case we have done 553 reads from the
Library cache.
STEP 2 - Examine statements using high resource
===============================================
update ...
where ...
| call | count | cpu | elapsed | disk | query | current | rows |
|---------|-------|-----|---------|------|---------|---------|--------|
| Parse | 1 | 7 | 122 | 0 | 0 | 0 | 0 |
| Execute | 1 | 75 | 461 | 5 | [H] 297 | [I] 3 | [J] 1 |
| Fetch | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
-----------------------------------------------------------------------
[H] shows that this query is visiting 297 blocks to find the rows to
update
[I] shows that only 3 blocks are visited performing the update
[J] shows that only 1 row is updated.
297 block to update 1 rows is a lot.
Possibly there is an index missing?
STEP 3 - Look for over parsing
==============================
select ...
| call | count | cpu | elapsed | disk | query | current | rows |
|---------|-------|---------|---------|------|--------|---------|-------|
| Parse | [M] 2 | [N] 221 | 329 | 0 | 45 | 0 | 0 |
| Execute | [O] 3 | [P] 9 | 17 | 0 | 0 | 0 | 0 |
| Fetch | 3 | 6 | 8 | 0 | [L] 4 | 0 | [K] 1 |
-------------------------------------------------------------------------
Misses in library cache during parse: 2 [Q]
[K] is shows that the query has returned 1 row.
[L] shows that we had to read 4 blocks to get this row back.
This is fine.
[M] show that we are parsing the statement twice - this is not desirable
especially as the cpu usage is high [N] in comparison to the execute
figures : [O] & [P]. [Q] shows that these parses are hard parses. If
[Q] was 1 then the statement would have had 1 hard parse followed by
a soft parse (which just looks up the already parsed detail in the
library cache). See <a href="https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&id=32895.1">Note:32895.1</a> for more details.
This is not a particularly bad example since the query has only been
executed a few times. However excessive parsing should be avoided as far
as possible by:
o Ensuring that code is shared:
- use bind variables
- make shared pool large enough to hold query definitions in memory
long enough to be reused.
NOTE:
====
We need to ensure, we do not parse a >=9i version 10046 raw trace with an <= 8i tkprof utility.
This is because the timings in raw trace file for <=8i versions and >=9i versions are in
centiseconds and microseconds respectively.
</span></pre>
</div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com1tag:blogger.com,1999:blog-5330686748982593370.post-36960697628729615692012-01-10T18:11:00.000-08:002012-10-04T09:48:00.498-07:00EXAMPLE TOP SQL QUERIES FROM SQLAREA<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<pre><span style="font-family: Courier New, Courier, mono;">EXAMPLE V$SQLAREA QUERIES
-------------------------
Top 10 by Buffer Gets:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
buffer_gets, executions, buffer_gets/executions "Gets/Exec",
hash_value,address
FROM V$SQLAREA
WHERE buffer_gets > 10000
ORDER BY buffer_gets DESC)
WHERE rownum <= 10
;
Top 10 by Physical Reads:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
disk_reads, executions, disk_reads/executions "Reads/Exec",
hash_value,address
FROM V$SQLAREA
WHERE disk_reads > 1000
ORDER BY disk_reads DESC)
WHERE rownum <= 10
;
Top 10 by Executions:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
executions, rows_processed, rows_processed/executions "Rows/Exec",
hash_value,address
FROM V$SQLAREA
WHERE executions > 100
ORDER BY executions DESC)
WHERE rownum <= 10
;
Top 10 by Parse Calls:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
parse_calls, executions, hash_value,address
FROM V$SQLAREA
WHERE parse_calls > 1000
ORDER BY parse_calls DESC)
WHERE rownum <= 10
;
Top 10 by Sharable Memory:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
sharable_mem, executions, hash_value,address
FROM V$SQLAREA
WHERE sharable_mem > 1048576
ORDER BY sharable_mem DESC)
WHERE rownum <= 10
;
Top 10 by Version Count:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
version_count, executions, hash_value,address
FROM V$SQLAREA
WHERE version_count > 20
ORDER BY version_count DESC)
WHERE rownum <= 10
;
</span></pre>
-------------------------------------------------------------------------------------------<br />
<br />
<div>
Related links :<br />
<br />
<span dir="ltr">LATCHES LOCKS PINS AND MUTEXES</span><br />
<div>
<div>
<a href="http://koenigocm.blogspot.in/search/label/LATCHES%20LOCKS%20PINS%20AND%20MUTEXES" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/LATCHES%20LOCKS%20PINS%20AND%20MUTEXES</span></a></div>
<div>
</div>
<div id="yui_3_2_0_1_134587371257814690">
<span dir="ltr" id="yui_3_2_0_1_134587371257814689">MUTEXES AND LATCHES</span></div>
<div>
<a href="http://koenigocm.blogspot.in/search/label/MUTEXES%20AND%20LATCHES" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/MUTEXES%20AND%20LATCHES</span></a></div>
<div>
</div>
<div>
<span dir="ltr">PARENT AND CHILD CURSORS IN ORACLE</span></div>
<div>
<a href="http://koenigocm.blogspot.in/search/label/PARENT%20AND%20CHILD%20CURSORS%20IN%20ORACLE" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/PARENT%20AND%20CHILD%20CURSORS%20IN%20ORACLE</span></a></div>
<div>
</div>
<div>
<span style="color: red;"><span style="color: black;">QUICK OVERVIEW OF SHARED POOL TUNING</span></span></div>
<div>
<span style="color: red;"><a href="http://koenigocm.blogspot.in/search/label/QUICK%20OVERVIEW%20OF%20SHARED%20POOL%20TUNING" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/QUICK%20OVERVIEW%20OF%20SHARED%20POOL%20TUNING</span></a></span></div>
<div>
</div>
<div>
<span style="color: red;"><span dir="ltr"><span style="color: black;">SHARED POOL ARCHITECTURE</span></span></span></div>
<div>
<span style="color: red;"><a href="http://koenigocm.blogspot.in/search/label/SHARED%20POOL%20ARCHITECTURE" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SHARED%20POOL%20ARCHITECTURE</span></a></span></div>
<div>
</div>
<span style="color: red;"></span><br />
<div class="yiv10892242post-title yiv10892242entry-title" style="color: red; font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span style="color: red;"><span dir="ltr"><span dir="ltr"><span style="color: red;"><span dir="ltr"><span style="color: black;">SQL PLAN MANAGEMENT – ORACLE 11g : Part-1</span></span></span></span></span></span></div>
<span style="color: red;"> <a href="http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%E2%80%93%20ORACLE%20%2011g%20%3A%20Part-1" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%E2%80%93%20ORACLE%20%2011g%20%3A%20Part-1</span></a></span><br />
<br />
<span style="color: red;"></span><br />
<div class="yiv10892242post-title yiv10892242entry-title" style="color: black; font-family: arial, helvetica, sans-serif; font-size: 16px;">
</div>
<span style="color: red;">
</span>
<div class="yiv10892242post-title yiv10892242entry-title" style="color: red; font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span style="color: red;"></span><span style="color: red;"><span dir="ltr"><span dir="ltr"><span style="color: red;"><span dir="ltr"><span dir="ltr"><span style="color: black;">SQL PLAN MANAGEMENT – ORACLE 11g : Part-2</span></span></span></span></span></span></span></div>
<div class="yiv10892242post-title yiv10892242entry-title" style="color: red; font-family: arial, helvetica, sans-serif; font-size: 16px;">
<span dir="ltr"><span dir="ltr"><span style="color: red;"><span dir="ltr"></span></span></span></span> <a href="http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%20%E2%80%93%20ORACLE%2011g%20%3A%20Part-2" rel="nofollow" target="_blank"><span style="color: #234786;">http://koenigocm.blogspot.in/search/label/SQL%20PLAN%20MANAGEMENT%20%E2%80%93%20ORACLE%2011g%20%3A%20Part-2</span></a><br />
<br />
<span style="color: red;"><span dir="ltr"><span style="color: black;">CURSOR_SHARING DEMYSTIFIED</span></span></span></div>
<div class="yiv10892242post-title yiv10892242entry-title" style="color: red; font-family: arial, helvetica, sans-serif; font-size: 16px;">
<a href="http://koenigocm.blogspot.in/search/label/CURSOR_SHARING%20DEMYSTIFIED">http://koenigocm.blogspot.in/search/label/CURSOR_SHARING%20DEMYSTIFIED</a></div>
</div>
<br />
<span id="yui_3_2_0_18_1346273642331899" style="color: red;"><span id="yui_3_2_0_18_1346273642331898"> <span style="background-color: #c0a154; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 15px;">LIBRARY CACHE LOCK/PIN DEMONSTRATED</span></span></span><br />
<div id="yui_3_2_0_18_1346273642331834" style="font-family: arial, helvetica, sans-serif; font-size: 16px;">
</div>
</div>
</div>
<span style="color: red;"> <a href="http://koenigocm.blogspot.in/search/label/LIBRARY%20CACHE%20LOCK%2FPIN%20DEMONSTRATED" style="color: blue !important; cursor: text !important; font-size: 12pt;">http://koenigocm.blogspot.in/search/label/LIBRARY%20CACHE%20LOCK%2FPIN%20DEMONSTRATED</a></span>
<br />
<span style="background-color: white; font-family: arial, helvetica, sans-serif; font-size: 16px;"></span></div>
Anonymoushttp://www.blogger.com/profile/15060193947044029025noreply@blogger.com0