Beruflich Dokumente
Kultur Dokumente
5 hours)
DB2's GOT TALENT FINALS #3 BY Renu Sharma ACE DBA CONSULTING Inc
select substr(tabschema,1,20)SCHEMA_NAME , count(*) TABLE_CNT, case type when 'A' then 'Alias' when 'w' then 'Created temporary table' when 'H' then 'Hierarchy table' when 'L' then 'Detached table' when 'N' then 'Nickname' when 'S' then 'Materialized query table' when 'T' then 'Table (untyped)' when 'U' then 'Typed table' when 'V' then 'View (untyped)' when 'W' then 'Typed view' end as TABLE_TYPE from syscat.tables where tabschema <> 'SYS%' group by tabschema, type order by 1 with ur
3/23/2013 DB2's GOT TALENT FINALS #3 BY Renu Sharma ACE DBA CONSULTING Inc 2
TABLE_CNT
TABLE_TYPE 3 Table (untyped) 1 View (untyped) 5 Alias 1 Nickname 1 Materialized query table
3/23/2013
DB2's GOT TALENT FINALS #3 BY Renu Sharma ACE DBA CONSULTING Inc
SQL 3 : TRIGGERS COUNT select substr(trigschema,1,15) TRIGSCHEMA, count(*) TRIGGERS_CNT from syscat.triggers where trigschema not like 'SYS%' group by trigschema
TRIGSCHEMA DB2INST1
3/23/2013
TRIGGERS_CNT 1
DB2's GOT TALENT FINALS #3 BY Renu Sharma ACE DBA CONSULTING Inc 4
SQL 4 : FUNCTIONS COUNT select substr(funcschema,1,15) FUNCSCHEMA, count(*) FUNCTIONS_CNT from syscat.functions where funcschema not like 'SYS%' group by funcschema with ur FUNCSCHEMA DB2INST1 FUNCTIONS_CNT 2
VIEW_CNT
1 20
5
DB2's GOT TALENT FINALS #3 BY Renu Sharma ACE DBA CONSULTING Inc
3/23/2013
DB2's GOT TALENT FINALS #3 BY Renu Sharma ACE DBA CONSULTING Inc
select tbspace from syscat.tablespaces where datatype not in ('T', 'U') except (select rtrim(tbspace) from syscat.tables) with ur TBSPACE DMSTBS
select substr(tbspace ,1,25)TBSPACE, substr( tbspacetype,1,1) SPACETYPE , substr(E.SGNAME,1,20) STOGNAME , case when E.SGNAME is null then 'NOT AUTOMATIC STORAGE' when E.SGNAME is not null then 'AUTOMATIC STORAGE' end STORAGE_Y_N from syscat.tablespaces E left outer join syscat.stogroups G on G.SGNAME = E.SGNAME where E.tbspace not like 'SYS% with ur
TBSPACE TEMPSPACE1 STSCUBE IBMDB2SAMPLEXML IBMDB2SAMPLEREL USERSPACE1 DMSTBS
3/23/2013
STORAGE_Y_N AUTOMATIC STORAGE AUTOMATIC STORAGE AUTOMATIC STORAGE AUTOMATIC STORAGE AUTOMATIC STORAGE NOT AUTOMATIC STORAGE
7
DB2's GOT TALENT FINALS #3 BY Renu Sharma ACE DBA CONSULTING Inc
SQL 3 : Whether the indexes are in different table space then data table space
select substr(tabschema||'.'||tabname,1,40) TABNAME ,substr(tbspace,1,20)TBSPACE , substr( index_tbspace,1,20) INDEX_TBSPACE from syscat.tables where tabschema not like 'SYS%' and tabname not like 'EXPL%' and tabname not like 'ADVISE%' and type in ('T','S') and INDEX_TBSPACE is null and tbspace in (select tbspace from syscat.tablespaces where tbspacetype <> 'S' ) with ur
TABNAME TBSPACE INDEX_TBSPACE
DB2INST1.CL_SCHED
DB2INST1.ADEFUSR DB2INST1.EMPMDC DB2INST1.PRODUCTSUPPLIER CUBE_SCHEMA.PPCL_CUBE_CUBENBR
USERSPACE1
USERSPACE1 IBMDB2SAMPLEREL IBMDB2SAMPLEXML STSCUBE
CUBE_SCHEMA.PPCL_TRAN_LOG
STSCUBE
3/23/2013
DB2's GOT TALENT FINALS #3 BY Renu Sharma ACE DBA CONSULTING Inc
SQL 1 : To get the names of tables having primary key and unique Index
SELECT type , substr(tabschema,1,10) TABSCHEMA, substr( tabname,1,20) TABNAME FROM syscat.tabconst WHERE type in ('P','U') with ur
TYPE U U U P P P P TABSCHEMA SYSTOOLS SYSTOOLS SYSTOOLS DB2INST1 DB2INST1 DB2INST1 DB2INST1 TABNAME POLICY HMON_ATM_INFO HMON_COLLECTION DEPARTMENT EMPLOYEE EMP_PHOTO EMP_RESUME
3/23/2013
DB2's GOT TALENT FINALS #3 BY Renu Sharma ACE DBA CONSULTING Inc
SQL 2 : How to get count of Total Number of Indexes and Last used indexes total number
select distinct substr(tabschema,1,15) TABSCHEMA, substr(tabname,1,35) TABNAME, count(*) TOTALINDEX, (select count(*) from syscat.indexes where lastused = '01/01/0001' and tabname = I.tabname and tabschema = I.tabschema) LASTUSEDSINCE01010001 from syscat.indexes I where tabname not like 'EXPLAIN%' and tabschema not like 'SYS%' group by tabschema,tabname with ur
TABSCHEMA CUBE_SCHEMA DB2INST1 DB2INST1 DB2INST1 DB2INST1 DB2INST1 DB2INST1 DB2INST1 TABNAME PPCL_CUBE_CUBENBR DEPARTMENT INVENTORY ACT EMPLOYEE SUPPLIERS PRODUCT CUSTOMER TOTALINDEX 2 3 1 2 2 3 7 12 LASTUSEDSINCE01010001 0 0 1 1 1 3 5 7
3/23/2013
DB2's GOT TALENT FINALS #3 BY Renu Sharma ACE DBA CONSULTING Inc
10
PARTITION
BUFFERPOOL
HIT_RATIO
0 IBMDEFAULTBP
0 BP08 0 IBMSYSTEMBP4K
99
97 0
0 IBMSYSTEMBP8K
0 IBMSYSTEMBP16K 0 IBMSYSTEMBP32K
0
0 0
3/23/2013
DB2's GOT TALENT FINALS #3 BY Renu Sharma ACE DBA CONSULTING Inc
11
3/23/2013
DB2's GOT TALENT FINALS #3 BY Renu Sharma ACE DBA CONSULTING Inc
12
Thanks
My contact and blog info : Renu Sharma ACE DBA Consulting Inc www.db2dbas.com renusharma@db2dbas.com, renusharma@aol.com 732-342-7630, 732-995-9963,732-374-3601 Facebook :https://www.facebook.com/home.php#!/pages/ACE-DBAConsulting/138802816289257 Twitter : @db2_dbas Linkedin : http://www.linkedin.com/home?trk=hb_tab_home_top
3/23/2013
DB2's GOT TALENT FINALS #3 BY Renu Sharma ACE DBA CONSULTING Inc
14