PCT_FREE
I am creating a table:
Create table MEDLEMMAR_NEW (
MEDLEMS_NR NUMBER (10,0),
BLABSSSS VARCHAR2 (6),
EFTERNAMN VARCHAR2 (25),
FÖRNAMN VARCHAR2 (25),
ADRESS VARCHAR2 (100),
STAD VARCHAR2 (30),
TELEFON VARCHAR2 (15),
ANSLUTNINGS_DATUM DATE default SYSDATE ,
BIBLIOTEKS_NR NUMBER (10,0),
CONSTRAINT CEFT_NAMN__NN_NEW CHECK ( "EFTERNAMN" IS NOT NULL ),
CONSTRAINT CANS_DAT__NN_NEW CHECK ( "ANSLUTNINGS_DATUM" IS NOT NULL ),
CONSTRAINT MEDLEM_BIBLIOTEK_FK_NEW FOREIGN KEY ( BIBLIOTEKS_NR ) REFERENCES BIBLIOTEK ( BIBLIOTEKS_NR ),
CONSTRAINT CMEDL_NR_PK_NEW PRIMARY KEY ( MEDLEMS_NR ))
tablespace CDX_DAT01
PCTUSED 40 PCTFREE 10
INITRANS 1
MAXTRANS 255
When i look on user_tables it says that the pct_used is NULL becouse the tablespace is created whit segment_space_management: (AUTO)
And when i look on "script" it says that the pct_used is "0"
But i create it whit 40
what does 40 and null have to do whit 0?
Hi,
Can i now where u extracted the script?
ANd when you are using segment space management as auto..this means that pctfree and pctused wil be handled by the oracle server itself. Pctfree and pctused are basically concerned with the space in blocks. Pctused =0 and pctused set to null are different things. Pctused can be set to 0 in segment space management as manual. It is set to null automaticaly when segment space management is auto.
Regards
Similar Messages
-
Pct_free,pct_used
Hi,
Please find the below details for table fragmentation :
windows Server 2003
oracle database version : 10.2.0.4
Table Owner (Schema) Table Name TABLE Size (With Fragmentation) Actual data in table Difference
ACCMAN S_DEDUP_RESULT 979 MB 357 MB 622 MB
SQL> select pct_free,pct_used,table_name from dba_tables where table_name='S_DEDUP_RESULT' and owner='ACCMAN';
PCT_FREE PCT_USED TABLE_NAME
40 S_DEDUP_RESULT
Would a re-org activity release space ?
re-org tables by export/import will release the space ?
also, please let me know is there any impact on re-org due to pctfree & pctused.
Thanks,1) PCT_USED has nothing to do with monitoring a table for fragmentation - you have a misconception here
2) It is questionable whether reorganizing tables is actually required at all
See here for a brief explanation for 2)
http://uhesse.com/2010/08/23/reorganizing-tables-in-oracle-is-it-worth-the-effort/
Kind regards
Uwe Hesse
"Don't believe it, test it!"
http://uhesse.com -
Can I change PCT_FREE for selected tables During Datapump Operation
Hello,
I would like to know if it is possible to change the PCT_FREE for a few tables during ether an expdb or a impdb?
Thanks for any help.You may have to pre-create the table(s) before import and use TABLE_EXISTS_ACTION=TRUNCATE.
:p -
Tweak for sql query - help needed for smalll change
Hi.
I am trying to run a script that checks for used space on all tablespaces and returns the results.
So far so good:
set lines 200 pages 2000
col tablespace_name heading 'Tablespace' format a30 truncate
col total_maxspace_mb heading 'MB|Max Size' format 9G999G999
col total_allocspace_mb heading 'MB|Allocated' format 9G999G999
col used_space_mb heading 'MB|Used' format 9G999G999D99
col free_space_mb heading 'MB|Free Till Max' like used_space_mb
col free_space_ext_mb heading 'MB|Free Till Ext' like used_space_mb
col pct_used heading '%|Used' format 999D99
col pct_free heading '%|Free' like pct_used
break on report
compute sum label 'Total Size:' of total_maxspace_mb total_allocspace_mb used_space_mb - free_space_mb (used_space_mb/total_maxspace_mb)*100 on report
select
alloc.tablespace_name,
(alloc.total_allocspace_mb - free.free_space_mb) used_space_mb,
free.free_space_mb free_space_ext_mb,
((alloc.total_allocspace_mb - free.free_space_mb)/alloc.total_maxspace_mb)*100 pct_used,
((free.free_space_mb+(alloc.total_maxspace_mb-alloc.total_allocspace_mb))/alloc.total_maxspace_mb)*100 pct_free
FROM (SELECT tablespace_name,
ROUND(SUM(CASE WHEN maxbytes = 0 THEN bytes ELSE maxbytes END)/1048576) total_maxspace_mb,
ROUND(SUM(bytes)/1048576) total_allocspace_mb
FROM dba_data_files
WHERE file_id NOT IN (SELECT FILE# FROM v$recover_file)
GROUP BY tablespace_name) alloc,
(SELECT tablespace_name,
SUM(bytes)/1048576 free_space_mb
FROM dba_free_space
WHERE file_id NOT IN (SELECT FILE# FROM v$recover_file)
GROUP BY tablespace_name) free
WHERE alloc.tablespace_name = free.tablespace_name (+)
ORDER BY pct_used DESC
The above returns something like this:
MB MB % %
Tablespace Used Free Till Ext Used Free
APPS_TS_ARCHIVE 1,993.13 54.88 97.32 2.68
APPS_TS_TX_IDX 14,756.13 1,086.88 91.37 8.63
APPS_TS_TX_DATA 20,525.75 594.25 80.18 19.82
APPS_TS_MEDIA 6,092.00 180.00 74.37 25.63
APPS_TS_INTERFACE 13,177.63 366.38 71.49 28.51
The above works fine, but I would like to further change the query so that only those tablespaces with free space less than 5% (or used space more than 95%) are returned.
I have been working on this all morning and wanted to open it up to the masters!
I have tried using WHERE pct_used > 95 but to no avail.
Any advice would be appreciated.
Many thanks.
10.2.0.4
Linux Red Hat 4.Thanks for that.
What is confusing is that the below query works for every other (about 10 others) database but not this one (?)
SQL> set lines 200 pages 2000
SQL>
SQL> col tablespace_name heading 'Tablespace' format a30 truncate
SQL> col total_maxspace_mb heading 'MB|Max Size' format 9G999G999
SQL> col total_allocspace_mb heading 'MB|Allocated' format 9G999G999
SQL> col used_space_mb heading 'MB|Used' format 9G999G999D99
SQL> col free_space_mb heading 'MB|Free Till Max' like used_space_mb
SQL> col free_space_ext_mb heading 'MB|Free Till Ext' like used_space_mb
SQL> col pct_used heading '%|Used' format 999D99
SQL> col pct_free heading '%|Free' like pct_used
SQL>
SQL> break on report
SQL> compute sum label 'Total Size:' of total_maxspace_mb total_allocspace_mb used_space_mb - free_space_mb (used_space_mb/total_maxspace_mb)*100 on report
SQL>
SQL> select /*+ALL_ROWS */
2 alloc.tablespace_name,
3 alloc.total_maxspace_mb,
4 alloc.total_allocspace_mb,
5 (alloc.total_allocspace_mb - free.free_space_mb) used_space_mb,
6 free.free_space_mb+(alloc.total_maxspace_mb-alloc.total_allocspace_mb) free_space_mb,
7 free.free_space_mb free_space_ext_mb,
8 ((alloc.total_allocspace_mb - free.free_space_mb)/alloc.total_maxspace_mb)*100 pct_used,
9 ((free.free_space_mb+(alloc.total_maxspace_mb-alloc.total_allocspace_mb))/alloc.total_maxspace_mb)*100 pct_free
10 FROM (SELECT tablespace_name,
11 ROUND(SUM(CASE WHEN maxbytes = 0 THEN bytes ELSE maxbytes END)/1048576) total_maxspace_mb,
12 ROUND(SUM(bytes)/1048576) total_allocspace_mb
13 FROM dba_data_files
14 WHERE file_id NOT IN (SELECT FILE# FROM v$recover_file)
15 GROUP BY tablespace_name) alloc,
16 (SELECT tablespace_name,
17 SUM(bytes)/1048576 free_space_mb
18 FROM dba_free_space
19 WHERE file_id NOT IN (SELECT FILE# FROM v$recover_file)
20 GROUP BY tablespace_name) free
21 WHERE alloc.tablespace_name = free.tablespace_name (+)
22 ORDER BY pct_used DESC
23 /
((alloc.total_allocspace_mb - free.free_space_mb)/alloc.total_maxspace_mb)*100 pct_used,
ERROR at line 8:
ORA-01476: divisor is equal to zero -
Global temp table problem w/ODP?
I'm using the current version of the ODP .NET data adapter to access a global temporary table on an Oracle
9.2.0.4.0 server created with -
CREATE GLOBAL TEMPORARY TABLE euik_dex_open_tasks_temp1
(resource_id NUMBER,
task_assignment_id NUMBER,
task_id NUMBER,
incident_id NUMBER,
customer_product_id NUMBER,
inventory_item_id NUMBER,
contract_service_id NUMBER)
ON COMMIT DELETE ROWS
(See below for what is returned from the data dictionary for this table)
If I use SQLPlus to insert a row into this table, then query the table immediately, I see the inserted row.
If I use the same exact SQL through the ODP adapter, the ExecuteNonQuery statement returns the fact the 1 row was inserted. However, doing a SELECT from the table immediately after the INSERT, no rows are returned. See the .NET test ap, below.
Also, note that if I use a global temp table made with ON COMMIT PRESERVE ROWS, the ODP adapter works fine.
What am I doing wrong? Thanks in advance...
Pat
Private Sub TestTempTable()
Dim Str1 As New System.Text.StringBuilder
Dim Strx As New System.Text.StringBuilder
Dim StrOut As New System.Text.StringBuilder
Dim nInsert As Integer
Dim nRow As Integer
'Insert into the global temp table
Str1.Append("INSERT INTO euik_dex_open_tasks_temp1(resource_id, " & vbCrLf)
Str1.Append(" task_Assignment_id, " & vbCrLf)
Str1.Append(" task_id, " & vbCrLf)
Str1.Append(" incident_id, " & vbCrLf)
Str1.Append(" customer_product_id, " & vbCrLf)
Str1.Append(" inventory_item_id, " & vbCrLf)
Str1.Append(" contract_service_id) " & vbCrLf)
Str1.Append(" VALUES(1,2,3,4,5,6,7)" & vbCrLf)
Dim cn As New Oracle.DataAccess.Client.OracleConnection
Dim dr As Oracle.DataAccess.Client.OracleDataReader
Dim cd As New Oracle.DataAccess.Client.OracleCommand
Try
cn.ConnectionString = "Data Source=XXX;User ID=mickey;Password=mouse;"
cd.CommandType = CommandType.Text
cd.Connection = cn
cn.Open()
'Run the query to load data in the temp table
cd.CommandText = Str1.ToString()
nInsert = cd.ExecuteNonQuery()
MessageBox.Show(nInsert & " row(s) inserted.")
'See if there are rows in the temp table
Strx.Append("Select * from euik_dex_open_tasks_temp1")
cd.CommandText = Strx.ToString()
dr = cd.ExecuteReader
nRow = 0
While dr.Read
StrOut.Append(dr(0) & vbCrLf)
nRow = nRow + 1
End While
MessageBox.Show(nRow & " row(s) selected.")
Catch ex As OracleClient.OracleException
MessageBox.Show(ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
cn.Close()
End Try
End Sub
OWNER TABLE_NAME TABLESPACE_NAME CLUSTER_NAME IOT_NAME PCT_FREE PCT_USED
INI_TRANS MAX_TRANS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE
FREELISTS FREELIST_GROUPS LOGGING BACKED_UP NUM_ROWS BLOCKS EMPTY_BLOCKS AVG_SPACE
CHAIN_CNT AVG_ROW_LEN AVG_SPACE_FREELIST_BLOCKS NUM_FREELIST_BLOCKS DEGREE INSTANCES
CACHE TABLE_LOCK SAMPLE_SIZE LAST_ANALYZED PARTITIONED IOT_TYPE TEMPORARY
SECONDARY NESTED BUFFER_POOL ROW_MOVEMENT GLOBAL_STATS USER_STATS DURATION
SKIP_CORRUPT MONITORING CLUSTER_OWNER DEPENDENCIES COMPRESSION
APPS EUIK_DEX_OPEN_TASKS_TEMP1 10 40 1 255
1 1 NO N
1 1 N ENABLED NO Y N NO
DEFAULT DISABLED NO NO SYS$TRANSACTION DISABLED NO DISABLED
DISABLEDAndrew,
As David indicated if you do not wish to have "auto commit mode" you just need to use a transaction object to manually control the transaction.
I'm just nervous at the idea of ODP.NET initiating interactions I am not aware of.I think it would be more fair to say "finishing interactions" in this case rather than "initiating interactions" but you could always just run a SQL trace from the database to see exactly what is happening if you are concerned.
HTH,
- Mark
=======================================
Mark A. Williams
Oracle DBA
Author, Professional .NET Oracle Programming
http://www.apress.com/book/bookDisplay.html?bID=378 -
Unable to create a bitmap index
Hi,
I want to create a bitmap index on one of the colums on a table. I fired following query and it failed.
SQL> CREATE BITMAP INDEX TRANS_N_BITMAPIDX_VEH_PLATFORM ON TRANSACTION_NEW(VEH_PLATFORM) LOCAL;
Error starting at line 2 in command:
CREATE BITMAP INDEX TRANS_N_BITMAPIDX_VEH_PLATFORM ON TRANSACTION_NEW(VEH_PLATFORM) LOCAL
Error at Command Line:2 Column:70
Error report:
SQL Error: ORA-01408: such column list already indexed
01408. 00000 - "such column list already indexed"
*Cause:
*Action:I found there is a combined NORMAL index with VEH_PLATFORM column called ‘IDX$$_30AA00021’. It has following columns
• VEH_PLATFORM
• VEH_MODEL
• MODL_YR_NBR
• VEH_MAKE
• TXN_PROCS_DT
But I was able to create bitmap index on VEH_MODEL,MODL_YR_NBR and VEH_MAKE columns without any error.
Why does it error out for VEH_PLATFORM column?
Regards,
SamHi,
I am sure that BITMAP index is only created for
VEH_MAKE
VEH_MODEL
MODL_YR_NBR
BUILD_REGION
VEH_LINE_SERIES
TRANS_CTG_ID
and not for VEH_PLATFORM.
SQL> SELECT * FROM USER_INDEXES WHERE INDEX_TYPE='BITMAP' AND TABLE_NAME='TRANSACTION_NEW';
INDEX_NAME INDEX_TYPE TABLE_OWNER TABLE_NAME TABLE_TYPE UNIQUENESS COMPRESSION PREFIX_LENGTH TABLESPACE_NAME INI_TRANS MAX_TRANS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE PCT_THRESHOLD INCLUDE_COLUMN FREELISTS FREELIST_GROUPS PCT_FREE LOGGING BLEVEL LEAF_BLOCKS DISTINCT_KEYS AVG_LEAF_BLOCKS_PER_KEY AVG_DATA_BLOCKS_PER_KEY CLUSTERING_FACTOR STATUS NUM_ROWS SAMPLE_SIZE LAST_ANALYZED DEGREE INSTANCES PARTITIONED TEMPORARY GENERATED SECONDARY BUFFER_POOL FLASH_CACHE CELL_FLASH_CACHE USER_STATS DURATION PCT_DIRECT_ACCESS ITYP_OWNER ITYP_NAME PARAMETERS GLOBAL_STATS DOMIDX_STATUS DOMIDX_OPSTATUS FUNCIDX_STATUS JOIN_INDEX IOT_REDUNDANT_PKEY_ELIM DROPPED VISIBILITY DOMIDX_MANAGEMENT SEGMENT_CREATED
TRANS_N_BITMAPIDX_MAKE BITMAP VISUAL TRANSACTION_NEW TABLE NONUNIQUE DISABLED 2 6102 20 305 611 12226 N/A 12226 2208 11-MAY-11 1 1 YES N N N DEFAULT DEFAULT DEFAULT NO YES NO NO NO VISIBLE N/A
TRANS_N_BITMAPIDX_MODEL BITMAP VISUAL TRANSACTION_NEW TABLE NONUNIQUE DISABLED 2 11284 158 71 144 22813 N/A 22813 2321 11-MAY-11 1 1 YES N N N DEFAULT DEFAULT DEFAULT NO YES NO NO NO VISIBLE N/A
TRANS_N_BITMAPIDX_BUILD_REGION BITMAP VISUAL TRANSACTION_NEW TABLE NONUNIQUE DISABLED 2 2911 5 582 1161 5808 N/A 5808 5808 11-MAY-11 1 1 YES N N N DEFAULT DEFAULT DEFAULT NO YES NO NO NO VISIBLE N/A
TRANS_N_BITMAPIDX_MODL_YR_NBR BITMAP VISUAL TRANSACTION_NEW TABLE NONUNIQUE DISABLED 2 2911 5 582 1161 5808 N/A 5808 5808 11-MAY-11 1 1 YES N N N DEFAULT DEFAULT DEFAULT NO YES NO NO NO VISIBLE N/A
TRANS_N_BITMAPIDX_TRANS_CTG_ID BITMAP VISUAL TRANSACTION_NEW TABLE NONUNIQUE DISABLED 2 7547 43 175 359 15457 N/A 15457 2345 11-MAY-11 1 1 YES N N N DEFAULT DEFAULT DEFAULT NO YES NO NO NO VISIBLE N/A
TRANS_N_BITMAPIDX_VEH_LINE_S BITMAP VISUAL TRANSACTION_NEW TABLE NONUNIQUE DISABLED 2 10581 253 41 84 21477 N/A 21477 2247 11-MAY-11 1 1 YES N N N DEFAULT DEFAULT DEFAULT NO YES NO NO NO VISIBLE N/A
6 rows selectedRegards,
Sam -
Capacity Planning for Creation of Table
Hello Guys,
I just need some advise here.
I have been told to work out the space needed for the creation of a table.
The table in question would have three columns with datatypes [num(10), varchar(10),date] and would be loaded with 100,000 rows. How do I go about it.
Thanks in AdvanceTry with something like this, may help you.
Prerreqs: parameter OPTIMIZER_MODE != RULE.
grant to execute DBMS_SPACE
DDL Table creation:
CREATE TABLE SAMPLE
ID NUMBER(9),
NAME VARCHAR(50),
CREATE_DATE_TIME DATE,
MOD_DATE_TIME DATE,
USER_ID VARCHAR(15)
set serveroutput on
declare
calc_used_bytes NUMBER;
calc_alloc_bytes NUMBER;
cols sys.create_table_cost_columns;
begin
cols := sys.create_table_cost_columns
sys.create_table_cost_colinfo('NUMBER', 9),
sys.create_table_cost_colinfo('VARCHAR2', 50),
sys.create_table_cost_colinfo('VARCHAR2', 15),
sys.create_table_cost_colinfo('DATE', NULL),
sys.create_table_cost_colinfo('DATE', NULL)
DBMS_SPACE.CREATE_TABLE_COST (
tablespace_name => 'USERS',
--avg_row_size => 100, quitar comentario para 11g
row_count => 5000,
pct_free => 10,
used_bytes => calc_used_bytes,
alloc_bytes => calc_alloc_bytes
dbms_output.put_line('Used (M): '||round(calc_used_bytes/(1024*1024)));
dbms_output.put_line('Allocated (M): '||round(calc_alloc_bytes/(1024*1024)));
end;
/More info: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_space.htm#i1003180
Regards.
johnxjean
Edited by: johnxjean on 18-Mar-2011 09:43
Edited by: johnxjean on 18-Mar-2011 09:44 -
TIPS(18) : CREATING SCRIPTS TO RECREATE A TABLE STRUCTURE
제품 : SQL*PLUS
작성날짜 : 1996-11-12
TIPS(18) : Creating Scripts to Recreate a Table Structure
=========================================================
The script creates scripts that can be used to recreate a table structure.
For example, this script can be used when a table has become fragmented or to
get a defintion that can be run on another database.
CREATES SCRIPT TO RECREATE A TABLE-STRUCTURE
INCL. STORAGE, CONSTRAINTS, TRIGGERS ETC.
This script creates scripts to recreate a table structure.
Use the script to reorganise a table that has become fragmented,
to get a definition that can be run on another database/schema or
as a basis for altering the table structure (eg. drop a column!).
IMPORTANT: Running the script is safe as it only creates two new scripts and
does not do anything to your database! To get anything done you have to run the
scripts created.
The created scripts does the following:
1. save the content of the table
2. drop any foreign key constraints referencing the table
3. drop the table
4. creates the table with an Initial storage parameter that
will accomodate the entire content of the table. The Next
parameter is 25% of the initial.
The storage parameters are picked from the following list:
64K, 128K, 256K, 512K, multiples of 1M.
5. create table and column comments
6. fill the table with the original content
7. create all the indexes incl storage parameters as above.
8. add primary, unique key and check constraints.
9. add foreign key constraints for the table and for referencing
tables.
10.Create the table's triggers.
11.Compile any depending objects (cascading).
12.Grant table and column privileges.
13.Create synonyms.
This script must be run as the owner of the table.
If your table contains a LONG-column, use the COPY
command in SQL*Plus to store/restore the data.
USAGE
from SQL*Plus:
start reorgtb
This will create the scripts REORGS1.SQL and REORGS2.SQL
REORGS1.SQL contains code to save the current content of the table.
REORGS2.SQL contains code to rebuild the table structure.
undef tab;
set echo off
column a1 new_val stor
column b1 new_val nxt
select
decode(sign(1024-sum(bytes)/1024),-1,to_char((round(sum(bytes)/(1024*1
024))+1))||'M', /* > 1M new rounded up to nearest Megabyte */
decode(sign(512-sum(bytes)/1024), -1,'1M',
decode(sign(256-sum(bytes)/1024), -1,'512K',
decode(sign(128-sum(bytes)/1024), -1,'256K',
decode(sign(64-sum(bytes)/1024) , -1,'128K',
'64K'
a1,
decode(sign(1024-sum(bytes)/4096),-1,to_char((round(sum(bytes)/(4096*1
024))+1))||'M', /* > 1M new rounded up to nearest Megabyte */
decode(sign(512-sum(bytes)/4096), -1,'1M',
decode(sign(256-sum(bytes)/4096), -1,'512K',
decode(sign(128-sum(bytes)/4096), -1,'256K',
decode(sign(64-sum(bytes)/4096) , -1,'128K',
'64K'
b1
from user_extents
where segment_name=upper('&1');
set pages 0 feed off verify off lines 150
col c1 format a80
spool reorgs1.sql
PROMPT drop table bk_&1
prompt /
PROMPT create table bk_&1 storage (initial &stor) as select * from &1
prompt /
spool off
spool reorgs2.sql
PROMPT spool reorgs2
select 'alter table '||table_name||' drop constraint
'||constraint_name||';'
from user_constraints where r_constraint_name
in (select constraint_name from user_constraints where
table_name=upper('&1')
and constraint_type in ('P','U'));
PROMPT drop table &1
prompt /
prompt create table &1
select decode(column_id,1,'(',',')
||rpad(column_name,40)
||decode(data_type,'DATE' ,'DATE '
,'LONG' ,'LONG '
,'LONG RAW','LONG RAW '
,'RAW' ,'RAW '
,'CHAR' ,'CHAR '
,'VARCHAR' ,'VARCHAR '
,'VARCHAR2','VARCHAR2 '
,'NUMBER' ,'NUMBER '
,'unknown')
||rpad(
decode(data_type,'DATE' ,null
,'LONG' ,null
,'LONG RAW',null
,'RAW' ,decode(data_length,null,null
,'('||data_length||')')
,'CHAR' ,decode(data_length,null,null
,'('||data_length||')')
,'VARCHAR' ,decode(data_length,null,null
,'('||data_length||')')
,'VARCHAR2',decode(data_length,null,null
,'('||data_length||')')
,'NUMBER' ,decode(data_precision,null,' '
,'('||data_precision||
decode(data_scale,null,null
,','||data_scale)||')')
,'unknown'),8,' ')
||decode(nullable,'Y','NULL','NOT NULL') c1
from user_tab_columns
where table_name = upper('&1')
order by column_id
prompt )
select 'pctfree '||t.pct_free c1
,'pctused '||t.pct_used c1
,'initrans '||t.ini_trans c1
,'maxtrans '||t.max_trans c1
,'tablespace '||s.tablespace_name c1
,'storage (initial '||'&stor' c1
,' next '||'&stor' c1
,' minextents '||t.min_extents c1
,' maxextents '||t.max_extents c1
,' pctincrease '||t.pct_increase||')' c1
from user_Segments s, user_tables t
where s.segment_name = upper('&1') and
t.table_name = upper('&1')
and s.segment_type = 'TABLE'
prompt /
select 'comment on table &1 is '''||comments||''';' c1 from
user_tab_comments
where table_name=upper('&1');
select 'comment on column &1..'||column_name||
' is '''||comments||''';' c1 from user_col_comments
where table_name=upper('&1');
prompt insert into &1 select * from bk_&1
prompt /
set serveroutput on
declare
cursor c1 is select index_name,decode(uniqueness,'UNIQUE','UNIQUE')
unq
from user_indexes where
table_name = upper('&1');
indname varchar2(50);
cursor c2 is select
decode(column_position,1,'(',',')||rpad(column_name,40) cl
from user_ind_columns where table_name = upper('&1') and
index_name = indname
order by column_position;
l1 varchar2(100);
l2 varchar2(100);
l3 varchar2(100);
l4 varchar2(100);
l5 varchar2(100);
l6 varchar2(100);
l7 varchar2(100);
l8 varchar2(100);
l9 varchar2(100);
begin
dbms_output.enable(100000);
for c in c1 loop
dbms_output.put_line('create '||c.unq||' index '||c.index_name||' on
&1');
indname := c.index_name;
for q in c2 loop
dbms_output.put_line(q.cl);
end loop;
dbms_output.put_line(')');
select 'pctfree '||i.pct_free ,
'initrans '||i.ini_trans ,
'maxtrans '||i.max_trans ,
'tablespace '||i.tablespace_name ,
'storage (initial '||
decode(sign(1024-sum(e.bytes)/1024),-1,
to_char((round(sum(e.bytes)/(1024*1024))+1))||'M',
decode(sign(512-sum(e.bytes)/1024), -1,'1M',
decode(sign(256-sum(e.bytes)/1024), -1,'512K',
decode(sign(128-sum(e.bytes)/1024), -1,'256K',
decode(sign(64-sum(e.bytes)/1024) , -1,'128K',
'64K'))))) ,
' next '||
decode(sign(1024-sum(e.bytes)/4096),-1,
to_char((round(sum(e.bytes)/(4096*1024))+1))||'M',
decode(sign(512-sum(e.bytes)/4096), -1,'1M',
decode(sign(256-sum(e.bytes)/4096), -1,'512K',
decode(sign(128-sum(e.bytes)/4096), -1,'256K',
decode(sign(64-sum(e.bytes)/4096) , -1,'128K',
'64K'))))) ,
' minextents '||s.min_extents ,
' maxextents '||s.max_extents ,
' pctincrease '||s.pct_increase||')'
into l1,l2,l3,l4,l5,l6,l7,l8,l9
from user_extents e,user_segments s, user_indexes i
where s.segment_name = c.index_name
and s.segment_type = 'INDEX'
and i.index_name = c.index_name
and e.segment_name=s.segment_name
group by s.min_extents,s.max_extents,s.pct_increase,
i.pct_free,i.ini_trans,i.max_trans,i.tablespace_name ;
dbms_output.put_line(l1);
dbms_output.put_line(l2);
dbms_output.put_line(l3);
dbms_output.put_line(l4);
dbms_output.put_line(l5);
dbms_output.put_line(l6);
dbms_output.put_line(l7);
dbms_output.put_line(l8);
dbms_output.put_line(l9);
dbms_output.put_line('/');
end loop;
end;
declare
cursor c1 is
select constraint_name, decode(constraint_type,'U',' UNIQUE',' PRIMARY
KEY') typ,
decode(status,'DISABLED','DISABLE',' ') status from user_constraints
where table_name = upper('&1')
and constraint_type in ('U','P');
cname varchar2(100);
cursor c2 is
select decode(position,1,'(',',')||rpad(column_name,40) coln
from user_cons_columns
where table_name = upper('&1')
and constraint_name = cname
order by position;
begin
for q1 in c1 loop
cname := q1.constraint_name;
dbms_output.put_line('alter table &1');
dbms_output.put_line('add constraint '||cname||q1.typ);
for q2 in c2 loop
dbms_output.put_line(q2.coln);
end loop;
dbms_output.put_line(')' ||q1.status);
dbms_output.put_line('/');
end loop;
end;
declare
cursor c1 is
select c.constraint_name,c.r_constraint_name cname2,
c.table_name table1, r.table_name table2,
decode(c.status,'DISABLED','DISABLE',' ') status,
decode(c.delete_rule,'CASCADE',' on delete cascade ',' ')
delete_rule
from user_constraints c,
user_constraints r
where c.constraint_type='R' and
c.r_constraint_name = r.constraint_name and
c.table_name = upper('&1')
union
select c.constraint_name,c.r_constraint_name cname2,
c.table_name table1, r.table_name table2,
decode(c.status,'DISABLED','DISABLE',' ') status,
decode(c.delete_rule,'CASCADE',' on delete cascade ',' ')
delete_rule
from user_constraints c,
user_constraints r
where c.constraint_type='R' and
c.r_constraint_name = r.constraint_name and
r.table_name = upper('&1');
cname varchar2(50);
cname2 varchar2(50);
cursor c2 is
select decode(position,1,'(',',')||rpad(column_name,40) colname
from user_cons_columns
where constraint_name = cname
order by position;
cursor c3 is
select decode(position,1,'(',',')||rpad(column_name,40) refcol
from user_cons_columns
where constraint_name = cname2
order by position;
begin
dbms_output.enable(100000);
for q1 in c1 loop
cname := q1.constraint_name;
cname2 := q1.cname2;
dbms_output.put_line('alter table '||q1.table1||' add constraint ');
dbms_output.put_line(cname||' foreign key');
for q2 in c2 loop
dbms_output.put_line(q2.colname);
end loop;
dbms_output.put_line(') references '||q1.table2);
for q3 in c3 loop
dbms_output.put_line(q3.refcol);
end loop;
dbms_output.put_line(') '||q1.delete_rule||q1.status);
dbms_output.put_line('/');
end loop;
end;
col c1 format a79 word_wrap
set long 32000
set arraysize 1
select 'create or replace trigger ' c1,
description c1,
'WHEN ('||when_clause||')' c1,
trigger_body ,
'/' c1
from user_triggers
where table_name = upper('&1') and when_clause is not null
select 'create or replace trigger ' c1,
description c1,
trigger_body ,
'/' c1
from user_triggers
where table_name = upper('&1') and when_clause is null
select 'alter trigger '||trigger_name||decode(status,'DISABLED','
DISABLE',' ENABLE')
from user_Triggers where table_name='&1';
set serveroutput on
declare
cursor c1 is
select 'alter table
'||'&1'||decode(substr(constraint_name,1,4),'SYS_',' ',
' add constraint ') a1,
decode(substr(constraint_name,1,4),'SYS_','
',constraint_name)||' check (' a2,
search_condition a3,
') '||decode(status,'DISABLED','DISABLE','') a4,
'/' a5
from user_constraints
where table_name = upper('&1') and
constraint_type='C';
b1 varchar2(100);
b2 varchar2(100);
b3 varchar2(32000);
b4 varchar2(100);
b5 varchar2(100);
fl number;
begin
open c1;
loop
fetch c1 into b1,b2,b3,b4,b5;
exit when c1%NOTFOUND;
select count(*) into fl from user_tab_columns where table_name =
upper('&1') and
upper(column_name)||' IS NOT NULL' = upper(b3);
if fl = 0 then
dbms_output.put_line(b1);
dbms_output.put_line(b2);
dbms_output.put_line(b3);
dbms_output.put_line(b4);
dbms_output.put_line(b5);
end if;
end loop;
end;
create or replace procedure dumzxcvreorg_dep(nam varchar2,typ
varchar2) as
cursor cur is
select type,decode(type,'PACKAGE BODY','PACKAGE',type) type1,
name from user_dependencies
where referenced_name=upper(nam) and referenced_type=upper(typ);
begin
dbms_output.enable(500000);
for c in cur loop
dbms_output.put_line('alter '||c.type1||' '||c.name||' compile;');
dumzxcvreorg_dep(c.name,c.type);
end loop;
end;
exec dumzxcvreorg_dep('&1','TABLE');
drop procedure dumzxcvreorg_Dep;
select 'grant '||privilege||' on '||table_name||' to '||grantee||
decode(grantable,'YES',' with grant option;',';') from
user_tab_privs where table_name = upper('&1');
select 'grant '||privilege||' ('||column_name||') on &1 to
'||grantee||
decode(grantable,'YES',' with grant option;',';')
from user_col_privs where grantor=user and
table_name=upper('&1')
order by grantee, privilege;
select 'create synonym '||synonym_name||' for
'||table_owner||'.'||table_name||';'
from user_synonyms where table_name=upper('&1');
PROMPT REM
PROMPT REM YOU MAY HAVE TO LOG ON AS SYSTEM TO BE
PROMPT REM ABLE TO CREATE ANY OF THE PUBLIC SYNONYMS!
PROMPT REM
select 'create public synonym '||synonym_name||' for
'||table_owner||'.'||table_name||';'
from all_synonyms where owner='PUBLIC' and table_name=upper('&1') and
table_owner=user;
prompt spool off
spool off
set echo on feed on verify on
The scripts REORGS1.SQL and REORGS2.SQL have been
created. Alter these script as necesarry.
To recreate the table-structure, first run REORGS1.SQL.
This script saves the content of your table in a table
called bk_.
If this script runs successfully run REORGS2.SQL.
The result is spooled to REORGTB.LST.
Check this file before dropping the bk_ table.
*/Please do NOT cross-postings: create a deep structure for dynamic internal table
Regards
Uwe -
Hi,
I´m new with tuning and i have a little problem, i read a lot of blogs and articles about awr and stackspack. Here is part of my awr report.
Server – DELL 2850 – Windows 2003 SP2 x86 – 4GB RAM (/3GB) 2CPU.
Snap Id Snap Time Sessions Curs/Sess
Begin Snap: 11592 20-May-09 09:00:49 110 50.3
End Snap: 11761 27-May-09 10:01:00 115 45.3
Elapsed: 10,140.18 (mins)
DB Time: 19,151.07 (mins)
Cache Sizes
~~~~~~~~~~~ Begin End
Buffer Cache: 316M 316M Std Block Size: 8K
Shared Pool Size: 576M 576M Log Buffer: 6,924K
Load Profile
~~~~~~~~~~~~ Per Second Per Transaction
Redo size: 196,591.16 6,808.93
Logical reads: 68,060.52 2,357.27
Block changes: 1,664.88 57.66
Physical reads: 157.76 5.46
Physical writes: 34.21 1.18
User calls: 1,689.77 58.53
Parses: 675.63 23.40
Hard parses: 2.86 0.10
Sorts: 7,059.70 244.51
Logons: 2.41 0.08
Executes: 2,377.07 82.33
Transactions: 28.87
% Blocks changed per Read: 2.45 Recursive Call %: 74.45
Rollback per transaction %: 76.03 Rows per Sort: 0.73
Instance Efficiency Percentages (Target 100%)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Buffer Nowait %: 99.99 Redo NoWait %: 100.00
Buffer Hit %: 99.77 In-memory Sort %: 100.00
Library Hit %: 102.97 Soft Parse %: 99.58
Execute to Parse %: 71.58 Latch Hit %: 99.93
Parse CPU to Parse Elapsd %: 78.73 % Non-Parse CPU: 98.55
Shared Pool Statistics Begin End
Memory Usage %: 47.32 47.64
% SQL with executions>1: 58.04 69.45
% Memory for SQL w/exec>1: 68.71 76.32
Top 5 Timed Events Avg %Total
~~~~~~~~~~~~~~~~~~ wait Call
Event Waits Time (s) (ms) Time Wait Class
CPU time 873,110 76.0
log file sync 5,161,812 76,211 15 6.6 Commit
enq: UL – contention 243,039 54,470 224 4.7 Applicatio
db file sequential read 12,534,382 41,279 3 3.6 User I/O
log file parallel write 8,215,709 25,760 3 2.2 System I/O
I see that CPU time is very high and the other wait events not are very significant.
My Database reports Rollback per transaction %age to 76%.
Statistic Total per Second per Trans
user commits 4,210,155 6.9 0.2
user rollbacks 13,356,226 22.0 0.8
Transacciones = user commits + user rollbacks
Transacciones = 4.210.155 + 13.356.226 = 17.566.381
Rollbacks por transacción = (100*13.356.226/17.566.381)= 76,03%
I review this other statistics.
Statistic Total per Second per Trans
db block changes 1,012,928,251 1,664.9 57.7
rollback changes – undo records 177,118,776 291.1 10.1
In the section on sql statistics i don´t see any query with delete statement or something that is producing the rollback.
For the other hand, i saw high values for latches:
Latch Activity
Pct Avg Wait Pct
Get Get Slps Time NoWait NoWait
Latch Name Requests Miss /Miss (s) Requests Miss
cache buffer handles 594,141,662 0.0 0.0 0 0 N/A
cache buffers chains ############## 0.0 0.0 24 256,952,500 0.0
cache buffers lru chain 57,432,611 0.1 0.0 0 407,926,828 0.0
cache table scan latch 0 N/A N/A 0 7,211,848 0.0
channel handle pool latc 248,878 0.0 0.0 0 0 N/A
channel operations paren 4,191,138 0.0 0.0 0 0 N/A
checkpoint queue latch 93,701,454 0.0 0.0 0 18,705,338 0.0
client/application info 74,841,233 0.0 0.0 0 0 N/A
In memory undo latch 319,086,961 0.2 0.0 3 48,465,421 0.1
row cache objects 2,204,749,411 0.1 0.0 0 630,441 0.0
lgwr LWN SCN 8,230,336 0.0 0.0 0 0 N/A
library cache 2,606,820,844 0.2 0.0 1106 8,043,804 0.4
library cache load lock 841,281 0.0 0.0 0 74 0.0
library cache lock 611,525,102 0.1 0.0 0 205 0.0
library cache lock alloc 32,549,163 0.0 0.0 0 0 N/A
library cache pin 1,349,787,907 0.1 0.0 1 4,386 0.0
library cache pin alloca 2,617,831 0.0 0.0 0 0 N/A
Latch Name
Get Requests Misses Sleeps Spin Gets Sleep1 Sleep2 Sleep3
cache buffers chains
############## 22,397,249 127,771 ########## 0 0 0
session allocation
-953,498,830 5,328,052 341 5,327,714 0 0 0
library cache
2,606,820,844 5,076,626 82,635 4,995,862 0 0 0
simulator lru latch
-3,426,351,079 4,816,176 244 4,815,941 0 0 0
row cache objects
2,204,749,411 2,659,953 25 2,659,928 0 0 0
library cache pin
1,349,787,907 1,566,144 2,726 1,563,447 0 0 0
library cache lock
611,525,102 801,491 75 801,416 0 0 0
In memory undo latch
319,086,961 724,884 5,850 719,534 0 0 0
enqueues
256,944,623 546,555 1,748 544,980 0 0 0
shared pool
190,887,687 515,397 78,393 439,711 0 0 0
session idle bit
2,097,791,961 512,800 2,111 510,722 0 0 0
enqueue hash chains
325,688,224 316,885 2,067 314,956 0 0 0
undo global data
395,144,808 249,509 395 249,136 0 0 0
dml lock allocation
82,685,629 38,906 213 38,738 0 0 0
Latch Miss Sources
NoWait Waiter
Latch Name Where Misses Sleeps Sleeps
cache buffers chains kcbchg: kslbegin: bufs not 0 124,497 72,893
cache buffers chains kcbgtcr: fast path 0 84,073 73,823
cache buffers chains kcbgtcr: kslbegin excl 0 69,785 47,848
cache buffers chains kcbzwb 0 47,844 28,553
cache buffers chains kcbgcur: kslbegin 0 46,897 10,928
cache buffers chains kcbrls: kslbegin 0 11,584 58,227
cache buffers chains kcbchg: kslbegin: call CR 0 5,786 50,971
cache buffers chains kcbget: pin buffer 0 3,802 691
cache buffers chains kcb_is_private 0 2,362 42,467
cache buffers chains kcbbxsv 0 1,421 79
cache buffers chains kcbnlc 0 1,197 5,431
library cache kglpnp: child 0 25,131 56,619
library cache kglpndl: child: after proc 0 8,800 216
library cache kglhdgn: child: 0 7,515 16,401
library cache kglLockCursor 0 3,962 1,328
library cache kglpndl: child: before pro 0 990 5,918
library cache kglic 0 750 28
shared pool kghasp 0 54,200 40
shared pool kghupr1 0 13,535 56,783
shared pool kghalo 0 6,161 12,243
shared pool kghfre 0 3,081 8,630
shared pool kgh_next_free 0 887 9
I´m a bit lost… i need to look for hot blocks, sql statments that are consuming a lot of cpu, set pct_free of hot_blocks to a high value¿?
Edited by: Roberto Marotta on Jun 22, 2009 3:45 AMWell,
DELL -2850 4GB RAM 2CPU
I´ll try to explain better. Sorry for my explains and my english because my english is not very well.
This environment had serious memory problems some time ago. Sometimes database hangs because memory problems. We resolve the problem with /3GB setting in the Windows OS.
Now we are doing a study "tuning" of the database server looking for gain performance.
I find that the redo size is not the optimal size. Actual = 50M Recommended= 6GB.
Statistic l
log switches (derived) Tota 2,682 per Hour 15.87
OPTIMAL_LOGFILE_SIZE
6008
In one week the server had processed 17M of transactions.
Statistic Total per Second per Trans
user commits 4,210,155 6.9 0.2
user rollbacks 13,356,226 22.0 0.8
Transacciones = user commits + user rollbacks
Transacciones = 4.210.155 + 13.356.226 = 17.566.381
Rollbacks por transacción = (100*13.356.226/17.566.381)= 76,03%
Statistic Total per Second per Trans
db block changes 1,012,928,251 1,664.9 57.7
rollback changes - undo records 177,118,776 291.1 10.1
I think that is a problem with the logic of application but i don´t find anything like delete statements or something that alerts me doing much rollback.
For the other hand i detect high values for some latches "cache buffer chains", "library cache", "row objects cache".
More things:
METRIC_NAME
Database Wait Time Ratio value 24.3862681
Database CPU Time Ratio value 75.6137319
METRIC_NAME MINIMUN MAXIMUN AVERAGE
CPU Usage Per Sec 0 158.290545 109.032138
CPU Usage Per Txn 0 6.15517349 3.72228913
Database CPU Time Ratio 0 88.7685616 77.766078
Database Wait Time Ratio 0 88.8858063 22.233922
Executions Per Sec 0 5624.66667 2633.58251
Executions Per Txn 0 218.716785 90.4001077
Response Time Per Txn (secs) 0 .31 .05
SQL Service Response Time (secs) 0 0 0
User Transaction Per Sec 0 53.1166667 29.6726776
STAT_NAME PCT_TIME
sql execute elapsed time 33.84
DB time 32
DB CPU 7670898.16 26.44
PL/SQL execution elapsed time 1202699.05 4.15
background elapsed time 560082.574 1.93
parse time elapsed 227501.434 .78
hard parse elapsed time 87775.528 .3
PL/SQL compilation elapsed time 53801.08 .19
background cpu time 47749.065 .16
failed parse elapsed time 37235.995 .13
hard parse (sharing criteria) elapsed time 5800.741 .02
inbound PL/SQL rpc elapsed time 3930.999 .01
RMAN cpu time (backup/restore) 3828.488 .01
connection management call elapsed time 3332.64 .01
sequence load elapsed time 2438.323 .01
hard parse (bind mismatch) elapsed time 1337.938 0
repeated bind elapsed time 510.387 0
Java execution elapsed time 18.669 0
failed parse (out of shared memory) elapsed time 0 0
I think that the server expend much time executing sql statements...
Best Regards,
Edited by: Roberto Marotta on Jun 22, 2009 5:20 AM
Edited by: Roberto Marotta on Jun 22, 2009 5:20 AM
Edited by: Roberto Marotta on Jun 22, 2009 5:22 AM
Edited by: Roberto Marotta on Jun 22, 2009 5:23 AM
Edited by: Roberto Marotta on Jun 22, 2009 5:25 AM
Edited by: Roberto Marotta on Jun 22, 2009 5:25 AM -
High Buffer Busy Wait due to Concurrent INSERTS
Hi All,
One of my OLTP database is running on 11.1.0.7 (11.1.0.7.0 - 64bit Production) with RHEL 5.4.
On frequent basis, i am observing 'BUFFER BUSY WAITS' and last time i tried to capture some dictionary information to dig the waits.
1. Session Watis :
Oracle Sec Hash
Sid,Serial User OS User Svr-Pgm Wait Event State-Seq Wt Module Cmnd Value P1 P2 P3
633,40830 OLTP_USE fateadm 21646-orac buffer busy wai Wtng-9999 1 ORDERS ISRT 3932487748 384 1863905 1
647, 1761 OLTP_USE fateadm 22715-orac buffer busy wai Wtng-3837 0 ORDERS ISRT 3932487748 384 1863905 1
872, 5001 OLTP_USE fateadm 21836-orac buffer busy wai Wtng-9999 1 ORDERS ISRT 3932487748 384 1863905 1
702, 1353 OLTP_USE fateadm 21984-orac buffer busy wai Wtng-9999 1 ORDERS ISRT 3932487748 384 1863905 1
337,10307 OLTP_USE fateadm 21173-orac buffer busy wai Wtng-9999 1 ORDERS ISRT 3932487748 384 1863905 1
751,43016 OLTP_USE fateadm 21619-orac buffer busy wai Wtng-9999 1 ORDERS ISRT 3932487748 384 1863905 1
820,17959 OLTP_USE fateadm 21648-orac buffer busy wai Wtng-9999 0 ORDERS ISRT 3932487748 384 1863905 1
287,63359 OLTP_USE fateadm 27053-orac buffer busy wai Wtng-9999 0 ORDERS ISRT 3932487748 384 1863905 1
629, 1653 OLTP_USE fateadm 22468-orac buffer busy wai Wtng-9999 1 ORDERS ISRT 3932487748 384 1863905 1
788,14160 OLTP_USE fateadm 22421-orac buffer busy wai Wtng-9999 0 ORDERS ISRT 3932487748 384 1863905 1
615, 4580 OLTP_USE fateadm 21185-orac buffer busy wai Wtng-9999 0 ORDERS ISRT 3932487748 384 1863905 1
525,46068 OLTP_USE fateadm 27043-orac buffer busy wai Wtng-9034 1 ORDERS ISRT 3932487748 384 1863905 1
919,23243 OLTP_USE fateadm 21428-orac buffer busy wai Wtng-6340 1 ORDERS ISRT 3932487748 384 1863906 1
610,34557 OLTP_USE fateadm 21679-orac buffer busy wai Wtng-6422 1 ORDERS ISRT 3932487748 384 1863906 1
803, 1583 OLTP_USE fateadm 21580-orac buffer busy wai Wtng-6656 1 ORDERS ISRT 3932487748 384 1863906 1
781, 1523 OLTP_USE fateadm 21781-orac buffer busy wai Wtng-9999 0 ORDERS ISRT 3932487748 384 1863906 1
369,11005 OLTP_USE fateadm 21718-orac buffer busy wai Wtng-9999 0 ORDERS ISRT 3932487748 384 1863906 1
823,35800 OLTP_USE fateadm 21148-orac buffer busy wai Wtng-9999 1 ORDERS ISRT 3932487748 384 1863906 1
817, 1537 OLTP_USE fateadm 22505-orac buffer busy wai Wtng-9999 1 ORDERS ISRT 3932487748 384 1863906 1
579,54959 OLTP_USE fateadm 22517-orac buffer busy wai Wtng-9999 0 ORDERS ISRT 3932487748 384 1863906 1
591,33597 OLTP_USE fateadm 27027-orac buffer busy wai Wtng-9999 1 ORDERS ISRT 3932487748 384 1863906 1
481, 3031 OLTP_USE fateadm 21191-orac buffer busy wai Wtng-3502 1 ORDERS ISRT 3932487748 384 1863906 1
473,24985 OLTP_USE fateadm 22629-orac buffer busy wai Wtng-9999 0 ORDERS ISRT 3932487748 384 1863906 1
868, 3984 OLTP_USE fateadm 27191-orac buffer busy wai Wtng-9999 0 ORDERS ISRT 3932487748 384 1863906 1
select owner,segment_name,segment_type from dba_extents where file_id = 384 and 1863905 between block_id and block_id + blocks -1;
OWNER SEGMENT_NAME SEGMENT_TYPE
ORDER ORDER_DETAILS TABLE
select TABLE_NAME,PARTITIONED,ini_trans ,degree,compression,FREELISTS from dba_TABLES WHERE TABLE_NAME='ORDER_DETAILS';
TABLE_NAME PAR INI_TRANS DEGREE COMPRESS FREELISTS
ORDER_DETAILS NO 1 1 ENABLED 1
Tablespace is not ASSM managed !
select
object_name,
statistic_name,
value
from
V$SEGMENT_STATISTICS
where
object_name = 'ORDER_DETAILS';
OBJECT_NAME STATISTIC_NAME VALUE
ORDER_DETAILS logical reads 487741104
ORDER_DETAILS buffer busy waits 4715174
ORDER_DETAILS db block changes 200858896
ORDER_DETAILS physical reads 143642724
ORDER_DETAILS physical writes 20581330
ORDER_DETAILS physical reads direct 55239903
ORDER_DETAILS physical writes direct 19500551
ORDER_DETAILS space allocated 1.6603E+11
ORDER_DETAILS segment scans 9727
ORDER_DETAILS table is ~ 153 GB non-partitioned table.
It seems its not a READ BY OTHER SESSIONS wait but BUFFER BUSY due to write-wirte contention inside same block. I have never observed Cache Buffer Chain/ ITL-Wait/ High wait time on dbfile sequential/scattered reads.Table contains one PK (composite index on 3 columns) which seems to be highly fragmented.This non partitioned global Index has 3182037735 rows and blevel is 4.
BHAVIK_DBA.FATE1NA>select index_name,status,num_rows,blevel,pct_free,ini_trans,clustering_factor from dba_indexes where index_name='IDX_ORDERS';
INDEX_NAME STATUS NUM_ROWS BLEVEL PCT_FREE INI_TRANS CLUSTERING_FACTOR
IDX_ORDERS VALID 3182037735 4 2 2 2529462377
1 row selected.
One of the index column value is being populated by sequence. (Monotonically increasing value)
SEGMENT_NAME MB
IDX_ORDERS 170590.438
Index size is greater than table size !Tuning goal here is to reduce buffer busy waits and thus commit latencies.
I think, i need to increase FREELISTS and PCT_FREE to address this issue, but not much confident whether it is going to solve the issue or not?
Can i ask for any help here ?Hi Johnathan;
Many thanks for your detailed write-up. I was expecting you !
Your post here gave lot of information and wisdom that made me think last couple of hrs that is the reason for the delay in reply.
I did visited your index explosion posts couple of times and that scenario only gave me insight that concurrent DML (INSERT) is cause of index fragmentation in my case.
Let me also pick the opportunity to ask you to shed more light on some of the information you have highlighted.
if you can work out the number of concurrent inserts that are really likely to happen at any one instant then a value of freelists that in the range of
concurrency/4 to concurrency/2 is probably appropriate.May i ask you how did you derive this formula ? I dont want to miss learning opportunity here !
Note - with multiple freelists, you may find that you now get buffer busy waits on the segment header block.I did not quite get this point ? Can you shed more light please? What piece in segment header block is going to result contention(BBW on SEGMENT HEADER) on all concurrent inserts ?
The solution to this is to increase the number of freelist groups (making sure that
freelists and freelist groups have no common factors).My prod db NON-RAC environment. Can i use FREELIST GROUPS here ? My little knowledge did not get, What "common factors" you are referring here ?
The reads could be related to leaf block splits, but there are several possible scenarios that could lead to that pattern of activity - so the next step is to find out which blocks are being
read. Capture a sample of the waits, then query dba_extents for the extent_id, file_id, and block_id (don't run that awful query with the "block_id + blocks" predicate) and cross-check the
list of blocks to see if they are typically the first couple of blocks of an extent or randomly scattered throughout extents. If the former the problem is probably related to ASSM, if the
latter it may be related to failed probes on index leaf block reuse (i.e. after large scale deletes).I have 10046 trace file with me (giving you some sample below) that can give some information. However, since the issue was critical, i killed the insert process and rebuilt both the indexes. Since, index is rebuilt, i am not able to find any information in dba_extents.
select SEGMENT_NAME,SEGMENT_TYPE,EXTENT_ID from dba_extents where file_id=42 and block_id=1109331;
no rows selected
select SEGMENT_NAME,SEGMENT_TYPE,EXTENT_ID from dba_extents where file_id=42 and block_id=1109395 ;
no rows selected
select SEGMENT_NAME,SEGMENT_TYPE,EXTENT_ID from dba_extents where file_id=42 and block_id=1109459;
no rows selected
select SEGMENT_NAME,SEGMENT_TYPE,EXTENT_ID from dba_extents where file_id=10 and block_id=1107475;
no rows selected
select SEGMENT_NAME,SEGMENT_TYPE,EXTENT_ID from dba_extents where file_id=10 and block_id=1107539;
no rows selected
select object_name,object_Type from dba_objects where object_id=17599;
no rows selected
WAIT #4: nam='db file sequential read' ela= 49 file#=42 block#=1109331 blocks=1 obj#=17599 tim=1245687162307379
WAIT #4: nam='db file sequential read' ela= 59 file#=42 block#=1109395 blocks=1 obj#=17599 tim=1245687162307462
WAIT #4: nam='db file sequential read' ela= 51 file#=42 block#=1109459 blocks=1 obj#=17599 tim=1245687162307538
WAIT #4: nam='db file sequential read' ela= 49 file#=10 block#=1107475 blocks=1 obj#=17599 tim=1245687162307612
WAIT #4: nam='db file sequential read' ela= 49 file#=10 block#=1107539 blocks=1 obj#=17599 tim=1245687162307684
WAIT #4: nam='db file sequential read' ela= 198 file#=10 block#=1107603 blocks=1 obj#=17599 tim=1245687162307905
WAIT #4: nam='db file sequential read' ela= 88 file#=10 block#=1107667 blocks=1 obj#=17599 tim=1245687162308016
WAIT #4: nam='db file sequential read' ela= 51 file#=10 block#=1107731 blocks=1 obj#=17599 tim=1245687162308092
WAIT #4: nam='db file sequential read' ela= 49 file#=10 block#=1107795 blocks=1 obj#=17599 tim=1245687162308166
WAIT #4: nam='db file sequential read' ela= 49 file#=10 block#=1107859 blocks=1 obj#=17599 tim=1245687162308240
WAIT #4: nam='db file sequential read' ela= 52 file#=10 block#=1107923 blocks=1 obj#=17599 tim=1245687162308314
WAIT #4: nam='db file sequential read' ela= 57 file#=42 block#=1109012 blocks=1 obj#=17599 tim=1245687162308395
WAIT #4: nam='db file sequential read' ela= 52 file#=42 block#=1109076 blocks=1 obj#=17599 tim=1245687162308470
WAIT #4: nam='db file sequential read' ela= 98 file#=42 block#=1109140 blocks=1 obj#=17599 tim=1245687162308594
WAIT #4: nam='db file sequential read' ela= 67 file#=42 block#=1109204 blocks=1 obj#=17599 tim=1245687162308686
WAIT #4: nam='db file sequential read' ela= 53 file#=42 block#=1109268 blocks=1 obj#=17599 tim=1245687162308762
WAIT #4: nam='db file sequential read' ela= 54 file#=42 block#=1109332 blocks=1 obj#=17599 tim=1245687162308841
WAIT #4: nam='db file sequential read' ela= 55 file#=42 block#=1109396 blocks=1 obj#=17599 tim=1245687162308920
WAIT #4: nam='db file sequential read' ela= 54 file#=42 block#=1109460 blocks=1 obj#=17599 tim=1245687162308999
WAIT #4: nam='db file sequential read' ela= 52 file#=10 block#=1107476 blocks=1 obj#=17599 tim=1245687162309074
WAIT #4: nam='db file sequential read' ela= 89 file#=10 block#=1107540 blocks=1 obj#=17599 tim=1245687162309187
WAIT #4: nam='db file sequential read' ela= 407 file#=10 block#=1107604 blocks=1 obj#=17599 tim=1245687162309618TKPROF for above trace
INSERT into
order_rev
(aggregated_revenue_id,
legal_entity_id,
gl_product_group,
revenue_category,
warehouse_id,
tax_region,
gl_product_subgroup,
total_shipments,
total_units_shipped,
aggregated_revenue_amount,
aggregated_tax_amount,
base_currency_code,
exchange_rate,
accounting_date,
inventory_owner_type_id,
fin_commission_structure_id,
seller_of_record_vendor_id,
organizational_unit_id,
merchant_id,
last_updated_date,
revenue_owner_type_id,
sales_channel,
location)
VALUES
(order_rev.nextval,:p1,:p2,:p3,:p4,:p5,:p6,:p7,:p8,:p9,:p10,:p11,:p12,to_date(:p13, 'dd-MON-yyyy'),:p14,:p15,:p16,:p17,:p18,sysdate,:p19,:p20,:p21)
call count cpu elapsed disk query current rows
Parse 0 0.00 0.00 0 0 0 0
Execute 613 5.50 40.32 96672 247585 306916 613
Fetch 0 0.00 0.00 0 0 0 0
total 613 5.50 40.32 96672 247585 306916 613
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 446
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
db file sequential read 164224 0.04 62.33
SQL*Net message to client 613 0.00 0.00
SQL*Net message from client 613 0.03 0.90
latch: cache buffers chains 8 0.00 0.00
latch: object queue header operation 2 0.00 0.00Is there any other way to find out culprit amongst the two you have listed (ASSM / failed probes on index leaf block reuse ) ? -
Updates needed to the N8!
#1: Kill the sms-erase bug! - When writing long sms´s and you are about to delete one letter but 95% of the whole long sms is erased due to something. Have happen to me about 10 times since Oct 2010, **bleep** me off! And when saving your sms while writing to prevent this the sms-bug it will not help cause when the bug sets in and you lost 95% of your text and you want to exit the write page it asks: "Really wanna delete your sms?" and not alternative....your "saved" sms will be erased aswell...turning off you phone will not help, then the saved sms is erased when you restart your phone, really ugly bug!
I have tried to simulate this bug but not successful...it always sets in when wring a real sms....I bet the right arrow key is to close to the erase-key in some way..donno how it it possible to mark 95% of the text and delete it with one press of a button...anyone can confirm this bug?
#2: Let us write more than 10 sms long sms´s witout automaticly changing to MMS-mode..like the good old 6680 didnt do. With that phone I could write more than 20 sms long sms´s without problems.....SMS is free of charge to the whole world for me, MMS is NOT...so why do I wanna send a MMS with text?? And cutting the message and sending several 10 sms long sms´s is complicated and stoneage! Dont even wanna try it!
#3: The musicplayer:
- Custom ezualizer! How about at least 10 bands to be altered. Not very high tech...
- Better musiklibrary, let the player read the filenames ONLY if wished, like the Windows Explorer...Folders/Albums at top and single files below...now the libary is a mess...single files end up in same albums and the player read the deep info in a MP3 file and automaticly shows an album with one song in it. Albums called "Greatest Hits" will gather files from different artists "Greatest Hits" albums for ex.
-More powerful output to the earphones (if possible). Make a meny where you can choose "small earphones" or "big earphones" and when choosing "big earphones" the phone give extra power to the volume with the cost of sucking out the battery faster but who cares? You get a charger for free when buying your phone!
-More settings for the sound quality...there are many many of them.
#4: More zoom when watching photos, when you edit a picture you are allowed to zoom much more, why not in basic view mode too?
#5: The GPS....there is no info or setting at all for this one. Settings may not be needed but a screen where you can see the number of satellites found and the current status of how accurate it is at the moment. Sometimes it takes long time to find the exakt position and you dont know if the position is 100% accurate or just 90% accurate. I bet there are some useful and interesting info that could be shown if requested but the user!
Have I missed something?
Love the N8 but this things could be better!With this script you can monitor the tablespace size and take action:
==========================================
set linesize 150
column tablespace_name format a20 heading 'Tablespace'
column sumb format 999,999,999
column extents format 9999
column bytes format 999,999,999,999
column largest format 999,999,999,999
column Tot_Size format 999,999 Heading 'Total| Size(Mb)'
column Tot_Free format 999,999,999 heading 'Total Free(MB)'
column Pct_Free format 999.99 heading '% Free'
column Chunks_Free format 9999 heading 'No Of Ext.'
column Max_Free format 999,999,999 heading 'Max Free(Kb)'
set echo off
PROMPT FREE SPACE AVAILABLE IN TABLESPACES
select a.tablespace_name,sum(a.tots/1048576) Tot_Size,
sum(a.sumb/1048576) Tot_Free,
sum(a.sumb)*100/sum(a.tots) Pct_Free,
sum(a.largest/1024) Max_Free,sum(a.chunks) Chunks_Free
from
select tablespace_name,0 tots,sum(bytes) sumb,
max(bytes) largest,count(*) chunks
from dba_free_space a
group by tablespace_name
union
select tablespace_name,sum(bytes) tots,0,0,0 from
dba_data_files
group by tablespace_name) a
group by a.tablespace_name
order by pct_free;
=========
regards
Shanoj -
Count total rows in database?
Hello all,
Is there a way to query the database for the total number of rows.... without using ANALYZE STATISTICS? (That would cause the db to sometimes use COST instead of RULE based optimization, slowing it down significantly.)
I know I could could brute force a total row count with something like:
spool get_total_rows.sql
SELECT 'SELECT COUNT(*) FROM '||owner||'.'||table_name||';'
FROM ALL_TABLES;
spool off
...then run get_total_rows and manually add all the counts.
But it just seems like there must be a cleaner way to do it.
Thanks much,
Natashaok. here you have that information:
ALL_TABLES
ALL_TABLES describes all relational tables accessible to the current user. To gather statistics for this view, use the SQL ANALYZE statement.
Related Views
DBA_TABLES describes all relational tables in the database.
USER_TABLES describes all relational tables owned by the current user. This view does not display the OWNER column.
Note:
Columns marked with an asterisk are populated only if you collect statistics on the table with the ANALYZE statement or the DBMS_STATS package.
Column Datatype NULL Description
OWNER
VARCHAR2(30)
Owner of the table
TABLE_NAME
VARCHAR2(30)
Name of the table
TABLESPACE_NAME
VARCHAR2(30)
Name of the tablespace containing the table; NULL for partitioned, temporary and index-organized tables
CLUSTER_NAME
VARCHAR2(30)
Name of the cluster, if any, to which the table belongs
IOT_NAME
VARCHAR2(30)
Name of the index-organized table, if any, to which the overflow entry belongs. If IOT_TYPE column is not null, this column contains the base table name.
PCT_FREE
NUMBER
Minimum percentage of free space in a block; NULL for partitioned tables
PCT_USED
NUMBER
Minimum percentage of used space in a block; NULL for partitioned tables
INI_TRANS
NUMBER
Initial number of transactions; NULL for partitioned tables
MAX_TRANS
NUMBER
Maximum number of transactions; NULL for partitioned tables
INITIAL_EXTENT
NUMBER
Size of the initial extent in bytes; NULL for partitioned tables
NEXT_EXTENT
NUMBER
Size of the secondary extension bytes; NULL for partitioned tables
MIN_EXTENTS
NUMBER
Minimum number of extents allowed in the segment; NULL for partitioned tables
MAX_EXTENTS
NUMBER
Maximum number of extents allowed in the segment; NULL for partitioned tables
PCT_INCREASE
NUMBER
Percentage increase in extent size; NULL for partitioned tables
FREELISTS
NUMBER
Number of process freelists allocated to this segment; NULL for partitioned tables
FREELIST_GROUPS
NUMBER
Number of freelist groups allocated to this segment; NULL for partitioned tables
LOGGING
VARCHAR2(3)
Logging attribute; NULL for partitioned tables
BACKED_UP
VARCHAR2(1)
Has table been backed up since last change
NUM_ROWS*
NUMBER
Number of rows in the table
BLOCKS*
NUMBER
Number of used data blocks in the table
EMPTY_BLOCKS*
NUMBER
Number of empty (never used) data blocks in the table
AVG_SPACE*
NUMBER
Average amount of free space, in bytes, in a data block allocated to the table
CHAIN_CNT*
NUMBER
Number of rows in the table that are chained from one data block to another, or which have migrated to a new block, requiring a link to preserve the old ROWID
AVG_ROW_LEN*
NUMBER
Average length of a row in the table in bytes
AVG_SPACE_FREELIST
_BLOCKS
NUMBER
The average freespace of all blocks on a freelist
NUM_FREELIST_BLOCKS
NUMBER
The number of blocks on the freelist
DEGREE
VARCHAR2(10)
The number of threads per instance for scanning the table
INSTANCES
VARCHAR2(10)
The number of instances across which the table is to be scanned
CACHE
VARCHAR2(5)
Whether the cluster is to be cached in the buffer cache (CACHE | NOCACHE)
TABLE_LOCK
VARCHAR2(8)
Whether table locking is enabled or disabled
SAMPLE_SIZE
NUMBER
Sample size used in analyzing this table
LAST_ANALYZED
DATE
Date on which this table was most recently analyzed
PARTITIONED
VARCHAR2(3)
Indicates whether this table is partitioned. Set to YES if it is partitioned.
IOT_TYPE
VARCHAR2(12)
If this is an index-organized table, then IOT_TYPE is IOT, IOT_OVERFLOW, or IOT_MAPPING. If this is not an index-organized table, then IOT_TYPE is NULL.
TEMPORARY
VARCHAR2(1)
Can the current session only see data that it place in this object itself?
SECONDARY
VARCHAR2(1)
Whether the trigger is a secondary object created by the ODCIIndexCreate method of the Oracle9i Data Cartridge (Y |N)
NESTED
VARCHAR2(3)
Is the table a nested table?
BUFFER_POOL
VARCHAR2(7)
The default buffer pool for the object. NULL for partitioned tables
ROW_MOVEMENT
VARCHAR2(8)
Whether partitioned row movement is enabled or disabled
GLOBAL_STATS
VARCHAR2(3)
For partitioned tables, indicates whether statistics were collected for the table as a whole (YES) or were estimated from statistics on underlying partitions and subpartitions (NO)
USER_STATS
VARCHAR2(3)
Were the statistics entered directly by the user?
DURATION
VARCHAR2(15)
Indicates the duration of a temporary table:
SYS$SESSION: the rows are preserved for the duration of the session
SYS$TRANSACTION: the rows are deleted after COMMIT
Null for a permanent table
SKIP_CORRUPT
VARCHAR2(8)
Whether Oracle ignores blocks marked corrupt during table and index scans (ENABLED) or raises an error (DISABLED). To enable this feature, run the DBMS_REPAIR.SKIP_CORRUPT_BLOCKS procedure.
MONITORING
VARCHAR2(3)
Whether the table has the MONITORING attribute set
Try with ALL_TABLES and post if the results were zero too
Joel P�rez -
Oracle 9i - Calculating Total Amount of Space Available/Used by Tablespace
OK, so here is my situation....
I'm on Oracle 9i on a Windows 2000 Server. Windows has a file size restriction of 16 gig. So when you setup datafiles to auto-extend to unlimited, the max it will extend to is 16 gig.
I have all of my datafiles setup to auto-extend, but I want to write a query that will show me for each tablespace, the amount of data currently being used, and the maxium amount that the tablespace could extend to. That way I have a tool to see when I might need to add another datafile, before it blows up....
Does anyone has a suggestion on how to do this....Hi,
Question #1 -- When you set it to UNLIMITED, it assigns the MAX FILE SIZE to 16 gig so Oracle must know the operating system limitation.When you set it to unlimited it will extend upto 32 GB.
Question #2 -- I guess what I'm looking for is how much room is available for additional objects in that particular tablespace. So I guess you could come up with amount used by finding out Max Available - Free Space = Amount UsedSeT lines 300
SET verify OFF
SET pages 40
COLUMN pct_used format 999.99 heading "%|Used"
COLUMN pct_free format 999.99 heading "%|Free"
COLUMN NAME format a16 heading "Tablespace Name"
COLUMN mbytes format 999,999,999.99 heading "Total|MB"
COLUMN used format 999,999,999.99 heading "Used|MB"
COLUMN free format 999,999,999.99 heading "Free|MB"
COLUMN largest format 999,999,999.99 heading "Largest"
BREAK ON report
COMPUTE SUM OF mbytes ON report
COMPUTE SUM OF free ON report
COMPUTE SUM OF used ON report
-- PROMPT ORDER BY:
-- PROMPT 1:TABLESPACE NAME
-- PROMPT 2:total mbytes
-- PROMPT 3:used Mb
-- PROMPT 4:free mb
-- PROMPT 5:% used
-- PROMPT 6:% free
-- define orderby=5 desc
SELECT NVL (b.tablespace_name, NVL (a.tablespace_name, 'UNKOWN')) NAME,
mbytes_alloc mbytes, mbytes_alloc - NVL (mbytes_free, 0) used,
NVL (mbytes_free, 0) free,
((mbytes_alloc - NVL (mbytes_free, 0)) / mbytes_alloc)
* 100 pct_used,
100
- (((mbytes_alloc - NVL (mbytes_free, 0)) / mbytes_alloc) * 100)
pct_free
FROM (SELECT SUM(BYTES) / 1024 / 1024 mbytes_free, tablespace_name
FROM SYS.dba_free_space
GROUP BY tablespace_name) a,
(SELECT SUM(BYTES) / 1024 / 1024 mbytes_alloc, tablespace_name
FROM SYS.dba_data_files
GROUP BY tablespace_name) b
WHERE a.tablespace_name(+) = b.tablespace_name
UNION ALL
SELECT f.tablespace_name,
SUM (ROUND((f.bytes_free + f.bytes_used) / 1024 / 1024, 2)
) "total MB",
SUM (ROUND(NVL (p.bytes_used, 0) / 1024 / 1024, 2)) "Used MB",
SUM (ROUND ( ((f.bytes_free + f.bytes_used) - NVL (p.bytes_used, 0)
/ 1024
/ 1024,
2
) "Free MB",
(SUM (ROUND (NVL (p.bytes_used, 0) / 1024 / 1024, 2)) * 100)
/ (SUM (ROUND ((f.bytes_free + f.bytes_used) / 1024 / 1024, 2))),
100
- (SUM (ROUND (NVL (p.bytes_used, 0) / 1024 / 1024, 2)) * 100)
/ (SUM (ROUND ((f.bytes_free + f.bytes_used) / 1024 / 1024, 2)))
FROM SYS.v_$temp_space_header f,
dba_temp_files d,
SYS.v_$temp_extent_pool p
WHERE f.tablespace_name(+) = d.tablespace_name AND f.file_id(+) = d.file_id
AND p.file_id(+) = d.file_id
GROUP BY f.tablespace_name
ORDER BY 5 desc --&orderby
Regards
Jafar -
Dear Gurus/Masters/All,
I request your valuble assistance in tuning one of my SQL.
We are using oracle 10.2.04 version and OS is HP-UX 11.23(ia64) version
In my production environment one SQL is taking more time to complete the task. According to EXPLAIN PLAN, i observed that one of it's WHERE condition execution is causing the issue.
I took the explain plan of the WHERE condition which is causing the issue. It is going for full table scan to satisfy the criteria. But a normal index exists on this column.
Main Query WHERE condition and Explain Plan.
SELECT column list ....
FROM
SIEBEL.S_ADDR_PER T1,
SIEBEL.S_PTY_PAY_PRFL T2,
SIEBEL.S_INVLOC T3,
SIEBEL.S_ORDER T4,
SIEBEL.S_ORG_EXT T5,
SIEBEL.S_POSTN T6,
SIEBEL.S_PARTY T7,
SIEBEL.S_PROJ T8,
SIEBEL.S_CON_ADDR T9,
SIEBEL.S_ORG_EXT T10,
SIEBEL.S_USER T11,
SIEBEL.S_DOC_QUOTE T12,
SIEBEL.S_ACCNT_POSTN T13,
SIEBEL.S_INS_CLAIM T14,
SIEBEL.S_USER T15,
SIEBEL.S_ORG_EXT T16,
SIEBEL.S_ASSET T17,
SIEBEL.S_ORDER_TNTX T18,
SIEBEL.S_ORG_EXT_TNTX T19,
SIEBEL.S_PERIOD T20,
SIEBEL.S_DEPOSIT_TNT T21,
SIEBEL.S_ADDR_PER T22,
SIEBEL.S_PAYMENT_TERM T23,
SIEBEL.S_ORG_EXT_X T24,
SIEBEL.S_ORG_EXT T25,
SIEBEL.S_INSCLM_ELMNT T26,
SIEBEL.S_INVOICE T27
WHERE
T25.BU_ID = T10.PAR_ROW_ID (+) AND
T26.INSCLM_ID = T14.ROW_ID (+) AND
T27.ELEMENT_ID = T26.ROW_ID (+) AND
T27.LAST_UPD_BY = T15.PAR_ROW_ID (+) AND
T4.QUOTE_ID = T12.ROW_ID (+) AND
T3.CG_ASSSET_ID = T17.ROW_ID (+) AND
T27.BL_ADDR_ID = T22.ROW_ID (+) AND
T8.BU_ID = T5.PAR_ROW_ID (+) AND
T27.PER_PAY_PRFL_ID = T2.ROW_ID (+) AND
T27.REMIT_ORG_EXT_ID = T16.PAR_ROW_ID (+) AND
T27.PROJ_ID = T8.ROW_ID (+) AND
T27.BL_PERIOD_ID = T20.ROW_ID (+) AND
T27.PAYMENT_TERM_ID = T23.ROW_ID (+) AND
T12.BU_ID = T19.PAR_ROW_ID (+) AND
T27.ACCNT_ID = T25.PAR_ROW_ID (+) AND
T27.ORDER_ID = T18.ROW_ID (+) AND
T4.SRC_INVLOC_ID = T3.ROW_ID (+) AND
T27.ORDER_ID = T4.ROW_ID (+) AND
T27.ACCNT_ID = T24.PAR_ROW_ID (+) AND
T18.PR_DEPOSIT_ID = T21.ROW_ID (+) AND
T27.BL_ADDR_ID = T9.ADDR_PER_ID (+) AND T27.ACCNT_ID = T9.ACCNT_ID (+) AND
T27.BL_ADDR_ID = T1.ROW_ID (+) AND
T25.PR_POSTN_ID = T13.POSITION_ID (+) AND T25.ROW_ID = T13.OU_EXT_ID (+) AND
T13.POSITION_ID = T7.ROW_ID (+) AND
T13.POSITION_ID = T6.PAR_ROW_ID (+) AND
T6.PR_EMP_ID = T11.PAR_ROW_ID (+) AND
(T27.INVC_TYPE_CD = :1)
ORDER BY
T27.INVC_DT;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 2576210427
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 39M| 71G| | 624M (1)|278:42:59 |
| 1 | SORT ORDER BY | | 39M| 71G| 150G| 624M (1)|278:42:59 |
| 2 | NESTED LOOPS OUTER | | 39M| 71G| | 610M (1)|272:11:24 |
| 3 | NESTED LOOPS OUTER | | 39M| 70G| | 515M (1)|229:48:41 |
| 4 | NESTED LOOPS OUTER | | 39M| 69G| | 483M (1)|215:41:04 |
| 5 | NESTED LOOPS OUTER | | 39M| 68G| | 483M (1)|215:41:04 |
| 6 | NESTED LOOPS OUTER | | 39M| 67G| | 483M (1)|215:41:04 |
| 7 | NESTED LOOPS OUTER | | 39M| 66G| | 406M (1)|181:17:50 |
| 8 | NESTED LOOPS OUTER | | 39M| 65G| | 343M (1)|153:12:57 |
| 9 | NESTED LOOPS OUTER | | 39M| 64G| | 311M (1)|139:04:56 |
| 10 | NESTED LOOPS OUTER | | 39M| 63G| | 185M (1)| 82:37:56 |
| 11 | NESTED LOOPS OUTER | | 39M| 54G| | 108M (1)| 48:11:29 |
| 12 | NESTED LOOPS OUTER | | 39M| 53G| | 108M (1)| 48:11:29 |
| 13 | NESTED LOOPS OUTER | | 39M| 51G| | 76M (1)| 34:03:51 |
| 14 | NESTED LOOPS OUTER | | 39M| 49G| | 76M (1)| 34:03:51 |
| 15 | NESTED LOOPS OUTER | | 39M| 46G| | 76M (1)| 34:03:51 |
| 16 | NESTED LOOPS OUTER | | 39M| 44G| | 76M (1)| 34:03:51 |
| 17 | NESTED LOOPS OUTER | | 39M| 40G| | 65M (1)| 29:25:49 |
| 18 | NESTED LOOPS OUTER | | 39M| 39G| | 65M (1)| 29:25:49 |
| 19 | NESTED LOOPS OUTER | | 39M| 38G| | 65M (1)| 29:25:49 |
| 20 | NESTED LOOPS OUTER | | 39M| 34G| | 65M (1)| 29:17:44 |
| 21 | NESTED LOOPS OUTER | | 39M| 32G| | 65M (1)| 29:17:08 |
| 22 | NESTED LOOPS OUTER | | 39M| 31G| | 65M (1)| 29:09:04 |
| 23 | NESTED LOOPS OUTER | | 39M| 30G| | 2043K (9)| 00:54:42 |
| 24 | NESTED LOOPS OUTER | | 39M| 30G| | 2043K (9)| 00:54:42 |
| 25 | NESTED LOOPS OUTER | | 39M| 25G| | 2015K (7)| 00:53:57 |
| 26 | NESTED LOOPS OUTER | | 39M| 22G| | 2015K (7)| 00:53:57 |
| 27 | NESTED LOOPS OUTER | | 39M| 16G| | 2015K (7)| 00:53:57 |
|* 28 | TABLE ACCESS FULL | S_INVOICE | 39M| 9G| | 2015K (7)| 00:53:57 |
| 29 | TABLE ACCESS BY INDEX ROWID| S_PROJ | 1 | 188 | | 1 (0)| 00:00:01 |
|* 30 | INDEX UNIQUE SCAN | S_PROJ_P1 | 1 | | | 1 (0)| 00:00:01 |
| 31 | TABLE ACCESS BY INDEX ROWID | S_PAYMENT_TERM | 1 | 156 | | 1 (0)| 00:00:01 |
|* 32 | INDEX UNIQUE SCAN | S_PAYMENT_TERM_P1 | 1 | | | 1 (0)| 00:00:01 |
| 33 | TABLE ACCESS BY INDEX ROWID | S_INSCLM_ELMNT | 1 | 77 | | 1 (0)| 00:00:01 |
|* 34 | INDEX UNIQUE SCAN | S_INSCLM_ELMNT_P1 | 1 | | | 1 (0)| 00:00:01 |
| 35 | TABLE ACCESS BY INDEX ROWID | S_INS_CLAIM | 1 | 134 | | 1 (0)| 00:00:01 |
|* 36 | INDEX UNIQUE SCAN | S_INS_CLAIM_P1 | 1 | | | 1 (0)| 00:00:01 |
| 37 | TABLE ACCESS BY INDEX ROWID | S_PERIOD | 1 | 19 | | 1 (0)| 00:00:01 |
|* 38 | INDEX UNIQUE SCAN | S_PERIOD_P1 | 1 | | | 1 (0)| 00:00:01 |
| 39 | TABLE ACCESS BY INDEX ROWID | S_USER | 1 | 25 | | 2 (0)| 00:00:01 |
|* 40 | INDEX UNIQUE SCAN | S_USER_U2 | 1 | | | 1 (0)| 00:00:01 |
| 41 | TABLE ACCESS BY INDEX ROWID | S_ORDER_TNTX | 1 | 26 | | 2 (0)| 00:00:01 |
|* 42 | INDEX UNIQUE SCAN | S_ORDER_TNTX_P1 | 1 | | | 1 (0)| 00:00:01 |
| 43 | TABLE ACCESS BY INDEX ROWID | S_DEPOSIT_TNT | 1 | 45 | | 1 (0)| 00:00:01 |
|* 44 | INDEX UNIQUE SCAN | S_DEPOSIT_TNT_P1 | 1 | | | 1 (0)| 00:00:01 |
| 45 | TABLE ACCESS BY INDEX ROWID | S_ORDER | 1 | 101 | | 2 (0)| 00:00:01 |
|* 46 | INDEX UNIQUE SCAN | S_ORDER_P1 | 1 | | | 1 (0)| 00:00:01 |
| 47 | TABLE ACCESS BY INDEX ROWID | S_INVLOC | 1 | 47 | | 1 (0)| 00:00:01 |
|* 48 | INDEX UNIQUE SCAN | S_INVLOC_P1 | 1 | | | 1 (0)| 00:00:01 |
| 49 | TABLE ACCESS BY INDEX ROWID | S_DOC_QUOTE | 1 | 21 | | 1 (0)| 00:00:01 |
|* 50 | INDEX UNIQUE SCAN | S_DOC_QUOTE_P1 | 1 | | | 1 (0)| 00:00:01 |
|* 51 | TABLE ACCESS FULL | S_ORG_EXT_TNTX | 1 | 94 | | 0 (0)| 00:00:01 |
| 52 | TABLE ACCESS BY INDEX ROWID | S_PTY_PAY_PRFL | 1 | 74 | | 1 (0)| 00:00:01 |
|* 53 | INDEX UNIQUE SCAN | S_PTY_PAY_PRFL_P1 | 1 | | | 1 (0)| 00:00:01 |
| 54 | TABLE ACCESS BY INDEX ROWID | S_ADDR_PER | 1 | 84 | | 2 (0)| 00:00:01 |
|* 55 | INDEX UNIQUE SCAN | S_ADDR_PER_P1 | 1 | | | 1 (0)| 00:00:01 |
| 56 | TABLE ACCESS BY INDEX ROWID | S_ADDR_PER | 1 | 57 | | 1 (0)| 00:00:01 |
|* 57 | INDEX UNIQUE SCAN | S_ADDR_PER_P1 | 1 | | | 1 (0)| 00:00:01 |
| 58 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 32 | | 1 (0)| 00:00:01 |
|* 59 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | | 1 (0)| 00:00:01 |
| 60 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 32 | | 1 (0)| 00:00:01 |
|* 61 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | | 1 (0)| 00:00:01 |
| 62 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 256 | | 2 (0)| 00:00:01 |
|* 63 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | | 1 (0)| 00:00:01 |
| 64 | TABLE ACCESS BY INDEX ROWID | S_ACCNT_POSTN | 1 | 32 | | 3 (0)| 00:00:01 |
|* 65 | INDEX RANGE SCAN | S_ACCNT_POSTN_U1 | 1 | | | 2 (0)| 00:00:01 |
| 66 | TABLE ACCESS BY INDEX ROWID | S_POSTN | 1 | 21 | | 1 (0)| 00:00:01 |
|* 67 | INDEX UNIQUE SCAN | S_POSTN_U2 | 1 | | | 1 (0)| 00:00:01 |
| 68 | TABLE ACCESS BY INDEX ROWID | S_USER | 1 | 25 | | 2 (0)| 00:00:01 |
|* 69 | INDEX UNIQUE SCAN | S_USER_U2 | 1 | | | 1 (0)| 00:00:01 |
| 70 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 32 | | 2 (0)| 00:00:01 |
|* 71 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | | 1 (0)| 00:00:01 |
| 72 | TABLE ACCESS BY INDEX ROWID | S_ASSET | 1 | 24 | | 2 (0)| 00:00:01 |
|* 73 | INDEX UNIQUE SCAN | S_ASSET_P1 | 1 | | | 2 (0)| 00:00:01 |
| 74 | TABLE ACCESS BY INDEX ROWID | S_CON_ADDR | 1 | 36 | | 3 (0)| 00:00:01 |
|* 75 | INDEX RANGE SCAN | S_CON_ADDR_U1 | 1 | | | 2 (0)| 00:00:01 |
|* 76 | INDEX UNIQUE SCAN | S_PARTY_P1 | 1 | 12 | | 1 (0)| 00:00:01 |
| 77 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT_X | 1 | 37 | | 2 (0)| 00:00:01 |
|* 78 | INDEX RANGE SCAN | S_ORG_EXT_X_U1 | 1 | | | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
28 - filter("T27"."INVC_TYPE_CD"=:1)
30 - access("T27"."PROJ_ID"="T8"."ROW_ID"(+))
32 - access("T27"."PAYMENT_TERM_ID"="T23"."ROW_ID"(+))
34 - access("T27"."ELEMENT_ID"="T26"."ROW_ID"(+))
36 - access("T26"."INSCLM_ID"="T14"."ROW_ID"(+))
38 - access("T27"."BL_PERIOD_ID"="T20"."ROW_ID"(+))
40 - access("T27"."LAST_UPD_BY"="T15"."PAR_ROW_ID"(+))
42 - access("T27"."ORDER_ID"="T18"."ROW_ID"(+))
44 - access("T18"."PR_DEPOSIT_ID"="T21"."ROW_ID"(+))
46 - access("T27"."ORDER_ID"="T4"."ROW_ID"(+))
48 - access("T4"."SRC_INVLOC_ID"="T3"."ROW_ID"(+))
50 - access("T4"."QUOTE_ID"="T12"."ROW_ID"(+))
51 - filter("T12"."BU_ID"="T19"."PAR_ROW_ID"(+))
53 - access("T27"."PER_PAY_PRFL_ID"="T2"."ROW_ID"(+))
55 - access("T27"."BL_ADDR_ID"="T1"."ROW_ID"(+))
57 - access("T27"."BL_ADDR_ID"="T22"."ROW_ID"(+))
59 - access("T8"."BU_ID"="T5"."PAR_ROW_ID"(+))
61 - access("T27"."REMIT_ORG_EXT_ID"="T16"."PAR_ROW_ID"(+))
63 - access("T27"."ACCNT_ID"="T25"."PAR_ROW_ID"(+))
65 - access("T25"."ROW_ID"="T13"."OU_EXT_ID"(+) AND "T25"."PR_POSTN_ID"="T13"."POSITION_ID"(+))
67 - access("T13"."POSITION_ID"="T6"."PAR_ROW_ID"(+))
69 - access("T6"."PR_EMP_ID"="T11"."PAR_ROW_ID"(+))
71 - access("T25"."BU_ID"="T10"."PAR_ROW_ID"(+))
73 - access("T3"."CG_ASSSET_ID"="T17"."ROW_ID"(+))
75 - access("T27"."BL_ADDR_ID"="T9"."ADDR_PER_ID"(+) AND "T27"."ACCNT_ID"="T9"."ACCNT_ID"(+))
filter("T27"."ACCNT_ID"="T9"."ACCNT_ID"(+))
76 - access("T13"."POSITION_ID"="T7"."ROW_ID"(+))
78 - access("T27"."ACCNT_ID"="T24"."PAR_ROW_ID"(+))
117 rows selected.SQL> EXPLAIN PLAN FOR
2 SELECT * FROM SIEBEL.S_INVOICE T27 WHERE T27.INVC_TYPE_CD=:1;
Explained.
SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
PLAN_TABLE_OUTPUT
Plan hash value: 1810797629
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 39M| 9G| 2016K (8)| 00:53:59 |
|* 1 | TABLE ACCESS FULL| S_INVOICE | 39M| 9G| 2016K (8)| 00:53:59 |
Predicate Information (identified by operation id):
1 - filter("T27"."INVC_TYPE_CD"=:1)
13 rows selected.Edited by: KODS on Feb 13, 2013 1:08 PMDear Ivan,
Please find the details below.
select * from dba_indexes where index_name = 'S_INVOICE_U1';
OWNER INDEX_NAME INDEX_TYPE TABLE_OWNER TABLE_NAME TABLE_TYPE UNIQUENESS COMPRESSION PREFIX_LENGTH TABLESPACE_NAME INI_TRANS MAX_TRANS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE PCT_THRESHOLD INCLUDE_COLUMN FREELISTS FREELIST_GROUPS PCT_FREE LOGGING BLEVEL LEAF_BLOCKS DISTINCT_KEYS AVG_LEAF_BLOCKS_PER_KEY AVG_DATA_BLOCKS_PER_KEY CLUSTERING_FACTOR STATUS NUM_ROWS SAMPLE_SIZE LAST_ANALYZED DEGREE INSTANCES PARTITIONED TEMPORARY GENERATED SECONDARY BUFFER_POOL USER_STATS DURATION PCT_DIRECT_ACCESS ITYP_OWNER ITYP_NAME PARAMETERS GLOBAL_STATS DOMIDX_STATUS DOMIDX_OPSTATUS FUNCIDX_STATUS JOIN_INDEX IOT_REDUNDANT_PKEY_ELIM DROPPED
SIEBEL S_INVOICE_U1 NORMAL SIEBEL S_INVOICE TABLE UNIQUE DISABLED CRMSBL_AEM_INDEX 2 255 65536 1 2147483645 10 NO 3 902796 196739390 1 1 125598294 VALID 196739390 196739390 10-02-13 1 1 NO N N N DEFAULT NO YES NO NO NO
select * from dba_ind_columns where index_name = 'S_INVOICE_U1' order by column_position;
INDEX_OWNER INDEX_NAME TABLE_OWNER TABLE_NAME COLUMN_NAME COLUMN_POSITION COLUMN_LENGTH CHAR_LENGTH DESCEND
SIEBEL S_INVOICE_U1 SIEBEL S_INVOICE INVC_NUM 1 200 50 ASC
SIEBEL S_INVOICE_U1 SIEBEL S_INVOICE INVC_TYPE_CD 2 120 30 ASC
SIEBEL S_INVOICE_U1 SIEBEL S_INVOICE CONFLICT_ID 3 60 15 ASC -
Query tuning for data-warehousing application in Oracle 8i.
We have to pick up 24 months old data. Each month data is kept in a different partition.
2007-May month data is kept in PRESC200705 partition
SELECT r.account_id,
p.presc_num,
spm.product_id,
p.month,
t.best_call_state,
sum(p.trx_count)
FROM rlup_assigned_account r,
temp_presc_num_TEST t,
retail.prescrip_retail partition (PRESC200705) p,
sherlock.sherlock_product_mapping spm
WHERE spm.product_id like '056%'
and spm.mds6 = p.product_id
and t.CLIENT_ID = p.presc_num
and r.ndc_pyr_id = p.payer_plan
and t.best_call_state = r.ST
GROUP BY r.account_id,
p.presc_num,
spm.product_id,
p.month,
t.best_call_state
Q This Query is to be tuned
SQL> SELECT table_name,
2 partition_name,
3 high_value,
4 num_rows
5 FROM user_tab_partitions
6 ;
no rows selectedI have the following task:
Requirement:
According to the client, new partitions are created every month.
So the query should contain only the 24 most recent partions leaving one old partition every month.
So, the query becomes dynamic.
The query will have to leave one old partion every month and move ahead with the new partion created.
The total partitions accessed should not cross 24.
Is this possible?
Partition# for OCt 2007
1
2
3
4
5
6
7
24
Partition# for Nov 2007
Old|New
1
2..1
3..2
4..3
5..4
6..5
7..6
24..23
..24
Secondly, with one month data (in a partitioned table), the query takes about one hour to run.
with 24 month data accessed by the query, the query will take 24 hours to run.
I am sure that Oracle can be tuned to run on such huge data with ease and the query output can
come within seconds.. Otherwise, nobody would use oracle for datawarehousing applicaions.
Q. How do I write a dynamic query that references 24 recent partitions, using the query provided:
abc>SELECT r.account_id,
2 p.presc_num,
3 spm.product_id,
4 p.month,
5 t.best_call_state,
6 sum(p.trx_count)
7 FROM rlup_assigned_account r,
8 temp_presc_num_TEST t,
9 retail.prescrip_retail partition (PRESC200705) p,
10 sherlock.sherlock_product_mapping spm
11 WHERE spm.product_id like '056%'
12 and t.CLIENT_ID='934759'
13 and spm.mds6 = p.product_id
14 and t.CLIENT_ID = p.presc_num
15 and r.ndc_pyr_id = p.payer_plan
16 and t.best_call_state = r.ST
17 GROUP BY r.account_id,
18 p.presc_num,
19 spm.product_id,
20 p.month,
21 t.best_call_state
22 ;
retail.prescrip_retail partition (PRESC200705) p,
Partition name, PRESC200705 cannot be hardcoded into the sql.
Sql should take a range of 24 recent partitions.
And the query should execute fast too.
Now, is that what is called a challenge?
+++++++++++++++++++++++++++++++++++++++++++++++
Here are the index/constraints/explain_plan output on prescrip_retail table (which is partitioned)
as well as other tables to which prescrip_retail table is joined
This is what prescrip_retail looks like. This is the table having partitions.
It does not seem to have a primary key!
SQL> desc prescrip_retail
Name Null? Type
PRESC_NUM NUMBER
PFIER_NUM CHAR(8)
RELID NOT NULL CHAR(9)
ME_NUM NOT NULL CHAR(10)
PRODUCT_ID NOT NULL CHAR(6)
PRODUCT_FRMSTR NOT NULL CHAR(1)
PAYER_PLAN NOT NULL CHAR(6)
MONTH NOT NULL DATE
PYMT_CODE NOT NULL CHAR(1)
NRX_COUNT NOT NULL NUMBER(7)
NRX_QUANTITY NOT NULL NUMBER(9)
NRX_DOLLARS NOT NULL NUMBER(13,2)
TRX_COUNT NOT NULL NUMBER(7)
TRX_QUANTITY NOT NULL NUMBER(9)
TRX_DOLLARS NOT NULL NUMBER(13,2)
Table Size of Prescrip_Retail...
1 select table_name,tablespace_name,pct_free,pct_used,num_rows,avg_space
2 from all_tables
3* where table_name='PRESCRIP_RETAIL'
SQL> /
TABLE_NAME TABLESPACE_NAME PCT_FREE PCT_USED NUM_ROWS AVG_SPACE
PRESCRIP_RETAIL 2806673860 360
Explain Plan for the query to be tuned...
22:32:31 SQL> explain plan set statement_id='vista_query'
22:43:33 2 for
22:43:35 3 SELECT r.pfier_account_id,
22:43:41 4 p.presc_num,
22:43:41 5 spm.product_id,
22:43:41 6 p.month,
22:43:41 7 t.best_call_state,
22:43:41 8 sum(p.trx_count)
22:43:41 9 FROM rlup_assigned_account r,
22:43:41 10 temp_presc_num_TEST t,
22:43:41 11 retail.prescrip_retail partition (PRESC200705) p,
22:43:41 12 sherlock.sherlock_product_mapping spm
22:43:41 13 WHERE spm.product_id like '056%'
22:43:41 14 and spm.mds6 = p.product_id
22:43:41 15 and t.CLIENT_ID = p.presc_num
22:43:41 16 and r.ndc_pyr_id = p.payer_plan
22:43:41 17 and t.best_call_state = r.ST
22:43:41 18 GROUP BY r.pfier_account_id,
22:43:41 19 p.presc_num,
22:43:41 20 spm.product_id,
22:43:41 21 p.month,
22:43:41 22 t.best_call_state;
Explained.
SQL> select statement_id,operation,options,object_name
2 from plan_table
3 where statement_id='vista_query';
22:46:03 SQL> /
STATEMENT_ID OPERATION OPTIONS OBJECT_NAME
vista_query SELECT STATEMENT
vista_query SORT GROUP BY
vista_query HASH JOIN
vista_query TABLE ACCESS FULL TEMP_PRESC_NUM_TEST
vista_query HASH JOIN
vista_query TABLE ACCESS FULL RLUP_ASSIGNED_ACCOUNT
vista_query HASH JOIN
vista_query TABLE ACCESS FULL SHERLOCK_PRODUCT_MAPPING
vista_query TABLE ACCESS FULL PRESCRIP_RETAIL
9 rows selected.
Partition Pruning: This is supposed to provide an insight to the partitions oracle
vists internally...
I guess we can use "month>= add_months(sysdate,-24)" instead of partions too.
I don't think Oracle is visiting any partitions.
I'll also search into all_tab_partitions to verify this.
Explain_Plan for what partitions oracle visits internally (partition pruning):
SQL> ed
Wrote file afiedt.buf
1 explain plan set statement_id='vista'
2 for select * from retail.prescrip_retail
3* where month>= add_months(sysdate,-24)
SQL> /
Explained.
Elapsed: 00:00:00.05
22:13:56 SQL> select statement_id,operation,options,object_name
22:14:28 2 from plan_table
22:14:30 3 where statement_id='vista';
STATEMENT_ID OPERATION
OPTIONS OBJECT_NAME
vista SELECT STATEMENT
vista PARTITION RANGE
ITERATOR
vista TABLE ACCESS
FULL PRESCRIP_RETAIL
Elapsed: 00:00:01.00
Indexes/Constraints on PRESCRIP_RETAIL table:
SQL> ED
Wrote file afiedt.buf
1 SELECT TABLE_NAME,TABLE_TYPE,INDEX_NAME,INDEX_TYPE,PCT_FREE,STATUS,PARTITIONED
2 FROM ALL_INDEXES
3* WHERE TABLE_NAME IN ('PRESCRIP_RETAIL')
SQL> /
TABLE_NAME TABLE INDEX_NAME INDEX_TYPE PCT_FREE STATUS PAR
PRESCRIP_RETAIL TABLE BX6_PRESC_RELID BITMAP N/A YES
PRESCRIP_RETAIL TABLE BX7_PRESC_ME BITMAP N/A YES
PRESCRIP_RETAIL TABLE BX1_PRESC_PROD BITMAP N/A YES
PRESCRIP_RETAIL TABLE BX2_PRESC_PAYER BITMAP N/A YES
PRESCRIP_RETAIL TABLE BX3_PRESC_PAYERCD BITMAP N/A YES
PRESCRIP_RETAIL TABLE BX4_PRESC_PRESC BITMAP N/A YES
PRESCRIP_RETAIL TABLE BX5_PRESC_PFIER BITMAP N/A YES
7 rows selected.
SQL> ed
Wrote file afiedt.buf
1 SELECT TABLE_NAME,CONSTRAINT_NAME,CONSTRAINT_TYPE,STATUS,DEFERRABLE
2 FROM ALL_CONSTRAINTS
3* WHERE TABLE_NAME IN ('PRESCRIP_RETAIL')
SQL> /
TABLE_NAME CONSTRAINT_NAME C STATUS DEFERRABLE
PRESCRIP_RETAIL SYS_C001219 C ENABLED NOT DEFERRABLE
PRESCRIP_RETAIL SYS_C001220 C ENABLED NOT DEFERRABLE
PRESCRIP_RETAIL SYS_C001221 C ENABLED NOT DEFERRABLE
PRESCRIP_RETAIL SYS_C001222 C ENABLED NOT DEFERRABLE
PRESCRIP_RETAIL SYS_C001223 C ENABLED NOT DEFERRABLE
PRESCRIP_RETAIL SYS_C001224 C ENABLED NOT DEFERRABLE
PRESCRIP_RETAIL SYS_C001225 C ENABLED NOT DEFERRABLE
PRESCRIP_RETAIL SYS_C001226 C ENABLED NOT DEFERRABLE
PRESCRIP_RETAIL SYS_C001227 C ENABLED NOT DEFERRABLE
PRESCRIP_RETAIL SYS_C001228 C ENABLED NOT DEFERRABLE
PRESCRIP_RETAIL SYS_C001229 C ENABLED NOT DEFERRABLE
PRESCRIP_RETAIL SYS_C001230 C ENABLED NOT DEFERRABLE
PRESCRIP_RETAIL SYS_C001231 C ENABLED NOT DEFERRABLE
13 rows selected.
In all_tables:
NUM_ROWS:2806673860
AVG_SPACE:360
Here is the data size in the table.
SQL> select count(*) from PRESCRIP_RETAIL;
COUNT(*)
4602980312
Again, here is the partition information and the amount of data in each partition:
SQL> ed
Wrote file afiedt.buf
1 select
2 partition_name,SUBPARTITION_COUNT,PARTITION_POSITION,TABLESPACE_NAME,
3 NUM_ROWS
4 from all_tab_partitions
5 where table_name='PRESCRIP_RETAIL'
6* order by partition_name desc
SQL> /
PARTITION_NAME SUBPARTITION_COUNT PARTITION_POSITION TABLESPACE_NAME NUM_ROWS
PRESC200705 0 36 PRESC_PARTITION_29 141147085
PRESC200704 0 35 PRESC_PARTITION_28 140299317
PRESC200703 0 34 PRESC_PARTITION_27 140703128
PRESC200702 0 33 PRESC_PARTITION_26 132592733
PRESC200701 0 32 PRESC_PARTITION_25 145832356
PRESC200612 0 31 PRESC_PARTITION_24 136702837
PRESC200611 0 30 PRESC_PARTITION_23 137421767
PRESC200610 0 29 PRESC_PARTITION_22 140836119
PRESC200609 0 28 PRESC_PARTITION_21 131273578
PRESC200608 0 27 PRESC_PARTITION_20 134967317
PRESC200607 0 26 PRESC_PARTITION_19 130785504
PRESC200606 0 25 PRESC_PARTITION_18 131472696
PRESC200605 0 24 PRESC_PARTITION_17 138590581
PRESC200604 0 23 PRESC_PARTITION_16 126849798
PRESC200603 0 22 PRESC_PARTITION_15 137164667
PRESC200602 0 21 PRESC_PARTITION_14 126938544
PRESC200601 0 20 PRESC_PARTITION_13 135408324
PRESC200512 0 19 PRESC_PARTITION_12 123285100
PRESC200511 0 18 PRESC_PARTITION_11 121245764
PRESC200510 0 17 PRESC_PARTITION_10 122112932
PRESC200509 0 16 PRESC_PARTITION_09 119137399
PRESC200508 0 15 PRESC_PARTITION_08 123372311
PRESC200507 0 14 PRESC_PARTITION_07 112905435
PRESC200506 0 13 PRESC_PARTITION_06 119581406
PRESC200505 0 12 PRESC_PARTITION_05 123977315
PRESC200504 0 11 PRESC_PARTITION_04 118975597
PRESC200503 0 10 PRESC_PARTITION_03 125782688
PRESC200502 0 9 PRESC_PARTITION_02 117448839
PRESC200501 0 8 PRESC_PARTITION_01 122214436
PRESC200412 0 7 PRESC_PARTITION_36 124799998
PRESC200411 0 6 PRESC_PARTITION_35 125471042
PRESC200410 0 5 PRESC_PARTITION_34 118457422
PRESC200409 0 4 PRESC_PARTITION_33 119537488
PRESC200408 0 3 PRESC_PARTITION_32 121319137
PRESC200407 0 2 PRESC_PARTITION_31 115226621
PRESC200406 0 1 PRESC_PARTITION_30 119143031
36 rows selected.
Data in induvidual partition of PRESCRIP_RETAIL.
SQL> SELECT COUNT(*) FROM PRESCRIP_RETAIL PARTITION(PRESC200704);
COUNT(*)
140299317
SQL> SELECT COUNT(*) FROM PRESCRIP_RETAIL PARTITION(PRESC200703);
COUNT(*)
140703128
SQL> SELECT COUNT(*) FROM PRESCRIP_RETAIL PARTITION(PRESC200702);
COUNT(*)
132592733
SQL> SELECT COUNT(*) FROM PRESCRIP_RETAIL PARTITION(PRESC200701);
COUNT(*)
145832356
SQL> SELECT COUNT(*) FROM PRESCRIP_RETAIL PARTITION(PRESC200606);
COUNT(*)
131472696
SQL> SELECT COUNT(*) FROM PRESCRIP_RETAIL PARTITION(PRESC200605);
COUNT(*)
138590581
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other tables info:
Index of other tables related to PRESCRIP_REATIL:
SQL> SELECT TABLE_NAME,TABLE_TYPE,INDEX_NAME,INDEX_TYPE,PCT_FREE,STATUS,PARTITIONED
2 FROM ALL_INDEXES
3 WHERE TABLE_NAME IN ('RLUP_ASSIGNED_ACCOUNT','TEMP_PRESC_NUM_TEST','SHERLOCK_PRODUCT_MAPPING');
SQL> /
TABLE_NAME TABLE INDEX_NAME INDEX_TYPE PCT_FREE STATUS PAR
SHERLOCK_PRODUCT_MAPPING TABLE SHERLOCK_PRODUCT_MAPPING_PK NORMAL 10 VALID NO
SHERLOCK_PRODUCT_MAPPING TABLE SHERLOCK_PRODUCT_MAPPING_X1 NORMAL 0 VALID NO
SHERLOCK_PRODUCT_MAPPING TABLE SHERLOCK_PRODUCT_MAPPING_BX1 BITMAP 0 VALID NO
SHERLOCK_PRODUCT_MAPPING TABLE SHERLOCK_PRODUCT_MAPPING_BX2 BITMAP 0 VALID NO
SHERLOCK_PRODUCT_MAPPING TABLE SHERLOCK_PRODUCT_MAPPING_BX3 BITMAP 0 VALID NO
RLUP_ASSIGNED_ACCOUNT TABLE BX1_RLUP_ASSIGNED_ACCT_PYR BITMAP 10 VALID NO
RLUP_ASSIGNED_ACCOUNT TABLE BX2_RLUP_ASSIGNED_ACCT_TOPLVL BITMAP 10 VALID NO
RLUP_ASSIGNED_ACCOUNT TABLE BX3_RLUP_ASSIGNED_ACCT_PBM BITMAP 10 VALID NO
RLUP_ASSIGNED_ACCOUNT TABLE BX4_RLUP_ASSIGNED_ACCT_AA_FLAG BITMAP 10 VALID NO
RLUP_ASSIGNED_ACCOUNT TABLE BX5_RLUP_ASSIGNED_ACCT_AA_CHD BITMAP 10 VALID NO
RLUP_ASSIGNED_ACCOUNT TABLE BX6_RLUP_ASSIGNED_ACCT_PBM_FLG BITMAP 10 VALID NO
RLUP_ASSIGNED_ACCOUNT TABLE BX7_RLUP_ASSIGNED_ACCT_ACCTID BITMAP 10 VALID NO
RLUP_ASSIGNED_ACCOUNT TABLE PK_RLUP_ASSIGNED_ACCOUNT NORMAL 10 VALID NO
13 rows selected.
Constraints in other tables:
SQL> SELECT TABLE_NAME,CONSTRAINT_NAME,CONSTRAINT_TYPE,STATUS,DEFERRABLE
2 FROM ALL_CONSTRAINTS
3 WHERE TABLE_NAME IN ('RLUP_ASSIGNED_ACCOUNT','TEMP_PRESC_NUM_TEST','SHERLOCK_PRODUCT_MAPPING');
TABLE_NAME CONSTRAINT_NAME C STATUS DEFERRABLE
RLUP_ASSIGNED_ACCOUNT SYS_C00637753 C ENABLED NOT DEFERRABLE
RLUP_ASSIGNED_ACCOUNT SYS_C00637754 C ENABLED NOT DEFERRABLE
RLUP_ASSIGNED_ACCOUNT SYS_C00637755 C ENABLED NOT DEFERRABLE
RLUP_ASSIGNED_ACCOUNT SYS_C00637756 C ENABLED NOT DEFERRABLE
RLUP_ASSIGNED_ACCOUNT SYS_C00637757 C ENABLED NOT DEFERRABLE
RLUP_ASSIGNED_ACCOUNT SYS_C00637758 C ENABLED NOT DEFERRABLE
RLUP_ASSIGNED_ACCOUNT SYS_C00637759 C ENABLED NOT DEFERRABLE
RLUP_ASSIGNED_ACCOUNT SYS_C00637760 C ENABLED NOT DEFERRABLE
RLUP_ASSIGNED_ACCOUNT SYS_C00637761 C ENABLED NOT DEFERRABLE
RLUP_ASSIGNED_ACCOUNT SYS_C00637762 C ENABLED NOT DEFERRABLE
RLUP_ASSIGNED_ACCOUNT PK_RLUP_ASSIGNED_ACCOUNT P ENABLED NOT DEFERRABLE
TEMP_PRESC_NUM_TEST SYS_C00640536 C ENABLED NOT DEFERRABLE
12 rows selected.
TEMP_PRESC_NUM_TEST does not contain any constraints or index.
Maybe you are looking for
-
Image swaps with fade out and in
I am new to Dreamweaver, in fact only got into it to do my own website. I want to create image swaps with a fade out and then fade in with the new image. Nowhere can I find out how to do this so far. Can anybody point me in the right direction. Many
-
Hi, our organization is testing the following software upgrades: - Oracle R12 (from 11) - For HRMS, replacing IE 6 with Firefox 3.6.1 Based on an email from one of our clients: - Trouble recording UPK in HRMS R12 with Firefox (works fine in R12 with
-
I prefer Preview as my default reader. Somehow Adobe Reader has locked itself as the default. How do I reset back to Preview?
-
Hello, I'm working with crystal reports SP3 connected to SAP ERP. I'm already working with other reports and works fine. The problem is with one of the reports that when I refresh it it shows me this error, CRYSTAL/OSQL_EXECUTE_QUERY returned: subrc:
-
Hi there, Is there anyone of you who have created a BDC program for CA21? because I'm experiencin a problem with field VORNR. The message is "Field PLPOD-VORNR (1) input value is longer than screen field". Though when you try to run it in SM35 the