Execution Statistics
I was looking at some statistics from an ADDM report and the executions of the statement made me curious. When a Statspack (AWR in 10g) report is run are the executions of a particular statement accurate for the time frame for that report? Also If I were to look at v$sqlarea or v$sql and pull out the executions is that cumulative since database startup?
I had a hard time finding that info in the documentation so any assistance would be greatly appreciated.
Thanks,
Brian
And a follow up to this for those of you familiar with RAC. Are the statistics specific for a particular instance or are they an indication of the amount of times a statement was executed in the database regardless of instance?
Thanks,
Brian
Similar Messages
-
Hi all,
Good day...
I could see in my db,version 10.2.0.4 Plan Execution Statistics, OS time stastiscs are disabled...What is the user of these parameterss..?
SQL> /
STATISTICS_NAME SESSION_ SYSTEM_S ACTIVAT
Buffer Cache Advice ENABLED ENABLED TYPICAL
MTTR Advice ENABLED ENABLED TYPICAL
Timed Statistics ENABLED ENABLED TYPICAL
Timed OS Statistics DISABLED DISABLED ALL
Segment Level Statistics ENABLED ENABLED TYPICAL
PGA Advice ENABLED ENABLED TYPICAL
Plan Execution Statistics DISABLED DISABLED ALL
Shared Pool Advice ENABLED ENABLED TYPICAL
Modification Monitoring ENABLED ENABLED TYPICAL
Longops Statistics ENABLED ENABLED TYPICAL
Bind Data Capture ENABLED ENABLED TYPICAL
Ultrafast Latch Statistics ENABLED ENABLED TYPICAL
Threshold-based Alerts ENABLED ENABLED TYPICAL
Global Cache Statistics ENABLED ENABLED TYPICAL
Active Session History ENABLED ENABLED TYPICAL
Undo Advisor, Alerts and Fast Ramp up ENABLED ENABLED TYPICAL
Streams Pool Advice ENABLED ENABLED TYPICAL
17 rows selected.thanks,
baskar.lIf I am getting it right, these setting won't change as long as you don't go and manually change them.
SQL> select STATISTICS_NAME,SYSTEM_STATUS,SESSION_STATUS
2 from V$statistics_level
3 /
STATISTICS_NAME SYSTEM_S SESSION_
Buffer Cache Advice ENABLED ENABLED
MTTR Advice ENABLED ENABLED
Timed Statistics ENABLED ENABLED
Timed OS Statistics DISABLED DISABLED
Segment Level Statistics ENABLED ENABLED
PGA Advice ENABLED ENABLED
Plan Execution Statistics DISABLED DISABLED
Shared Pool Advice ENABLED ENABLED
Modification Monitoring ENABLED ENABLED
Longops Statistics ENABLED ENABLED
Bind Data Capture ENABLED ENABLED
Ultrafast Latch Statistics ENABLED ENABLED
Threshold-based Alerts ENABLED ENABLED
Global Cache Statistics ENABLED ENABLED
Active Session History ENABLED ENABLED
Undo Advisor, Alerts and Fast Ramp up ENABLED ENABLED
16 rows selected.
SQL> alter session set timed_os_statistics=4;
Session altered.
SQL> select STATISTICS_NAME,SYSTEM_STATUS,SESSION_STATUS
2 from V$statistics_level
3 /
STATISTICS_NAME SYSTEM_S SESSION_
Buffer Cache Advice ENABLED ENABLED
MTTR Advice ENABLED ENABLED
Timed Statistics ENABLED ENABLED
Timed OS Statistics DISABLED ENABLED
Segment Level Statistics ENABLED ENABLED
PGA Advice ENABLED ENABLED
Plan Execution Statistics DISABLED DISABLED
Shared Pool Advice ENABLED ENABLED
Modification Monitoring ENABLED ENABLED
Longops Statistics ENABLED ENABLED
Bind Data Capture ENABLED ENABLED
Ultrafast Latch Statistics ENABLED ENABLED
Threshold-based Alerts ENABLED ENABLED
Global Cache Statistics ENABLED ENABLED
Active Session History ENABLED ENABLED
Undo Advisor, Alerts and Fast Ramp up ENABLED ENABLED
16 rows selected.This was 10201 on OEL4.
Looking at the docs,
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams211.htm#REFRN10214
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams215.htm#REFRN10217
For the parameter value Typical, default value for this parameter is 0 which means it would be diabled. I have changed it my session level and its working now. In the first link,
>
When the STATISTICS_LEVEL parameter is modified by ALTER SYSTEM, all advisories or statistics are dynamically turned on or off, depending on the new value of STATISTICS_LEVEL. When modified by ALTER SESSION, the following advisories or statistics are turned on or off in the local session only. Their system-wide state is not changed:
Timed statistics
Timed OS statistics
Plan execution statistics
>
HTH
Aman.... -
How I can generate statistics about execution of report custom on the system? I know transaction ST03 but is not possible to analyze data in a long time range.
I want to generate statistics to undestand if all reports custom present on the R/3 are used or not.
Thank you very mutch and excuse me for grammal errors,
GianlucaHi Gianluca,
I don't think any real statistics are stored in data base tables. This kind of data really lends itself to being stored in files.
My gut feeling is that if you can't find what you need in STAT, is that there is probably not going to be an easy way of getting what you want.
Sorry couldn't offer you a more positive response.
Cheers,
Brad -
Hello,
Normally using the repository browser,one can see the dml statistics of a mapping execution,
but i shows the total number of records, selected, inserted or updated by a mapping.
If there are more than one target table in a mapping, and I want to see the number of records
inserted/updated/delete in each of the target tables,
where do I need to check?
Thnks
MDHi
The below query will give u all the necessary details
Execute it from OWNER Schema.
select
x.TASK_NAME,
y.TARGET_NAME,
z.NUMBER_ERRORS,z.NUMBER_RECORDS_INSERTED Inserted,
z.NUMBER_RECORDS_UPDATED UPDATED ,z.NUMBER_RECORDS_MERGED MERGED, z.NUMBER_RECORDS_SELECTED SELECTED,
z.ELAPSE_TIME,z.RUN_STATUS,
x.EXECUTION_AUDIT_ID,
a.MAP_RUN_ID
from ALL_RT_AUDIT_STEP_RUNS z,
ALL_RT_AUDIT_STEP_RUN_TARGETS y ,
ALL_RT_AUDIT_map_runs a,
ALL_RT_AUDIT_EXECUTIONS x
where x.EXECUTION_AUDIT_ID = a.EXECUTION_AUDIT_ID and
a.MAP_RUN_ID = z.MAP_RUN_ID and
z.step_id = y.step_id
and x.task_name like *'Mapping_name'*
order by x.EXECUTION_AUDIT_ID, a.MAP_RUN_ID -
Execution Statistics by target
I'm looking for a way to either capture the following information or maybe OWB already gathers this info and I just need to know where to look.
I'm looking at the following info for each target.
Target Table Name
Load start time
Load end time
rows inserted
rows modified
Success or Failure.
I'd like to tie this information to an audit key in the target tables so we can always know when each row was loaded.
I searched on audit tables (and that returned more error related stuff) and statistics (and that returned more stuff on analyze table and actual Oracle stats).u can use dbms_utility.gettime
declare
tempo number;
begin
TEMPO := DBMS_UTILITY.GET_TIME;
<your code>
TEMPO := TEMPO - DBMS_UTILITY.GET_TIME;
DBMS_OUTPUT.PUT_LINE('TEMPO>'||TEMPO);
end; -
Upload data from excel to Ztable with statistics
Hi,
I have a requirement to upload data from excel sheet to ztable .
Here i need tp provide the user with the execution statistics like
1.Number of records read from the Excel spread-sheet
2. Number records processed successfully
3. Number records with Error
4. Name and location of Error Log-file (text-file format)
5. Name and location of the file containing error records (Excel spread-sheet format)
I would appreciate if any of you have code written for the sameSee the below example code to upload from xl file to sap
REPORT ZLWMI151_UPLOAD no standard page heading
line-size 100 line-count 60.
*tables : zbatch_cross_ref.
data : begin of t_text occurs 0,
werks(4) type c,
cmatnr(15) type c,
srlno(12) type n,
matnr(7) type n,
charg(10) type n,
end of t_text.
data: begin of t_zbatch occurs 0,
werks like zbatch_cross_ref-werks,
cmatnr like zbatch_cross_ref-cmatnr,
srlno like zbatch_cross_ref-srlno,
matnr like zbatch_cross_ref-matnr,
charg like zbatch_cross_ref-charg,
end of t_zbatch.
data : g_repid like sy-repid,
g_line like sy-index,
g_line1 like sy-index,
$v_start_col type i value '1',
$v_start_row type i value '2',
$v_end_col type i value '256',
$v_end_row type i value '65536',
gd_currentrow type i.
data: itab like alsmex_tabline occurs 0 with header line.
data : t_final like zbatch_cross_ref occurs 0 with header line.
selection-screen : begin of block blk with frame title text.
parameters : p_file like rlgrap-filename obligatory.
selection-screen : end of block blk.
initialization.
g_repid = sy-repid.
at selection-screen on value-request for p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = g_repid
IMPORTING
FILE_NAME = p_file.
start-of-selection.
Uploading the data into Internal Table
perform upload_data.
perform modify_table.
top-of-page.
CALL FUNCTION 'Z_HEADER'
EXPORTING
FLEX_TEXT1 =
FLEX_TEXT2 =
FLEX_TEXT3 =
*& Form upload_data
text
FORM upload_data.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_file
I_BEGIN_COL = $v_start_col
I_BEGIN_ROW = $v_start_row
I_END_COL = $v_end_col
I_END_ROW = $v_end_row
TABLES
INTERN = itab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
write:/10 'File '.
ENDIF.
if sy-subrc eq 0.
read table itab index 1.
gd_currentrow = itab-row.
loop at itab.
if itab-row ne gd_currentrow.
append t_text.
clear t_text.
gd_currentrow = itab-row.
endif.
case itab-col.
when '0001'.
t_text-werks = itab-value.
when '0002'.
t_text-cmatnr = itab-value.
when '0003'.
t_text-srlno = itab-value.
when '0004'.
t_text-matnr = itab-value.
when '0005'.
t_text-charg = itab-value.
endcase.
endloop.
endif.
append t_text.
ENDFORM. " upload_data
*& Form modify_table
Modify the table ZBATCH_CROSS_REF
FORM modify_table.
loop at t_text.
t_final-werks = t_text-werks.
t_final-cmatnr = t_text-cmatnr.
t_final-srlno = t_text-srlno.
t_final-matnr = t_text-matnr.
t_final-charg = t_text-charg.
t_final-erdat = sy-datum.
t_final-erzet = sy-uzeit.
t_final-ernam = sy-uname.
t_final-rstat = 'U'.
append t_final.
clear t_final.
endloop.
delete t_final where werks = ''.
describe table t_final lines g_line.
sort t_final by werks cmatnr srlno.
Deleting the Duplicate Records
perform select_data.
describe table t_final lines g_line1.
modify zbatch_cross_ref from table t_final.
if sy-subrc ne 0.
write:/ 'Updation failed'.
else.
Skip 1.
Write:/12 'Updation has been Completed Sucessfully'.
skip 1.
Write:/12 'Records in file ',42 g_line .
write:/12 'Updated records in Table',42 g_line1.
endif.
delete from zbatch_cross_ref where werks = ''.
ENDFORM. " modify_table
*& Form select_data
Deleting the duplicate records
FORM select_data.
select werks
cmatnr
srlno from zbatch_cross_ref
into table t_zbatch for all entries in t_final
where werks = t_final-werks
and cmatnr = t_final-cmatnr
and srlno = t_final-srlno.
sort t_zbatch by werks cmatnr srlno.
loop at t_zbatch.
read table t_final with key werks = t_zbatch-werks
cmatnr = t_zbatch-cmatnr
srlno = t_zbatch-srlno.
if sy-subrc eq 0.
delete table t_final .
endif.
clear: t_zbatch,
t_final.
endloop.
ENDFORM. " select_data
Reward Points if it is helpful
Thanks
Seshu -
NEW FEATURE:AUTOTRACE IN SQL*PLUS 3.3(EXECUTION PLAN)
제품 : SQL*PLUS
작성날짜 : 2003-10-07
NEW FEATURE:AUTOTRACE IN SQL*PLUS 3.3
======================================
Autotrace는 SQL*Plus 3.3부터 지원하는 New feature로서 기존에는 init.ora에
SQL_TRACE=TRUE를 setting 후 얻어진 trace file을 TKPROF란 utility를
이용하여 SQL 문의 수행 경로, 각종 통계 정보를 얻었다.
그러나, SQL*Plus 3.3부터는 이것을 간단히 처리할 수 있는 방법을 제공한다.
1. SQL*Plus를 실행하여 scott user로 접속한 후, plan table을 생성한다.
#sqlplus scott/tiger
SQL>@$ORACLE_HOME/rdbms/admin/utlxplan
2. 다음에 sys user에서 PLUSTRACE란 ROLE을 만든다.
SVRMGR>connect internal;
SVRMGR>create role plustrace;
SVRMGR>grant select on v_$sesstat to plustrace;
SVRMGR>grant select on v_$statname to plustrace;
SVRMGR>grant select on v_$session to plustrace;
SVRMGR>grant plustrace to dba with admin option;
SVRMGR>grant plustrace to scott;
비고) 위의 grant 문은 client에 SQL*Plus 3.3이 install되어 있는 경우
C:ORAWIN95\PLUS33\PLUSTRCE.SQL이라는 script에 기록되어 있다.
다음과 같이 실행해 주면 된다.
1> connect sys/manager
2> @$ORACLE_HOME/sqlplus/admin/plustrce.sql
3> grant plustrace to scott;
3. 다음에는 scott user로 connect하여 작업한다.
#sqlplus scott/tiger
SQL>set autotrace on
SQL>select * from emp;
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 TABLE ACCESS (FULL) OF 'EMP'
Statistics
389 recursive calls
5 db block gets
53 consistent gets
12 physical reads
0 redo size
1049 bytes sent via SQL*Net to client
239 bytes received via SQL*Net from client
4 SQL*Net round-trips to/from client
0 sorts (memory)
0 sorts (disk)
13 rows processed
4. 참고로 set autotrace에는 여러가지 option을 부여해 작업할 수도 있다.
예)set autotrace on => Explain plan and statistics.
set autotrace on explain => Explain plan only.
set autotrace traceonly => select된 결과는 빼고 trace만 display
시킴.
set autotrace on statistics=> sql statement execution statistics.
5. 서버 버젼과 상관없다.
Server가 7.2 version 이하일지라도 clinet에 SQL*Plus 3.3이 install되어
있으면 client에서 sqlplus 3.3을 구동시켜 server에 접속하여 위와 같이
작업하면 무리없이 작업이 가능하다.
Reference Documents
<Note:43214.1>Hi Roman,
I don't have an Oracle 9.2 database readily available, but it works fine on 10g XE. Please note 3.1 is not certified with 9i:
http://www.oracle.com/technetwork/developer-tools/sql-developer/certification-096745.html
Regards,
Gary
SQL Developer Team -
Performance Tuning -To find the execution time for Select Statement
Hi,
There is a program that takes 10 hrs to execute. I need tune its performance. The program is basically reading few tables like KNA1,ANLA,ANLU,ADRC etc and updates to Custom table. I did my analysis and found few performance techniques for ABAP coding.
Now my problem is, to get this object approved I need to submit the execution statistics to client.I checked both ST05 and SE30. I heard of a Tcode where we can execute a select statement and note its time, then modify and find its improved Performance. Can anybody suggest me on this.
Thanks,
Rajani.Hi,
This is documentation regarding performance analysis. Hope this will be useful
It is a general practice to use Select * from <database> This statement populates all the values of the structure in the database.
The effect is many fold:-
It increases the time to retrieve data from database
There is large amount of unused data in memory
It increases the processing time from work area or internal tables
It is always a good practice to retrieve only the required fields. Always use the syntax Select f1 f2 fn from <database>
e.g. Do not use the following statement:-
Data: i_mara like mara occurs 0 with header line.
Data: i_marc like marc occurs 0 with header line.
Select * from mara
Into table i_mara
Where matnr in s_matnr.
Select * from marc
Into table i_marc
For all entries in i_mara
Where matnr eq i_mara-matnr.
Instead use the following statement:-
Data: begin of i_mara occurs 0,
Matnr like mara-matnr,
End of i_mara.
Data: begin of i_marc occurs 0,
Matnr like marc-matnr,
Werks like marc-werks,
End of i_marc.
Select matnr from mara
Into table i_mara
Where matnr in s_matnr. -
How to get the execution time of a query
Hi,
Environment: 10.2.0.4.0
Just wondering how I can get the query execution time? I am not interested in the query output nor do I want the statistics, just the execution time?
Any suggestions will be appreciated
Thanks in advance
rogers42If you're using SQL*Plus
SQL> set autotrace traceonly
SQL> set timing on
SQL> <<your query here>>SQL*Plus will fetch all the data and then report the query plan, execution statistics, and elapsed time. It will not display the actual data.
SET TIMING ON alone tells SQL*Plus to display the execution time of each SQL statement-- the problem is that it also displays all the data which can skew the results because you're including the time required by SQL*Plus to pipe a bunch of data to the screen.
Justin -
Performance issue with SQL with different input data
Hi Experts,
I have an SQL query that uses three tables imtermination, imconnection, imconnectiondesign. Each of these tables have around 23Lakh, 11Lakh, 11Lakh rows respectively. There are appropriate indexes on these tables.
Now there is a query:
SELECT
/*+ NO_MERGE(a) ORDERED USE_NL(c) */ c.objectid,
c.typeid,
c.transactionstatus,
c.usersessionid,
cd.objectid designid,
c.reservationid,
c.networkid,
c.networktype,
cd.inprojectid,
cd.inprojecttype,
cd.outprojectid,
cd.outprojecttype,
cd.asiteid,
cd.asitetype,
cd.anetworkelementid,
cd.anetworkelementtype,
cd.aportid,
cd.aporttype,
cd.achannelpath,
c.asignaltype,
cd.zsiteid,
cd.zsitetype,
cd.znetworkelementid,
cd.znetworkelementtype,
cd.zportid,
cd.zporttype,
cd.zchannelpath,
c.zsignaltype,
c.signaltype,
c.visualkey,
c.resourcestate,
cd.assignmentstate,
c.effectivefrom,
cd.effectiveto,
c.channelized,
c.circuitusage,
c.hardwired,
c.consumedsignaltype,
c.flowqualitycode,
c.capacityused,
c.percentused,
c.maxcapacity,
c.warningthreshold,
c.typecode,
cd.lastupdateddate,
c.lastreconcileddate,
c.bandwidth,
c.unit
FROM
(SELECT terminatedid
FROM imtermination t1
WHERE t1.networkelementid = 9200150)
a,
imconnectiondesign cd,
imconnection c
WHERE cd.objectid = a.terminatedid
AND c.objectid = cd.connectionid
AND(SUBSTR('10000000000000000000011111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', c.consumedsignaltype + 1, 1) = '1' OR SUBSTR('10000000000000000000011111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', c.signaltype + 1, 1) = '1')
AND c.typeid = '$131'
AND cd.assignmentstate IN(2, 3)
The above query takes around 70 secs to execute when input t1.networkelementid = 9200150. Moreover i have observed in the enterprise manager that this has very high i/o wait time.
Now the same query takes around 5 secs to execute when the input t1.networkelementid = 42407448. Both these obejcts with id 9200150 and 42407448 have almost same number of rows and output and without any condition each have 6500 rows in all the three tables.
The execution plan for both these queries with t1.networkelementid = 9200150 and t1.networkelementid = 42407448 is also coming same.
The rows that are corresponding to t1.networkelementid = 9200150 in these three tables are the result of the data created through the application over a period of time. While in case of rows corresponding to t1.networkelementid = 42407448 i have created manually and are contiguous in the three tables.
Does the above behavior is because in case of t1.networkelementid = 42407448 the rows that corresponds to it are not contiguous as they are created over a period of time ?
Execution Statistics
Total Per Execution Per Row
Executions 1 1 0.02
CPU Time (sec) 0.91 0.91 0.02
Buffer Gets 11943 11943.00 238.86
Disk Reads 4804 4804.00 96.08
Direct Writes 0 0.00 0.00
Rows 50 50.00 1
Fetches 5 5.00 0.10
User I/O Waits(98.7%)
CPU(1.3%)
Enterprise manager shows high db file scattered read in case of t1.networkelementid = 9200150, the input for which it is taking 70 secs.
Request experts to provide some pointers to fix this issue as i am not an expert in db tuning.
Thanks in advance for your help.
RegardsHi David,
Please find below the output:
SQL> SELECT table_name, num_rows, last_analyzed
2 FROM all_tables
3 WHERE table_name IN ('IMTERMINATION', 'IMCONNECTIONDESIGN', 'IMCONNECTION')
4 /
TABLE_NAME NUM_ROWS LAST_ANAL
IMTERMINATION 2338746 19-SEP-11
IMCONNECTIONDESIGN 1129298 19-SEP-11
IMCONNECTION 1169373 19-SEP-11
IMTERMINATION 19852 13-SEP-11
IMCONNECTIONDESIGN 6820 13-SEP-11
IMCONNECTION 9926 13-SEP-11
6 rows selected.
SQL> SELECT table_name, index_name,num_rows, last_analyzed
2 FROM all_indexes
3 WHERE table_name IN ('IMTERMINATION', 'IMCONNECTIONDESIGN', 'IMCONNECTION')
4 order by table_name,index_name
5 /
TABLE_NAME INDEX_NAME NUM_ROWS LAST_ANAL
IMCONNECTION IMCONNECTION_A_NE 9925 13-SEP-11
IMCONNECTION IMCONNECTION_A_NE 1169154 19-SEP-11
IMCONNECTION IMCONNECTION_A_PORT 84743 19-SEP-11
IMCONNECTION IMCONNECTION_A_PORT 3371 13-SEP-11
IMCONNECTION IMCONNECTION_A_SITE 1169373 19-SEP-11
IMCONNECTION IMCONNECTION_A_SITE 9926 13-SEP-11
IMCONNECTION IMCONNECTION_NET 0 19-SEP-11
IMCONNECTION IMCONNECTION_NET 12 13-SEP-11
IMCONNECTION IMCONNECTION_PK 9926 13-SEP-11
IMCONNECTION IMCONNECTION_PK 1169373 19-SEP-11
IMCONNECTION IMCONNECTION_RES 0 13-SEP-11
IMCONNECTION IMCONNECTION_RES 0 19-SEP-11
IMCONNECTION IMCONNECTION_ST 2 13-SEP-11
IMCONNECTION IMCONNECTION_ST 60 19-SEP-11
IMCONNECTION IMCONNECTION_TYPEID 4 13-SEP-11
IMCONNECTION IMCONNECTION_TYPEID 64 19-SEP-11
IMCONNECTION IMCONNECTION_UR 26880 19-SEP-11
IMCONNECTION IMCONNECTION_UR 3 13-SEP-11
IMCONNECTION IMCONNECTION_VK 9810 13-SEP-11
IMCONNECTION IMCONNECTION_VK 1191866 19-SEP-11
IMCONNECTION IMCONNECTION_Z_NE 1169173 19-SEP-11
IMCONNECTION IMCONNECTION_Z_NE 9925 13-SEP-11
IMCONNECTION IMCONNECTION_Z_PORT 84092 19-SEP-11
IMCONNECTION IMCONNECTION_Z_PORT 3370 13-SEP-11
IMCONNECTION IMCONNECTION_Z_SITE 9926 13-SEP-11
IMCONNECTION IMCONNECTION_Z_SITE 1169373 19-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_CON 1129298 19-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_CON 6820 13-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_PK 1129298 19-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_PK 6820 13-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_ST 6820 13-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_ST 1129298 19-SEP-11
IMTERMINATION IMTERMINATION_ID 19852 13-SEP-11
IMTERMINATION IMTERMINATION_ID 2279477 19-SEP-11
IMTERMINATION IMTERMINATION_NE 19850 13-SEP-11
IMTERMINATION IMTERMINATION_NE 2327175 19-SEP-11
IMTERMINATION IMTERMINATION_PORT 168835 19-SEP-11
IMTERMINATION IMTERMINATION_PORT 6741 13-SEP-11
IMTERMINATION IMTERMINATION_SITE 19852 13-SEP-11
IMTERMINATION IMTERMINATION_SITE 2391415 19-SEP-11
40 rows selected.
SQL> select table_name,index_name,column_name,column_position
2 FROM all_ind_columns
3 WHERE table_name IN ('IMTERMINATION', 'IMCONNECTIONDESIGN', 'IMCONNECTION')
4 order by table_name,index_name, column_position
5 /
TABLE_NAME INDEX_NAME
COLUMN_NAME
COLUMN_POSITION
IMCONNECTION IMCONNECTION_A_NE
ANETWORKELEMENTID
1
IMCONNECTION IMCONNECTION_A_NE
ANETWORKELEMENTID
1
IMCONNECTION IMCONNECTION_A_PORT
APORTID
1
IMCONNECTION IMCONNECTION_A_PORT
APORTID
1
IMCONNECTION IMCONNECTION_A_SITE
ASITEID
1
IMCONNECTION IMCONNECTION_A_SITE
ASITEID
1
IMCONNECTION IMCONNECTION_NET
NETWORKID
1
IMCONNECTION IMCONNECTION_NET
NETWORKID
1
IMCONNECTION IMCONNECTION_PK
OBJECTID
1
IMCONNECTION IMCONNECTION_PK
OBJECTID
1
IMCONNECTION IMCONNECTION_RES
RESERVATIONID
1
IMCONNECTION IMCONNECTION_RES
RESERVATIONID
1
IMCONNECTION IMCONNECTION_ST
RESOURCESTATE
1
IMCONNECTION IMCONNECTION_ST
RESOURCESTATE
1
IMCONNECTION IMCONNECTION_TYPEID
TYPEID
1
IMCONNECTION IMCONNECTION_TYPEID
TYPEID
1
IMCONNECTION IMCONNECTION_UR
USERSESSIONID
1
IMCONNECTION IMCONNECTION_UR
USERSESSIONID
1
IMCONNECTION IMCONNECTION_VK
VISUALKEY
1
IMCONNECTION IMCONNECTION_VK
VISUALKEY
1
IMCONNECTION IMCONNECTION_Z_NE
ZNETWORKELEMENTID
1
IMCONNECTION IMCONNECTION_Z_NE
ZNETWORKELEMENTID
1
IMCONNECTION IMCONNECTION_Z_PORT
ZPORTID
1
IMCONNECTION IMCONNECTION_Z_PORT
ZPORTID
1
IMCONNECTION IMCONNECTION_Z_SITE
ZSITEID
1
IMCONNECTION IMCONNECTION_Z_SITE
ZSITEID
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_CON
CONNECTIONID
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_CON
CONNECTIONID
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_PK
OBJECTID
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_PK
OBJECTID
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_ST
ASSIGNMENTSTATE
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_ST
ASSIGNMENTSTATE
1
IMTERMINATION IMTERMINATION_ID
TERMINATEDID
1
IMTERMINATION IMTERMINATION_ID
TERMINATEDID
1
IMTERMINATION IMTERMINATION_NE
NETWORKELEMENTID
1
IMTERMINATION IMTERMINATION_NE
NETWORKELEMENTID
1
IMTERMINATION IMTERMINATION_PORT
PORTID
1
IMTERMINATION IMTERMINATION_PORT
PORTID
1
IMTERMINATION IMTERMINATION_SITE
SITEID
1
IMTERMINATION IMTERMINATION_SITE
SITEID
1
40 rows selected.
Plan without sql hints:
SQL> select * from table(dbms_xplan.display)
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 2493901029
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 40 | 9960 | 6316 (1)| 00:01:16 |
| 1 | NESTED LOOPS | | 40 | 9960 | 6316 (1)| 00:01:16 |
| 2 | NESTED LOOPS | | 1359 | 160K| 3592 (1)| 00:00:44 |
| 3 | TABLE ACCESS BY INDEX ROWID| IMTERMINATION | 1359 | 16308 | 915 (1)| 00:00:11 |
|* 4 | INDEX RANGE SCAN | IMTERMINATION_NE | 1359 | | 6 (0)| 00:00:01 |
|* 5 | TABLE ACCESS BY INDEX ROWID| IMCONNECTIONDESIGN | 1 | 109 | 2 (0)| 00:00:01 |
|* 6 | INDEX UNIQUE SCAN | IMCONNECTIONDESIGN_PK | 1 | | 1 (0)| 00:00:01 |
|* 7 | TABLE ACCESS BY INDEX ROWID | IMCONNECTION | 1 | 128 | 2 (0)| 00:00:01 |
|* 8 | INDEX UNIQUE SCAN | IMCONNECTION_PK | 1 | | 1 (0)| 00:00:01 |
Predicate Information (identified by operation id):
4 - access("T1"."NETWORKELEMENTID"=9200150)
5 - filter("CD"."ASSIGNMENTSTATE"=2 OR "CD"."ASSIGNMENTSTATE"=3)
6 - access("CD"."OBJECTID"="TERMINATEDID")
7 - filter((("C"."CONSUMEDSIGNALTYPE"=21 OR "C"."CONSUMEDSIGNALTYPE"=22 OR
"C"."CONSUMEDSIGNALTYPE"=23 OR "C"."CONSUMEDSIGNALTYPE"=24 OR "C"."CONSUMEDSIGNALTYPE"=25 OR
"C"."CONSUMEDSIGNALTYPE"=26 OR "C"."CONSUMEDSIGNALTYPE"=27 OR "C"."CONSUMEDSIGNALTYPE"=28 OR
"C"."CONSUMEDSIGNALTYPE"=29 OR "C"."CONSUMEDSIGNALTYPE"=30 OR "C"."CONSUMEDSIGNALTYPE"=31 OR
"C"."CONSUMEDSIGNALTYPE"=32 OR "C"."CONSUMEDSIGNALTYPE"=33) OR ("C"."SIGNALTYPE"=21 OR
"C"."SIGNALTYPE"=22 OR "C"."SIGNALTYPE"=23 OR "C"."SIGNALTYPE"=24 OR "C"."SIGNALTYPE"=25 OR
"C"."SIGNALTYPE"=26 OR "C"."SIGNALTYPE"=27 OR "C"."SIGNALTYPE"=28 OR "C"."SIGNALTYPE"=29 OR
"C"."SIGNALTYPE"=30 OR "C"."SIGNALTYPE"=31 OR "C"."SIGNALTYPE"=32 OR "C"."SIGNALTYPE"=33)) AND
"C"."TYPEID"='$131')
8 - access("C"."OBJECTID"="CD"."CONNECTIONID")
32 rows selected. -
AWR Report - no data!!
Oracle Version: 11.1.0.7 64x
OS Version: Windows 2008 Server 64x
Hi There,
We're just trying to generate a awr report for one of our databases and the report is coming out with no data.
statistics_level parameter is set to "TYPICAL"; any idea to what's going on please?
Thanks
SQL>
SQL> @?/rdbms/admin/awrrpt.sql
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
1391811405 WEBTST 1 webtst
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Would you like an HTML report, or a plain text report?
Enter 'html' for an HTML report, or 'text' for plain text
Defaults to 'html'
Enter value for report_type: text
Type Specified: text
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
* 1391811405 1 WEBTST webtst WEBDBTST
Using 1391811405 for database Id
Using 1 for instance number
Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the most recent
(n) days of snapshots being listed. Pressing <return> without
specifying a number lists all completed snapshots.
Enter value for num_days: 1
Listing the last day's Completed Snapshots
Snap
Instance DB Name Snap Id Snap Started Level
webtst WEBTST 43973 12 May 2011 00:00 1
43974 12 May 2011 01:00 1
43975 12 May 2011 02:00 1
43976 12 May 2011 03:00 1
43977 12 May 2011 04:00 1
43978 12 May 2011 05:00 1
43979 12 May 2011 06:00 1
43980 12 May 2011 07:00 1
43981 12 May 2011 08:00 1
43982 12 May 2011 09:00 1
43983 12 May 2011 10:00 1
43984 12 May 2011 11:00 1
43985 12 May 2011 11:02 1
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 43984
Begin Snapshot Id specified: 43984
Enter value for end_snap: 43985
End Snapshot Id specified: 43985
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_43984_43985.txt. To use this name,
press <return> to continue, otherwise enter an alternative.
Enter value for report_name:
Using the report name awrrpt_1_43984_43985.txt
WARNING (-20023)
ORA-20023: Missing start and end values for time model stat: parse time elapsed
WARNING (-20023)
ORA-20023: Missing start and end values for time model stat: DB CPU
WARNING (-20016)
ORA-20016: Missing value for SGASTAT: free memory
WARNING (-20016)
ORA-20016: Missing value for SGASTAT: free memory
WARNING (-20009)
ORA-20009: Missing System Statistic logons current
WARNING (-20009)
ORA-20009: Missing System Statistic logons current
WARNING (-20009)
ORA-20009: Missing System Statistic opened cursors current
WARNING (-20009)
ORA-20009: Missing System Statistic opened cursors current
WARNING (-20023)
ORA-20023: Missing start and end values for time model stat: sql execute elapsed
WARNING (-20008)
ORA-20008: Missing Init.ora parameter undo_management
WARNING (-20008)
ORA-20008: Missing Init.ora parameter db_block_size
WARNING (-20016)
ORA-20016: Missing value for SGASTAT: log_buffer
WARNING (-20023)
ORA-20023: Missing start and end values for time model stat: DB time
WARNING (-20008)
ORA-20008: Missing Init.ora parameter timed_statistics
WARNING (-20008)
ORA-20008: Missing Init.ora parameter timed_statistics
WARNING (-20008)
ORA-20008: Missing Init.ora parameter statistics_level
WARNING (-20008)
ORA-20008: Missing Init.ora parameter statistics_level
WARNING (-20008)
ORA-20008: Missing Init.ora parameter sga_target
WARNING (-20008)
ORA-20008: Missing Init.ora parameter pga_aggregate_target
WARNING (-20023)
ORA-20023: Missing start and end values for time model stat: background cpu time
WARNING (-20023)
ORA-20023: Missing start and end values for time model stat: background elapsed
WARNING (-20023)
ORA-20023: Missing start and end values for time model stat: connection manageme
WARNING (-20016)
ORA-20016: Missing value for SGASTAT: buffer_cache
WARNING (-20016)
ORA-20016: Missing value for SGASTAT: buffer_cache
WARNING: Since the DB Time is less than one second, there was
minimal foreground activity in the snapshot period.
Some of the percentage values will be invalid.
WORKLOAD REPOSITORY report for
DB Name DB Id Instance Inst Num Startup Time Release RAC
WEBTST 1391811405 webtst 1 29-Apr-11 04:50 11.1.0.7.0 NO
Host Name Platform CPUs Cores Sockets Memory(GB)
WEBDBTST Microsoft Windows x86 64-bit .00
Snap Id Snap Time Sessions Curs/Sess
Begin Snap: 43984 12-May-11 11:00:01
End Snap: 43985 12-May-11 11:02:00
Elapsed: 1.98 (mins)
DB Time: 0.00 (mins)
Cache Sizes Begin End
~~~~~~~~~~~ ---------- ----------
Buffer Cache:MM Std Block Size:K
Shared Pool Size: 0M 0M Log Buffer:K
ORA-01403: no data found
Error encountered in Report Summary
Continuing to Report Sections
Time Model Statistics DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Operating System Statistics DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Operating System Statistics - DetailDB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Foreground Wait Class DB/Inst: WEBTST/webtst Snaps: 43984-43985
-> s - second, ms - millisecond - 1000th of a second
-> ordered by wait time desc, waits desc
-> %Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
-> Captured Time accounts for % of Total DB time .00 (s)
-> Total FG Wait Time: (s) DB CPU time: .00 (s)
Avg
%Time Total Wait wait
Wait Class Waits -outs Time (s) (ms) %DB time
DB CPU 0 100.0
Foreground Wait Events DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Background Wait Events DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Wait Event Histogram DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Service Statistics DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Service Wait Class Stats DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
SQL ordered by Elapsed Time DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
SQL ordered by CPU Time DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
SQL ordered by Gets DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
SQL ordered by Reads DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
SQL ordered by Executions DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
SQL ordered by Parse Calls DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
SQL ordered by Sharable Memory DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
SQL ordered by Version Count DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Instance Activity Stats DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Instance Activity Stats - Absolute ValuesDB/Inst: WEBTST/webtst Snaps: 43984
No data exists for this section of the report.
Instance Activity Stats - Thread ActivityDB/Inst: WEBTST/webtst Snaps: 43984-
No data exists for this section of the report.
Tablespace IO Stats DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
File IO Stats DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Buffer Pool Statistics DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Instance Recovery Stats DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Buffer Pool Advisory DB/Inst: WEBTST/webtst Snap: 43985
No data exists for this section of the report.
PGA Aggr Summary DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
PGA Aggr Target Stats DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
PGA Aggr Target Histogram DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
PGA Memory Advisory DB/Inst: WEBTST/webtst Snap: 43985
No data exists for this section of the report.
Shared Pool Advisory DB/Inst: WEBTST/webtst Snap: 43985
No data exists for this section of the report.
SGA Target Advisory DB/Inst: WEBTST/webtst Snap: 43985
No data exists for this section of the report.
Streams Pool Advisory DB/Inst: WEBTST/webtst Snap: 43985
No data exists for this section of the report.
Java Pool Advisory DB/Inst: WEBTST/webtst Snap: 43985
No data exists for this section of the report.
Buffer Wait Statistics DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Enqueue Activity DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Undo Segment Summary DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Undo Segment Stats DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Latch Activity DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Latch Sleep Breakdown DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Latch Miss Sources DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Mutex Sleep Summary DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Parent Latch Statistics DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Child Latch Statistics DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Segments by Row Lock Waits DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Segments by ITL Waits DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Segments by Buffer Busy Waits DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Dictionary Cache Stats DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Library Cache Activity DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Memory Dynamic Components DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Memory Resize Operations Summary DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Memory Resize Ops DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Process Memory Summary DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
sum
SGA breakdown difference DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Streams CPU/IO Usage DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Streams Capture DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Streams Apply DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Buffered Queues DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Buffered Subscribers DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Rule Set DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Persistent Queues DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Persistent Subscribers DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
Resource Limit Stats DB/Inst: WEBTST/webtst Snap: 43985
No data exists for this section of the report.
init.ora Parameters DB/Inst: WEBTST/webtst Snaps: 43984-43985
No data exists for this section of the report.
End of ReportSQL> show parameter statistics
NAME TYPE VALUE
optimizer_use_pending_statistics boolean FALSE
statistics_level string TYPICAL
timed_os_statistics integer 0
timed_statistics boolean TRUE
SQL>
SQL> SELECT statistics_name,
2 session_status,
3 system_status,
4 activation_level,
5 session_settable
6 FROM v$statistics_level
7 ORDER BY statistics_name;
STATISTICS_NAME SESSION_ SYSTEM_S ACTIVAT SES
Active Session History ENABLED ENABLED TYPICAL NO
Adaptive Thresholds Enabled ENABLED ENABLED TYPICAL NO
Automated Maintenance Tasks ENABLED ENABLED TYPICAL NO
Bind Data Capture ENABLED ENABLED TYPICAL NO
Buffer Cache Advice ENABLED ENABLED TYPICAL NO
Global Cache Statistics ENABLED ENABLED TYPICAL NO
Longops Statistics ENABLED ENABLED TYPICAL NO
MTTR Advice DISABLED DISABLED TYPICAL NO
Modification Monitoring ENABLED ENABLED TYPICAL NO
PGA Advice ENABLED ENABLED TYPICAL NO
Plan Execution Sampling ENABLED ENABLED TYPICAL YES
Plan Execution Statistics DISABLED DISABLED ALL YES
SQL Monitoring ENABLED ENABLED TYPICAL YES
Segment Level Statistics ENABLED ENABLED TYPICAL NO
Shared Pool Advice ENABLED ENABLED TYPICAL NO
Streams Pool Advice ENABLED ENABLED TYPICAL NO
Threshold-based Alerts ENABLED ENABLED TYPICAL NO
Time Model Events ENABLED ENABLED TYPICAL YES
Timed OS Statistics DISABLED DISABLED ALL YES
Timed Statistics ENABLED ENABLED TYPICAL YES
Ultrafast Latch Statistics ENABLED ENABLED TYPICAL NO
Undo Advisor, Alerts and Fast Ramp up ENABLED ENABLED TYPICAL NO
V$IOSTAT_* statistics ENABLED ENABLED TYPICAL NO
23 rows selected.
SQL>Thanks
Edited by: rsar001 on May 12, 2011 11:33 AM -
Hello,
Below I provide a complete code to re-produce the behavior I am observing. You could run it in tempdb or any other database, which is not important. The test query provided at the top of the script is pretty silly, but I have observed the same
performance degradation with about a dozen of various queries of different complexity, so this is just the simplest one I am using as an example here. Note that I also included approximate run times in the script comments (this is obviously based on what I
observed on my machine). Here are the steps with numbers corresponding to the numbers in the script:
1. Run script from #1 to #7. This will create the two test tables, populate them with records (40 mln. and 10 mln.) and build regular clustered indexes.
2. Run test query (at the top of the script). Here are the execution statistics:
Table 'Main'. Scan count 5, logical reads 151435, physical reads 0, read-ahead reads 4, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'Txns'. Scan count 5, logical reads 74155, physical reads 0, read-ahead reads 7, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'Workfile'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
SQL Server Execution Times:
CPU time = 5514 ms,
elapsed time = 1389 ms.
3. Run script from #8 to #9. This will replace regular clustered indexes with columnstore clustered indexes.
4. Run test query (at the top of the script). Here are the execution statistics:
Table 'Txns'. Scan count 4, logical reads 44563, physical reads 0, read-ahead reads 37186, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'Main'. Scan count 4, logical reads 54850, physical reads 2, read-ahead reads 96862, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'Workfile'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
SQL Server Execution Times:
CPU time = 828 ms,
elapsed time = 392 ms.
As you can see the query is clearly faster. Yay for columnstore indexes!.. But let's continue.
5. Run script from #10 to #12 (note that this might take some time to execute). This will move about 80% of the data in both tables to a different partition. You should be able to see the fact that the data has been moved when running Step #
11.
6. Run test query (at the top of the script). Here are the execution statistics:
Table 'Txns'. Scan count 4, logical reads 44563, physical reads 0, read-ahead reads 37186, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'Main'. Scan count 4, logical reads 54817, physical reads 2, read-ahead reads 96862, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'Workfile'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
SQL Server Execution Times:
CPU time = 8172 ms,
elapsed time = 3119 ms.
And now look, the I/O stats look the same as before, but the performance is the slowest of all our tries!
I am not going to paste here execution plans or the detailed properties for each of the operators. They show up as expected -- column store index scan, parallel/partitioned = true, both estimated and actual number of rows is less than during the second
run (when all of the data resided on the same partition).
So the question is: why is it slower?
Thank you for any help!
Here is the code to re-produce this:
--==> Test Query - begin --<===
DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE
SET STATISTICS IO ON
SET STATISTICS TIME ON
SELECT COUNT(1)
FROM Txns AS z WITH(NOLOCK)
LEFT JOIN Main AS mmm WITH(NOLOCK) ON mmm.ColBatchID = 70 AND z.TxnID = mmm.TxnID AND mmm.RecordStatus = 1
WHERE z.RecordStatus = 1
--==> Test Query - end --<===
--===========================================================
--1. Clean-up
IF OBJECT_ID('Txns') IS NOT NULL DROP TABLE Txns
IF OBJECT_ID('Main') IS NOT NULL DROP TABLE Main
IF EXISTS (SELECT 1 FROM sys.partition_schemes WHERE name = 'PS_Scheme') DROP PARTITION SCHEME PS_Scheme
IF EXISTS (SELECT 1 FROM sys.partition_functions WHERE name = 'PF_Func') DROP PARTITION FUNCTION PF_Func
--2. Create partition funciton
CREATE PARTITION FUNCTION PF_Func(tinyint) AS RANGE LEFT FOR VALUES (1, 2, 3)
--3. Partition scheme
CREATE PARTITION SCHEME PS_Scheme AS PARTITION PF_Func ALL TO ([PRIMARY])
--4. Create Main table
CREATE TABLE dbo.Main(
SetID int NOT NULL,
SubSetID int NOT NULL,
TxnID int NOT NULL,
ColBatchID int NOT NULL,
ColMadeId int NOT NULL,
RecordStatus tinyint NOT NULL DEFAULT ((1))
) ON PS_Scheme(RecordStatus)
--5. Create Txns table
CREATE TABLE dbo.Txns(
TxnID int IDENTITY(1,1) NOT NULL,
GroupID int NULL,
SiteID int NULL,
Period datetime NULL,
Amount money NULL,
CreateDate datetime NULL,
Descr varchar(50) NULL,
RecordStatus tinyint NOT NULL DEFAULT ((1))
) ON PS_Scheme(RecordStatus)
--6. Populate data (credit to Jeff Moden: http://www.sqlservercentral.com/articles/Data+Generation/87901/)
-- 40 mln. rows - approx. 4 min
--6.1 Populate Main table
DECLARE @NumberOfRows INT = 40000000
INSERT INTO Main (
SetID,
SubSetID,
TxnID,
ColBatchID,
ColMadeID,
RecordStatus)
SELECT TOP (@NumberOfRows)
SetID = ABS(CHECKSUM(NEWID())) % 500 + 1, -- ABS(CHECKSUM(NEWID())) % @Range + @StartValue,
SubSetID = ABS(CHECKSUM(NEWID())) % 3 + 1,
TxnID = ABS(CHECKSUM(NEWID())) % 1000000 + 1,
ColBatchId = ABS(CHECKSUM(NEWID())) % 100 + 1,
ColMadeID = ABS(CHECKSUM(NEWID())) % 500000 + 1,
RecordStatus = 1
FROM sys.all_columns ac1
CROSS JOIN sys.all_columns ac2
--6.2 Populate Txns table
-- 10 mln. rows - approx. 1 min
SET @NumberOfRows = 10000000
INSERT INTO Txns (
GroupID,
SiteID,
Period,
Amount,
CreateDate,
Descr,
RecordStatus)
SELECT TOP (@NumberOfRows)
GroupID = ABS(CHECKSUM(NEWID())) % 5 + 1, -- ABS(CHECKSUM(NEWID())) % @Range + @StartValue,
SiteID = ABS(CHECKSUM(NEWID())) % 56 + 1,
Period = DATEADD(dd,ABS(CHECKSUM(NEWID())) % 365, '05-04-2012'), -- DATEADD(dd,ABS(CHECKSUM(NEWID())) % @Days, @StartDate)
Amount = CAST(RAND(CHECKSUM(NEWID())) * 250000 + 1 AS MONEY),
CreateDate = DATEADD(dd,ABS(CHECKSUM(NEWID())) % 365, '05-04-2012'),
Descr = REPLICATE(CHAR(65 + ABS(CHECKSUM(NEWID())) % 26), ABS(CHECKSUM(NEWID())) % 20),
RecordStatus = 1
FROM sys.all_columns ac1
CROSS JOIN sys.all_columns ac2
--7. Add PK's
-- 1 min
ALTER TABLE Txns ADD CONSTRAINT PK_Txns PRIMARY KEY CLUSTERED (RecordStatus ASC, TxnID ASC) ON PS_Scheme(RecordStatus)
CREATE CLUSTERED INDEX CDX_Main ON Main(RecordStatus ASC, SetID ASC, SubSetId ASC, TxnID ASC) ON PS_Scheme(RecordStatus)
--==> Run test Query --<===
--===========================================================
-- Replace regular indexes with clustered columnstore indexes
--===========================================================
--8. Drop existing indexes
ALTER TABLE Txns DROP CONSTRAINT PK_Txns
DROP INDEX Main.CDX_Main
--9. Create clustered columnstore indexes (on partition scheme!)
-- 1 min
CREATE CLUSTERED COLUMNSTORE INDEX PK_Txns ON Txns ON PS_Scheme(RecordStatus)
CREATE CLUSTERED COLUMNSTORE INDEX CDX_Main ON Main ON PS_Scheme(RecordStatus)
--==> Run test Query --<===
--===========================================================
-- Move about 80% the data into a different partition
--===========================================================
--10. Update "RecordStatus", so that data is moved to a different partition
-- 14 min (32002557 row(s) affected)
UPDATE Main
SET RecordStatus = 2
WHERE TxnID < 800000 -- range of values is from 1 to 1 mln.
-- 4.5 min (7999999 row(s) affected)
UPDATE Txns
SET RecordStatus = 2
WHERE TxnID < 8000000 -- range of values is from 1 to 10 mln.
--11. Check data distribution
SELECT
OBJECT_NAME(SI.object_id) AS PartitionedTable
, DS.name AS PartitionScheme
, SI.name AS IdxName
, SI.index_id
, SP.partition_number
, SP.rows
FROM sys.indexes AS SI WITH (NOLOCK)
JOIN sys.data_spaces AS DS WITH (NOLOCK)
ON DS.data_space_id = SI.data_space_id
JOIN sys.partitions AS SP WITH (NOLOCK)
ON SP.object_id = SI.object_id
AND SP.index_id = SI.index_id
WHERE DS.type = 'PS'
AND OBJECT_NAME(SI.object_id) IN ('Main', 'Txns')
ORDER BY 1, 2, 3, 4, 5;
PartitionedTable PartitionScheme IdxName index_id partition_number rows
Main PS_Scheme CDX_Main 1 1 7997443
Main PS_Scheme CDX_Main 1 2 32002557
Main PS_Scheme CDX_Main 1 3 0
Main PS_Scheme CDX_Main 1 4 0
Txns PS_Scheme PK_Txns 1 1 2000001
Txns PS_Scheme PK_Txns 1 2 7999999
Txns PS_Scheme PK_Txns 1 3 0
Txns PS_Scheme PK_Txns 1 4 0
--12. Update statistics
EXEC sys.sp_updatestats
--==> Run test Query --<===Hello Michael,
I just simulated the situation and got the same results as in your description. However, I did one more test - I rebuilt the two columnstore indexes after the update (and test run). I got the following details:
Table 'Txns'. Scan count 8, logical reads 12922, physical reads 1, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'Main'. Scan count 8, logical reads 57042, physical reads 1, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'Workfile'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
SQL Server Execution Times:
CPU time = 251 ms, elapsed time = 128 ms.
As an explanation of the behavior - because of the UPDATE statement in CCI is executed as a DELETE and INSERT operation, you had all original row groups of the index with almost all data deleted and almost the same amount of new row groups with new data
(coming from the update). I suppose scanning the deleted bitmap caused the additional slowness at your end or something related with that "fragmentation".
Ivan Donev MCITP SQL Server 2008 DBA, DB Developer, BI Developer -
My Database Server is running very slow
Hi,
I have two tables as shown below
CREATE TABLE DummyTbl1
Id NUMBER(10),
Type NUMBER(10),
ComponentId NUMBER(10),
CompType NUMBER(10),
CompNum NUMBER(10),
CompParentNum NUMBER(10),
CompDBId NUMBER(10),
TimeStamp DATE,
Severity NUMBER(10),
Category NUMBER(10),
State NUMBER(10),
CauseType NUMBER(10),
CauseCode NUMBER(10),
UnitType NUMBER(10),
UnitId NUMBER(10),
UnitName VARCHAR2(256),
UnitDBId NUMBER(10),
ServerName VARCHAR2(256),
AckTimeStamp DATE,
DelTimeStamp DATE,
StrParam VARCHAR2(256),
CustomerId NUMBER(10),
ParentCustId NUMBER(10),
ExtraParam1 NUMBER(10),
ExtraParam2 NUMBER(10),
ExtraParam3 NUMBER(10),
ExtraStrParam VARCHAR2(256),
futureInt1 NUMBER (10),
futureInt2 NUMBER (10),
futureInt3 NUMBER (10) ,
futureInt4 NUMBER (10) ,
futureStr1 VARCHAR2(256) ,
futureStr2 VARCHAR2(256)
CREATE TABLE DummyTbl2
Id NUMBER(10),
ComponentId NUMBER(10),
CustomerId NUMBER(10),
ProfileId NUMBER(10),
ParentProfileId NUMBER(10),
String LONG RAW,
ScriptName VARCHAR2(256),
SrcIPAddress NUMBER(10),
DestIPAddress NUMBER(10),
SrcPort NUMBER(10),
DestPort NUMBER(10),
SessionId NUMBER(10),
IFId NUMBER (10),
SessionDir NUMBER (10),
RuleId NUMBER (10),
CustomerName RAW(512),
futureInt1 NUMBER (10),
futureInt2 NUMBER (10),
futureInt3 NUMBER (10),
futureInt4 NUMBER (10),
futureStr1 VARCHAR2(256),
futureStr2 VARCHAR2(256)
I also have a sequence
CREATE SEQUENCE dummyid_seq START WITH 1 INCREMENT BY 1;
The queries I am doing per transaction are as below
1)SELECT dummyid_seq.NextVal FROM Dual;
2)INSERT INTO DummyTbl1 (Id, ComponentId, CompNum, CompType, CompParentNum, CompDbId, TimeStamp, Severity, Category,
State, CauseType, CauseCode, UnitType, UnitId, UnitName, UnitDBId, ServerName, StrParam, CustomerId, ParentCustId,
ExtraParam1, ExtraParam2, ExtraParam3, ExtraStrParam,Type) VALUES( 186,805322753, 1, 3, 1, 1,
TO_DATE('2004-05-06 10:26:07', 'YYYY-MM-DD HH24:MI:SS'), 3, 2, 2, 0, 10, 0, 0, '',0, 'ipe3k_vpn',
'FTP_CTRL', 18, 0,1,1,0,'H',3);
3)INSERT INTO DummyTbl2 (Id, ComponentId, CustomerId, ScriptName, ProfileId, String, ParentProfileId,
SrcIPAddress, DestIPAddress, SrcPort, DestPort, SessionId, IFid, SessionDir, RuleId, CustomerName) VALUES ( 186,
805322753, 18, '', 0, 'ABCDABCDABCDABCD', 0, 3232248321, 2886739969, 1691, 80, 2986, 1, 1, 1023, 'ABCDABCDABCDABCD');
4)COMMIT;
The no. of transactions that I am able to achieve are 71 per seconds, whereas I need of the magnitude of 5000 per sec.
Please let me know of all those things I need to tune for a better performance.
Thanks,
TuhinHello Tuhin,
Performance tuning is a big subject and you should have a look at the documentation - http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96533/toc.htm
As for these particular insert statements you need to see what is taking so long. A good place to start would be to use auto trace (set autotrace on) in sqlplus. This will show you the execution plan and the execution statistics for each statement. Once you have these, it will probably be worth posting them up here, as there may be something that stands out as taking most the time in the query. Are the tables on a remote site by any chance? If they are, this could go some way to explaining the length of time for inserts. Other things could be triggers, number of indexes etc etc. As I said, performance tuning is a big subject but with the auto trace info you'll get a good idea of where to start.
HTH
David -
XE and 10g performance comparison
Hi all,
does anyone compared the performance of both systems? What I mean is, would the same query, on the same machine, on the same data and identic plans result in the same execution statistics, hence result in the same run-time on both systems. Or is there somekind of a undocumented bottleneck?
More precisely I would like to source out small domains of my data warehouse on machines running XE. I know that there are no bitmap indizes available, but I think that should be fine for small data sets (between 5mb and 1000mb).
Thanks in advance
MaikThanks for your responses. I did some measurements on the weekend comparing the performance of Oracle XE and Oracle 9.2.0.6.0, because I had no 10gR2 ready to hand. SGA, PGA, cache size, shared_pool_size were set to the same sizes.
The result was, that the XE performed 5-6 times slower than the same queries on the 9i database, even with exactly the same execution statistics, as you can see on the example below.
Does anyone has an idea where this run-time overhead is coming from?
Maik
XE:
Elapsed: 00:00:00.06
Statistics
0 recursive calls
0 db block gets
2567 consistent gets
0 physical reads
0 redo size
2860 bytes sent via SQL*Net to client
461 bytes received via SQL*Net from client
9 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
115 rows processed
9i:
Elapsed: 00:00:00.01
Statistics
0 recursive calls
0 db block gets
2567 consistent gets
0 physical reads
0 redo size
2754 bytes sent via SQL*Net to client
576 bytes received via SQL*Net from client
9 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
115 rows processed -
I guess it's a bit late for christmas, but here's my wishlist for Raptor.
1. Statement execution statistics (autotrace).
2. Ability to browse different between different schemas without having to create a new
connection for each one.
3. Tabs are great. But opening a new tab for each stored proc clicked is pretty
annoying. Especially when you are searching through some stored procs to find
the SQL statement that your STATPACKS turned up. A CTRL toggle to open a new tab or use back existing tab will be great
4. Execution Plan is great. TKPROF would be even better.
Anyways, great first attempt. For a free product it's already way beyond what i
would expect.Tuning will be greatly increased for 1.1.
One thing to find your code is look at the search source report. Then you could get the exact object your looking for.
-kris
Maybe you are looking for
-
I am trying to sync my contacts between my iphone and my Windows 8.1 computer.
My iphone says that it is version 7.1.2 in the settings. My computer is a Dell with Windows 8.1. I was able to get the devices to sync for music and pictures, but not the contacts. Would the contacts be saved in Outlook on my computer?
-
Batch determination in production order
Hi all, Raw materiala are manged in batches and finished products are in serial numbers. when I release the production order the batch is not determining automatically. can any body expalin the SPRO settings for automatic determination of batch. Than
-
Vendor, Email Addresses, Correspondence of Payments?
Dear Readers, How do I enable vendor payment notification and clearing through the email of the Vendors given in FK01. How do we email vendors using their email in SAP? How do we use SAP for this? How does SAP correspond with the email bearers? How i
-
Condition record exist, but has not been set
I am creating proforma invoice for STO replenishment delivery. I am getting error log "Billing type contains split criteria, n invoiced:123456789, invoice not required". But I am able to save it. I used all standard settings for copy control and bill
-
Can a printer that supports PostScript 3 and PDF direct, support the use of JDF files? I would like to send a JDF file to perform such tasks as tray selection, number of copies or duplexing. I am using Lexmark C736 and C935. If they do support thi