473,396 Members | 2,011 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,396 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 1303
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 inefficient use of horizontal space due to UA's default...
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 viewport widths as exiting the borders of the...
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 STYLE="font-family:monospace; font-size:0.95em; width:40%; border:red 2px...
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 expert in HTML, for that matter). Is there a way to...
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 (into a text editor) the <pre> tag listing will...
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 served as text/html?
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 text. This text is encode to HTML so that no...
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 pages, and one of the problems occurs with Bash...
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 notation, is a functional notation, and is not a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.