Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old May 23rd, 2006, 09:55 AM
V_S_H_Satish
Guest
 
Posts: n/a
Default DB2 Daily Check Lists

Hai Friends

Quite a long time back i ask these questions but everybody send me some
snapshot and functions names but i need select statements for the
following stuff pls help me in this

1. instance name instance status from which table

2. db status and db name fro which table

3. tablespace free space available and how to increase the space

4. to check backup details from which table

I need to create report for tablespace as follows:

TABLESPACE TOTAL USED FREE %Used
%Free
------------------------------ --------- ------ --------- ----------
---------- -----------------------------------------

Pls provide me the script

Appreciate your help

Need Select Statements only ..................


Cheers

Satish

  #2  
Old May 23rd, 2006, 06:55 PM
Shashi Mannepalli
Guest
 
Posts: n/a
Default Re: DB2 Daily Check Lists

There are NO direct SELECT or TABLES for the infomation you are
looking.
That is why everybody is giving you to USE SNAPSHOT TABLE FUNCTIONS.

Example:

To get tablespace info you asked ...Run this


select substr(tablespace_name,1,20) TBSPACE,
case(tablespace_type)
when 0 then 'DMS'
else 'SMS'
end as "TYPE",
int((total_pages*page_size)/1024/1024) as "Total
Allocated(MB)",int((used_pages*
page_size)/1024/1024) as "Total
Used(MB)",int((free_pages*page_size)/1024/1024)
as "Free Space(MB)" from table(snapshot_tbs_cfg(' ',-1)) as tbs order
by 4 asc;

Cheers...
Shashi Mannepalli

  #3  
Old May 23rd, 2006, 09:05 PM
Dave Hughes
Guest
 
Posts: n/a
Default Re: DB2 Daily Check Lists

V_S_H_Satish wrote:
[color=blue]
> Hai Friends
>
> Quite a long time back i ask these questions but everybody send me
> some snapshot and functions names but i need select statements for the
> following stuff pls help me in this[/color]

Once more unto the breach ...

I'm guessing you didn't actually *read* or *try* anything from the link
Serge posted last time round? If you had, you might have realized that
table functions are used within SELECT statements...

In case you need it again, here it is:
http://publib.boulder.ibm.com/infoce...om.ibm.db2.udb
..doc/admin/r0012548.htm

Read about and try out the functions in that list. You'll probably find
quite a bit (if not all) of what you're looking for. To get you started:
[color=blue]
> I need to create report for tablespace as follows:
>
> TABLESPACE TOTAL USED FREE %Used
> %Free[/color]

SELECT
TABLESPACE_NAME AS TABLESPACE,
TOTAL_PAGES AS TOTAL,
USED_PAGES AS USED,
FREE_PAGES AS FREE,
CASE
WHEN TOTAL_PAGES = 0 THEN NULL
ELSE (USED_PAGES * 100) / TOTAL_PAGES
END AS USED_PCT,
CASE
WHEN TOTAL_PAGES = 0 THEN NULL
ELSE (FREE_PAGES * 100) / TOTAL_PAGES
END AS FREE_PCT
FROM
TABLE(SNAPSHOT_TBS_CFG(CAST(NULL AS VARCHAR(255)), CAST(NULL AS
INTEGER))) AS T;

Produces something like:

TABLESPACE TOTAL USED FREE USED_PCT FREE_PCT
-------------------- ------- -------- ---------- -------- --------
SYSCATSPACE 8192 4716 3472 57 42
TEMPSPACE1 0 0 0 - -
USERSPACE1 4096 2016 2048 49 50
SYSTOOLSPACE 0 0 0 - -
SYSTOOLSTMPSPACE 0 0 0 - -

The tablespaces with 0 total pages (and hence NULL percentages) are SMS
tablespaces which don't have a fixed size
[color=blue]
> 1. instance name instance status from which table[/color]

Instance name, start time and last reset time:

SELECT
SERVER_INSTANCE_NAME,
DB2START_TIME,
LAST_RESET
FROM
TABLE(HEALTH_DBM_INFO(CAST(NULL AS INTEGER))) AS T;

See HEALTH_DBM_HI for lots of health-indicators which ought to give you
all the "status" information (whatever that might be) you could wish
for and then some
[color=blue]
> 2. db status and db name fro which table[/color]

For database name:

SELECT
DB_NAME
FROM TABLE(HEALTH_DB_INFO(CAST(NULL AS VARCHAR(255)), CAST(NULL AS
INTEGER))) AS T;

See HEALTH_DB_HI for health-indicators.
[color=blue]
> 3. tablespace free space available and how to increase the space[/color]

Dealt with above (to increase space see the ALTER TABLESPACE statement
in the SQL reference).
[color=blue]
> 4. to check backup details from which table[/color]

Information on the last backup of the databases in the current instance:

SELECT
HI_ADDITIONAL_INFO
FROM TABLE(HEALTH_DB_HI(CAST(NULL AS VARCHAR(255)), CAST(NULL AS
INTEGER))) AS T
WHERE HI_ID = 1018;


Dave.

P.S. People are a lot more willing to provide assistance if you can
demonstrate that you've at least *tried* to solve the problem yourself.
People are not here to do your work for you. If you come back a fourth
time asking the same thing without having lifted a finger to try any of
the suggestions people have taken the time to provide you with, expect
to be ignored.

If you do run into a problem with any of the suggestions from myself or
others, try and be explicit in your description of the problem
(including platform, version, what things you've tried, any error
message, and error codes are all helpful).

--

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,338 network members.