Setting OPTIMIZER_MODE
How and where do I set the OPTIMIZER_MODE in Oracle 8?
null
HI,
U can set this in INIT configuration file. Better to set COST based, rather than RULE based optimisation.
with regads,
Boby Jose Thekkanath.
Similar Messages
-
Problem while setting OPTIMIZER_MODE =RULE
I want to set optimizer_mode=RULE in init.ora file for Oracle92
For this i have shutdown the d/b and set the optimizer_mode=RULE
but when i retsarted the d/b the chnages is not reflected it is showing optimizer_mode=CHOOSE
Is there changes we have to do to take d/b in RBO.
Thanx
Junubut getting following Oracle erroe message
ORA-02096 specified initialization parameter is not modifiable with this option
That's correct. You cannot change it using ALTER SYSTEM. See below:
SQL> select issys_modifiable from v$parameter where name='optimizer_mode';
ISSYS_MOD
FALSEAs you can see ISSYS_MODIFIABLE value is FALSE which means you cannot change it using ALTER SYSTEM.
Also there many init.ora and spfile files in 'admin' and other directory even iam unable to decide which is the current one?
During starting instance you can choose init.ora file.
See help here:
http://download-uk.oracle.com/docs/cd/B14117_01/server.101/b12170/ch13.htm#i2699631
Peter D. -
Optimizer_mode set to CHOOSE in Oracle 10G
I a bit confused about the new settings for the parameter "optimizer_mode" on 10G. If the parameter is set to CHOOSE on a 10G database, what value is the database actually using since CHOOSE is no longer a valid choice for this parameter (ALL_ROWS or FIRST_ROWS) ?
Thanks
Johndatabase actually using since CHOOSE is no longer a
valid choice for this parameter (ALL_ROWS or
FIRST_ROWS) ?It is completely valid choice. It is deprecated yes and should not be used but see as follows:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> alter system set optimizer_mode = choose scope=both;
System altered.
SQL> select user from dual;
USER
GINTS
SQL> create table bzzz as select * from dba_source;
Table created.
SQL> alter session set optimizer_dynamic_sampling = 0;
Session altered.
SQL> set autot on
SQL> select count(*) from bzzz;
COUNT(*)
280779
Execution Plan
Plan hash value: 2985757553
| Id | Operation | Name |
| 0 | SELECT STATEMENT | |
| 1 | SORT AGGREGATE | |
| 2 | TABLE ACCESS FULL| BZZZ |
Note
- rule based optimizer used (consider using cbo)Gints Plivna
http://www.gplivna.eu -
Slow response on data dictionary queries with optimizer_mode=rule in 10g
I have two dataabse: DB1 (9i) and DB2 (10g) on windows 2000
They are two development databases with the same schemas and same tables. The application executes the same commands but with different results and execution plans.
In DB2 the queries with the most slow response tima are the queries on the data dictionary (for example: all_synonyms).
These query are very fast with the optimizer_mode=cost and very slow with the optimizer_mode=rule.
And the the problem is this:
in DB1 and DB2 the application executes after the connection this command:
ALTER SESSION SET OPTIMIZER_MODE = 'RULE';
These are the traces of the session in db1 and db2:
The queries are created dynamically by the application.
Is there a solution for this?
thanks
Message was edited by:
user596611Here is a simple example of what can happen,
@>alter session set optimizer_mode=all_rows;
@>SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 1 | 2 (0)|
| 1 | FAST DUAL | | 1 | 2 (0)|
@>alter session set optimizer_mode=rule;
@>SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());
PLAN_TABLE_OUTPUT
| Id | Operation | Name |
| 0 | SELECT STATEMENT | |
| 1 | FAST DUAL | |
Note
- rule based optimizer used (consider using cbo)As you can see incomplete explain plans. Therefore it is not advised.
Adith -
Best value for optimizer_mode
In my production environment we have to move from Rule based optimizer to cost based optimizer . We work with oracle 10g but until now our application before run queries execute an alter session set optimizer_mode=rule.
What is the best value for this parameter?
# FIRST_ROWS(n)
# FIRST_ROWS
# ALL_ROWS
# CHOOSE
We don't know what kind of query users will do. Those queries can retrive all rows or a part of the table.Do you think tha I shoud use stored outlines?
I have found this :
20.2.1 Moving from RBO to the Query Optimizer
If an application was developed using the rule-based optimizer, then a considerable amount of effort might have gone into manually tuning the SQL statements to optimize performance. You can use plan stability to leverage the effort that has already gone into performance tuning by preserving the behavior of the application when upgrading from rule-based to query optimization.
By creating outlines for an application before switching to query optimization, the plans generated by the rule-based optimizer can be used, while statements generated by newly written applications developed after the switch use query plans. To create and use outlines for an application, use the following process.
Note:
Carefully read this procedure and consider its implications before executing it!
1.
Ensure that schemas in which outlines are to be created have the CREATE ANY OUTLINE privilege. For example, from SYS:
GRANT CREATE ANY OUTLINE TO user-name
2.
Execute syntax similar to the following to designate; for example, the RBOCAT outline category.
ALTER SESSION SET CREATE_STORED_OUTLINES = rbocat;
3.
Run the application long enough to capture stored outlines for all important SQL statements.
4.
Suspend outline generation:
ALTER SESSION SET CREATE_STORED_OUTLINES = FALSE;
5.
Gather statistics with the DBMS_STATS package.
6.
Alter the parameter OPTIMIZER_MODE to CHOOSE.
7.
Enter the following syntax to make Oracle use the outlines in category RBOCAT:
ALTER SESSION SET USE_STORED_OUTLINES = rbocat;
8.
Run the application.
Subject to the limitations of plan stability, access paths for this application's SQL statements should be unchanged.
http://download.oracle.com/docs/cd/B28359_01/server.111/b28274/outlines.htm#i12916
is it good for performance?
I have never use stored outlines. -
Hi,
We have 12 TB of data to be restored from PROD to DEV.
In Prod, we have ASM having 12TB of space and in DEV, we have 2 filesystem (DATA1 & DATA2) shares 6TB each.
We used the below script for RMAN restore using set new name to restore it to the different locations in DEV:
connect target /
run
sql "alter session set optimizer_mode=RULE";
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
allocate channel c5 device type disk;
allocate channel c6 device type disk;
allocate channel c7 device type disk;
allocate channel c8 device type disk;
allocate channel c9 device type disk;
allocate channel c10 device type disk;
allocate channel c11 device type disk;
CATALOG START WITH '/oracle/backup/ora-prod-ebs/RMAN/EBSGOLD_08062013';
set until time "to_date('2013-JUL-14 01:00:00','YYYY-MON-DD HH24:MI:SS')";
SET NEWNAME FOR DATAFILE '+DATA/stbyprod/datafile/a_media08.dbf' to '/oracle/oradata/VMWDEV1/DATA1/VMPRD/a_media08.dbf';
SET NEWNAME FOR DATAFILE '+DATA/stbyprod/datafile/a_media02.dbf' to '/oracle/oradata/VMWDEV1/DATA1/VMPRD/a_media02.dbf';
SET NEWNAME FOR DATAFILE '+DATA/stbyprod/datafile/a_media03.dbf' to '/oracle/oradata/VMWDEV1/DATA1/VMPRD/a_media03.dbf';
SET NEWNAME FOR DATAFILE '+DATA/stbyprod/datafile/a_media04.dbf' to '/oracle/oradata/VMWDEV1/DATA1/VMPRD/a_media04.dbf';
SET NEWNAME FOR DATAFILE '+DATA/stbyprod/datafile/a_media05.dbf' to '/oracle/oradata/VMWDEV1/DATA1/VMPRD/a_media05.dbf';
SET NEWNAME FOR DATAFILE '+DATA/stbyprod/datafile/apps_ts_tx_idx.521.799600075' to '/oracle/oradata/VMWDEV1/DATA1/VMPRD/apps
SET NEWNAME FOR DATAFILE '+DATA/stbyprod/datafile/sysaux.344.809874457' to '/oracle/oradata/VMWDEV1/DATA2/VMPRD/sysaux.344.809874457';
SET NEWNAME FOR DATAFILE '+DATA/stbyprod/datafile/apps_ts_tx_data.343.810623133' to '/oracle/oradata/VMWDEV1/DATA2/VMPRD/apps_ts_tx_data.343.810623133';
SET NEWNAME FOR DATAFILE '+DATA/stbyprod/datafile/apps_ts_tx_data.342.810623199' to '/oracle/oradata/VMWDEV1/DATA2/VMPRD/apps_ts_tx_data.342.810623199';
SET NEWNAME FOR DATAFILE '+DATA/stbyprod/datafile/apps_ts_tx_data.341.810623265' to '/oracle/oradata/VMWDEV1/DATA2/VMPRD/apps_ts_tx_data.341.810623265';
SET NEWNAME FOR DATAFILE '+DATA/stbyprod/datafile/apps_ts_tx_data.340.810623327' to '/oracle/oradata/VMWDEV1/DATA2/VMPRD/apps_ts_tx_data.340.810623327';
SET NEWNAME FOR DATAFILE '+DATA/stbyprod/datafile/apps_ts_tx_data.339.810623399' to '/oracle/oradata/VMWDEV1/DATA2/VMPRD/apps_ts_tx_data.339.810623399';
SET NEWNAME FOR DATAFILE '+DATA/stbyprod/datafile/apps_ts_tx_data.338.810623475' to '/oracle/oradata/VMWDEV1/DATA2/VMPRD/apps_ts_tx_data.338.810623475';
SET NEWNAME FOR DATAFILE '+DATA/stbyprod/datafile/apps_ts_tx_data.337.810623543' to '/oracle/oradata/VMWDEV1/DATA2/VMPRD/apps_ts_tx_data.337.810623543';
SET NEWNAME FOR DATAFILE '+DATA/stbyprod/datafile/apps_ts_tx_data.336.810623611' to '/oracle/oradata/VMWDEV1/DATA2/VMPRD/apps_ts_tx_data.336.810623611';
restore database;
switch datafile all;
recover database delete archivelog;
alter database open resetlogs;
But, unfortunately all the files were getting restored to only one of the filesystem DATA1 and not to DATA2 at all.
Hence, RMAN restore failed with the following error since no space is available in DATA1
channel c9: ORA-19870: error while restoring backup piece /oracle/backup/ora-prod-ebs/RMAN/EBSGOLD_08062013/vmwprod_full_backup_JUN8_VMWPROD_34228_1
ORA-19502: write error on file "/oracle/oradata/VMWDEV1/DATA1/VMPRD/a_txn_data01.dbf", block number 523904 (block size=8192)
ORA-27072: File I/O error
Linux-x86_64 Error: 28: No space left on device
Additional information: 4
Additional information: 523904
Additional information: -
failover to previous backup
Please help us to solve this issue.
DB Version: 11.2.0.3Hi,
It is hard to say anything with an incomplete script and without the RMAN restore output/log.
If they are too large to post here, you can upload it somewhere, e.g pastebin.com.
It is very unlikely that Oracle ignored DATA2 in your script and replaced it to DATA1 on all occurences... -
how can set optimizer mode
SQL> alter session set optimizer_goal = first_rows
2 /
alter session set optimizer_goal = first_rows
ERROR at line 1:
ORA-01986: OPTIMIZER_GOAL is obsolete
how can set this setting.
thanx in advance.
i am waiting for reply.use OPTIMIZER_MODE instead.
alter session set optimizer_mode=first_rows; -
Change optimizer_mode from rule to choose ?
Hi All
Could we change optimizer mode from rule to choose by restarting the instance
thanks
kedarYes. It is needed if your are using a text intialization file and want the change to be permanent.
See http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96536/ch13.htm#1013938
If you are using a spfile, you don't need to restart the instance, just run:
ALTER SYSTEM SET optimizer_mode=choose;
The parameter will be changed in a permanant way.
See: http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96536/ch1140.htm#1021526
and
http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96536/ch13.htm#1013935
Message was edited by:
Pierre Forstmann
Message was edited by:
Pierre Forstmann -
We have a report that used to produce a 1000+ page pdf in
about 2 minutes. It has gone to producing a 200+ page report in
about the same amount of time. No change to the data, database,
report or environment, it just suddenly slowed down and nothing
seems to be able to make it go back to decent performance on large
record sets.
Server reboots don't help, any ideas or thoughts would be
appreciated.Hello
I followed some Donald's suggestion and went through some explanations he's given on its web site to try to figure out how could I speed up the database 10g since we migrated from 8i to 10g.
Here are default values in our 10g influencing the COST BASE OPTIMIZER
OPTIMIZER_FEATURES_ENABLE=10.2.0.1
OPTIMIZER_MODE=ALL_ROWS
OPTIMIZER_INDEX_COST_ADJ=100
I launched his script below provided to see time waited between full scan table
('db file scattered read representing by the c3 row and the
sequential read representing by the c4 row)
select
sum(a.time_waited_micro)/sum(a.total_waits)/1000000 c1,
sum(b.time_waited_micro)/sum(b.total_waits)/1000000 c2,
sum(a.total_waits) /
sum(a.total_waits + b.total_waits)
) * 100 c3,
sum(b.total_waits) /
sum(a.total_waits + b.total_waits)
) * 100 c4,
sum(b.time_waited_micro)/sum(b.total_waits))/
(sum(a.time_waited_micro)/sum(a.total_waits)
) * 100 c5
from
dba_hist_system_event a,
dba_hist_system_event b
where
a.snap_id = b.snap_id
and
a.event_name = 'db file scattered read'
and
b.event_name = 'db file sequential read';
there is the output of the script
C1 C2 C3 C4 C5
.002438964 .002888595 24.6526611 75.3473389 118.435332
So the time waited for full scan(c3) table is most faster than index sequential read(c4:index probe)
I changed the parameter OPTIMIZER_INDEX_COST_ADJ and OPTIMIZER_MODE
alter system set OPTIMIZER_INDEX_COST_ADJ=20 scope=both;
alter system set OPTIMIZER_MODE=FIRST_ROWS_1000 scope=both;
I lauched aigain the script above, but the output shows the result below
C1 C2 C3 C4 C5
.002438964 .002888595 24.6526611 75.3473389 118.435332
this output isn't different than the first one, so does this mean that INDEXES are not well designed or WHAT ELSE?.
Wich parameter could I enable or change to decrease the C4(index sequential read wait time?
Thank you for your help -
How to avoid full Table scan when using Rule based optimizer (Oracle817)
1. We have a Oracle 8.1.7 DB, and the optimizer_mode is set to "RULE"
2. There are three indexes on table cm_contract_supply, which is a large table having 28732830 Rows, and average row length 149 Bytes
COLUMN_NAME INDEX_NAME
PROGRESS_RECID XAK11CM_CONTRACT_SUPPLY
COMPANY_CODE XIE1CM_CONTRACT_SUPPLY
CONTRACT_NUMBER XIE1CM_CONTRACT_SUPPLY
COUNTRY_CODE XIE1CM_CONTRACT_SUPPLY
SUPPLY_TYPE_CODE XIE1CM_CONTRACT_SUPPLY
VERSION_NUMBER XIE1CM_CONTRACT_SUPPLY
CAMPAIGN_CODE XIF1290CM_CONTRACT_SUPPLY
COMPANY_CODE XIF1290CM_CONTRACT_SUPPLY
COUNTRY_CODE XIF1290CM_CONTRACT_SUPPLY
SUPPLIER_BP_ID XIF801CONTRACT_SUPPLY
COMMISSION_LETTER_CODE XIF803CONTRACT_SUPPLY
COMPANY_CODE XIF803CONTRACT_SUPPLY
COUNTRY_CODE XIF803CONTRACT_SUPPLY
COMPANY_CODE XPKCM_CONTRACT_SUPPLY
CONTRACT_NUMBER XPKCM_CONTRACT_SUPPLY
COUNTRY_CODE XPKCM_CONTRACT_SUPPLY
SUPPLY_SEQUENCE_NUMBER XPKCM_CONTRACT_SUPPLY
VERSION_NUMBER XPKCM_CONTRACT_SUPPLY
3. We are querying the table for a particular contract_number and version_number. We want to avoid full table scan.
SELECT /*+ INDEX(XAK11CM_CONTRACT_SUPPLY) */
rowid, pms.cm_contract_supply.*
FROM pms.cm_contract_supply
WHERE
contract_number = '0000000000131710'
AND version_number = 3;
However despite of giving hint, query results are fetched after full table scan.
Execution Plan
0 SELECT STATEMENT Optimizer=RULE (Cost=1182 Card=1 Bytes=742)
1 0 TABLE ACCESS (FULL) OF 'CM_CONTRACT_SUPPLY' (Cost=1182 Card=1 Bytes=742)
4. I have tried giving
SELECT /*+ FIRST_ROWS + INDEX(XAK11CM_CONTRACT_SUPPLY) */
rowid, pms.cm_contract_supply.*
FROM pms.cm_contract_supply
WHERE
contract_number = '0000000000131710'
AND version_number = 3;
and
SELECT /*+ CHOOSE + INDEX(XAK11CM_CONTRACT_SUPPLY) */
rowid, pms.cm_contract_supply.*
FROM pms.cm_contract_supply
WHERE
contract_number = '0000000000131710'
AND version_number = 3;
But it does not work.
Is there some way without changing optimizer mode and without creating an additional index, we can use the index instead of full table scan?David,
Here is my test on a Oracle 10g database.
SQL> create table mytable as select * from all_tables;
Table created.
SQL> set autot traceonly
SQL> alter session set optimizer_mode = choose;
Session altered.
SQL> select count(*) from mytable;
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 SORT (AGGREGATE)
2 1 TABLE ACCESS (FULL) OF 'MYTABLE' (TABLE)
Statistics
1 recursive calls
0 db block gets
29 consistent gets
0 physical reads
0 redo size
223 bytes sent via SQL*Net to client
276 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
SQL> analyze table mytable compute statistics;
Table analyzed.
SQL> select count(*) from mytable
2 ;
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=11 Card=1)
1 0 SORT (AGGREGATE)
2 1 TABLE ACCESS (FULL) OF 'MYTABLE' (TABLE) (Cost=11 Card=1
788)
Statistics
1 recursive calls
0 db block gets
29 consistent gets
0 physical reads
0 redo size
222 bytes sent via SQL*Net to client
276 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
SQL> disconnect
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining options -
[./solutions/atonx.sql]
REM
REM script ATONX.SQL
REM =====================================
SET AUTOTRACE ON EXPLAIN
[./solutions/saved_settings.sql]
set appinfo OFF
set appinfo "SQL*Plus"
set arraysize 15
set autocommit OFF
set autoprint OFF
set autorecovery OFF
set autotrace OFF
set blockterminator "."
set cmdsep OFF
set colsep " "
set compatibility NATIVE
set concat "."
set copycommit 0
set copytypecheck ON
set define "&"
set describe DEPTH 1 LINENUM OFF INDENT ON
set echo OFF
set editfile "afiedt.buf"
set embedded OFF
set escape OFF
set feedback ON
set flagger OFF
set flush ON
set heading ON
set headsep "|"
set linesize 80
set logsource ""
set long 80
set longchunksize 80
set markup HTML OFF HEAD "<style type='text/css'> body {font:10pt Arial,Helvetica,sans-serif; color:black; background:White;} p {font:10pt Arial,Helvetica,sans-serif; color:black; background:White;} table,tr,td {font:10pt Arial,Helvetica,sans-serif; color:Black; background:#f7f7e7; padding:0px 0px 0px 0px; margin:0px 0px 0px 0px;} th {font:bold 10pt Arial,Helvetica,sans-serif; color:#336699; background:#cccc99; padding:0px 0px 0px 0px;} h1 {font:16pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; border-bottom:1px solid #cccc99; margin-top:0pt; margin-bottom:0pt; padding:0px 0px 0px 0px;} h2 {font:bold 10pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; margin-top:4pt; margin-bottom:0pt;} a {font:9pt Arial,Helvetica,sans-serif; color:#663300; background:#ffffff; margin-top:0pt; margin-bottom:0pt; vertical-align:top;}</style><title>SQL*Plus Report</title>" BODY "" TABLE "border='1' width='90%' align='center' summary='Script output'" SPOOL OFF ENTMAP ON PRE ON
set newpage 1
set null ""
set numformat ""
set numwidth 10
set pagesize 14
set pause OFF
set recsep WRAP
set recsepchar " "
set serveroutput OFF
set shiftinout invisible
set showmode OFF
set sqlblanklines OFF
set sqlcase MIXED
set sqlcontinue "> "
set sqlnumber ON
set sqlpluscompatibility 8.1.7
set sqlprefix "#"
set sqlprompt "SQL> "
set sqlterminator ";"
set suffix "sql"
set tab ON
set termout OFF
set time OFF
set timing OFF
set trimout ON
set trimspool OFF
set underline "-"
set verify ON
set wrap ON
[./solutions/sol_06_04d.sql]
-- this script requires the sql id from the previous script to be substituted
SELECT PLAN_TABLE_OUTPUT
FROM TABLE (DBMS_XPLAN.DISPLAY_AWR(' your sql id here'));
[./solutions/rpsqlarea.sql]
set feedback off
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('your sql_id here'));
set feedback on
[./solutions/sqlid2.sql]
SELECT SQL_ID, SQL_TEXT FROM V$SQL
WHERE SQL_TEXT LIKE '%REPORT%' ;
[./solutions/schemastats.sql]
SELECT last_analyzed analyzed, sample_size, monitoring,
table_name
FROM user_tables;
[./solutions/allrows.sql]
REM
REM script ALLROWS.SQL
REM =====================================
alter session set optimizer_mode = all_rows
[./solutions/aton.sql]
REM
REM script ATON.SQL
REM =====================================
SET AUTOTRACE ON
[./solutions/li.sql]
REM script LI.SQL (list indexes)
REM wildcards in table_name allowed,
REM and a '%' is appended by default
REM ======================================
set termout off
store set sqlplus_settings replace
save buffer.sql replace
set verify off autotrace off
set feedback off termout on
break on table_name skip 1 on index_type
col table_name format a25
col index_name format a30
col index_type format a20
accept table_name -
prompt 'List indexes on table : '
SELECT ui.table_name
, decode(ui.index_type
,'NORMAL', ui.uniqueness
,ui.index_type) AS index_type
, ui.index_name
FROM user_indexes ui
WHERE ui.table_name LIKE upper('&table_name.%')
ORDER BY ui.table_name
, ui.uniqueness desc;
get buffer.sql nolist
@sqlplus_settings
set termout on
[./solutions/utlxplp.sql]
Rem
Rem $Header: utlxplp.sql 23-jan-2002.08:55:23 bdagevil Exp $
Rem
Rem utlxplp.sql
Rem
Rem Copyright (c) 1998, 2002, Oracle Corporation. All rights reserved.
Rem
Rem NAME
Rem utlxplp.sql - UTiLity eXPLain Parallel plans
Rem
Rem DESCRIPTION
Rem script utility to display the explain plan of the last explain plan
Rem command. Display also Parallel Query information if the plan happens to
Rem run parallel
Rem
Rem NOTES
Rem Assume that the table PLAN_TABLE has been created. The script
Rem utlxplan.sql should be used to create that table
Rem
Rem With SQL*plus, it is recomended to set linesize and pagesize before
Rem running this script. For example:
Rem set linesize 130
Rem set pagesize 0
Rem
Rem MODIFIED (MM/DD/YY)
Rem bdagevil 01/23/02 - rewrite with new dbms_xplan package
Rem bdagevil 04/05/01 - include CPU cost
Rem bdagevil 02/27/01 - increase Name column
Rem jihuang 06/14/00 - change order by to order siblings by.
Rem jihuang 05/10/00 - include plan info for recursive SQL in LE row source
Rem bdagevil 01/05/00 - make deterministic with order-by
Rem bdagevil 05/07/98 - Explain plan script for parallel plans
Rem bdagevil 05/07/98 - Created
Rem
set markup html preformat on
Rem
Rem Use the display table function from the dbms_xplan package to display the last
Rem explain plan. Use default mode which will display only relevant information
Rem
select * from table(dbms_xplan.display());
[./solutions/cbinp.sql]
REM Oracle10g SQL Tuning Workshop
REM script CBI.SQL (create bitmap index)
REM prompts for input; index name generated
REM =======================================
accept TABLE_NAME prompt " on which table : "
accept COLUMN_NAME prompt " on which column: "
set termout off
store set saved_settings replace
set heading off feedback off verify off
set autotrace off termout on
column dummy new_value index_name
SELECT 'creating index'
, SUBSTR( SUBSTR('&table_name',1,4)||'_' ||
TRANSLATE(REPLACE('&column_name', ' ', '')
, 1, 25
)||'_idx' dummy
FROM dual;
CREATE BITMAP INDEX &index_name ON &TABLE_NAME(&COLUMN_NAME)
NOLOGGING COMPUTE STATISTICS
@saved_settings
set termout on
undef INDEX_NAME
undef TABLE_NAME
undef COLUMN_NAME
[./solutions/dump.sql]
SElECT *
FROM v$parameter
WHERE name LIKE '%dump%';
[./solutions/utlxplan.sql]
rem
rem $Header: utlxplan.sql 29-oct-2001.20:28:58 mzait Exp $ xplainpl.sql
rem
Rem Copyright (c) 1988, 2001, Oracle Corporation. All rights reserved.
Rem NAME
REM UTLXPLAN.SQL
Rem FUNCTION
Rem NOTES
Rem MODIFIED
Rem mzait 10/26/01 - add keys and filter predicates to the plan table
Rem ddas 05/05/00 - increase length of options column
Rem ddas 04/17/00 - add CPU, I/O cost, temp_space columns
Rem mzait 02/19/98 - add distribution method column
Rem ddas 05/17/96 - change search_columns to number
Rem achaudhr 07/23/95 - PTI: Add columns partition_{start, stop, id}
Rem glumpkin 08/25/94 - new optimizer fields
Rem jcohen 11/05/93 - merge changes from branch 1.1.710.1 - 9/24
Rem jcohen 09/24/93 - #163783 add optimizer column
Rem glumpkin 10/25/92 - Renamed from XPLAINPL.SQL
Rem jcohen 05/22/92 - #79645 - set node width to 128 (M_XDBI in gendef)
Rem rlim 04/29/91 - change char to varchar2
Rem Peeler 10/19/88 - Creation
Rem
Rem This is the format for the table that is used by the EXPLAIN PLAN
Rem statement. The explain statement requires the presence of this
Rem table in order to store the descriptions of the row sources.
create table PLAN_TABLE (
statement_id varchar2(30),
timestamp date,
remarks varchar2(80),
operation varchar2(30),
options varchar2(255),
object_node varchar2(128),
object_owner varchar2(30),
object_name varchar2(30),
object_instance numeric,
object_type varchar2(30),
optimizer varchar2(255),
search_columns number,
id numeric,
parent_id numeric,
position numeric,
cost numeric,
cardinality numeric,
bytes numeric,
other_tag varchar2(255),
partition_start varchar2(255),
partition_stop varchar2(255),
partition_id numeric,
other long,
distribution varchar2(30),
cpu_cost numeric,
io_cost numeric,
temp_space numeric,
access_predicates varchar2(4000),
filter_predicates varchar2(4000));
[./solutions/indstats.sql]
accept table_name -
prompt 'on which table : '
SELECT index_name name, num_rows n_r,
last_analyzed l_a, distinct_keys d_k,
leaf_blocks l_b, avg_leaf_blocks_per_key a_l,join_index j_I
FROM user_indexes
WHERE table_name = upper('&table_name');
undef table_name
[./solutions/test.sql]
declare
x number;
begin
for i in 1..10000 loop
select count(*) into x from customers;
end loop;
end;
[./solutions/rp.sql]
set feedback off
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
set feedback on
[./solutions/sol_08_02b.sql]
ALTER SESSION SET SQL_TRACE = TRUE;
[./solutions/trace.sql]
ALTER SESSION SET SQL_TRACE = TRUE;
[./solutions/doit.sql]
DROP INDEX SALES_CH_BIX;
DROP INDEX SALES_CUST_BIX;
DROP INDEX SALES_PROD_BIX;
[./solutions/ci.sql]
REM SQL Tuning Workshop
REM script CI.SQL (create index)
REM prompts for input; index name generated
REM =======================================
accept TABLE_NAME prompt " on which table : "
accept COLUMN_NAME prompt " on which column(s): "
set termout off
store set saved_settings replace
set heading off feedback off autotrace off
set verify off termout on
column dummy new_value index_name
SELECT 'creating index'
, SUBSTR( SUBSTR('&table_name',1,4)||'_' ||
TRANSLATE(REPLACE('&column_name', ' ', '')
, 1, 25
)||'_idx' dummy
FROM dual;
CREATE INDEX &index_name
ON &table_name(&column_name)
NOLOGGING COMPUTE STATISTICS;
@saved_settings
set termout on
undef INDEX_NAME
undef TABLE_NAME
undef COLUMN_NAME
[./solutions/sol_06_04c.sql]
exec dbms_workload_repository.create_snapshot('ALL');
[./solutions/sol_06_04a.sql]
column sql_text format a25
SELECT SQL_ID, SQL_TEXT FROM V$SQL
WHERE SQL_TEXT LIKE '%REPORT%' ;
[./solutions/login.sql]
REM ======================================
REM COL[UMN] commands
REM ======================================
col dummy new_value index_name
col name format a32
col segment_name format a20
col table_name format a20
col column_name format a20
col index_name format a30
col index_type format a10
col constraint_name format a20
col num_distinct format 999999
col update_comment format a20 word
-- for the SHOW SGA/PARAMETER commands:
col name_col_plus_show_sga format a24
col name_col_plus_show_param format a40 -
heading name
col value_col_plus_show_param format a35 -
heading value
-- for the AUTOTRACE setting:
col id_plus_exp format 90 head i
col parent_id_plus_exp format 90 head p
col plan_plus_exp format a80
col other_plus_exp format a44
col other_tag_plus_exp format a29
col object_node_plus_exp format a8
REM ======================================
REM SET commands
REM ======================================
set describe depth 2
set echo off
set editfile D:\Tmp\buffer.sql
set feedback 40
set linesize 120
set long 999
set numwidth 8
set pagesize 36
set pause "[Enter]..." pause off
set tab off
set trimout on
set trimspool on
set verify off
set wrap on
REM ======================================
REM DEFINE commands
REM ======================================
def 1=employees
def table_name=employees
def column_name=first_name
def buckets=1
def sc=';'
REM ======================================
REM miscellaneous
REM ======================================
[./solutions/sqlid.sql]
SELECT SQL_ID, SQL_TEXT FROM V$SQL
WHERE SQL_TEXT LIKE '%/* my%' ;
[./solutions/hist1.sql]
SELECT * FROM products WHERE prod_status LIKE 'available, on stock'
[./solutions/sol_08_02.sql]
ALTER SESSION SET TRACEFILE_IDENTIFIER = 'User12';
[./solutions/utlxrw.sql]
Rem
Rem $Header: utlxrw.sql 29-apr-2005.08:22:09 mthiyaga Exp $
Rem
Rem utlxrw.sql
Rem
Rem Copyright (c) 2000, 2005, Oracle. All rights reserved.
Rem
Rem NAME
Rem utlxrw.sql - Create the output table for EXPLAIN_REWRITE
Rem
Rem DESCRIPTION
Rem Outputs of the EXPLAIN_REWRITE goes into the table created
Rem by utlxrw.sql (called REWRITE_TABLE). So utlxrw must be
Rem invoked before any EXPLAIN_REWRITE tests.
Rem
Rem NOTES
Rem If user specifies a different name in EXPLAIN_REWRITE, then
Rem it should have been already created before calling EXPLAIN_REWRITE.
Rem
Rem MODIFIED (MM/DD/YY)
Rem mthiyaga 04/29/05 - Remove unncessary comment
Rem mthiyaga 06/08/04 - Add rewritten_txt field
Rem mthiyaga 10/10/02 - Add extra columns
Rem mthiyaga 09/27/00 - Create EXPLAIN_REWRITE output table
Rem mthiyaga 09/27/00 - Created
Rem
Rem
CREATE TABLE REWRITE_TABLE(
statement_id VARCHAR2(30), -- id for the query
mv_owner VARCHAR2(30), -- owner of the MV
mv_name VARCHAR2(30), -- name of the MV
sequence INTEGER, -- sequence no of the error msg
query VARCHAR2(2000),-- user query
query_block_no INTEGER, -- block no of the current subquery
rewritten_txt VARCHAR2(2000),-- rewritten query
message VARCHAR2(512), -- EXPLAIN_REWRITE error msg
pass VARCHAR2(3), -- rewrite pass no
mv_in_msg VARCHAR2(30), -- MV in current message
measure_in_msg VARCHAR2(30), -- Measure in current message
join_back_tbl VARCHAR2(30), -- Join back table in current msg
join_back_col VARCHAR2(30), -- Join back column in current msg
original_cost INTEGER, -- Cost of original query
rewritten_cost INTEGER, -- Cost of rewritten query
flags INTEGER, -- associated flags
reserved1 INTEGER, -- currently not used
reserved2 VARCHAR2(10)) -- currently not used
[./solutions/nm.sql]
ALTER INDEX &indexname NOMONITORING USAGE;
[./solutions/attox.sql]
REM
REM script ATTOX.SQL
REM =====================================
set autotrace traceonly explain
[./solutions/create_tab.sql]
DROP TABLE test_sales;
DROP TABLE test_promotions;
DROP TABLE test_customers;
DROP TABLE test_countries;
CREATE table test_sales as select * from sales;
CREATE TABLE test_promotions AS SELECT * FROM promotions;
CREATE INDEX t_promo_id_idx ON TEST_PROMOTIONS(promo_id);
ALTER TABLE test_promotions MODIFY promo_id PRIMARY KEY USING INDEX t_promo_id_idx;
CREATE TABLE test_customers AS SELECT * FROM customers;
CREATE INDEX t_cust_id_idx ON TEST_CUSTOMERS(cust_id);
ALTER TABLE test_customers MODIFY cust_id PRIMARY KEY USING INDEX t_cust_id_idx;
CREATE TABLE test_countries AS SELECT * FROM countries;
CREATE INDEX t_country_id_idx ON TEST_COUNTRIES(country_id);
ALTER TABLE test_countries MODIFY country_id PRIMARY KEY USING INDEX t_country_id_idx;
UPDATE test_customers SET cust_credit_limit = 1000 WHERE ROWNUM <= 15000;
[./solutions/cui.sql]
REM SQL Tuning Workshop
REM script CUI.SQL (create unique index)
REM prompts for input; index name generated
REM =======================================
accept TABLE_NAME prompt " on which table : "
accept COLUMN_NAME prompt " on which column(s): "\
set termout off
store set saved_settings replace
set heading off feedback off verify off
set autotrace off termout on
SELECT 'creating unique index'
, SUBSTR('ui_&TABLE_NAME._' ||
TRANSLATE(REPLACE('&COLUMN_NAME', ' ', '')
, 1, 30) dummy
from dual
CREATE UNIQUE INDEX &INDEX_NAME ON &TABLE_NAME(&COLUMN_NAME)
@saved_settings
set termout on
undef INDEX_NAME
undef TABLE_NAME
undef COLUMN_NAME
[./solutions/advisor_cache_setup.sql]
set echo on
alter system flush shared_pool;
grant advisor to sh;
connect sh/sh;
SELECT c.cust_last_name, sum(s.amount_sold) AS dollars,
sum(s.quantity_sold) as quantity
FROM sales s , customers c, products p
WHERE c.cust_id = s.cust_id
AND s.prod_id = p.prod_id
AND c.cust_state_province IN ('Dublin','Galway')
GROUP BY c.cust_last_name;
SELECT c.cust_id, SUM(amount_sold) AS dollar_sales
FROM sales s, customers c WHERE s.cust_id= c.cust_id GROUP BY c.cust_id;
select sum(unit_cost) from costs group by prod_id;
[./solutions/utlxmv.sql]
Rem
Rem $Header: utlxmv.sql 16-feb-2001.13:03:32 nshodhan Exp $
Rem
Rem utlxmv.sql
Rem
Rem Copyright (c) Oracle Corporation 2000. All Rights Reserved.
Rem
Rem NAME
Rem utlxmv.sql - UTiLity for eXplain MV
Rem
Rem DESCRIPTION
Rem The utility script creates the MV_CAPABILITIES_TABLE that is
Rem used by the DBMS_MVIEW.EXPLAIN_MVIEW() API.
Rem
Rem NOTES
Rem
Rem MODIFIED (MM/DD/YY)
Rem nshodhan 02/16/01 - Bug#1647071: replace mv with mview
Rem raavudai 11/28/00 - Fix comment.
Rem twtong 12/01/00 - fix for sql*plus
Rem twtong 09/13/00 - modify mv_capabilities_tabe
Rem twtong 08/18/00 - change create table to upper case
Rem jraitto 06/12/00 - add RELATED_NUM and MSGNO columns
Rem jraitto 05/09/00 - Explain_MV table
Rem jraitto 05/09/00 - Created
Rem
CREATE TABLE MV_CAPABILITIES_TABLE
(STATEMENT_ID VARCHAR(30), -- Client-supplied unique statement identifier
MVOWNER VARCHAR(30), -- NULL for SELECT based EXPLAIN_MVIEW
MVNAME VARCHAR(30), -- NULL for SELECT based EXPLAIN_MVIEW
CAPABILITY_NAME VARCHAR(30), -- A descriptive name of the particular
-- capability:
-- REWRITE
-- Can do at least full text match
-- rewrite
-- REWRITE_PARTIAL_TEXT_MATCH
-- Can do at leat full and partial
-- text match rewrite
-- REWRITE_GENERAL
-- Can do all forms of rewrite
-- REFRESH
-- Can do at least complete refresh
-- REFRESH_FROM_LOG_AFTER_INSERT
-- Can do fast refresh from an mv log
-- or change capture table at least
-- when update operations are
-- restricted to INSERT
-- REFRESH_FROM_LOG_AFTER_ANY
-- can do fast refresh from an mv log
-- or change capture table after any
-- combination of updates
-- PCT
-- Can do Enhanced Update Tracking on
-- the table named in the RELATED_NAME
-- column. EUT is needed for fast
-- refresh after partitioned
-- maintenance operations on the table
-- named in the RELATED_NAME column
-- and to do non-stale tolerated
-- rewrite when the mv is partially
-- stale with respect to the table
-- named in the RELATED_NAME column.
-- EUT can also sometimes enable fast
-- refresh of updates to the table
-- named in the RELATED_NAME column
-- when fast refresh from an mv log
-- or change capture table is not
-- possilbe.
POSSIBLE CHARACTER(1), -- T = capability is possible
-- F = capability is not possible
RELATED_TEXT VARCHAR(2000),-- Owner.table.column, alias name, etc.
-- related to this message. The
-- specific meaning of this column
-- depends on the MSGNO column. See
-- the documentation for
-- DBMS_MVIEW.EXPLAIN_MVIEW() for details
RELATED_NUM NUMBER, -- When there is a numeric value
-- associated with a row, it goes here.
-- The specific meaning of this column
-- depends on the MSGNO column. See
-- the documentation for
-- DBMS_MVIEW.EXPLAIN_MVIEW() for details
MSGNO INTEGER, -- When available, QSM message #
-- explaining why not possible or more
-- details when enabled.
MSGTXT VARCHAR(2000),-- Text associated with MSGNO.
SEQ NUMBER);
-- Useful in ORDER BY clause when
-- selecting from this table.
[./solutions/di.sql]
DROP INDEX &index_name;
[./solutions/hist2.sql]
SELECT * FROM products WHERE prod_status = 'obsolete'
[./solutions/sol_06_04b.sql]
-- this script requires the sql_id that you got from the previous step
SELECT SQL_ID, SQL_TEXT FROM dba_hist_sqltext where sql_id ='yourr sql id here';
[./solutions/tabstats.sql]
accept table_name -
prompt 'on which table : '
SELECT last_analyzed analyzed, sample_size, monitoring,
table_name
FROM user_tables
WHERE table_name = upper('&table_name');
undef TABLE_NAME
[./solutions/rewrite.sql]
ALTER SESSION SET QUERY_REWRITE_ENABLED = true
[./solutions/atto.sql]
REM
REM script ATTO.SQL
REM =====================================
set autotrace traceonly
[./solutions/flush.sql]
--this script flushes the shared pool
alter system flush shared_pool
[./solutions/atoff.sql]
REM
REM script ATOFF.SQLREM =====================================
SET AUTOTRACE OFF
[./solutions/cbi.sql]
REM Oracle10g SQL Tuning Workshop
REM script CBI.SQL (create bitmap index)
REM prompts for input; index name generated
REM =======================================
accept TABLE_NAME prompt " on which table : "
accept COLUMN_NAME prompt " on which column: "
set termout off
store set saved_settings replace
set heading off feedback off verify off
set autotrace off termout on
column dummy new_value index_name
SELECT 'creating index'
, SUBSTR( SUBSTR('&table_name',1,4)||'_' ||
TRANSLATE(REPLACE('&column_name', ' ', '')
, 1, 25
)||'_idx' dummy
FROM dual;
CREATE bitmap index &INDEX_NAME on &TABLE_NAME(&COLUMN_NAME)
LOCAL NOLOGGING COMPUTE STATISTICS
@saved_settings
set termout on
undef INDEX_NAME
undef TABLE_NAME
undef COLUMN_NAME
[./solutions/buffer.sql]
SELECT c.cust_last_name, c.cust_year_of_birth
, co.country_name
FROM customers c
JOIN countries co
USING (country_id)
[./solutions/sol_08_04.sql]
ALTER SESSION SET SQL_TRACE = false;
[./solutions/sqlplus_settings.sql]
set appinfo OFF
set appinfo "SQL*Plus"
set arraysize 15
set autocommit OFF
set autoprint OFF
set autorecovery OFF
set autotrace TRACEONLY EXPLAIN STATISTICS
set blockterminator "."
set cmdsep OFF
set colsep " "
set compatibility NATIVE
set concat "."
set copycommit 0
set copytypecheck ON
set define "&"
set describe DEPTH 1 LINENUM OFF INDENT ON
set echo OFF
set editfile "afiedt.buf"
set embedded OFF
set escape OFF
set feedback 6
set flagger OFF
set flush ON
set heading ON
set headsep "|"
set linesize 80
set logsource ""
set long 80
set longchunksize 80
set markup HTML OFF HEAD "<style type='text/css'> body {font:10pt Arial,Helvetica,sans-serif; color:black; background:White;} p {font:10pt Arial,Helvetica,sans-serif; color:black; background:White;} table,tr,td {font:10pt Arial,Helvetica,sans-serif; color:Black; background:#f7f7e7; padding:0px 0px 0px 0px; margin:0px 0px 0px 0px;} th {font:bold 10pt Arial,Helvetica,sans-serif; color:#336699; background:#cccc99; padding:0px 0px 0px 0px;} h1 {font:16pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; border-bottom:1px solid #cccc99; margin-top:0pt; margin-bottom:0pt; padding:0px 0px 0px 0px;} h2 {font:bold 10pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; margin-top:4pt; margin-bottom:0pt;} a {font:9pt Arial,Helvetica,sans-serif; color:#663300; background:#ffffff; margin-top:0pt; margin-bottom:0pt; vertical-align:top;}</style><title>SQL*Plus Report</title>" BODY "" TABLE "border='1' width='90%' align='center' summary='Script output'" SPOOL OFF ENTMAP ON PRE OFF
set newpage 1
set null ""
set numformat ""
set numwidth 10
set pagesize 14
set pause OFF
set recsep WRAP
set recsepchar " "
set serveroutput OFF
set shiftinout invisible
set showmode OFF
set sqlblanklines OFF
set sqlcase MIXED
set sqlcontinue "> "
set sqlnumber ON
set sqlpluscompatibility 8.1.7
set sqlprefix "#"
set sqlprompt "SQL> "
set sqlterminator ";"
set suffix "sql"
set tab ON
set termout OFF
set time OFF
set timing OFF
set trimout ON
set trimspool OFF
set underline "-"
set verify ON
set wrap ON
[./solutions/sol_07_01.sql]
SELECT owner, job_name,enabled
FROM DBA_SCHEDULER_JOBS
WHERE JOB_NAME = 'GATHER_STATS_JOB';
[./solutions/colhist.sql]
SELECT column_name, num_distinct, num_buckets, histogram
FROM USER_TAB_COL_STATISTICS
WHERE histogram <> 'NONE';
[./solutions/rpawr.sql]
set feedback off
SELECT PLAN_TABLE_OUTPUT
FROM TABLE (DBMS_XPLAN.DISPLAY_AWR('&sqlid'));
set feedback on
[./solutions/im.sql]
ALTER INDEX &indexname MONITORING USAGE;
[./solutions/utlxpls.sql]
Rem
Rem $Header: utlxpls.sql 26-feb-2002.19:49:37 bdagevil Exp $
Rem
Rem utlxpls.sql
Rem
Rem Copyright (c) 1998, 2002, Oracle Corporation. All rights reserved.
Rem
Rem NAME
Rem utlxpls.sql - UTiLity eXPLain Serial plans
Rem
Rem DESCRIPTION
Rem script utility to display the explain plan of the last explain plan
Rem command. Do not display information related to Parallel Query
Rem
Rem NOTES
Rem Assume that the PLAN_TABLE table has been created. The script
Rem utlxplan.sql should be used to create that table
Rem
Rem With SQL*plus, it is recomended to set linesize and pagesize before
Rem running this script. For example:
Rem set linesize 100
Rem set pagesize 0
Rem
Rem MODIFIED (MM/DD/YY)
Rem bdagevil 02/26/02 - cast arguments
Rem bdagevil 01/23/02 - rewrite with new dbms_xplan package
Rem bdagevil 04/05/01 - include CPU cost
Rem bdagevil 02/27/01 - increase Name column
Rem jihuang 06/14/00 - change order by to order siblings by.
Rem jihuang 05/10/00 - include plan info for recursive SQL in LE row source
Rem bdagevil 01/05/00 - add order-by to make it deterministic
Rem kquinn 06/28/99 - 901272: Add missing semicolon
Rem bdagevil 05/07/98 - Explain plan script for serial plans
Rem bdagevil 05/07/98 - Created
Rem
set markup html preformat on
Rem
Rem Use the display table function from the dbms_xplan package to display the last
Rem explain plan. Force serial option for backward compatibility
Rem
select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'));
[./solutions/dai.sql]
REM script DAI.SQL (drop all indexes)
REM prompts for a table name; % is appended
REM does not touch indexes associated with constraints
REM ==================================================
accept table_name -
prompt 'on which table : '
set termout off
store set sqlplus_settings replace
save buffer.sql replace
set heading off verify off autotrace off feedback off
spool doit.sql
SELECT 'drop index '||i.index_name||';'
FROM user_indexes i
WHERE i.table_name LIKE UPPER('&table_name.%')
AND NOT EXISTS
(SELECT 'x'
FROM user_constraints c
WHERE c.index_name = i.index_name
AND c.table_name = i.table_name
AND c.status = 'ENABLED');
spool off
@doit
get buffer.sql nolist
@sqlplus_settings
set termout on
[./solutions/setupenv.sql]
connect system/oracle
GRANT DBA TO sh;
GRANT CREATE ANY OUTLINE TO sh;
GRANT ADVISOR TO sh;
GRANT CREATE ANY VIEW TO sh;
EXECUTE DBMS_What an insane topic. Where's your question?
I recommend you to start over with a smart question and only the relevant code lines.
Check this link: [How To Ask Questions The Smart Way|http://www.catb.org/~esr/faqs/smart-questions.html]. -
How to get rid of 'BITMAP CONVERSION' in Execution Plan.
Hi I am using oracle 10g.
I am getting the path of execution of the query something as below. I have posted some part of it not all.
I want to get rid of this 'BITMAP CONVERSION' Section of the path, is there any hint for the same in oracle?
| 56 | TABLE ACCESS BY INDEX ROWID | XMVL_ONLINE_VIEW_BASE | 7274 | 1662K| | 3320 (21)| 00:00:17 |
| 57 | BITMAP CONVERSION TO ROWIDS | | | | | | |
| 58 | BITMAP AND | | | | | | |
| 59 | BITMAP OR | | | | | | |
| 60 | BITMAP CONVERSION FROM ROWIDS| | | | | | |
| 61 | SORT ORDER BY | | | | | | |
| 62 | INDEX RANGE SCAN | IDX_XMVLONLINEVIEW_BCOMPANYPK | | | | 4 (50)| 00:00:01 |
| 63 | BITMAP CONVERSION FROM ROWIDS| | | | | | |
| 64 | SORT ORDER BY | | | | 3608K| | |
| 65 | INDEX RANGE SCAN | IDX_XMVLONLINEVIEW_BCOMPANYPK | | | | 4 (50)| 00:00:01 |
| 66 | BITMAP CONVERSION FROM ROWIDS | | | | | | |
| 67 | SORT ORDER BY | | | | 3288K| | |
| 68 | INDEX RANGE SCAN | IDX_XMVLVIEW_UPPERVENDORNAME | | | | 59 (45)| 00:00:01 |Mark,
Please check below link :
http://www.orafaq.com/node/1420
In the above link there is a query :
EXPLAIN PLAN FOR
SELECT *
FROM ef_actl_expns
WHERE lbcr_sk IN (
SELECT lbcr_sk
FROM ed_lbr_cst_role
WHERE lbr_actv_typ_cd = 'A'
If it is ALTER SESSION SET OPTIMIZER_MODE = 'FIRST_ROWS' then there is "BITMAP CONVERSION TO ROWIDS" in the execution plan, but if it is ALTER SESSION SET OPTIMIZER_MODE = 'FIRST_ROWS_1' then there is no "BITMAP CONVERSION" in the plan. So, can we suggest to OP to go for ALTER SESSION SET OPTIMIZER_MODE = 'FIRST_ROWS_1' ?
But yes, as you stated that what is 4 digit of Oracle version is also mising in the above link. I am just asking that is it good to go with ALTER SESSION SET OPTIMIZER_MODE = 'FIRST_ROWS_1' please ? Because generally in the execution plan "BITMAP CONVERSION" happens for star transformation so, I think below link may also be interest to OP :
http://docs.oracle.com/cd/B19306_01/server.102/b14223/schemas.htm
Regards
Girish Sharma -
Hi!
While trying to register a new provider (following the steps in Section 6.3 of the OAS Portal Developer's Guide 10gR2 (10.1.4) I got the following error:
WWC-43273: An error occurred during the call to the WSRP Provider: %1.
Cause: A problem occurred while getting the service description. This may be
because the provider sent unsupported extensions.
Action: Try turning off extensions on the producer side or contact the WSRP
provider administrator or portal administrator.
The application is running on an OAS 10gR2 (10.1.2.0.2) instance on the same box. So by "turning off extensions on the producer side" that means in the Enterprise Manager console of that (10.1.2.0.2) instance? When I enter the producer url according to the instructions (http://myserver/sampleportlets/portlets?WSDL I get the XML output as specified on page 6-18 of the developer's guide.
Any comments? Thx!I ran the PDA (Portal Diagnostics Agent) and it found no critical errors. It did say to set OPTIMIZER_MODE to CHOOSE in init.ora but that is no longer (not in 10g) a valid option; it should be ALL_ROWS.
I did find the following in the sampleportlets application log:
--- < start > ---
07/10/07 11:10:03 wsrp-samples: [id=4518914530624,1] ERROR: caught exception while handling request: oracle.webdb.wsrp.server.ContainerRuntimeException:
An internal error has occurred in method <init>
oracle.webdb.utils.PortalExceptionImpl: An internal error has occurred in method <init>
at oracle.webdb.wsrp.server.ContainerRuntimeException.<init>(Unknown Source)
at oracle.webdb.wsrp.server.ConsumerRegistration.<init>(Unknown Source)
at oracle.webdb.wsrp.server.Server.register(Unknown Source)
at oracle.webdb.wsrp.WSRP_v1_Registration_PortType_Tie.invoke_register(WSRP_v1_Registration_PortType_Tie.java:96)
at oracle.webdb.wsrp.WSRP_v1_Registration_PortType_Tie.processingHook(WSRP_v1_Registration_PortType_Tie.java:257)
at com.sun.xml.rpc.server.StreamingHandler.handle(StreamingHandler.java:230)
at com.sun.xml.rpc.server.http.ea.JAXRPCServletDelegate.doPost(JAXRPCServletDelegate.java:153)
at com.sun.xml.rpc.server.http.JAXRPCServlet.doPost(JAXRPCServlet.java:69)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.webdb.wsrp.server.ContextFilter.doFilter(Unknown Source)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
at oracle.webdb.wsrp.server.ContextFilter.doFilter(Unknown Source)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:659)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)
Caused by: oracle.webdb.wsrp.server.ContainerIOException: Error getting connection from datasource with JNDI path "jdbc/portletPrefs"
at oracle.webdb.wsrp.server.PersistentCacheLoader.getConnection(Unknown Source)
at oracle.webdb.wsrp.server.PersistentCacheLoader.create(Unknown Source)
at oracle.webdb.wsrp.server.PersistentCacheGroup.create(Unknown Source)
... 20 more
Caused by: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
The Connection descriptor used by the client was:
//alpha:1521/orcl2
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:137)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:292)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:327)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:433)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:150)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:31)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:571)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:101)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.DriverManagerXADataSource.getXAConnection(DriverManagerXADataSource.java:120)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTDataSource.getPooledConnection(OrionCMTDataSource.java:197)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.PooledConnectionUsage.getPooledConnection(PooledConnectionUsage.java:39)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionPooledDataSource.getTheConnection(OrionPooledDataSource.java:254)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionPooledDataSource.getOPDSConnection(OrionPooledDataSource.java:329)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTConnection.getConnection(OrionCMTConnection.java:206)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTConnection.<init>(OrionCMTConnection.java:126)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTConnectionFinalize.<init>(OrionCMTConnectionFinalize.java:42)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ClassOptimizerFactory.getOrionCMTConnection(ClassOptimizerFactory.java:80)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTDataSource.getConnection(OrionCMTDataSource.java:237)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTDataSource.getConnection(OrionCMTDataSource.java:217)
... 23 more
caused by: oracle.webdb.utils.PortalExceptionImpl: Error getting connection from datasource with JNDI path "jdbc/portletPrefs"
at oracle.webdb.wsrp.server.ContainerIOException.<init>(Unknown Source)
at oracle.webdb.wsrp.server.PersistentCacheLoader.getConnection(Unknown Source)
at oracle.webdb.wsrp.server.PersistentCacheLoader.create(Unknown Source)
at oracle.webdb.wsrp.server.PersistentCacheGroup.create(Unknown Source)
at oracle.webdb.wsrp.server.ConsumerRegistration.<init>(Unknown Source)
at oracle.webdb.wsrp.server.Server.register(Unknown Source)
at oracle.webdb.wsrp.WSRP_v1_Registration_PortType_Tie.invoke_register(WSRP_v1_Registration_PortType_Tie.java:96)
at oracle.webdb.wsrp.WSRP_v1_Registration_PortType_Tie.processingHook(WSRP_v1_Registration_PortType_Tie.java:257)
at com.sun.xml.rpc.server.StreamingHandler.handle(StreamingHandler.java:230)
at com.sun.xml.rpc.server.http.ea.JAXRPCServletDelegate.doPost(JAXRPCServletDelegate.java:153)
at com.sun.xml.rpc.server.http.JAXRPCServlet.doPost(JAXRPCServlet.java:69)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.webdb.wsrp.server.ContextFilter.doFilter(Unknown Source)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
at oracle.webdb.wsrp.server.ContextFilter.doFilter(Unknown Source)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:659)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
The Connection descriptor used by the client was:
//alpha:1521/orcl2
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:137)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:292)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:327)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:433)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:150)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:31)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:571)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:101)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.DriverManagerXADataSource.getXAConnection(DriverManagerXADataSource.java:120)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTDataSource.getPooledConnection(OrionCMTDataSource.java:197)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.PooledConnectionUsage.getPooledConnection(PooledConnectionUsage.java:39)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionPooledDataSource.getTheConnection(OrionPooledDataSource.java:254)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionPooledDataSource.getOPDSConnection(OrionPooledDataSource.java:329)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTConnection.getConnection(OrionCMTConnection.java:206)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTConnection.<init>(OrionCMTConnection.java:126)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTConnectionFinalize.<init>(OrionCMTConnectionFinalize.java:42)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ClassOptimizerFactory.getOrionCMTConnection(ClassOptimizerFactory.java:80)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTDataSource.getConnection(OrionCMTDataSource.java:237)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTDataSource.getConnection(OrionCMTDataSource.java:217)
... 23 more
caused by: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
The Connection descriptor used by the client was:
//alpha:1521/orcl2
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:137)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:292)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:327)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:433)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:150)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:31)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:571)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:101)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.DriverManagerXADataSource.getXAConnection(DriverManagerXADataSource.java:120)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTDataSource.getPooledConnection(OrionCMTDataSource.java:197)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.PooledConnectionUsage.getPooledConnection(PooledConnectionUsage.java:39)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionPooledDataSource.getTheConnection(OrionPooledDataSource.java:254)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionPooledDataSource.getOPDSConnection(OrionPooledDataSource.java:329)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTConnection.getConnection(OrionCMTConnection.java:206)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTConnection.<init>(OrionCMTConnection.java:126)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTConnectionFinalize.<init>(OrionCMTConnectionFinalize.java:42)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ClassOptimizerFactory.getOrionCMTConnection(ClassOptimizerFactory.java:80)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTDataSource.getConnection(OrionCMTDataSource.java:237)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].sql.OrionCMTDataSource.getConnection(OrionCMTDataSource.java:217)
at oracle.webdb.wsrp.server.PersistentCacheLoader.getConnection(Unknown Source)
at oracle.webdb.wsrp.server.PersistentCacheLoader.create(Unknown Source)
at oracle.webdb.wsrp.server.PersistentCacheGroup.create(Unknown Source)
at oracle.webdb.wsrp.server.ConsumerRegistration.<init>(Unknown Source)
at oracle.webdb.wsrp.server.Server.register(Unknown Source)
at oracle.webdb.wsrp.WSRP_v1_Registration_PortType_Tie.invoke_register(WSRP_v1_Registration_PortType_Tie.java:96)
at oracle.webdb.wsrp.WSRP_v1_Registration_PortType_Tie.processingHook(WSRP_v1_Registration_PortType_Tie.java:257)
at com.sun.xml.rpc.server.StreamingHandler.handle(StreamingHandler.java:230)
at com.sun.xml.rpc.server.http.ea.JAXRPCServletDelegate.doPost(JAXRPCServletDelegate.java:153)
at com.sun.xml.rpc.server.http.JAXRPCServlet.doPost(JAXRPCServlet.java:69)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.webdb.wsrp.server.ContextFilter.doFilter(Unknown Source)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
at oracle.webdb.wsrp.server.ContextFilter.doFilter(Unknown Source)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:659)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)
--- < end > ---
Goint to that server and running lsnrctl status I see instace orcl2, status "READY" is there. I also do not have any problems connecting to the orcl2 instance.
Perhaps portal settings are not pointing to the correct place? Where to look?
Thx! -
FUNCTION-BASED INDEX ( ORACLE 8I NEW FEATURE )
제품 : ORACLE SERVER
작성날짜 : 2004-08-16
FUNCTION-BASED INDEX ( ORACLE 8I NEW FEATURE )
==============================================
SCOPE
10g Standard Edition(10.1.0) 이상 부터 Function-based Index 기능이 지원된다.
Explanation
1. 개요
Function-based index는, 함수(function)이나 수식(expression)으로 계산
된 결과에 대해 인덱스를 생성하여 사용할 수 있는 기능을 제공한다.
질의 수행 시 해당 함수나 수식을 처리하여 결과를 가져 오는 것이 아니라,
인덱스 형태로 존재하는 미리 계산되어 있는 결과를 가지고 처리하므로
성능 향상을 기할 수 있다.
2. 제약사항
1) aggregate function 에 대한 function-based index 생성 불가.
(예 : sum(...) )
2) LOB, REF, nested table 컬럼에 대한 function-based index 생성 불가.
3. 주요 특징
1) cost-based optimizer에 의해 사용됨.
2) B*Tree / bitmap index로 생성 가능.
3) 산술식 (arithmetic expression), PLSQL function, SQL built-in
function 등에 적용 가능.
4) 함수나 수식으로 처리된 결과에 대한 range scan 가능
5) NLS SORT 지원
6) SELECT/DELETE를 할 때마다 함수나 수식의 결과를 계산하는 것이 아니라
INSERT/UPDATE 시 계산된 값을 인덱스에 저장.
7) 질의 속도 향상
8) object column이나 REF column에 대해서는 해당 object에 정의된
method에 대해 function-based index 생성 가능.
4. 생성 방법
CREATE [UNIQUE | BITMAP ] INDEX <index_name>
ON <tablename> (<index-expression-list>)
<index-expression-list> -> { <column_name> | <column_expression> }
예) CREATE INDEX EMP_NAME_INDEX ON EMP (UPPER(ENAME));
CREATE INDEX EMP_SAL_INDEX ON EMP( SAL + COMM, empno);
* Function-based index를 생성하기 위해서는 QUERY REWRITE 권한이
부여 되어 있어야만 한다.
예) GRANT QUERY REWRITE TO SCOTT;
5. Function-Based Index 사용을 위한 사전 작업
1) Function-based index는 cost based optimizer에서만 사용 가능하므로,
테이블에 대해 미리 analyze 해 주는 것이 바람직하다.
그리고 init 파일에서 OPTIMIZER_MODE 를 FIRST_ROWS 나 ALL_ROWS 등으
로 지정하거나 HINT 등을 사용하여 cost based optimizer가 사용되도록
한다.
2) init 파일에서 COMPATIBLE 파라미터 값을 8.1 이상으로 설정되어 있어야
한다.
( 예 : COMPATIBLE = 8.1.6 )
3) session/instance level 에서 QUERY_REWRITE_ENABLED 값이 TRUE 지정
되어 있어야 한다.
( 예 : ALTER SESSION SET QUERY_REWRITE_ENABLED = TRUE; )
6. 예제
1) init 파라미터에서 다음과 같이 지정
compatible = 8.1.6 (반드시 8.1이상이어야 한다)
query_rewrite_enabled = true
query_rewrite_integrity = trusted
2) SCOTT 유저에서 function_based_index 생성
create index idx_emp_lower_ename
on emp
( lower(ename) ) ;
3) EMP table analyze
analyze table emp compute statistics ;
4) PLAN_TABLE 생성
@ ?/rdbms/admin/utlxplan.sql
5) Cost based optimizer 선택
alter session set optimizer_mode = FIRST_ROWS ;
6) Query 실행
explain plan set statement_id='qry1' FOR
select empno, ename
from emp
where lower(ename) = 'ford' ;
7) PLAN 분석
SELECT LPAD(' ',2*level-2)||operation||' '||options||' '||object_name query_plan
FROM plan_table
WHERE statement_id='qry1'
CONNECT BY prior id = parent_id
START WITH id = 0 order by id ;
-> 결과
QUERY_PLAN
SELECT STATEMENT
TABLE ACCESS BY INDEX ROWID EMP
INDEX RANGE SCAN IDX_EMP_LOWER_ENAME
7. 결론
Function-based index는 적절하게 사용될 경우 성능상의 많은 이점을 가져
온다. Oracle8i Designing and Tuning for Performance에서도 가능한 한
Function-based index를 사용하는 것을 권장하고 있으며, LOWER(), UPPER()
등의 함수를 사용하여 불가피하게 FULL TABLE SCAN을 하는 경우에 대해서도
효과적으로 처리해 줄 수 있는 방안이라 할 수 있다.
Reference Documents
-------------------Partha:
From the Oracle8i Administrators Guide:
"Table owners should have EXECUTE privileges on the functions used in function-based indexes.
For the creation of a function-based index in your own schema, you must be
granted the CREATE INDEX and QUERY REWRITE system privileges. To create
the index in another schema or on another schemas tables, you must have the
CREATE ANY INDEX and GLOBAL QUERY REWRITE privileges."
Hope this helps.
Peter -
Resource consumption details not shown for each row source operation
Hi Friends,
I have generated a tracefile for a query as shown below.
set autotrace traceonly arraysize 100
ALTER SESSION SET optimizer_mode = ALL_ROWS ;
alter session set tracefile_identifier = 'trcwithtime_221010_03';
alter session set events '10046 trace name context forever, level 12';
spool on
spool C:\Sree\trcwtime.log
-- put your statement here
SELECT e.*,d.dname
FROM scott.emp e
,scott.dept d
WHERE e.deptno = d.deptno;
spool off;
exitBelow is the trace file
SELECT e.*,d.dname
FROM scott.emp e
,scott.dept d
WHERE e.deptno = d.deptno
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 2 0.00 0.00 4 7 0 14
total 4 0.00 0.00 4 7 0 14
Misses in library cache during parse: 0
Optimizer goal: ALL_ROWS
Parsing user id: 173
Rows Row Source Operation
14 HASH JOIN
4 TABLE ACCESS FULL DEPT
14 TABLE ACCESS FULL EMP
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 2 0.00 0.00
db file sequential read 4 0.00 0.00
SQL*Net message from client 2 0.41 0.77
********************************************************************************For each rowsource operation, resource consumption details (cr,pr,pw,time) are not shown in the TKPROF output.
How can i get these details as well?
DBVersion: 9.2.0.8
Regards,
Sreekanth MunagalaSreekanth Munagala wrote:
For each rowsource operation, resource consumption details (cr,pr,pw,time) are not shown in the TKPROF output.
How can i get these details as well?
DBVersion: 9.2.0.8You can get those details by setting values for following parameters (at session level, preferably) before generating the 10046 trace.
ALTER SESSION SET statistics_level = ALL ;
ALTER SESSION SET timed_statistics = TRUE ;
Maybe you are looking for
-
Field Text is a required field for G/L account 1000 24505000
hi, while posting MIRO i am facing the problem the following message i am getting Field Text is a required field for G/L account 1000 24505000 The value for field "Text" in the interface to Financial Accounting is an initial value but you are require
-
I want to make 2 partitions in usb flash drive. How can a usb can be partitioned using C or C++ or C# languages? And these partitions can be able to see either in a tool or in windows o.s
-
How to start a Listener in Windows XP
When I loggin into the DB from EM, I got the message SQLException IO : The Network Adapter could not establish the connection And when I enter the following from prompt lsnrctl startStarting tnslsnr: please wait... Failed to start service, error 3. T
-
Okay, I just need to figure out how to make dynamic variable names. In this case, I have a loop, and inside the loop I need to create a new array for every iteration of the loop. Something like <cfloop from="0" to="10" index="i"> <cfset LoopArray#i#
-
I know the I pad have a function that when you touch the top of the screen, the page will turn to the top automatically. But this function always make trouble. Especially when you are reading some long papers. I would like to turn it off. What can I