Tuning Oracle10g
Hi All,
I am learning Oracle Memory Tuning and gone through some Performance Tuning Articles. My questions are:
- Since Oracle10g has Automatic Memory Management, once we specified Max SGA and MAX PGA what we need to tune in memory?
- Where can I get tuning examples with case scenarios?
Thanks & Regards,
Danish
Hi Danish,
Since Oracle10g has Automatic Memory Management, once we specified Max SGA and MAX PGA what we need to tune in memory?My company supports hundreds of databases, and I've noticed that while this "autoimated" memory management is OK for small databases, it may not be right for shops with a large or busy system. This is because AMM is "reactive", and waits until it detects a problem before addressing it. I have an alert here about it, how AMM resise operations can cause performance issues, in some cases:
http://www.dba-oracle.com/t_amm_automatic_memory_resize.htm
Oracle has an insatiable appetite for RAM, but there are diminishing marginal returns as you approach full caching.
Your goal is to give him enough RAM to hit the "sweet spot" of optimal pool sizes.
Oracle has pool advisory utilities that can assist you in this, check them out . . . .
Also, I wrote this note especially for people like you, who use AMM and want to tune RAM:
http://www.oracle-training.cc/t_amm_oracle_instance_tuning.htm
Since you are on 10g, I've collected numerous "gotchas" in 10g that you may find useful:
http://www.dba-oracle.com/t_slow_performance_after_upgrade.htm
Where can I get tuning examples with case scenarios?There are literally thousands of examples on the web. I would search like this, for Oracle RAM (or SGA) tuning examples:
http://www.google.com/search?&q=oracle+ram%7Csga+tuning+example
In sum, the best way to learn how to optimize RAM is to dive-in and get your feet wet!
Hope this helps . . .
Donald K. Burleson
Oracle Press author
Author of "Oracle Tuning: The Definitive Reference"
http://www.rampant-books.com/book_2005_1_awr_proactive_tuning.htm
Similar Messages
-
Tuning Workshop for Oracle10g v.2
Hi ,
Is there any downloadable tuning Workshop for Oracle10g v.2 or material which can help me to develop one...?????
Many thanks,
SimonI ' m going to teach Oracle Tuning in Oracle db 10g and one of the contents of this subject is to develop a tuning workshop....to work with at the end of it - such as practise...
Is there any material about this....????
Many thanks,
Simon -
Oracle10g cpu_count tuning
Hello Gurus
We have used the 10.2.0.4 Database
OS : Red-hat Enterprise Linux Server-64bit
CPU : 16 CPU processors
RAM:16 GB RAM Size
In our case we used the same box for oracle and application so how to tune the cpu_count properly?
How to troubleshoot and diagnose that cpu_count require to be tuned?
We had read the oracle database performance tuning guide but we didn't find any thing about the CPU_COUNT tuning
Regards
HitgonHi,
Thanks again,
AWR
Load Profile
Per Second Per Transaction
Redo size: 2,853.63 1,493.77
Logical reads: 92.79 48.57
Block changes: 16.56 8.67
Physical reads: 0.02 0.01
Physical writes: 1.61 0.84
User calls: 37.05 19.39
Parses: 8.20 4.29
Hard parses: 0.00 0.00
Sorts: 1.25 0.66
Logons: 0.02 0.01
Executes: 11.81 6.18
Transactions: 1.91
Top 5 Timed Events
Event Waits Time(s) Avg Wait(ms) % Total Call Time Wait Class
log file sync 105,303 1,088 10 85.3 Commit
log file parallel write 102,292 942 9 73.8 System I/O
CPU time 671 52.6
control file parallel write 19,170 427 22 33.5 System I/O
SQL*Net more data to client 373,439 3 0 .3 Network
ADDM
FINDING 1: 85% impact (1088 seconds)
Waits on event "log file sync" while performing COMMIT and ROLLBACK operations
were consuming significant database time.
RECOMMENDATION 1: Application Analysis, 85% benefit (1088 seconds)
ACTION: Investigate application logic for possible reduction in the
number of COMMIT operations by increasing the size of transactions.
RATIONALE: The application was performing 114 transactions per minute
with an average redo size of 1493 bytes per transaction.
RECOMMENDATION 2: Host Configuration, 85% benefit (1088 seconds)
ACTION: Investigate the possibility of improving the performance of I/O
to the online redo log files.
RATIONALE: The average size of writes to the online redo log files was 1
K and the average time per write was 9 milliseconds.
SYMPTOMS THAT LED TO THE FINDING:
SYMPTOM: Wait class "Commit" was consuming significant database time.
(85% impact [1088 seconds])
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Regards
Hitgon -
Hi Friends,
I'm evaluating the Oracle Diagnostic pack and tuning pack to compliment the already available standard SAP tool for tuning like st04/st03n,etc
Few questions
1. Anyone see the worth of the above 2 pack ?
2.sto4 can show you only so much why certain read/write in DB is slow, will this be the better tool in market for diagnostics
3. Anyone sees negative impact/ horror stories due to this?
4. Oracle has improvised OEM in 11g and 10g significantly, any inputs on this and usage on RAC
5. Any other great inputs are welcomed as well
Thanks & Best Regards,
NarenHi Naren,
From an Oracle DBA perspective, which is where am coming from, these tools are very helpful but because you are on SAP where you are really bound by SAP metrics, these are not going to be helpful to you because SAP recommendation supercedes Oracle's recommednation.
Note also that these packs require a separate license. If you are not licensed to use it, you should not be using them. From Oracle10g onward, Oracle had a record everytime that you use the diagnostic pack. You should have gotten this warning the first time that you try and use the diagnostic pack.
IMHO, most tuning are supposed to be coming from an application end and this is what most of the OEM reports will show you, the most expensive SQLs, you need to put index here and there, log switching, memory not enough etc. Most of these are already discussed in SAP notes. Additional indexes if ever one is identified, you will still have to get SAP Support to approve that, so what's the point? -
Is Zero is the Automatic Value for fast_start_mttr_target in ORacle10g
Dear Friends ,
I am working in Oracle 10g . In Oracle 9i the default value of fast_start_mttr_target is 600 . Now my question is :
In Oracle10g , is the '0' value is automatic recovery activities for fast_start_mttr_target (i.e., fast_start_mttr_target=0, here MTTR performs auto) ?
Is it correct ?
And also using the query , How can I measure the MTTR value :
Estimate the value for FAST_START_MTTR_TARGET as follows:
SELECT TARGET_MTTR,
ESTIMATED_MTTR,
CKPT_BLOCK_WRITES
FROM V$INSTANCE_RECOVERY;
TARGET_MTTR ESTIMATED_MTTR CKPT_BLOCK_WRITES
103 12 169
How can I measure MTTR terget using this value ? plz help .. ..."Unset" means 'not set, non-existent'.
If you're using a text init.ora, you simply delete the line on which that parameter is set.
If you're using a binary spfile, you issue the command
alter system reset fast_start_mttr_target scope=spfile sid='*';
Either way, you end up with the parameter physically not being specified in your configuration file. As opposed to it being set to a zero value, in which case it is physically present in the configuration file, set to a value which will switch off auto-tuning of checkpoints.
You want it "not existing", not "existing but set to a value of zero".
I'm afraid I don't know of any other way to explain the difference between non-existence and existence at value zero to you.
One slight twist is that if the parameter does not exist in the spfile at all, a "show parameter fast_start_mttr_target" in SQL*Plus will show its value to be set to zero. For example:
show parameter fast_start
NAME TYPE VALUE
fast_start_io_target integer 0
fast_start_mttr_target integer 0
fast_start_parallel_rollback string LOWShowing a zero value because it is explicitly set to zero.
alter system reset fast_start_mttr_target scope=spfile sid='*';
System altered.
show parameter fast_start
NAME TYPE VALUE
fast_start_io_target integer 0
fast_start_mttr_target integer 0
fast_start_parallel_rollback string LOWShowing a zero value because it doesn't exist in the spfile at all (which is what the 'reset' command did for me.
The only way I know to tell the difference between 'showing zero because it exists and it's been set to zero' and 'showing zero because it doesn't exist at all and zero happens to be the default value' is to try and delete the thing as shown above (with the alter system reset) command: if the parameter doesn't exist at all, and is showing a value of zero because that's merely the default value, then you'll get this error message displayed:
alter system reset fast_start_mttr_target scope=spfile sid='*'
ERROR at line 1:
ORA-32010: cannot find entry to delete in SPFILE -
Application Express performance - tuning required?
We have recently implemented a new Application Express system running under Oracle10g on a Linux/RedHat 4 server (actually a Dell PowerEdge 2850 with 8gb RAM and twin 3gb CPU's). The application mostly flies but on odd days (increasingly) performance degrade to the point where a single refresh takes longer than 5 seconds. We only have about 10 users on the system and the database is shared between about 25 users. We have had the network checked and have ruled that out as it only peaks at about 1.6mbps over a 54mbps line. I have updated stats on the database too. Looking in Enterprise Manager the HTTP_Server is hardly doing anything, the database appears to be using hardly any CPU but the memry allocation line on EM seems to be running along at 8gb all the time. The server is bounced every weekend.
The SQL is nearly all embedded in PL/SQL packages called from App. Ex. We have tried some of the parameter changes mentioned elsewhere in the forum, particularly changing the "keepAlive" parameter = off, from which we saw an immediate performance hike, but which then tailed away.
Can anyone suggest where the problem might be and where I can start looking and tuning to improve the performance of our application. We want to roll it out much more widely but are worried it wont scale to many more users and performance will stop completely.
Its all mighty puzzling so any help would be most welcome.Hi Jeremy,
if you have again such a situation where everything is slow, run your page in debug mode to get some statistics what's taking long. If it is really the rendering of the page or if it is something else (eg network problems).
Just rethought the above what I have written. You can immediately find out if the rendering sometimes really takes longer. Have a look at the dictionary view APEX_WORKSPACE_ACTIVITY_LOG and the column ELAPSED_TIME. It will tell you how long it took to render the page. See if you really have peaks sometimes.
If you don't have a peak there, you probably have more of an network or Apache problem.
Patrick
My APEX Blog: http://inside-apex.blogspot.com
The ApexLib Framework: http://apexlib.sourceforge.net
The APEX Builder Plugin: http://sourceforge.net/projects/apexplugin/ -
Error while running a J2EE application on Oracle10gAS
Hi,
I am receiving an error when trying to run a J2EE application on Oracle10gAS. The application runs successfully on Oracle9iAS, but throws the following exception on 10g application server:
<?xml version="1.0" encoding="UTF-8" ?>
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <SOAP-ENV:Body>
- <SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server.Exception:</faultcode>
<faultstring>com.evermind.server.rmi.OrionRemoteException: Error in createInstance(): null; nested exception is: java.lang.NoClassDefFoundError</faultstring>
<faultactor>/STAR-TicketBroker-context-root/TicketBrokerWS</faultactor>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Does anyone have any idea why I would be receiving this
error? We are using Session EJBs in our J2EE application. Are there any changes needed in the code in order to migrate a J2EE application from 9i to 10g ???
Please help.
Thanks,
-PrashantHi Somil,
I've just had this same error message, and it was because I had a bogus character in my JSP sources. I'd cut-and-pasted the text from a Word document, and it included the "registered trademark" sign (an R in a circle) as a single character. This worked in my test environment, but not in my production environment (where presumably the default encoding is different). I replaced the character with the equivalent HTML entity &reg; (ie. the five characters & r e g ; ) and it all worked.
Have a look through the offending JSPs and see whether you have any characters that might be incompatible with your default encoding (anything that isn't plain old 7-bit ASCII is potentially a problem). Change them to HTML entities and you should be fine.
Hope this helps,
Richie -
hello all
my one of query is returning result in 1-2 mins only for 1 lakh record but i am not sure if it showed me complete rows or not because when I an trying to get count of result ..its taking lot of time .when I am using this query on plsql code ..code is running slow so just wanted to confirm on query tuning point of view if its fine or not ..please look onto it and let me know if query is fine or not by explain plan .my oracle version is 11g
this is my query
SELECT ROWNUM , TRUNC(rownum/5000) + 20000 ,'FOR_UPDATE', sku_org.NAME ,
acct_promo_sku.src_num , acct_promo_sku.sub_type ,
promo_actual.sku_actual_pos
FROM siebel.s_src acct_promo_hdr,
siebel.s_src acct_title_format,
siebel.s_src acct_promo_sku,
siebel.s_src_x acct_promo_hdrx,
siebel.s_src_x acct_promo_skux,
siebel.s_prod_int prod,
siebel.s_bu promo_hdr_org,
siebel.s_bu sku_org,
siebelwb.stg_sbl_acct_promo_actuals2 promo_actual
WHERE acct_promo_hdr.sub_type = 'PLAN_ACCOUNT_PROMOTION'
AND acct_promo_hdr.row_id = acct_title_format.par_src_id
AND acct_title_format.sub_type = 'PLAN_ACCT_PROMOTION_CATEGORY'
AND acct_title_format.row_id = acct_promo_sku.par_src_id
AND acct_promo_sku.sub_type = 'PLAN_ACCOUNT_PROMOTION_PRODUCT'
AND acct_promo_hdr.row_id = acct_promo_hdrx.par_row_id
AND acct_promo_sku.row_id = acct_promo_skux.par_row_id(+)
AND acct_promo_sku.prod_id = prod.row_id
AND acct_promo_hdr.bu_id = promo_hdr_org.row_id
AND acct_promo_sku.bu_id = sku_org.row_id
AND prod.x_prod_material_num = promo_actual.material_number
and prod.X_PROD_SALES_ORG=promo_actual.sales_org
AND acct_promo_hdr.row_id = promo_actual.acct_promo_id
and nvl(acct_promo_hdr.pr_accnt_id,0)=nvl(promo_actual.acct_siebel_rowid,0)
and nvl(acct_promo_hdr.x_indirect_id,0)=nvl(promo_actual.indirect_acct_siebel_rowid,0)
AND promo_actual.load_date >= TRUNC(SYSDATE)
AND promo_actual.load_date < TRUNC(SYSDATE + 1)
explain plan
PLAN_TABLE_OUTPUT
Plan hash value: 3864590768
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 298 | 2300 (1)| 00:00:28 |
| 1 | COUNT | | | | | |
|* 2 | FILTER | | | | | |
| 3 | NESTED LOOPS | | | | | |
| 4 | NESTED LOOPS | | 1 | 298 | 2300 (1)| 00:00:28 |
| 5 | NESTED LOOPS OUTER | | 1 | 273 | 2298 (1)| 00:00:28 |
| 6 | NESTED LOOPS | | 1 | 263 | 2296 (1)| 00:00:28 |
| 7 | NESTED LOOPS | | 1 | 236 | 2295 (1)| 00:00:28 |
| 8 | NESTED LOOPS | | 1 | 165 | 2292 (1)| 00:00:28 |
| 9 | NESTED LOOPS | | 1 | 117 | 2289 (1)| 00:00:28 |
| 10 | NESTED LOOPS | | 1 | 109 | 2289 (1)| 00:00:28 |
| 11 | NESTED LOOPS | | 1 | 99 | 2287 (1)| 00:00:28 |
|* 12 | TABLE ACCESS FULL | STG_SBL_ACCT_PROMO_ACTUALS2 | 1 | 49 | 2285 (1)| 00:0
|* 13 | TABLE ACCESS BY INDEX ROWID| S_SRC | 1 | 50 | 2 (0)| 00:00:01 |
|* 14 | INDEX UNIQUE SCAN | S_SRC_P1 | 1 | | 1 (0)| 00:00:01 |
|* 15 | INDEX RANGE SCAN | S_SRC_X_U1 | 1 | 10 | 2 (0)| 00:00:01 |
|* 16 | INDEX UNIQUE SCAN | S_BU_P1 | 1 | 8 | 0 (0)| 00:00:01 |
|* 17 | TABLE ACCESS BY INDEX ROWID | S_SRC | 1 | 48 | 3 (0)| 00:00:01 |
|* 18 | INDEX RANGE SCAN | S_SRC_F2 | 2 | | 2 (0)| 00:00:01 |
|* 19 | TABLE ACCESS BY INDEX ROWID | S_SRC | 1 | 71 | 3 (0)| 00:00:01 |
|* 20 | INDEX RANGE SCAN | S_SRC_F2 | 2 | | 2 (0)| 00:00:01 |
| 21 | TABLE ACCESS BY INDEX ROWID | S_BU | 1 | 27 | 1 (0)| 00:00:01 |
|* 22 | INDEX UNIQUE SCAN | S_BU_P1 | 1 | | 0 (0)| 00:00:01 |
|* 23 | INDEX RANGE SCAN | S_SRC_X_U1 | 1 | 10 | 2 (0)| 00:00:01 |
|* 24 | INDEX UNIQUE SCAN | S_PROD_INT_P1 | 1 | | 1 (0)| 00:00:01 |
|* 25 | TABLE ACCESS BY INDEX ROWID | S_PROD_INT | 1 | 25 | 2 (0)| 00:00:
Predicate Information (identified by operation id):
2 - filter(TRUNC(SYSDATE@!)<TRUNC(SYSDATE@!+1))
12 - filter("PROMO_ACTUAL"."LOAD_DATE">=TRUNC(SYSDATE@!) AND "PROMO_ACTUAL"."LOAD_DATE"<TRUNC(SYSD
13 - filter("ACCT_PROMO_HDR"."SUB_TYPE"='PLAN_ACCOUNT_PROMOTION' AND
NVL("ACCT_PROMO_HDR"."PR_ACCNT_ID",'0')=NVL("PROMO_ACTUAL"."ACCT_SIEBEL_ROWID",'0') AND
NVL("ACCT_PROMO_HDR"."X_INDIRECT_ID",'0')=NVL("PROMO_ACTUAL"."INDIRECT_ACCT_SIEBEL_ROWID",'0'
14 - access("ACCT_PROMO_HDR"."ROW_ID"="PROMO_ACTUAL"."ACCT_PROMO_ID")
15 - access("ACCT_PROMO_HDR"."ROW_ID"="ACCT_PROMO_HDRX"."PAR_ROW_ID")
16 - access("ACCT_PROMO_HDR"."BU_ID"="PROMO_HDR_ORG"."ROW_ID")
17 - filter("ACCT_TITLE_FORMAT"."SUB_TYPE"='PLAN_ACCT_PROMOTION_CATEGORY')
18 - access("ACCT_PROMO_HDR"."ROW_ID"="ACCT_TITLE_FORMAT"."PAR_SRC_ID")
19 - filter("ACCT_PROMO_SKU"."PROD_ID" IS NOT NULL AND
"ACCT_PROMO_SKU"."SUB_TYPE"='PLAN_ACCOUNT_PROMOTION_PRODUCT')
20 - access("ACCT_TITLE_FORMAT"."ROW_ID"="ACCT_PROMO_SKU"."PAR_SRC_ID")
22 - access("ACCT_PROMO_SKU"."BU_ID"="SKU_ORG"."ROW_ID")
23 - access("ACCT_PROMO_SKU"."ROW_ID"="ACCT_PROMO_SKUX"."PAR_ROW_ID"(+))
24 - access("ACCT_PROMO_SKU"."PROD_ID"="PROD"."ROW_ID")
25 - filter("PROD"."X_PROD_MATERIAL_NUM" IS NOT NULL AND
"PROD"."X_PROD_MATERIAL_NUM"="PROMO_ACTUAL"."MATERIAL_NUMBER" AND
"PROD"."X_PROD_SALES_ORG"="PROMO_ACTUAL"."SALES_ORG")
55 rows selected.
thanksHi,
the plan you posted has the cost of 2300, i.e. 2300 single-block reads or equivalent number f multi-block reads. Even if none of the blocks is found in cache, 2300 reas shouldn't take more than a couple of minutes, beacause for most of the hard drives available today a disk read is typically within 5-10 ms.
This means that if there is a problem, we will never find out about it by looking in the plan. And it's quite likely that there is, in fact, a problem, because the plan contains a bunch of nested joins, and the cost of each nested join is directly proportional to the cardinality of the previous nested loop. I.e. it suffices to make one bad mistake in estimating the number of rows coming fom one of the nested rows to screw up the entire plan and get all remaining estimates (including the total cost of the query) completely wrong.
In order for us to be able to tell more, we need to see the plan with rowsource statistics, and please don't forget to use tags to preserve formatting (use the preview tab to make sure the posted plan is actually readable).
Best regards,
Nikolay -
Can not open sqlplus on Oracle10g/OEL5.0
I have installed an Oracle10g database on the OEL5.0 system (not encounter any errors) today. But after finishing the installation, I can not login the sqlplus.
[root@localhost ~]# sqlplus
bash: sqlplus: command not found.
When I loged in to the Database Console--->Administration-->Users, it dispayed no accounts table and no any users listed there.
What is the problem?
Thank you[root@localhost ~]# sqlplus
bash: sqlplus: command not found.I can see two problems here:
1. You are using root account as default (bad practice)
2. Shell environment. Your current setting is missing $ORACLE_HOME/bin in PATH variable. You probably set the environment for "oracle" user but I don't think you did the same for "root".
More information here: http://download.oracle.com/docs/cd/B19306_01/install.102/b15660/pre_install.htm#sthref709 -
Can not connect to oracle10g release2 database On XP SP2. Help needed
Hi! friends!
I have used Oracle 8 and it was nice. I didn't run Oracle 9i.
Now I installed Oracle10g R2 in WinXP-SP2. There was no problem in installation. But i can't run it. I get the Black SQL screen. But if i give some command it says "Not connected to database".
Oracle 8 version had built in database "emp" and "sal". In start up username and password box used to come(scott/tiger). But here I don't know if there is any builtin database,even there is no place to input username/password. So i cant work with 10g.
So i can't give command like Oracle 8
select *
from emp;
I do not have any network in my Desktop PC.. pls help me how to run and test Oracle 10g database on my machine. Also tell the name of the built in database.
I am much in trouble.
I am wishing thanks in advance to all who will reply.
Regards
Abir Atarthy
[email protected]In 10g database
During installation is you choose "database creation" option then default database is created.
database name is "ORCL"
you can check in windows registry
On command prompt
cmd>net start
if it is showing "OracleServiceORCL" then database is created"scott/tiger user is also created but in 10g it is LOCKED by default.
so you have to first unlock this user.
Now you can connect with "sys"or "system" but you know their password.
in 10g there is no default password for sys or system, we have to mention during installation time.
if you don't know then you can connect with sys like "SQL> CONN / AS SYSDBA" to sqlplus. -
HOW TO: Post a SQL statement tuning request - template posting
This post is not a question, but similar to Rob van Wijk's "When your query takes too long ..." post should help to improve the quality of the requests for SQL statement tuning here on OTN.
On the OTN forum very often tuning requests about single SQL statements are posted, but the information provided is rather limited, and therefore it's not that simple to provide a meaningful advice. Instead of writing the same requests for additional information over and over again I thought I put together a post that describes how a "useful" post for such a request should look like and what information it should cover.
I've also prepared very detailed step-by-step instructions how to obtain that information on my blog, which can be used to easily gather the required information. It also covers again the details how to post the information properly here, in particular how to use the \ tag to preserve formatting and get a fixed font output:
http://oracle-randolf.blogspot.com/2009/02/basic-sql-statement-performance.html
So again: This post here describes how a "useful" post should look like and what information it ideally covers. The blog post explains in detail how to obtain that information.
In the future, rather than requesting the same additional information and explaining how to obtain it, I'll simply refer to this HOW TO post and the corresponding blog post which describes in detail how to get that information.
*Very important:*
Use the \ tag to enclose any output that should have its formatting preserved as shown below.
So if you want to use fixed font formatting that preserves the spaces etc., do the following:
\ This preserves formatting
\And it will look like this:
This preserves formatting
. . .Your post should cover the following information:
1. The SQL and a short description of its purpose
2. The version of your database with 4-digits (e.g. 10.2.0.4)
3. Optimizer related parameters
4. The TIMING and AUTOTRACE output
5. The EXPLAIN PLAN output
6. The TKPROF output snippet that corresponds to your statement
7. If you're on 10g or later, the DBMS_XPLAN.DISPLAY_CURSOR output
The above mentioned blog post describes in detail how to obtain that information.
Your post should have a meaningful subject, e.g. "SQL statement tuning request", and the message body should look similar to the following:
*-- Start of template body --*
The following SQL statement has been identified to perform poorly. It currently takes up to 10 seconds to execute, but it's supposed to take a second at most.
This is the statement:
select
from
t_demo
where
type = 'VIEW'
order by
id;It should return data from a table in a specific order.
The version of the database is 11.1.0.7.
These are the parameters relevant to the optimizer:
SQL>
SQL> show parameter optimizer
NAME TYPE VALUE
optimizer_capture_sql_plan_baselines boolean FALSE
optimizer_dynamic_sampling integer 2
optimizer_features_enable string 11.1.0.7
optimizer_index_caching integer 0
optimizer_index_cost_adj integer 100
optimizer_mode string ALL_ROWS
optimizer_secure_view_merging boolean TRUE
optimizer_use_invisible_indexes boolean FALSE
optimizer_use_pending_statistics boolean FALSE
optimizer_use_sql_plan_baselines boolean TRUE
SQL>
SQL> show parameter db_file_multi
NAME TYPE VALUE
db_file_multiblock_read_count integer 8
SQL>
SQL> show parameter db_block_size
NAME TYPE VALUE
db_block_size integer 8192
SQL>
SQL> show parameter cursor_sharing
NAME TYPE VALUE
cursor_sharing string EXACT
SQL>
SQL> column sname format a20
SQL> column pname format a20
SQL> column pval2 format a20
SQL>
SQL> select
2 sname
3 , pname
4 , pval1
5 , pval2
6 from
7 sys.aux_stats$;
SNAME PNAME PVAL1 PVAL2
SYSSTATS_INFO STATUS COMPLETED
SYSSTATS_INFO DSTART 01-30-2009 16:25
SYSSTATS_INFO DSTOP 01-30-2009 16:25
SYSSTATS_INFO FLAGS 0
SYSSTATS_MAIN CPUSPEEDNW 494,397
SYSSTATS_MAIN IOSEEKTIM 10
SYSSTATS_MAIN IOTFRSPEED 4096
SYSSTATS_MAIN SREADTIM
SYSSTATS_MAIN MREADTIM
SYSSTATS_MAIN CPUSPEED
SYSSTATS_MAIN MBRC
SYSSTATS_MAIN MAXTHR
SYSSTATS_MAIN SLAVETHR
13 rows selected.Here is the output of EXPLAIN PLAN:
SQL> explain plan for
2 -- put your statement here
3 select
4 *
5 from
6 t_demo
7 where
8 type = 'VIEW'
9 order by
10 id;
Explained.
Elapsed: 00:00:00.01
SQL>
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 1390505571
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 60 | 0 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| T_DEMO | 1 | 60 | 0 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | IDX_DEMO | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("TYPE"='VIEW')
14 rows selected.Here is the output of SQL*Plus AUTOTRACE including the TIMING information:
SQL> rem Set the ARRAYSIZE according to your application
SQL> set autotrace traceonly arraysize 100
SQL> select
2 *
3 from
4 t_demo
5 where
6 type = 'VIEW'
7 order by
8 id;
149938 rows selected.
Elapsed: 00:00:02.21
Execution Plan
Plan hash value: 1390505571
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 60 | 0 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| T_DEMO | 1 | 60 | 0 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | IDX_DEMO | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("TYPE"='VIEW')
Statistics
0 recursive calls
0 db block gets
149101 consistent gets
800 physical reads
196 redo size
1077830 bytes sent via SQL*Net to client
16905 bytes received via SQL*Net from client
1501 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
149938 rows processed
SQL>
SQL> disconnect
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsThe TKPROF output for this statement looks like the following:
TKPROF: Release 11.1.0.7.0 - Production on Mo Feb 23 10:23:08 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Trace file: orcl11_ora_3376_mytrace1.trc
Sort options: default
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
select
from
t_demo
where
type = 'VIEW'
order by
id
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 1501 0.53 1.36 800 149101 0 149938
total 1503 0.53 1.36 800 149101 0 149938
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 88
Rows Row Source Operation
149938 TABLE ACCESS BY INDEX ROWID T_DEMO (cr=149101 pr=800 pw=0 time=60042 us cost=0 size=60 card=1)
149938 INDEX RANGE SCAN IDX_DEMO (cr=1881 pr=1 pw=0 time=0 us cost=0 size=0 card=1)(object id 74895)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1501 0.00 0.00
db file sequential read 800 0.05 0.80
SQL*Net message from client 1501 0.00 0.69
********************************************************************************The DBMS_XPLAN.DISPLAY_CURSOR output:
SQL> -- put your statement here
SQL> -- use the GATHER_PLAN_STATISTICS hint
SQL> -- if you're not using STATISTICS_LEVEL = ALL
SQL> select /*+ gather_plan_statistics */
2 *
3 from
4 t_demo
5 where
6 type = 'VIEW'
7 order by
8 id;
149938 rows selected.
Elapsed: 00:00:02.21
SQL>
SQL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));
PLAN_TABLE_OUTPUT
SQL_ID d4k5acu783vu8, child number 0
select /*+ gather_plan_statistics */ * from t_demo
where type = 'VIEW' order by id
Plan hash value: 1390505571
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads |
| 0 | SELECT STATEMENT | | 1 | | 149K|00:00:00.02 | 149K| 1183 |
| 1 | TABLE ACCESS BY INDEX ROWID| T_DEMO | 1 | 1 | 149K|00:00:00.02 | 149K| 1183 |
|* 2 | INDEX RANGE SCAN | IDX_DEMO | 1 | 1 | 149K|00:00:00.02 | 1880 | 383 |
Predicate Information (identified by operation id):
2 - access("TYPE"='VIEW')
20 rows selected.I'm looking forward for suggestions how to improve the performance of this statement.
*-- End of template body --*
I'm sure that if you follow these instructions and obtain the information described, post them using a proper formatting (don't forget about the \ tag) you'll receive meaningful advice very soon.
So, just to make sure you didn't miss this point:Use proper formatting!
If you think I missed something important in this sample post let me know so that I can improve it.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/Alex Nuijten wrote:
...you missed the proper formatting of the Autotrace section ;-)Alex,
can't reproduce, does it still look unformatted? Or are you simply kidding? :-)
Randolf
PS: Just noticed that it actually sometimes doesn't show the proper formatting although the code tags are there. Changing to the \ tag helped in this case, but it seems to be odd.
Edited by: Randolf Geist on Feb 23, 2009 11:28 AM
Odd behaviour of forum software -
Oracle10g Developer Suite - Application Development - SQL Plus Login Info
I have installed Oracle10g Developer Suite and when I am trying to login into the sql*plus environment the username scott with the passcode tiger is not working. I have Oracle9i Enterprise Edition Release 9.2.0.1.0 as the database.
Can anyone help me in setting up the username and password to login into Sql*plus Release 10.1.0.4.2It sounds like you may be new to Oracle and its products. I would recommend doing some reading.
Oracle 9.2 Net Services Admin Guide
http://download-west.oracle.com/docs/cd/B10501_01/network.920/a96580/toc.htm
Oracle Developer Suite Installation Guide
http://download-west.oracle.com/docs/cd/B25016_06/doc/dl/core/B16012_03/toc.htm
You create the "login" information when you install the database. If you are not the person who performed the installation, you will need to contact them or install it again. Also, be aware that the SCOTT schema is disabled by default in newer database versions for security reasons.
The tnsnames.ora and sqlnet.ora files can be found in the ORACLE_HOME\network\admin directory. This is the same for all Oracle products that use Sql-Net for database connections. You can also use the TNS_ADMIN environment variable to point to a pre-existing tnsnames.ora file (see previously mentioned documents).
The tnsnames.ora entry will be unique to your database and its listener however here is an example:
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = someServer.com)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = orcl)
) -
Need help in tuning a procedure
DECLARE
CURSOR Cur_sub_rp IS
SELECT A.SUB_ACCOUNT, B.PH_basic_srv,B.PH_Salesman,A.SUB_SSN
FROM STG_SUB_MASTER_MONTH_HISTORY A, STG_PHN_MASTER_MONTH_HISTORY
B
WHERE A.SUB_ACCOUNT = B.PH_ACCOUNT (+)
AND A.MONTH_ID = B.MONTH_ID ;
TYPE t_values_tab IS TABLE OF cur_sub_rp%rowtype ;
values_tab t_values_tab := t_values_tab() ;
BEGIN
OPEN Cur_sub_rp ;
LOOP
FETCH Cur_sub_rp BULK COLLECT INTO Values_tab
LIMIT 1000;
EXIT WHEN Cur_sub_rp%NOTFOUND ;
END LOOP ;
CLOSE Cur_sub_rp;
FORALL i IN VALUES_TAB.first..values_tab.last
INSERT INTO SUB_PHN_1 VALUES VALUES_TAB(i);
commit;
END;
The tables used here has 9 million records each.
The total process takes around 19 minutes.
Need your help in optimizing the process.i have tried using
Create table as SELECT A.SUB_ACCOUNT, B.PH_basic_srv,B.PH_Salesman,A.SUB_SSN
FROM STG_SUB_MASTER_MONTH_HISTORY A, STG_PHN_MASTER_MONTH_HISTORY
B
WHERE A.SUB_ACCOUNT = B.PH_ACCOUNT (+)
AND A.MONTH_ID = B.MONTH_ID (+);But still taking long time(apprx 15 min).
so used this...
help me in tuning the query in either of this.
DECLARE
CURSOR Cur_sub_rp IS
SELECT A.SUB_ACCOUNT, B.PH_basic_srv,B.PH_Salesman,A.SUB_SSN
FROM STG_SUB_MASTER_MONTH_HISTORY A, STG_PHN_MASTER_MONTH_HISTORY
B
WHERE A.SUB_ACCOUNT = B.PH_ACCOUNT (+)
AND A.MONTH_ID = B.MONTH_ID (+);
TYPE t_values_tab IS TABLE OF cur_sub_rp%rowtype ;
values_tab t_values_tab := t_values_tab() ;
BEGIN
OPEN Cur_sub_rp ;
LOOP
FETCH Cur_sub_rp BULK COLLECT INTO Values_tab
LIMIT 1000;
EXIT WHEN Cur_sub_rp%NOTFOUND ;
END LOOP ;
CLOSE Cur_sub_rp;
FORALL i IN VALUES_TAB.first..values_tab.last
INSERT INTO SUB_PHN_1 VALUES VALUES_TAB(i);
commit;
END;Message was edited by:
Vakeel
Message was edited by:
Vakeel -
Real Instruments, Enhance Tuning, Enhance Timing, Etc?
Hi,
I am having trouble getting to the Real Instruments, Enhance Tuning, Enhance Timing, area of GB3.
I see the window partially, but not enough to move the sliders, while seeing there placement..
I'm sure there's something I'm unaware of to get the full view, and I've snapped a screen shot to show what I'm talking about, if anyone is interested..
Thanks For Any Help,
EricHang-
I have a work around I kind of stumbled onto..
http://members.aol.com/unkie/GB3-pict-2.gif
After you select the Real Instrument track you'd like to correct the pitch or timing of, you hit the "I" for track information, then you can click on the region arrow,(?) and the Enhancing area opens up properly.
Check out the picture linked above, and below I will place the before shot link..
The preference not coming up seems to be linked to using iChat, believe it or not..
I read it here in the forum.
If you open iChat, and then Garageband 3, your preference pane may not open up, until you reboot your computer.
Strange but true..
HangTime, Thanks for "Hanging" in there with me through this dilemma..
Take Care,
Eric
Before Link: http://members.aol.com/unkie/GB3.gif
G4 Desktop (QuickSilver) Dual 1 Gig Processors Mac OS X (10.4.3) 1.5 Gigs of RAM -
Memory Problem with Oracle10g R2 and red Hat linux 2.4.21-37.EL
Hi All.
i've a 64Bit red Hat Linux 2.4.21-37.EL , 5GB Ram , 3GB Swap Space.
Oracle10g R2. i've 2 prodection database each is having 1400MB of SGA.
when i check the free meory it shows only 12mb of ram is free..why..?
and in swap space it's only 200mb is used...why..?
when i check the dbwither is taking 1.2GB of RAM why..?
can anybody help me in this ...how to get free memory or configure os level to get more free memory.
Sarit
[email protected]Linux uses Swap space to run applications. The RAM available may not be enough to run the applications so OS swaps the program between RAM and the swap space to run applications.
You can see your swap partition being used as the swap space with:
cat /proc/swaps
Regards,
Senthil Murugan
Maybe you are looking for
-
How do i install windows on my macbook, how do i install windows on my macbook
i really dont know how to do that and i want to do it by partition of my mac ...i want to keep both my mac osx and windows how to do that please let me know
-
Can I run a CD off a tethered computer?
My CD drive broke on my G4 and I need to install the printer driver of my new printer. I often connect my iBook G4 to my desktop G4 via firewire, though a CD in the iBook doesn't mount when connected. Is there any other way to run the install CD with
-
Java.util.zip not handling Unicode filenames
I have a zip file that contains files with Asian filenames. java.util.zip.ZipFile opens it, but the filenames are garbled. Is there any way to handle filenames that contain unicode characters?
-
Why when I edit object in acrobat x are the images sometimes rotated or lose their clipping paths?
-
IPad mini with 30 pin HDMI adapter
Hi, I have iPad mini and "lightning to 30 pin converter". I want to buy 30 pin HDMI Adapter (for iPad 2). I want to know that if I connect that 30 pin HDMI adapter to my iPad mini with the help of "lightning to 30 pin converter", will it work on my d