If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > db2look to simulate prod failed

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-01-09, 09:24
wondering wondering is offline
Registered User
 
Join Date: May 2009
Posts: 10
db2look to simulate prod failed

I am using db2look to get a bunch of related table statistics from a production databaes, and update a test database using the generated statements. Both the production database and test database don't have detailed index statistics.

During this process, only one update statement failed, which is to update SYSSTAT.TABLES for a specific table X. It failed with the message:
The catalog statistis "963" for column "CARD" is out of its target column,has an invalid format or is inconsistent in relation to some other statistics. (23521, -1227)

This is strange, becaues:
1) The update statements for other tables and their columns statistis succeeded. (i.e. the statements that update SYSSTAT.TABLES and SYSSTAT.COLUMNS)
2) The update statements for table X's column statistis (SYSSTAT.COLUMNS) succeeded. So I know that "CARD" value 963 of the table is greater than any column's COLCARD.

I suspect the relationship between "CARD" and "NPAGE", "FPAGE" might be off. Another posibility is that the some configuration of prod and test is different. However, i don't know how to confirm this. Could you please help?


I am using db2 8.
Reply With Quote
  #2 (permalink)  
Old 06-01-09, 17:43
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by wondering
I am using db2 8.
Out of service. But I would apply FP17 if you haven't already.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 06-01-09, 22:24
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
If by any chance your production database is partitioned and the test one is not, keep in mind that statistics are collected per partition.

If this is not the case, I would first try making sure that the statistics in production is fully up to date.
Reply With Quote
  #4 (permalink)  
Old 06-01-09, 22:30
wondering wondering is offline
Registered User
 
Join Date: May 2009
Posts: 10
Thanks, the production database is fully up to date, and it is not partitioned (neither is the test database).

There should be a relationship between CARD/NPAGES/FPAGES, such as a page can contain # of records, so CARD records should at least occupy #NPAGES, etc? I am just guessing.
Reply With Quote
  #5 (permalink)  
Old 06-02-09, 21:16
wondering wondering is offline
Registered User
 
Join Date: May 2009
Posts: 10
Anyone can help me on this?
Reply With Quote
  #6 (permalink)  
Old 06-02-09, 22:51
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Do you have a reason code for -1227 (sql1227n)?

SQL1227N The catalog statistic "<value>" for column
"<column>" is out of range for its target column, has
an invalid format, or is inconsistent in relation to
some other statistic. Reason Code = "<code>"


Can you execute the update statement from the command line to see if it gives you the RC.
Reply With Quote
  #7 (permalink)  
Old 06-03-09, 03:15
wondering wondering is offline
Registered User
 
Join Date: May 2009
Posts: 10
I am discovering something insteresting here. The prod database's statistics is updated with runstats command without "WITH DISTRIBUTION ON COLUMNS" clause, this can be proved by running the blow command on the prod database:

select * from SYSSTAT.COLUMNS where TABNAME = '***' AND TABSCHEMA = '***'
(*** is a placehold for real values, don't want to disclose my company's information :-))

This sql returns empty.

The db2look however returns update statements to update SYSSTAT.COLUMNS with valid values.

So it seems, db2look executes runstats on the prod database but doesn't write them into the prod tables.

But this doens't make sense, after all, i want to simulate the prod database.

1) is there a way to tell db2look to not do more than it should?
2) is there a way to delete information from SYSSTAT.COLUMNS?

Thank you for your help.
Reply With Quote
  #8 (permalink)  
Old 06-03-09, 09:55
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
select * from SYSSTAT.COLUMNS

should not return empty if table is there. Regardless how stats are collected.
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #9 (permalink)  
Old 06-03-09, 22:10
wondering wondering is offline
Registered User
 
Join Date: May 2009
Posts: 10
But how can I explain the empty result? I fired the sql statement via CLP, it shows "0 record(s) selected."

If I select from SYSCAT.COLUMNS, the result is not empty.

Could you expand on this?

Thanks.
Reply With Quote
  #10 (permalink)  
Old 06-04-09, 09:28
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
WOW buddy. you are confusing me. does select * from SYSCAT.COLUMNS gives you data or not. Show the command and its output.
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #11 (permalink)  
Old 06-07-09, 23:22
wondering wondering is offline
Registered User
 
Join Date: May 2009
Posts: 10
select * from SYSCAT.COLUMNS where TABNAME = 'XXXX' AND TABSCHEMA = 'XXXX'

The result set is not empty.

select * from SYSSTAT.COLUMNS where TABNAME = 'XXXX' AND TABSCHEMA = 'XXXX'
The result set is empty, even after I have executed RUNSTATS ON TABLE "XXXX"."XXXX"
WITH DISTRIBUTION ON ALL COLUMNS
on this table, the result set is still empty!

But the db2look on this table gives update statements, such as:
UPDATE SYSSTAT.COLUMNS
SET COLCARD=45056,
NUMNULLS=0,
SUB_COUNT=-1,
SUB_DELIM_LENGTH=-1,
AVGCOLLENCHAR=-1,
HIGH2KEY='338960',
LOW2KEY='10987',
AVGCOLLEN=4
WHERE COLNAME = 'XXXX' AND TABNAME = 'XXXX' AND TABSCHEMA = 'XXXX';

So it seems that the db2look command first does a runstats command on the table but without writing the statistics to the related system tables and output them.

Have I made myself clear? Please continue to help me. Thank you very much.
Reply With Quote
  #12 (permalink)  
Old 06-08-09, 08:53
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
db2look does not update statistics. I'd suggest you take a closer look at how you spell 'XXXX' and 'XXXX' in each of the statements.
Reply With Quote
  #13 (permalink)  
Old 06-08-09, 11:55
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
As Nick said db2look does nothing to change stats. Check your name.

btw. I just realized that you were talking about two diff schemas SYSCAT and SYSSTAT. but that does not changes anything. SYSSTAT should have info on the table and its columns regardles if you have indexes or has collected statistics.
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #14 (permalink)  
Old 06-08-09, 21:58
wondering wondering is offline
Registered User
 
Join Date: May 2009
Posts: 10
I run the sql "select * from SYSSTAT.COLUMNS" and grepped the result, there is no record for the XXXX table!

SYSSTAT should contain the records even for an empty table. I've proved that by creating an empty table and search for it in the SYSSTAT.COLUMNS.

Who can solve the mystery?
Reply With Quote
  #15 (permalink)  
Old 06-09-09, 09:24
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
Are you sure that your XXXX is a table??? Please run

select type from syscat.tables where tabschema = 'XXX' and tabname = 'XXXX'

and show the output.
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On