473,386 Members | 1,752 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,386 software developers and data experts.

Automated snapshot data

Is there any way in DB2 to automate the taking of a snapshot, for
example, a function that will cause a db2 snapshot to be taken every 5
minutes and written to a uniquely named file?

Am I better off attempting to do this with my poor knowledge of dos
batch files?

I'm running UDB 8.2 on Windows 2000.

Thanks.
Nov 12 '05 #1
4 3191
Hi Civilian,

our product takes automated Snapshots and a lot more than this. We put
the Snapshot Data into a Database offer a GUI to analyze the data and
so on...

http://www.itgain.de/en/speedgain.html

If you have any Questions feel free to send me an email.

Udo Weigl
Civilian_Target <ta****@bigfoot.com> wrote in message news:<3b*************@individual.net>...
Is there any way in DB2 to automate the taking of a snapshot, for
example, a function that will cause a db2 snapshot to be taken every 5
minutes and written to a uniquely named file?

Nov 12 '05 #2
Civilian_Target wrote:
Is there any way in DB2 to automate the taking of a snapshot, for
example, a function that will cause a db2 snapshot to be taken every 5 minutes and written to a uniquely named file?

Am I better off attempting to do this with my poor knowledge of dos
batch files?


Personally, I'd recommend working on your knowledge of batch files,
perl, python, or ruby. It's a "give a man a fish vs teach him how to
fish kind of thing": there are tons of administrative and development
tasks that can be automated via the shell, or a good interpreted
language. And even when commercial applications can perform the same
task, I find the script solutions often superior: since they can be
easily managed within a standard version control system, and easily
promoted along with the rest of the application code base. And you
don't waste a lot of time in procurement for commercial tools, only to
end up with insufficient licenses to cover every server you need.

And it's mostly very easy stuff. In the above example, I'd have a very
small script that connected to the database, ran a sql query to insert
the results into a dedicated table (using a snapshot table function),
then closed the connection. Scheduling & execution managed by the task
scheduler. Then you could query or export the data whenever you
wanted. Alternatively, you could use the snapshot command if you
preferred the formatting. More info on the snapshot table function:
http://publib.boulder.ibm.com/infoce...n/r0000294.htm
Good luck,

buck

Nov 12 '05 #3
In article <3b*************@individual.net>,
Civilian_Target <ta****@bigfoot.com> wrote:
Is there any way in DB2 to automate the taking of a snapshot, for
example, a function that will cause a db2 snapshot to be taken every 5
minutes and written to a uniquely named file?


Snapshots are taken with the administrative API; the DB2 CLP uses the
administrative API to get snapshot data and then displays it in textual
format.

At work, I have written a perl XS module (XS is the perl-to-C API) that
invokes the Admin API to collect snapshot data every minute and stores
it (we keep 2 hours); this is used to drive performance monitoring,
troubleshooting, etc. (Not open sourced - I'm working on that.)

If you're comfortable with C, look at the IBM-supplied samples - they
are quite nice and show how to get snapshot data, parse and display it,
etc.

What I like most about the admin API is that you can get snapshot data
for multiple areas at the same time, e.g. a snapshot for both the
instance, all active databases, and the tablespaces, all in one chunk of
data. Also, getting a snapshot and then analyzing it in
your own code is less expensive for the database than using the snapshot
SQL functions and cheaper in terms of CPU time than running the DB2 CLP
and then parsing the output.
Nov 12 '05 #4
Here is a fairly cheap non-program method I use:

Create tables to hold snapshots:
Examples:

CREATE TABLE DB2ADMIN.SNAP_DBM
AS (SELECT * FROM TABLE( SYSPROC.SNAPSHOT_DBM(-1)) as SNAPSHOT_DBM)
WITH NO DATA
IN USERSPACE1;

CREATE TABLE DB2ADMIN.SNAP_DB
AS (SELECT * FROM TABLE( SYSPROC.SNAPSHOT_DATABASE( 'SAMPLE', -1 ))
as SNAPSHOT_DB)
WITH NO DATA
IN USERSPACE1;

CREATE TABLE DB2ADMIN.SNAP_BP
AS (SELECT * FROM TABLE( SYSPROC.SNAPSHOT_BP( 'SAMPLE', -1 )) as
SNAPSHOT_BP)
WITH NO DATA
IN USERSPACE1;

Insert into the tables using cron, windows scheduler, or DB2
scheduler:
CONNECT TO SAMPLE;

INSERT INTO DB2ADMIN.SNAP_DBM SELECT * FROM TABLE(
SYSPROC.SNAPSHOT_DBM(-1)) as SNAPSHOT_DBM;

INSERT INTO DB2ADMIN.SNAP_DB SELECT * FROM TABLE(
SYSPROC.SNAPSHOT_DATABASE( 'SAMPLE', -1 )) as SNAPSHOT_DB;

INSERT INTO DB2ADMIN.SNAP_BP SELECT * FROM TABLE( SYSPROC.SNAPSHOT_BP(
'SAMPLE', -1 )) as SNAPSHOT_BP;
Once they are in tables it is easy to run queries to look for problems
or roll them up for long term trend analysis.

I run clean-up jobs to delete snapshots older than a week.

Norm
hp*@guest.lunatech.com (Hildo Biersma) wrote in message news:<11***************@yin.lunatech.com>...
In article <3b*************@individual.net>,
Civilian_Target <ta****@bigfoot.com> wrote:
Is there any way in DB2 to automate the taking of a snapshot, for
example, a function that will cause a db2 snapshot to be taken every 5
minutes and written to a uniquely named file?


Snapshots are taken with the administrative API; the DB2 CLP uses the
administrative API to get snapshot data and then displays it in textual
format.

At work, I have written a perl XS module (XS is the perl-to-C API) that
invokes the Admin API to collect snapshot data every minute and stores
it (we keep 2 hours); this is used to drive performance monitoring,
troubleshooting, etc. (Not open sourced - I'm working on that.)

If you're comfortable with C, look at the IBM-supplied samples - they
are quite nice and show how to get snapshot data, parse and display it,
etc.

What I like most about the admin API is that you can get snapshot data
for multiple areas at the same time, e.g. a snapshot for both the
instance, all active databases, and the tablespaces, all in one chunk of
data. Also, getting a snapshot and then analyzing it in
your own code is less expensive for the database than using the snapshot
SQL functions and cheaper in terms of CPU time than running the DB2 CLP
and then parsing the output.

Nov 12 '05 #5

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

Similar topics

5
by: Bernhard Krautschneider | last post by:
hello group, is it possible to do a storage snapshot of a running ms-sql database without losing transactions? What tasks must be done before such a snapshot. thanks in advance, Bernhard
1
by: Gary Lou | last post by:
Hi All, I have set up a snapshot replication, and schedule it to run every night. The snapshot run successfully, and data get replicated to the subscribed server. However, data do not get...
8
by: Jean-Marc Blaise | last post by:
Dear all, It seems there is a problem with some snapshot table functions, if you try to divide by some element that is unset or equal to 0. This generates a trap file with the db2fmp.exe...
1
by: Prince Kumar | last post by:
Is there anyway to display the partition number while taking snapshot on all the partitions (-2) using the snapshot function? ex, select TABLESPACE_NAME, TOTAL_PAGES from...
14
by: Ina Schmitz | last post by:
Hello, I would like to get the logical and physical reads for every sql statement executed. Thatfore, I used the command "db2 get snapshot for dynamic sql on <mydatabase>". There, I could see...
9
by: bluedolphin | last post by:
Hello All: I have been brought onboard to help on a project that had some performance problems last year. I have taken some steps to address the issues in question, but a huge question mark...
3
by: DavidB | last post by:
I have a Snapshot Control in a continuous form and I want the source for the control to be different for each instance of the continuous data (based on one of the fields in the recrod source for...
0
by: Rod | last post by:
I orginally posted this to microsoft.public.sqlserver.ce but had not received any responses. I have a CF.NET application (C#) with a SqlCE database. We had originally planned to use SQL...
4
by: MPD | last post by:
Hi How can I create a job in sql agent to create a new snapshot every hour? I have, for eg a T-SQL that does it manually. create database Snapshotter_snap_20070418_1821 on ( name =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.