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 > Count database objects ??

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-13-11, 11:38
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Count database objects ??

Hey friends : How do we count all database objects ??

please help with query if possible .


Regards
DBFinder
Reply With Quote
  #2 (permalink)  
Old 10-13-11, 11:56
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Can you be a little more specific what you want?

Andy
Reply With Quote
  #3 (permalink)  
Old 10-13-11, 12:04
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
I want to keep the count of all user database objects count for keeping an eye on new objects in an OLTP database.

If the count increases, my DBA will look immediately and act if an action is needed. Operational DBA is some times bypassed by higher authority DBA team members. This watch will just let DBA know that something new has entered the database.

Reagrds
Reply With Quote
  #4 (permalink)  
Old 10-13-11, 12:43
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Are you talking about Tables, Views, Triggers, Stored Procedures, etc?

Then something like:
Code:
 select tabschema,count(*) from syscat.tables group by tabschema
should work.


Andy
Reply With Quote
  #5 (permalink)  
Old 10-13-11, 19:07
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Actually I was expecting whole list of DB object types so that I can add up for total count of user database objects.

eg
1. Tables
2. Views
3. Triggers
4. Functions
5. Procedures
6. Sequences
7. . . . . . . ..
8. . . . . . . .
9. . . . . . . .

Can some one help complete the list so that I do not miss even one of all ??

Regards
DBFinder
Reply With Quote
  #6 (permalink)  
Old 10-13-11, 20:10
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
The DB2 catalog tables are described in the Appendix of the SQL Reference Vol 1. You will have to look at the layouts since (for example) syscat.tables includes tables and views, even though syscat.views includes the view information. See the TYPE column of syscat.tables for more info.
__________________
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
  #7 (permalink)  
Old 10-13-11, 20:33
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Thanks Marcus,

It is Appendix D in v8 manual. I will do my home work now.

Regards
DBFinder
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