472,352 Members | 1,491 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

A pre-Wilma freebie for the DB2 crowd

aj
I'm on the west coast of Florida south of Tampa, and as I
wait for my house to look like something from the Flinstones,
and am making sure that all of my disaster recovery ducks
are in a row, I though maybe someone could use my linux-based
script that backs up DB2 configuration data, which I call
"lifeboat".

Just put your own info anywhere you see UPPERCASE text in
<> brackets. I store everything in /db2/lifeboat/...

As a final step, the script scp's the config info to another
server for safekeeping. I run this on a cron - if you do,
don't forget to ssh-keygen to generate your SSH public key.

This, combined with your standard DB2 backups all stored in
a safe place, should make it far easier to recover from
disaster.

Cheers

Allen W. Jantzen, DBA
Ned Davis Research
--------------------------------
#start lifeboat.sh
for instance in <PUT INSTANCE HERE>
do
cd /db2/lifeboat/<HOSTNAME>/instance/$instance

# get instance cfg
echo `date` > $instance.cfg
db2 -v get dbm cfg >> $instance.cfg

# get db directory
echo `date` > db_directory.txt
db2 -v list database directory >> db_directory.txt

# get db2set
echo `date` > db2set.txt
db2set >> db2set.txt
done

for db in <LIST DATABASES HERE, SEPARATED BY SPACES>
do
cd /db2/lifeboat/<HOSTNAME>/database/$db

# get db cfg
echo `date` > $db.cf
db2 get db cfg for $db >> $db.cfg

echo `date` > backup_history.txt
db2 -v list history backup all for db $db >> backup_history.txt

db2 -v connect to $db
echo `date` > tablespace.txt
db2 -v list tablespaces show detail >> tablespace.txt

echo `date` > containers.txt
for tsid in `cat tablespace.txt | grep "Tablespace ID" | awk
'{print $4}'`
do
db2 -v list tablespace containers for $tsid show detail
containers.txt

done

echo `date` > tables.txt
db2 -v list tables for all >> tables.txt

echo `date` > table_structure.txt
for tableandschema in `cat tables.txt | awk '(NR > 5) {print
$0}' | grep -v "^ " | grep -v "^$" | awk '{print $2"."$1}'`
do
db2 -v describe table $tableandschema >>
table_structure.txt
done

echo `date` > table_indexes.txt
for tableandschema in `cat tables.txt | awk '(NR > 5) {print
$0}' | grep -v "^ " | grep -v "^$" | awk '{print $2"."$1}'`
do
db2 -v describe indexes for table $tableandschema >>
table_indexes.txt
done

echo `date` > table_sql.txt
db2look -d $db -e -a -xd | sed 's/NOT LOGGED INITIALLY//g' >>
table_sql.txt

echo `date` > $db.bpools.txt
db2look -d $db -l >> $db.bpools.txt

echo `date` > $db.db2look.cfg
db2look -d $db -f >> $db.db2look.cfg

echo `date` > packages.txt
db2 -v list packages for all >> packages.txt

db2 -v connect reset
db2 -v terminate

echo `date` > filesystem.txt
ls -lR /containers/$db >> filesystem.txt
done

cd /db2/lifeboat
scp -r <ANOTHER HOSTNAME>:/db2/lifeboat/<HOSTNAME> .
Nov 12 '05 #1
4 1262
aj wrote:
I'm on the west coast of Florida south of Tampa, and as I
wait for my house to look like something from the Flinstones,
and am making sure that all of my disaster recovery ducks
are in a row, I though maybe someone could use my linux-based
script that backs up DB2 configuration data, which I call
"lifeboat".

Just put your own info anywhere you see UPPERCASE text in
<> brackets. I store everything in /db2/lifeboat/...

As a final step, the script scp's the config info to another
server for safekeeping. I run this on a cron - if you do,
don't forget to ssh-keygen to generate your SSH public key.

This, combined with your standard DB2 backups all stored in
a safe place, should make it far easier to recover from
disaster.

Cheers

Allen W. Jantzen, DBA
Ned Davis Research


Allen,

A useful script.

I have one suggestion.

Running the db2support command gathers a lot of information about your
system. It will contain a lot of what you've gathered. Maybe you want to
look into running that as part of your process.

HTH

Phil Nelson
ScotDB Limited

Nov 12 '05 #2
aj
Philip -

A good suggestion - thanks.

aj

Philip Nelson wrote:
aj wrote:

I'm on the west coast of Florida south of Tampa, and as I
wait for my house to look like something from the Flinstones,
and am making sure that all of my disaster recovery ducks
are in a row, I though maybe someone could use my linux-based
script that backs up DB2 configuration data, which I call
"lifeboat".

Just put your own info anywhere you see UPPERCASE text in
<> brackets. I store everything in /db2/lifeboat/...

As a final step, the script scp's the config info to another
server for safekeeping. I run this on a cron - if you do,
don't forget to ssh-keygen to generate your SSH public key.

This, combined with your standard DB2 backups all stored in
a safe place, should make it far easier to recover from
disaster.

Cheers

Allen W. Jantzen, DBA
Ned Davis Research

Allen,

A useful script.

I have one suggestion.

Running the db2support command gathers a lot of information about your
system. It will contain a lot of what you've gathered. Maybe you want to
look into running that as part of your process.

HTH

Phil Nelson
ScotDB Limited

Nov 12 '05 #3
Hi aj,

Thanks for your script and for Philip's suggestion.

But . . . What more do these methods have above BACKUP DATABASE?

SS

Nov 12 '05 #4
Backup database does not capture anything outside of DB such as
instance config, db2set, os level etc...

Nov 12 '05 #5

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

Similar topics

21
by: Headless | last post by:
I've marked up song lyrics with the <pre> tag because it seems the most appropriate type of markup for the type of data. This results in...
3
Pre
by: Neal | last post by:
A few questions about pre... When presenting preformatted text using the white-space: pre; property/value, Opera renders long lines at small...
7
by: Alan Illeman | last post by:
How do I set several different properties for PRE in a CSS stylesheet, rather than resorting to this: <BODY> <PRE...
2
by: Buck Turgidson | last post by:
I want to have a css with 2 PRE styles, one bold with large font, and another non-bold and smaller font. I am new to CSS (and not exactly an...
5
by: Michael Shell | last post by:
Greetings, Consider the XHTML document attached at the end of this post. When viewed under Firefox 1.0.5 on Linux, highlighting and pasting...
8
by: Jarno Suni not | last post by:
It seems to be invalid in HTML 4.01, but valid in XHTML 1.0. Why is there the difference? Can that pose a problem when such a XHTML document is...
7
by: Rocky Moore | last post by:
I have a web site called HintsAndTips.com. On this site people post tips using a very simply webform with a multi line TextBox for inputing the tip...
9
by: Eric Lindsay | last post by:
I can't figure how to best display little snippets of shell script using <pre>. I just got around to organising to bulk validate some of my web...
23
by: Xah Lee | last post by:
The Concepts and Confusions of Pre-fix, In-fix, Post-fix and Fully Functional Notations Xah Lee, 2006-03-15 Let me summarize: The LISP...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.