Optimizer mode in oracle 10g
what is the difference between setting optimizer mode in oracle 10g
optimizer_mode=choose
optimizer_mode=all_rows
user446367 wrote:
what i have to set for the below parameters . any idea ?
optimizer_index_caching
optimizer_index_cost_adjIn general you would leave them set at the default value in 10g (and probably, in most earlier versions, for most cases as well). Even if you were to change them, asking for specific values on an internet forum is rather asking for trouble, it's not dissimilar to asking "what should I set for the parameter processes?" A reasonable value will be application dependent.
The first parameter reduces the cost of some types of indexed access by assuming that only the specified percentage of index i/o actually results in a physical I/O and therefore only that percentage of the io cost is taken into account. By contrast all tablescan access and the other types of indexed access are assumed to be uncached and therefore need costing.
The second parameter just arbitrarily scales indexed access path costings.
You could argue, and some have, that you could calculate a cache hit ratio for index blocks in much the same way as you can calculate a cache hit ratio generally and then set the first parameter to this value. The standout problems with this approach are
1) It applies to all matching statements and objects not just your problem ones.
2) It doesn't necessarily even apply to your problem statements.
3) It doesn't have anything to do with query duration per se, just efficiency of one particular access path.
4) People tend to choose to round costs down and make the likelihood of two plans getting the same cost and being chosen on a tiebreaker basis higher.
The second parameter just asks you how much you like the idea of indexes generally. If you are going to change it pick a family members age or something - it'll make you smile every time you see it.
Niall Litchfield
http://www.orawin.info/
Similar Messages
-
Archive log mode in oracle 10g
Hi,
I would like to know the archive log mode in oracle 10g and I use this code in SQLPlus
select log_mode from v$database
But it displayed: "2" not : NOARCHIVELOG or ARCHIVELOG
It displayed a number, not a String.
How could I know this?
ThanksHi Paul
Because I am a newbie in DBA Oracle so I got many difficulties.
You are very kind to help me.
So I have some more questions:
1. when I executed this code, it always reported error:
$ tmp=`${ORACLE_HOME}/bin/sqlplus -s / as sysdba << EOF
set heading off feedback off;
exit
EOF`
tmp='ERROR:
ORA-01031: insufficient privileges
SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
where <logon> ::= <username>[<password>][@<connect_identifier>] | /
SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
where <logon> ::= <username>[<password>][@<connect_identifier>] | /
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus'
so when I updated like this:
tmp=`${ORACLE_HOME}/bin/sqlplus -s sys/syspass@db02 as sysdba <<EOF
set heading off feedback off;
exit
EOF`
It run correctly.
2. With Paul's guide:
Do not execute Oracle commands from root, execute them as oracle user. This works to me :
$ tmp=`${ORACLE_HOME}/bin/sqlplus -s / as sysdba << EOF
set heading off feedback off
alter database backup controlfile to '${CONTROLFILE_DIR}/<file name>';
alter database backup controlfile to trace;
exit
EOF`
Of course CONTROLFILE_DIR must be set to a directory with write permission for oracle user.
For ex: I have an Unix account: unix/unix
and a Sys Oracle account: oracle/oracle
I login with Unix acount (unix/unix) and call script file that contains above code.
tmp=`${ORACLE_HOME}/bin/sqlplus -s oracle/oracle@db02 as sysdba <<EOF
set heading off feedback off
alter database backup controlfile to '${CONTROLFILE_DIR}/backup_control.ctl';
alter database backup controlfile to trace;
exit
EOF`
Unix report as following: Linux error: 13: Permission denied.
CONTROLFILE_DIR directory is read,write,execute for account unix/unix.
Of course CONTROLFILE_DIR must be set to a directory with write permission for oracle user. You mean I have to create a Unix user is the same to Oracle user so that Oracle user can have permission to write.
Please guilde more detail.
Thanks for your attention.
Message was edited by:
user481034 -
Archive log mode in oracle 10g on windows environment
Hi All,
I have a production database (Oracle 10g 10.2.0.1.0) on windows 2003 server. yesterday i put the database into archivelog mode. when i query for spfile location it is shown in ORACLE_HOME\dbs location.
but when i created pfile using the spfile it is created at ORACLE_HOME\database location. and there is another spfile also. i set the log_archive_dest at a location other than flash_recovery_area in pfile, but it is showing the DB_RECOVER_AREA.
today i seen archives are creating in both locations.
can a database have two spfiles. and working on them ?
can i remove a spfile in /dbs location.
pls. give me suggestion to rectify this
thanks and regards.Salman Qureshi wrote:
Hi,
On windows platform, spfile and initfiles are by default created under ORACLE_HOME\database directory and this is also the default location, so, your spfile or initfile in this directory are actually in use.
i set the log_archive_dest at a location other than flash_recovery_area in pfile, but it is showing the DB_RECOVER_AREA. You need to unset the "db_recovery_file_dest" parameter first.
alter system set db_recovery_file_dest='';Now set your log_archive_dest as follows
alter system set log_archive_dest_1="location=your_location";Don't user older "log_archive_dest" parameter
SalmanYour assertion that "You need to unset the "db_recovery_file_dest" parameter first." is patently false.
DB_RECOVERY_FILE_DEST is used for more than just archivelogs. Setting LOG_ARCHIVE_DEST_n to a location other than USE_DB_RECOVERY_FILE_DEST even while DB_RECOVERY_FILE_DEST is set is perfectly acceptable. In fact it is required if you want to continue to use the FRA for things other than archivelogs. Things, like - oh, say - backups!
=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2011.02.15 07:42:18 =~=~=~=~=~=~=~=~=~=~=~=
login as: oracle
oracle@vmlnx01's password:
Last login: Tue Feb 15 07:01:51 2011 from 192.168.160.1
[oracle@vmlnx01 ~]$ sqlplus / as sysdbaFirst, note the date and time of logon, to compare to archivelog timestamps later ...
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Feb 15 07:42:27 2011
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsNext, note the values for the log_archive_dest_n parameters. Actually, the value for #10 is the default if no log_arch_dest_n parms are set, but I like to set it explicitly to avoid ambiguity.
SQL> show parameter log_archive_dest_
NAME TYPE VALUE
log_archive_dest_1 string
log_archive_dest_10 string LOCATION=USE_DB_RECOVERY_FILE_
DEST
log_archive_dest_2 string
log_archive_dest_3 string
log_archive_dest_4 string
log_archive_dest_5 string
log_archive_dest_6 string
log_archive_dest_7 string
log_archive_dest_8 string
log_archive_dest_9 string
NAME TYPE VALUE
log_archive_dest_state_1 string enable
log_archive_dest_state_10 string enable
log_archive_dest_state_2 string enable
log_archive_dest_state_3 string enable
log_archive_dest_state_4 string enable
log_archive_dest_state_5 string enable
log_archive_dest_state_6 string enable
log_archive_dest_state_7 string enable
log_archive_dest_state_8 string enable
log_archive_dest_state_9 string enableAnd note the setting for db_recovery_file_dest ...
SQL> show parameter db_recovery_file_dest
NAME TYPE VALUE
db_recovery_file_dest string /orafra
db_recovery_file_dest_size big integer 4GNow lets check what's in the recovery dest. Notice there is no directory timestamped today (15 Feb), so no archivelogs have been generated for today.
SQL> !ls -l /orafra/VLNXORA1/archivelog
total 28
drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_08
drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_09
drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_10
drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_11
drwxr-x--- 2 oracle oinstall 4096 Feb 12 06:00 2011_02_12
drwxr-x--- 2 oracle oinstall 4096 Feb 13 11:00 2011_02_13
drwxr-x--- 2 oracle oinstall 4096 Feb 14 22:00 2011_02_14So lets force a log switch and check the results
SQL> alter system switch logfile;
System altered.
SQL> !ls -l /orafra/VLNXORA1/archivelog
total 32
drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_08
drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_09
drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_10
drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_11
drwxr-x--- 2 oracle oinstall 4096 Feb 12 06:00 2011_02_12
drwxr-x--- 2 oracle oinstall 4096 Feb 13 11:00 2011_02_13
drwxr-x--- 2 oracle oinstall 4096 Feb 14 22:00 2011_02_14
drwxr-x--- 2 oracle oinstall 4096 Feb 15 07:43 2011_02_15
SQL> !ls -l /orafra/VLNXORA1/archivelog/2011_02_15
total 1892
-rw-r----- 1 oracle oinstall 1931776 Feb 15 07:43 o1_mf_1_82_6oo0qomc_.arcSo we see that, as expected, the archivelog was written to the FRA. Note the log sequence # of 82
Also, let's check my "alternate" location, as yet undefinded to the db ..
SQL> !ls -l /oraarch/vlnxora1
total 0No files there.
Now we will change the archivelog destination. Note that I am NOT touching the FRA definition
SQL> alter system set log_archive_dest_1='location=/oraarch/vlnxora1' scope=both;
System altered.
SQL> alter system set log_archive_dest_10 = '' SCOPE=both;
System altered.
SQL> show parameter log_archive_dest_
NAME TYPE VALUE
log_archive_dest_1 string location=/oraarch/vlnxora1
log_archive_dest_10 string
log_archive_dest_2 string
log_archive_dest_3 string
log_archive_dest_4 string
log_archive_dest_5 string
log_archive_dest_6 string
log_archive_dest_7 string
log_archive_dest_8 string
log_archive_dest_9 string
log_archive_dest_state_1 string enable
NAME TYPE VALUE
log_archive_dest_state_10 string enable
log_archive_dest_state_2 string enable
log_archive_dest_state_3 string enable
log_archive_dest_state_4 string enable
log_archive_dest_state_5 string enable
log_archive_dest_state_6 string enable
log_archive_dest_state_7 string enable
log_archive_dest_state_8 string enable
log_archive_dest_state_9 string enable
SQL> show parameter db_recovery_file_dest
NAME TYPE VALUE
db_recovery_file_dest string /orafra
db_recovery_file_dest_size big integer 4GSo, above we see that I do not have an archivelog destination set to the FRA, but the FRA is still set. I did not unset it, as you asserted was necessary. I still want my backups to go there.
Next we'll do another log switch and check the results.
SQL> alter system switch logfile;
System altered.First, we'll check the (now unused) FRA destination. Notice that there is still just the one archivelog, sequence 82.
SQL> !ls -l /orafra/VLNXORA1/archivelog/2011_02_15
total 1892
-rw-r----- 1 oracle oinstall 1931776 Feb 15 07:43 o1_mf_1_82_6oo0qomc_.arcNow check the new, non-fra destination. Notice that it now has an archivelog, sequence 83
SQL> !ls -l /oraarch/vlnxora1
total 96
-rw-r----- 1 oracle oinstall 92160 Feb 15 07:45 1_83_732127364.dbf
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@vmlnx01 ~]$ exit
logout -
How to change the ARCHIVELOG / NOARCHIVELOG mode in Oracle 10g
Hi
how How to change the ARCHIVELOG / NOARCHIVELOG mode in Oracle10g in SQLPLUS ?
Many thanks.Steps :
0 - change SPFILE
ALTER SYSTEM SET log_archive_dest = '/oracle9i/archive/tmpr' SCOPE =SPFILE;
ALTER SYSTEM SET log_archive_start = TRUE SCOPE =SPFILE;
ALTER SYSTEM SET log_archive_format = 'tmpr_%s.arc' SCOPE =SPFILE;
1 - shutdown immediate
2 - startup mount
3 - alter database archivelog;
4 - alter database open
Note : to verify if is ok type :
SQL> archive log list; -
Problem in Converting Database into Archivelog mode (Oracle 10G)
Hi Team,
I come across a strange problem in the ORACLE 10G Server.
I am converting database mode from NoArchivelog to Archivelog mode through RMAN in 10G.
Now When I execute these following commands through RMAN prompt it works properly as shown below?
C:\>rman
Recovery Manager: Release 10.2.0.1.0 - Production on Thu Nov 30 18:01:08 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
RMAN> connect target /
connected to target database: RAVI (DBID=4025722893, not open)
RMAN> shutdown immediate;
using target database control file instead of recovery catalog
database dismounted
Oracle instance shut down
RMAN> STARTUP MOUNT;
connected to target database (not started)
Oracle instance started
database mounted
Total System Global Area 167772160 bytes
Fixed Size 1247876 bytes
Variable Size 79693180 bytes
Database Buffers 79691776 bytes
Redo Buffers 7139328 bytes
RMAN> SQL 'ALTER DATABASE ARCHIVELOG';
sql statement: ALTER DATABASE ARCHIVELOG
RMAN> ALTER DATABASE OPEN;
database opened
RMAN>
But this same script when i writes in the backup.ora file & pass to Rman prompt it fails,
File backup.ora contains...
run
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
SQL 'ALTER DATABASE ARCHIVELOG';
ALTER DATABASE OPEN;
passed to RMAN as follows...
C:\OracleCode\BACKUP>"C:\oracle\product\10.2.0\db_1\bin\RMAN.EXE" target /"connect target SYSTEM/sreedhar@RAVI" log="C:\ORACLE~2\LOGS\backup_log.log" append cmdfile="C:\ORACLE~2\BACKUP\backup.ora"
RMAN> 2> 3> 4> 5> 6> 7> 8>
then it fails giving the following errors...
using target database control file instead of recovery catalog
database closed
database dismounted
Oracle instance shut down
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 11/30/2006 18:05:59
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Recovery Manager complete.
The same thing is working in the Oracle 9i but not in the Oracle 10G.
Can Anybody plz help me in this?
Regards,
S.Tiwari
.export ORACLE_SID=<SID>
rman target /cmdfile="C:\ORACLE~2\BACKUP\backup.ora"
it will connect to the default SID, there's no such thing as a default SID, what do you mean?
But what if there are more that one SID available & I
want to connect to SID other than the default SID.just specify the desired SID prior starting rman.
more over the same string is working with 9i but not
with 10G.maybe due to a bug?
to summarize, you have two options it you would like to start up the instance:
either you specify the SID prior starting rman and use os authentication
or
you register the instance statically and use oracle authentication.
regards,
-ap -
Installing Oracle 10g Forms and Reports in Cluster Mode
Dear All,
My OS version is RHEL 4
In our current setup we have oracle 10g database two node cluster and Application Server 10g to node cluster.
Currently our report server has been configured to run in standalone mode
I have been asked to configure oracle 10g forms and report server in cluster mode.
Please provide me with the documentation link to configure oracle 10g reports server in cluster mode.
Thanks and Regards
Monoj Dasmy main goal is load balancing only
Then what I've done in 2007 might be what you need. In that thread there is a link to Web Cache Administrator's Guide : there you'll find everything you need to configure the web cache as a load balancer, particularly chapter 8 Setup and Configuration.
Anyway, here briefly some configurations : we have two machines, say MachineA and MachineB. The DNS resolves MachineA to a virtual address, which is normally assigned to MachineA; if MachineA crashes, it gets assigned to MachineB.
Users URL looks like this : http://MachineA:<port>/forms/frmservlet?config=<some config>
MachineA's web cache distributes connection requests between MachineA and MachineB.
Of course we're now using 11g as well, but that's another thing. -
Oracle 10g Database Installation In Active-Passive Mode.
Good Afternoon !!!!
We are installing Oracle 10g in Active-Passive Mode on HP UX-11.3 , with ASM. Can someone help me with step wise installation procedure for the same.
Many Thank's
Rajeev.Check on the release notes for your platform
This is for x86-64 Linux.. read it all, then you'll find the "6 Documentation Corrections and Additions" section you'll find the RPMs that you need
http://download.oracle.com/docs/cd/B19306_01/relnotes.102/b15666/toc.htm
then go to the official doc installation of 10gR2 on x86-64 Linux
http://download.oracle.com/docs/cd/B19306_01/install.102/b15667/toc.htm
Yum is a package management tool. This is what you'll be using to install the RPMs. But first you'll have to setup the Yum repository, usually what I do is stage the DVD media on the server then make it as a repository. If ever there's a specific (higher) version that I need then I just pull it on the RedHat Network.
There are a lot of HOWTOs about Yum. You may read on this link http://docs.fedoraproject.org/yum/en/
- Karl Arao
http://karlarao.wordpress.com/ -
Oracle Optimizer Mode Choose / Rule
Hello,
we have a strange behavior with Oracle 9.2
We have a application doing
SELECT to_char(COLUMNNAME)
FROM
VIEW WHERE ROWNUM = 1
This statement needs 75 seconds executed on the server within the application.
call count cpu elapsed disk query current rows
Parse 68 0.01 0.02 1 108 0 0
Execute 136 0.14 0.14 0 0 0 0
Fetch 68 68.74 75.64 119587 181628 2 68
total 272 68.89 75.81 119588 181736 2 68
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 25
Rows Row Source Operation
1 COUNT STOPKEY
1 HASH JOIN
524213 TABLE ACCESS FULL TABLEA
6 INDEX FAST FULL SCAN INDEX (object id 7026)
Optimizer mode is CHOOSE and we have generated Statistics.
When we switch to RULE the SQL will perform within millseconds
call count cpu elapsed disk query current rows
Parse 68 0.01 0.00 0 2 0 0
Execute 68 0.00 0.00 0 0 0 0
Fetch 68 0.01 0.05 68 476 0 68
total 204 0.02 0.05 68 478 0 68
Misses in library cache during parse: 1
Optimizer goal: RULE
Parsing user id: 25
Rows Row Source Operation
1 COUNT STOPKEY
1 NESTED LOOPS
1 TABLE ACCESS FULL TABLEA
1 INDEX UNIQUE SCAN INDEX (object id 7026)
Even when executing this statement within SQLPLUS on the server it takes 1 second (even too long but not 70 seconds).
Has anybody a hint where to look ?? I´m really confused.
Kind Regards,
KlausOptimizer mode choose with statistics effectively means ALL_ROWS. So I suspect that this probably is the reason why Oracle uses full scans and hash joins. On the other hand rownum = 1 should give the optimizer info that you only need 1 row back. So probably try with either optimizer_mode = first_rows_1 or hint first_rows(1) and see what happens.
Gints Plivna
http://www.gplivna.eu -
How to install Oracle 10g Database (Silent Mode) on Ms. Windows
Hello,
I need to find out how to run a silent mode installation for Oracle 10g Database. I could perform such an installation for Oracle EX because I could found the installation guidelines.
I need some document to guide me from scratch, how to write response files, etc.
Thanks in advance!!Hi,
this would help;
http://tinyurl.com/ybzvg4v -
Sybase ASE integrator to Oracle 10g use Synchronous mode?
I want to use ODI to replicate Sybase ASE data into Oracle 10g, what I've done is using "JKM Sybase simple" and "LKM SQL to SQL" and "IKM Oracle Incremental Update", then create a interface, create a scenario, create a scheduling running in Scheduler Agent, every 5 seconds get the journalized data from Sybase and refresh to Oracle.
This is acceptable, but my question is: Can I set this scenario in synchronous mode, not pulling changed data every 5 seconds but instead of pushing changed data to Oracle just after DML committed in Sybase?No, not the current workbench. We will be bringing out support for Sybase 15 in SQL Developer at the next release.
You could try bringing the db down to 12 if that was an option and then migrate from that.
Barry -
How to enable/disable archive mode from the pfile in oracle 10g?
hi
I am using oracle 10g.
Is there any mechanism to / parameter to enable or disable archive log mode?
can I enable arching directly from pfile without touching the startup process??
pls help.
thnx in advance..Please is not in pfile that you enable/disable archive log mode.
For ENABLE Archivelog mode:
shutdown immediate
startup mount
alter database archivelog;
alter database open;
For DISABLE Archivelog mode:
shutdown immediate
startup mount
alter database noarchivelog;
alter database open; -
Note 830576 - Parameter recommendations for Oracle 10g
hi all DBA experts.
I am not good familiar with Oracle database while i read a Note 830576 - Parameter recommendations for Oracle 10g. in which SAP General Recommendation:
You should delete obsolete initialization parameters from the profile.
To determine which obsolete parameters are currently set, proceed as follows:
SQL> SELECT NAME FROM V$OBSOLETE_PARAMETER WHERE ISSPECIFIED = 'TRUE';
when i execute above command then result is no rows selected
while there are many parameters in above SAP Note which are already obsolete and not set in initSID.ora file.
for exp. the parameter OPTIMIZER_INDEX_COST_ADJ is showing
#### OPTIMIZER MODE
#optimizer_index_cost_adj = 10
as you know that this parameter is very important regarding System Performance.
now please guide me . I have to set these parameter or no need while there is not showing any parameters against obsolete command.
waiting you valuable reply.
Regards,hi both,
thanks for knowledge sharing with me other SDN users,
Dear Orkun,
Ok. At this stage, I can recommend you that apply what they have suggested,
in the message. So, you already did a part of it by configuring
Oracle parameters, already.
SAP support sent me this file (PRD_Parameters)
*** INFORMATION 1 ***
*** INFORMATION 2 ***
*** INFORMATION 3 ***
*** INFORMATION 4 ***
*** INFORMATION 5 ***
*** INFORMATION 6 ***
*** INFORMATION 7 ***
*** INFORMATION 8 ***
*** INFORMATION 9 ***
*** INFORMATION 10 ***
*** INFORMATION 11 ***
_b_tree_bitmap_plans
_fix_control (4728348)
event (10753)
event (38087)
event (10183)
optimizer_index_cost_adj
star_transformation_enabled
event (10027)
event (10028)
event (10411)
event (10629)
event (14532)
_fix_control (5705630)
_fix_control (5765456)
_optimizer_mjc_enabled
_sort_elimination_cost_ratio
event (10091)
event (10142)
event (38068)
event (38085)
event (44951)
parallel_execution_message_size
parallel_threads_per_cpu
query_rewrite_enabled
log_archive_dest_1
log_archive_format
max_dump_file_size
optimizer_features_enable
log_archive_dest
_push_join_union_view
_cursor_features_enabled
_first_spare_parameter
event (10049)
db_writer_processes
parallel_max_servers
db_cache_size
pga_aggregate_target
processes
sessions
dml_locks
job_queue_processes
log_checkpoint_interval
remote_login_passwordfile
sga_max_size
shared_pool_reserved_size
sort_area_retained_size
sort_area_size
statistics_level
workarea_size_policy
they only highlighted these following parameters from above
**** INFORMATION 8 *** DB Patchset: 10.2.0.4.0
**** INFORMATION 9 *** DB Mergefix: 0 (released before 2008-07-11)
FYI... recently, i applied the Oracle Patches 10.2.0.4 in this sequence
MS Windows x86-64 (64-bit)
Patchset_10204_MSWIN-x86-64aa.bin
Patchset_10204_MSWIN-x86-64ab.bin
Patchset_10204_MSWIN-x86-64ac.bin
OPatch
OPatch_10205_Generic_v0.zip
Generic (32-bit / 64-bit)
p8350262_10204_Generic.zip
p7592030_10204_WIN_GENERIC.zip
p9254968_10204_WIN_GENERIC.zip
10204_Patch44_MSWIN-x86-64.zip
p9584028_102040_Generic.zip
p9843740_10204_Generic.zip
and please tell me , still i have to apply highlighted parameters or now no need.
Regards, -
Query taking time in Oracle 10g
Hi,
Recently we had a database upgrade from 9.2.0.8 to 10.2.0.4. We use HP-UX B11.23 as OS.The problem is we have a query which used to take 3 mins in 9i database but it is not returning any output in 10g database after running for 8 hours after which we need to kill it . The query is ,
SELECT DPPB.CO_CD, DPPB.PRC_BOOK_CD,NVL(PB.CO_PRC_BOOK_CD,'NULL') ,
NVL(BP.BASE_PROD_CD,'NULL'),NVL(FG.FG_CD,'NULL'),DPPB.EFFTV_STRT_DT,
DPPB.EFFTV_END_DT,PRC_BOOK_AMT, PRC_LST_RPT_IND ,
SYSDATE + (RANK () OVER (PARTITION BY PROD_PRC_BOOK_CD ORDER BY DPPB.EFFTV_STRT_DT)/(24*60*60)) "RANK",
SYSDATE FROM
DIM_PROD_PRC_BOOK DPPB,dim_prod FG,dim_prod BP,dim_prc_book PB
WHERE
DPPB.BASE_PROD_OID =BP.BASE_PROD_OID and bp.end_date>sysdate and bp.be_id=bp.base_prod_oid AND
FG.FG_OID=DPPB.FG_OID and fg.end_date>sysdate and fg.be_id=fg.fg_oid
AND DPPB.PRC_BOOK_OID=PB.prc_book_oid and pb.end_date>sysdate and pb.be_id=pb.PRC_BOOK_OID
AND DPPB.EFFTV_END_DT > ADD_MONTHS(TRUNC(SYSDATE), -15)
AND DPPB.CURR_IND='Y'
AND
PROD_PRC_BOOK_CD ||'-'||TO_CHAR(DPPB.END_DATE ,'DD-MM-YYYY hh24:mi:ss')
IN(
SELECT PROD_PRC_BOOK_CD ||'-'||TO_CHAR(MAX(DPPB.END_DATE ),'DD-MM-YYYY hh24:mi:ss')
FROM DIM_PROD_PRC_BOOK DPPB WHERE PROD_PRC_BOOK_CD IS NOT NULL GROUP BY PROD_PRC_BOOK_CD ,EFFTV_STRT_DT
)The explain plan of the query in 9i is,
Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
SELECT STATEMENT Optimizer Mode=CHOOSE 1 2964
WINDOW SORT 1 661 2964
HASH JOIN 1 661 2958
TABLE ACCESS BY INDEX ROWID WHSUSR.DIM_PROD 1 73 1
NESTED LOOPS 1 355 290
NESTED LOOPS 1 282 289
HASH JOIN 164 32 K 284
TABLE ACCESS FULL WHSUSR.DIM_PRC_BOOK 1 57 2
TABLE ACCESS FULL WHSUSR.DIM_PROD_PRC_BOOK 6 K 957 K 281
TABLE ACCESS BY INDEX ROWID WHSUSR.DIM_PROD 1 77 1
INDEX RANGE SCAN WHSUSR.XN15_DIM_PROD 3 1
INDEX RANGE SCAN WHSUSR.XN22_DIM_PROD 5 1
VIEW SYS.VW_NSO_1 132 K 38 M 2665
SORT UNIQUE 132 K 6 M 2665
SORT GROUP BY 132 K 6 M 2665
TABLE ACCESS FULL WHSUSR.DIM_PROD_PRC_BOOK 132 K 6 M 281 And the explain plan of the query in 10g database is
Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
SELECT STATEMENT Optimizer Mode=ALL_ROWS 4 1702
WINDOW SORT 4 1 K 1702
FILTER
TABLE ACCESS BY INDEX ROWID WHSUSR.DIM_PROD 1 73 1
NESTED LOOPS 1 339 899
NESTED LOOPS 14 3 K 898
HASH JOIN 2 K 428 K 805
TABLE ACCESS FULL WHSUSR.DIM_PRC_BOOK 1 53 3
TABLE ACCESS FULL WHSUSR.DIM_PROD_PRC_BOOK 93 K 12 M 801
TABLE ACCESS BY INDEX ROWID WHSUSR.DIM_PROD 1 77 1
INDEX RANGE SCAN WHSUSR.XN15_DIM_PROD 2 1
INDEX RANGE SCAN WHSUSR.XN22_DIM_PROD 5 1
FILTER
HASH GROUP BY 1 K 59 K 802
TABLE ACCESS FULL WHSUSR.DIM_PROD_PRC_BOOK 117 K 5 M 794 Please help in identifying the problem and how to tune it.user605926 wrote:
Thanks Sir for your immense help. I used the hint /*+ optimizer_features_enable('9.2.0.8') */ and the query took only 2 seconds. I am really delighted.
Sorry for not clicking the 'helpful' button earlier since honestly I did not know about the rules. Going forward I will not forget to do that.Don't apologise, it wasn't intended as a personal criticism - it's just a footnote I tend to use at present as a general reminder to everyone that feedback is useful.
I have one question. Do i have to use this hint for each and every query that is becoming a headache or is their any permanent solution to fix all the queries that used to run good on 9.2.0.8 database ? Please suggest.When doing an upgrade it is always valid (in the short term) to set the optimizer_features_enable parameter to the value of the database your moving from so that you can get the code improvements (or bug fixes) of the newer software without risking execution plan changes.
After that the ideal is to test software and identify generic cases where a change like an index definition, or some statistical information needs to be corrected for a particular reason in classes of queries. Eventually you get down to the point where you have a few awkward queries which the optimizer can't handle where you need hints. The optimizer_features_enable is very convenient here. In 10g, however, you could then capture the older plan and record is as an SQL Baseline against the unhinted query rather than permanently including hints.
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http://www.jlcomp.demon.co.uk
A general reminder about "Forum Etiquette / Reward Points": http://forums.oracle.com/forums/ann.jspa?annID=718
If you never mark your questions as answered people will eventually decide that it's not worth trying to answer you because they will never know whether or not their answer has been of any use, or whether you even bothered to read it.
It is also important to mark answers that you thought helpful - again it lets other people know that you appreciate their help, but it also acts as a pointer for other people when they are researching the same question, moreover it means that when you mark a bad or wrong answer as helpful someone may be prompted to tell you (and the rest of the forum) what's so bad or wrong about the answer you found helpful. -
Performance Problem between Oracle 9i to Oracle 10g using Crystal XI
We have a Crystal XI Report using ODBC Drivers, 14 tables, and one sub report. If we execute the report on an Oracle 9i database the report will complete in about 12 seconds. If we execute the report on an Oracle 10g database the report will complete in about 35 seconds.
Our technical Setup:
Application server: Windows Server 2003, Running Crystal XI SP2 Runtime dlls with Oracle Client 10.01.00.02, .Net Framework 1.1, C# for Crystal Integration, Unmanaged C++ for app server environment calling into C# through a dynamically loaded mixed-mode C++ DLL.
Database server is Oracle 10g
What we have concluded:
Reducing the number of tables to 1 will reduce the execution time of the report from 180s to 13s. With 1 table and the sub report we would get 30 seconds
We have done some database tracing and see that Crystal Reports Issues the following query when verifying the database and it takes longer in 10g vs 9i.
We have done some profiling in the application code. When we retarget the first table to the target database, it takes 20-30 times longer in 10g than in 9i. Retargeting the other tables takes about twice as long. The export to a PDF file takes about 4-5 times as long in 10g as in 9i.
Oracle 10g no longer supports the /*+ RULE */ hint.
Verify DB Query:
select /*+ RULE */ *
from
(select /*+ RULE */ null table_qualifier, o1.owner table_owner,
o1.object_name table_name, decode(o1.owner,'SYS', decode(o1.object_type,
'TABLE','SYSTEM TABLE','VIEW', 'SYSTEM VIEW', o1.object_type), 'SYSTEM',
decode(o1.object_type,'TABLE','SYSTEM TABLE','VIEW', 'SYSTEM VIEW',
o1.object_type), o1.object_type) table_type, null remarks from all_objects
o1 where o1.object_type in ('TABLE', 'VIEW') union select /*+ RULE */ null
table_qualifier, s.owner table_owner, s.synonym_name table_name, 'SYNONYM'
table_type, null remarks from all_objects o3, all_synonyms s where
o3.object_type in ('TABLE','VIEW') and s.table_owner= o3.owner and
s.table_name = o3.object_name union select /*+ RULE */ null table_qualifier,
s1.owner table_owner, s1.synonym_name table_name, 'SYNONYM' table_type,
null remarks from all_synonyms s1 where s1.db_link is not null ) tables
WHERE 1=1 AND TABLE_NAME='QCTRL_VESSEL' AND table_owner='QLM' ORDER BY 4,2,
3
SQL From Main Report:
SELECT "QCODE_PRODUCT"."PROD_DESCR", "QCTRL_CONTACT"."CONTACT_FIRST_NM", "QCTRL_CONTACT"."CONTACT_LAST_NM", "QCTRL_MEAS_PT"."MP_NM", "QCTRL_ORG"."ORG_NM", "QCTRL_TKT"."SYS_TKT_NO", "QCTRL_TRK_BOL"."START_DT", "QCTRL_TRK_BOL"."END_DT", "QCTRL_TRK_BOL"."DESTINATION", "QCTRL_TRK_BOL"."LOAD_TEMP", "QCTRL_TRK_BOL"."LOAD_PCT", "QCTRL_TRK_BOL"."WEIGHT_OUT", "QCTRL_TRK_BOL"."WEIGHT_IN", "QCTRL_TRK_BOL"."WEIGHT_OUT_UOM_CD", "QCTRL_TRK_BOL"."WEIGHT_IN_UOM_CD", "QCTRL_TRK_BOL"."VAPOR_PRES", "QCTRL_TRK_BOL"."SPECIFIC_GRAV", "QCTRL_TRK_BOL"."PMO_NO", "QCTRL_TRK_BOL"."ODORIZED_VOL", "QARCH_SEC_USER"."SEC_USER_NM", "QCTRL_TKT"."DEM_CTR_NO", "QCTRL_BA_ENTITY"."BA_NM1", "QCTRL_BA_ENTITY_VW"."BA_NM1", "QCTRL_BA_ENTITY"."BA_ID", "QCTRL_TRK_BOL"."VOLUME", "QCTRL_TRK_BOL"."UOM_CD", "QXREF_BOL_PROD"."MOVEMENT_TYPE_CD", "QXREF_BOL_PROD"."BOL_DESCR", "QCTRL_TKT"."VOL", "QCTRL_TKT"."UOM_CD", "QCTRL_PMO"."LINE_UP_BEFORE", "QCTRL_PMO"."LINE_UP_AFTER", "QCODE_UOM"."UOM_DESCR", "QCTRL_ORG_VW"."ORG_NM"
FROM (((((((((((("QLM"."QCTRL_TRK_BOL" "QCTRL_TRK_BOL" INNER JOIN "QLM"."QCTRL_PMO" "QCTRL_PMO" ON "QCTRL_TRK_BOL"."PMO_NO"="QCTRL_PMO"."PMO_NO") INNER JOIN "QLM"."QCTRL_MEAS_PT" "QCTRL_MEAS_PT" ON "QCTRL_TRK_BOL"."SUP_MP_ID"="QCTRL_MEAS_PT"."MP_ID") INNER JOIN "QLM"."QCTRL_TKT" "QCTRL_TKT" ON "QCTRL_TRK_BOL"."PMO_NO"="QCTRL_TKT"."PMO_NO") INNER JOIN "QLM"."QCTRL_CONTACT" "QCTRL_CONTACT" ON "QCTRL_TRK_BOL"."DRIVER_CONTACT_ID"="QCTRL_CONTACT"."CONTACT_ID") INNER JOIN "QFC_QLM"."QARCH_SEC_USER" "QARCH_SEC_USER" ON "QCTRL_TRK_BOL"."USER_ID"="QARCH_SEC_USER"."SEC_USER_ID") LEFT OUTER JOIN "QLM"."QCODE_UOM" "QCODE_UOM" ON "QCTRL_TRK_BOL"."ODORIZED_VOL_UOM_CD"="QCODE_UOM"."UOM_CD") INNER JOIN "QLM"."QCTRL_ORG_VW" "QCTRL_ORG_VW" ON "QCTRL_MEAS_PT"."ORG_ID"="QCTRL_ORG_VW"."ORG_ID") INNER JOIN "QLM"."QCTRL_BA_ENTITY" "QCTRL_BA_ENTITY" ON "QCTRL_TKT"."DEM_BA_ID"="QCTRL_BA_ENTITY"."BA_ID") INNER JOIN "QLM"."QCTRL_CTR_HDR" "QCTRL_CTR_HDR" ON "QCTRL_PMO"."DEM_CTR_NO"="QCTRL_CTR_HDR"."CTR_NO") INNER JOIN "QLM"."QCODE_PRODUCT" "QCODE_PRODUCT" ON "QCTRL_PMO"."PROD_CD"="QCODE_PRODUCT"."PROD_CD") INNER JOIN "QLM"."QCTRL_BA_ENTITY_VW" "QCTRL_BA_ENTITY_VW" ON "QCTRL_PMO"."VESSEL_BA_ID"="QCTRL_BA_ENTITY_VW"."BA_ID") LEFT OUTER JOIN "QLM"."QXREF_BOL_PROD" "QXREF_BOL_PROD" ON "QCTRL_PMO"."PROD_CD"="QXREF_BOL_PROD"."PURITY_PROD_CD") INNER JOIN "QLM"."QCTRL_ORG" "QCTRL_ORG" ON "QCTRL_CTR_HDR"."BUSINESS_UNIT_ORG_ID"="QCTRL_ORG"."ORG_ID"
WHERE "QCTRL_TRK_BOL"."PMO_NO"=12345 AND "QXREF_BOL_PROD"."MOVEMENT_TYPE_CD"='TRK'
SQL From Sub Report:
SELECT "QXREF_BOL_VESSEL"."PMO_NO", "QXREF_BOL_VESSEL"."VESSEL_NO"
FROM "QLM"."QXREF_BOL_VESSEL" "QXREF_BOL_VESSEL"
WHERE "QXREF_BOL_VESSEL"."PMO_NO"=12345
Does anyone have any suggestions on how we can improve the report performance with 10g?Hi Eric,
Thanks for your response. The optimizer mode in our 9i database is CHOOSE. We changed the optimizer mode from ALL_ROWS to CHOOSE in 10g but it didn't make a difference.
While researching Metalink I came across a couple of documents that indicated performance problems and issues with using certain data-dictionary views in 10g. Apparently, the definition of ALL_OBJECTS, ALL_ARGUMENTS and ALL_SYNONYMS have changed in 10g, resulting in degradation in performance, if quieried against these views. These are the same queries that crystal reports is queriying. We'll try the workaround suggested in these documents and see if it resolves the issue.
Here are the Doc Ids, if you are interested:
Note 377037.1
Note:364822.1
Thanks again for your response.
Venu Boddu. -
Hi,
How to change the optimizer mode from ALL_ROWS
ThanksWhether we do not know the OP's Oracle version, we can assume it is not 8i or 9i. Do you realize the link you provided is very old. Still speaking about RULE optimizer, "analyze table" command (both becoming obsolete then depracted) without telling anything about more modern database such as 10g+. Moreover there're some rule of thumbs which can mislead query tuning.
Much better to refer to the Oracle document that Pierre linked to in first place.
And why not ask to the OP, why he/she wants to modify the optimizer from ALL_ROWS to what value with what expected results, based on what analyzes...
Nicolas.
Maybe you are looking for
-
HT1657 How do I view my rented movie on itunes
How do I view my rented movie on itunes
-
Where is the source code of custom UI page written
hi experts, I am currently working on CRM 6.0 we have the standard UI page in SAP ,on which we have added our enhancements.Now I need to know where is the html code for the standard page is written,since I need to add a meta tag in that code.I know
-
Anyone know where I can get an animated fireplace screen saver for my G4?
I'm not sure this is the proper forum, but figured I could start here. I have been all over the internet looking and all I could find were these stupid cartoon-type drawings. I would love something that looks like a decent realistic fireplace with fl
-
Urgent : application exit when the user tryt to open the screen
Hi experts, I made small changes in the FMB ,compiled the form and copied in the local bin folder.It works as normally. Now when I copied the same fmx in the bin placed in a server and the user try to open the frontend , it exits the application. wha
-
My skype has been deleted.
Hi, I have 2 skypes (free) which I use for gaming with friends. one of them has been deleted because when I attempt to log in, it just shows me the following: Sorry, we didnt'recognize your sign-in details. Please check your Skype Name and password,