473,320 Members | 1,902 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

DB2 Daily Check Lists

Dear Friends

I am working as oracle and ms sql dba from last 4 years. My company
recently migrated to DB2 databases.

So i am very much new to db2 database

Can any one pls provide script to do daily db2 check lists.

The following colums i need in the daily check lists

Instance Name
Instance Status - if open means online, if not offline
Database Name
Database Status - if open means online, if not offline
Free space
error logs
Backup start
Backup end

Pls send me any similar scripts you are doing daily in ur routine life

Appreciate your help

Cheers
Satish

Apr 21 '06 #1
2 8744
Satish,

I am pointing to 2 articles, but they may not provide all the scripts
you are looking for.
http://www-128.ibm.com/developerwork...now/index.html
http://www-128.ibm.com/developerwork...e/dm-0509poon/

Thanks,
Kums
V_S_H_Satish wrote:
Dear Friends

I am working as oracle and ms sql dba from last 4 years. My company
recently migrated to DB2 databases.

So i am very much new to db2 database

Can any one pls provide script to do daily db2 check lists.

The following colums i need in the daily check lists

Instance Name
Instance Status - if open means online, if not offline
Database Name
Database Status - if open means online, if not offline
Free space
error logs
Backup start
Backup end

Pls send me any similar scripts you are doing daily in ur routine life

Appreciate your help

Cheers
Satish


Apr 21 '06 #2
V_S_H_Satish wrote:
The following colums i need in the daily check lists

Instance Name
Instance Status - if open means online, if not offline
Database Name
Database Status - if open means online, if not offline
Free space
error logs
Backup start
Backup end


Quite a few of these are probably covered by the GET HEALTH SNAPSHOT
command. Here's some example outputs from one of my test boxes which
just has a single instance (db2inst1) and a single almost empty
database (DOCTEST)...

When used with "FOR DATABASE MANAGER" you get info on the instances:

$ db2 GET HEALTH SNAPSHOT FOR DATABASE MANAGER

Database Manager Health Snapshot

Node type = Enterprise Server
Edition with local and remote clients
Instance name = db2inst1
Snapshot timestamp = 04/22/2006
01:03:08.563202

Number of database partitions in DB2 instance = 1
Start Database Manager timestamp = 04/04/2006
21:45:56.106610
Instance highest severity alert state = Attention

Health Indicators:

Indicator Name = db2.db2_op_status
Value = 0
Evaluation timestamp = 04/22/2006
01:00:57.263136
Alert state = Normal

Indicator Name = db2.sort_privmem_util
Value = 0
Unit = %
Evaluation timestamp = 04/22/2006
01:00:57.263136
Alert state = Normal

Indicator Name = db2.mon_heap_util
Value = 43
Unit = %
Evaluation timestamp = 04/22/2006
01:00:57.263136
Alert state = Normal

When used with "FOR ALL DATABASES" you get (unsurprisingly) info on all
the databases:

$ db2 GET HEALTH SNAPSHOT FOR ALL DATABASES

Database Health Snapshot

Snapshot timestamp = 04/22/2006 01:03:27.617192

Database name = DOCTEST
Database path =
/var/db2inst1/NODE0000/SQL00004/
Input database alias =
Operating system running at database server= LINUX
Location of the database = Local
Database highest severity alert state = Attention

Health Indicators:

Indicator Name = db.db_op_status
Value = 0
Evaluation timestamp = 04/22/2006
01:00:57.263136
Alert state = Normal

Indicator Name = db.sort_shrmem_util
Value = 0
Unit = %
Evaluation timestamp = 04/22/2006
01:00:57.263136
Alert state = Normal

[...lots more rather boring output snipped...]

Indicator Name = db.db_backup_req
Value = 1
Evaluation timestamp = 04/21/2006
23:45:57.365087
Alert state = Attention

As you can see from the above there's quite clear indicator lines
beginning with "Alert state" which you could use for grepping through
the output. For example, from the above it shouldn't be too tricky to
bash together a little cron script which could periodically run the two
GET HEALTH SNAPSHOT commands above, and only mail you the result if
either contain "Alert state = Attention" (or better still "Alert state
= [anything other than normal]").

For descriptions of the indicators (e.g. "db.db_backup_req") use the
GET DESCRIPTION FOR HEALTH INDICATOR command:

$ db2 GET DESCRIPTION FOR HEALTH INDICATOR db.db_backup_req

DESCRIPTION FOR db.db_backup_req

This health indicator tracks the need for a backup on the database.
Backups should be taken regularly as part of a recovery strategy to
protect your data against the possibility of loss in the event of a
hardware or software failure.

This health indicator determines when a database backup is required
based on the time elapsed and amount of data changed since the last
backup. Refer to the DB2 Information Center for information about how
to update these settings.
[snip]

Next ... free space. Okay, the LIST TABLESPACES SHOW DETAIL command
should take care of that (though it's output is rather verbose, so you
might want to process it a bit ... I've got a shell script lying around
somewhere that tidied it up a bit, I'll see if I can dig it up):

$ db2 CONNECT TO DOCTEST

Database Connection Information

Database server = DB2/LINUX 8.2.4
SQL authorization ID = DAVE
Local database alias = DOCTEST

$ db2 LIST TABLESPACES SHOW DETAIL

Tablespaces for Current Database

[snip]
Tablespace ID = 2
Name = USERSPACE1
Type = Database managed space
Contents = Any data
State = 0x0000
Detailed explanation:
Normal
Total pages = 4096
Useable pages = 4064
[here's the interesting bit vvvv]
Used pages = 1824
Free pages = 2240
High water mark (pages) = 1824
[here's the interesting bit ^^^^]
Page size (bytes) = 8192
Extent size (pages) = 32
Prefetch size (pages) = 32
Number of containers = 1
[snip]

As shown above, an active database connection is needed for this, so
you'll need to write a little script which iterates over all the local
databases connecting to each, running the above command, and possibly
deciding whether to bother including the verbose output (e.g. if a
tablespace is getting full).

That said, with the introduction of AUTOMATIC STORAGE (i.e. automatic
expansion) for DMS tablespaces in whichever fixpak introduced it, this
is less of an issue than it used to be (if you're using AUTOMATIC
STORAGE you can probably get away with just checking the available
space on whatever partitions are home to your tablespaces).

Hmmm ... error logs. Not sure exactly what you're looking for here. I
guess db2diag.log might be worth a look (take a look at the db2diag
command in the Command Reference for more information:
http://tinyurl.com/fsgat)

Final item on the shopping list ... backup history. Easy one this: use
the LIST HISTORY BACKUP command. For example, to list all backups taken:

$ db2 LIST HISTORY BACKUP ALL FOR DB DOCTEST

List History File for DOCTEST

Number of matching file entries = 0

(yeah, it's a test database, so I've never backed it up)

Or to list backups since a particular date/time:

$ db2 LIST HISTORY BACKUP SINCE 20060417000000 FOR DB DOCTEST

The timestamp format is YYYYMMDDHHMMSS. Wouldn't be difficult to knock
together a little cron script that lists the backup history over the
last week, to be mailed to you. Though, the db.db_backup_req health
parameter mentioned above may be enough for your purposes.
HTH,

Dave.

--

Apr 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Xah Lee | last post by:
Here's the belated Java solution. import java.util.List; import java.util.ArrayList; import java.lang.Math; class math { public static List range(double n) { return range(1,n,1); }
0
by: Alex82 | last post by:
I can't use it....for example i have to create a column that accept values between 1 to 120...i can't enumerate all of them....or i have to accept a value different from NULL if an other column has...
0
by: Marcel - IDUG Europe 2005 | last post by:
Visit the IDUG Europe Conference Blog for Daily Updates and Conference Information IDUG 2005 - Europe Blog New for this year's conference, IDUG 2005 - Europe has created a blog to give you...
3
by: dm1608 | last post by:
I have an Ecommerce application that uses mostly ASP and a bit of ASP.NET. Monitoring the servers memory via SNMP every 5 minutes would indicate that there is a memory leak somewhere within the...
3
by: VSH | last post by:
Dear Friends First i like to introduce myself. I am satish working as Oracle and Ms-SQL DBA from last 4yrs. My compnay recently introduced DB2 Database in one of our projects. I installed...
11
by: SKBodner | last post by:
Hello, I'm stumped and I'm hoping someone could help me figure out the best way to track daily attendance for the next 6-4 months. I have a list of 80 or so participants who should be attended...
2
by: V_S_H_Satish | last post by:
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....
6
by: bmjnine | last post by:
Hi all, I am trying to setup a daily task in my .NET (1.1) application. The application is a project management tool, and the daily task I am trying to set up will check for overdue project...
1
by: naveensrirangam | last post by:
We want to do a total 10 number of scheduled tasks daily. These tasks will run in certain time in daily and every task application developed in different technologies . Now we are looking to do...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.