By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,854 Members | 869 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,854 IT Pros & Developers. It's quick & easy.

Capturing and restoring views and triggers

P: n/a
I have several user defined functions which are referenced in triggers
and views. For software upgrades, I need to be able to drop the
triggers and views which reference these user defined functions, then
drop and recreate the user defined functions, then recreate all the
views and triggers. I don't imiagine I'm the first person who needed
to do this, and I don't have a lot of db2 experience, so I wanted to
see if there is a common or generally used technique for handling this.
This will be part of the upgrade process in a commercial software
product, so it has to be a programmatic technique, not something done
from the Control center. I have metadata tables which can tell me the
names of all the views and triggers that I need to drop and recreate,
so I don't need a way of finding which views and triggers need to be
recreated, just the ablility to drop and recreate the ones I specify.
This is for DB2 8.1.

Thanks in advance for any advice.

Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Have a look at 'db2look' utility. it extracts the ddl of views,
triggers and udfs and can store them in a plain ascii file. once
extracted, you can then later recreate those objects by executing this
ddl file. the relevant commands would be similar to:

db2look -d SAMPLE -e -o sample.ddl -p -a

db2 -tfv sample.ddl

regards,
dotyet
Bruce wrote:
I have several user defined functions which are referenced in triggers and views. For software upgrades, I need to be able to drop the
triggers and views which reference these user defined functions, then
drop and recreate the user defined functions, then recreate all the
views and triggers. I don't imiagine I'm the first person who needed
to do this, and I don't have a lot of db2 experience, so I wanted to
see if there is a common or generally used technique for handling this. This will be part of the upgrade process in a commercial software
product, so it has to be a programmatic technique, not something done
from the Control center. I have metadata tables which can tell me the names of all the views and triggers that I need to drop and recreate,
so I don't need a way of finding which views and triggers need to be
recreated, just the ablility to drop and recreate the ones I specify.
This is for DB2 8.1.

Thanks in advance for any advice.


Nov 12 '05 #2

P: n/a
May sound irrelevent, but . . .

<<db2look -d SAMPLE -e -o sample.ddl -p -a
<<db2 -tfv sample.ddl>>

Where does one find documentation for all such utilities for DB2 with
their switches and options? (Immediateley I'd like to find them for
db2, but also for Webshpere and everything else that IBM publishes.)

SS
_________
dotyet wrote:
Have a look at 'db2look' utility. it extracts the ddl of views,
triggers and udfs and can store them in a plain ascii file. once
extracted, you can then later recreate those objects by executing this ddl file. the relevant commands would be similar to:

db2look -d SAMPLE -e -o sample.ddl -p -a

db2 -tfv sample.ddl

regards,
dotyet
Bruce wrote:
I have several user defined functions which are referenced in

triggers
and views. For software upgrades, I need to be able to drop the
triggers and views which reference these user defined functions, then drop and recreate the user defined functions, then recreate all the
views and triggers. I don't imiagine I'm the first person who needed to do this, and I don't have a lot of db2 experience, so I wanted to see if there is a common or generally used technique for handling

this.
This will be part of the upgrade process in a commercial software
product, so it has to be a programmatic technique, not something done from the Control center. I have metadata tables which can tell me

the
names of all the views and triggers that I need to drop and recreate, so I don't need a way of finding which views and triggers need to be recreated, just the ablility to drop and recreate the ones I specify. This is for DB2 8.1.

Thanks in advance for any advice.


Nov 12 '05 #3

P: n/a
As for IBM DB2 UDB, this link may help you:

http://publib.boulder.ibm.com/infoce...help/index.jsp

For WebSphere, this may help:

http://publib.boulder.ibm.com/infoce...info/index.jsp

For everything else which IBM publishes: ;-)
http://publib.boulder.ibm.com/infocenter
enjoy!!
dotyet

Nov 12 '05 #4

P: n/a
Small correction:

the last one should be:

http://www.elink.ibmlink.ibm.com/pub...CTY=US&FNC=ICL

OR you click on "Information Centers and Libraries" link.
regards,
dotyet

Nov 12 '05 #5

P: n/a
Stanley, try: db2look -h
It lists all options, their meaning and also some examples.
HTH, Pierre and Joyeux Nol
PS: It's sunny and -10C

Stanley Sinclair wrote:
May sound irrelevent, but . . .

<<db2look -d SAMPLE -e -o sample.ddl -p -a
<<db2 -tfv sample.ddl>>

Where does one find documentation for all such utilities for DB2 with
their switches and options? (Immediateley I'd like to find them for
db2, but also for Webshpere and everything else that IBM publishes.)

SS
_________
dotyet wrote:
Have a look at 'db2look' utility. it extracts the ddl of views,
triggers and udfs and can store them in a plain ascii file. once
extracted, you can then later recreate those objects by executing


this
ddl file. the relevant commands would be similar to:

db2look -d SAMPLE -e -o sample.ddl -p -a

db2 -tfv sample.ddl

regards,
dotyet
Bruce wrote:
I have several user defined functions which are referenced in


triggers
and views. For software upgrades, I need to be able to drop the
triggers and views which reference these user defined functions,
then
drop and recreate the user defined functions, then recreate all the
views and triggers. I don't imiagine I'm the first person who
needed
to do this, and I don't have a lot of db2 experience, so I wanted
to
see if there is a common or generally used technique for handling


this.
This will be part of the upgrade process in a commercial software
product, so it has to be a programmatic technique, not something
done
from the Control center. I have metadata tables which can tell me


the
names of all the views and triggers that I need to drop and
recreate,
so I don't need a way of finding which views and triggers need to
be
recreated, just the ablility to drop and recreate the ones I
specify.
This is for DB2 8.1.

Thanks in advance for any advice.



--
Pierre Saint-Jacques - Reply to: sescons at attglobal dot net
IBM DB2 Cerified Solutions Expert - Administration
SES Consultants Inc.
Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.