473,799 Members | 2,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DB2 UDB recovery

There's something clearly missing in my understanding of recovery:

I set up a small sample datavase and deleted all the rows from a table.
Crucially, I omitted the "commit". I then shut down db2, and copied
everything under the db2inst1/db2inst1/NODE0000 directory to another server.

When I restarted db2 on the first server the rows were still missing.
But on the second server they were still there :-(
I repeated the exercise several times to be certain.

Obviously some sort of recovery has taken place on the second server.
Including a commit after the delete confirmed this: the rows were missing on
both sides. But I am confised as to how this would happen on the second
server but not the first.

Also, is there no implied commit in a db2stop?

thanks
Neil
Nov 12 '05 #1
8 4431
"Neil Truby" <ne********@ard enta.com> wrote in message
news:c5******** ****@ID-162943.news.uni-berlin.de...
There's something clearly missing in my understanding of recovery:

I set up a small sample datavase and deleted all the rows from a table.
Crucially, I omitted the "commit". I then shut down db2, and copied
everything under the db2inst1/db2inst1/NODE0000 directory to another server.
When I restarted db2 on the first server the rows were still missing.
But on the second server they were still there :-(
I repeated the exercise several times to be certain.

Obviously some sort of recovery has taken place on the second server.
Including a commit after the delete confirmed this: the rows were missing on both sides. But I am confised as to how this would happen on the second
server but not the first.

Also, is there no implied commit in a db2stop?

thanks
Neil

Most likely, the updates were rolled back when the original database was
stopped or restarted (since they were logged but not committed).

There is no implied commit for a db2stop. DB2 does not support copying
directories from one server to another.
Nov 12 '05 #2
Neil Truby wrote:
There's something clearly missing in my understanding of recovery:

I set up a small sample datavase and deleted all the rows from a table.
Crucially, I omitted the "commit". I then shut down db2, and copied
everything under the db2inst1/db2inst1/NODE0000 directory to another
server.

When I restarted db2 on the first server the rows were still missing.
But on the second server they were still there :-(
I repeated the exercise several times to be certain.

Obviously some sort of recovery has taken place on the second server.
Including a commit after the delete confirmed this: the rows were missing
on
both sides. But I am confised as to how this would happen on the second
server but not the first.

Also, is there no implied commit in a db2stop?

thanks
Neil


Neil, this is emphatically not the way to backup and recovery a DB2
database, or to move a DB2 database to another server. I know it is the
way that you do things on some other DBMSes, but not here. While I've
heard of some people doing this, I'd say that unless you use the IBM
supplied utilities "all bets are off" !!!

I wouldn't expect any uncommitted transactions to be implicitly applied by a
DB2 stop : the DBMS should not assume anything about the logic of an
application, so the only safe thing to do is a rollback. In addition, when
you start DB2 it does a "crash recovery" which will rollback any
uncommitted transactions.

Now to look at how you should do this -

Backups are taken using the BACKUP command, which produces a file (or files)
containing everything you need to recover (in the case of an offline
backup) or everything bar the logs (in a case of an offline backup). In
the new "Stinger" the online backup will even package with the backup the
logs needed to do the recovery as well.

To bring this backup onto another server you use the RESTORE and (possibly)
ROLLFORWARD commands. If you are happy to bring everything back under
exactly the same tablespace container details as the backup then a normal
restore will do. If you want to change the tablespace container locations
then you need to do a "redirected restore", where you use the "SET
TABLESPACE CONTAINERS" command between a "RESTORE ... REDIRECT" and a
"RESTORE ... CONTINUE" to specify the changes you require. I have a script
that generates a base redirected restore script from the source database.

If you want to move data between two databases then you should be looking at
EXPORT, IMPORT, LOAD and the "wrapper" utility db2move. If you want to
extract DDL for a database you should be looking at db2look.

HTH

Phil Nelson
Nov 12 '05 #3
"Mark A" <ma@switchboard .net> wrote in message
news:7r******** ******@news.usw est.net...
"Neil Truby" <ne********@ard enta.com> wrote in message
news:c5******** ****@ID-162943.news.uni-berlin.de...
There's something clearly missing in my understanding of recovery:

I set up a small sample datavase and deleted all the rows from a table.
Crucially, I omitted the "commit". I then shut down db2, and copied
everything under the db2inst1/db2inst1/NODE0000 directory to another server.

When I restarted db2 on the first server the rows were still missing.
But on the second server they were still there :-(
I repeated the exercise several times to be certain.

Obviously some sort of recovery has taken place on the second server.
Including a commit after the delete confirmed this: the rows were

missing on
both sides. But I am confised as to how this would happen on the second
server but not the first.

Also, is there no implied commit in a db2stop?

thanks
Neil

Most likely, the updates were rolled back when the original database was
stopped or restarted (since they were logged but not committed).


Indeed. But my question is: why did this rollback occur on the second
server, but not the first? Both presumably had the same set of logs (also
stored under the ~db2inst1/db2inst1/NODE0000 directory).

I fully take your point about this being an ineffective way to back up
databases: please see my reply to another correspondent.


Nov 12 '05 #4
"Philip Nelson" <te*****@scotdb .com> wrote in message
news:Xs******** *************** @news.easynews. com...
Neil Truby wrote:
There's something clearly missing in my understanding of recovery:

I set up a small sample datavase and deleted all the rows from a table.
Crucially, I omitted the "commit". I then shut down db2, and copied
everything under the db2inst1/db2inst1/NODE0000 directory to another
server.

When I restarted db2 on the first server the rows were still missing.
But on the second server they were still there :-(
I repeated the exercise several times to be certain.

Obviously some sort of recovery has taken place on the second server.
Including a commit after the delete confirmed this: the rows were missing on
both sides. But I am confised as to how this would happen on the second
server but not the first.

Also, is there no implied commit in a db2stop?

thanks
Neil
Neil, this is emphatically not the way to backup and recovery a DB2
database, or to move a DB2 database to another server. I know it is the
way that you do things on some other DBMSes, but not here. While I've
heard of some people doing this, I'd say that unless you use the IBM
supplied utilities "all bets are off" !!!

I wouldn't expect any uncommitted transactions to be implicitly applied by

a DB2 stop : the DBMS should not assume anything about the logic of an
application, so the only safe thing to do is a rollback. In addition, when you start DB2 it does a "crash recovery" which will rollback any
uncommitted transactions.


In fact, what I am doing is demonstrating the facility to use a particular
storage array to take "flash copies" of a DB2 database for subsequent use as
a backup or as a development/support server. I'll bow to your undoubtedly
superior knowledge of DB2 but will opine that this is a very effective
solution to, say, Informix or Oracle databases. From my reading of various
papers the same techniques *can* be used with DB2 UDB.

We have implemented exactly this technique at a very risk-adverse UK
retailer, albeit on Informix. In Informix it is important to ensure that a
"blocked checkpoint" occurs for the few seconds that the flash copy takes,
to write out all buffer pool data to disk and prevent new transactions
starting. This gives a physically-consistent database. My careful reading
of the DB2 UDB manual's Crash Recovery section suggests that this may be
unnecessary on DB2, and if it is necessary I can't find a suitable utility.

Informix supports an external restore from such a "backup" - I've done this
successfully in DB2 too. Whether or not DB2 supports subsequent application
of logs for a point in time recovery I don't know, but I'd like to bet that
it does.

Why my two servers behaved differently with exactly the same tablespace data
is still unexplained though :-((

Nov 12 '05 #5
> > Most likely, the updates were rolled back when the original database was
stopped or restarted (since they were logged but not committed).


Indeed. But my question is: why did this rollback occur on the second
server, but not the first? Both presumably had the same set of logs (also
stored under the ~db2inst1/db2inst1/NODE0000 directory).

I fully take your point about this being an ineffective way to back up
databases: please see my reply to another correspondent.

The rollback did NOT occur on the second server. That is why the uncommitted
rows are still there. The rollback occurred on the original server which
deleted the rows because they were not committed.

I am not sure whether the rollback occurred on the original server during
db2stop or during restart. It might depend on whether you used the force
option on db2stop.
Nov 12 '05 #6
Neil,

Now you have explained what you are trying to achieve I can point you down
another road. What you described is supported by DB2, but again you have
to use the correct DB2 commands to achieve it.

You want to read the "Data Recovery and High Availability Guide and
Reference" for full details. The place to start is Chapter 5 in the
section "High Availability Through Online Split Mirror and Suspended I/O
Support".

The basic process is -

On the source machine -

db2 "set write suspend ..."
Use OS Tools to Split The Mirror (or take your flash copy)
db2 "set write resume ..."

On the target machine -

db2start
db2inidb ...

The details of the "OS Tools" varies based on your hardware vendor.

There was an excellent presentation by someone from Network Appliances at a
fairly recent IDUG. I can probably dig this presentation out for you if
you wish.

Phil

Neil Truby wrote:
"Philip Nelson" <te*****@scotdb .com> wrote in message
news:Xs******** *************** @news.easynews. com...
Neil Truby wrote:
> There's something clearly missing in my understanding of recovery:
>
> I set up a small sample datavase and deleted all the rows from a
> table.
> Crucially, I omitted the "commit". I then shut down db2, and copied
> everything under the db2inst1/db2inst1/NODE0000 directory to another
> server.
>
> When I restarted db2 on the first server the rows were still missing.
> But on the second server they were still there :-(
> I repeated the exercise several times to be certain.
>
> Obviously some sort of recovery has taken place on the second server.
> Including a commit after the delete confirmed this: the rows were missing > on
> both sides. But I am confised as to how this would happen on the
> second server but not the first.
>
> Also, is there no implied commit in a db2stop?
>
> thanks
> Neil


Neil, this is emphatically not the way to backup and recovery a DB2
database, or to move a DB2 database to another server. I know it is the
way that you do things on some other DBMSes, but not here. While I've
heard of some people doing this, I'd say that unless you use the IBM
supplied utilities "all bets are off" !!!

I wouldn't expect any uncommitted transactions to be implicitly applied
by

a
DB2 stop : the DBMS should not assume anything about the logic of an
application, so the only safe thing to do is a rollback. In addition,

when
you start DB2 it does a "crash recovery" which will rollback any
uncommitted transactions.


In fact, what I am doing is demonstrating the facility to use a particular
storage array to take "flash copies" of a DB2 database for subsequent use
as
a backup or as a development/support server. I'll bow to your undoubtedly
superior knowledge of DB2 but will opine that this is a very effective
solution to, say, Informix or Oracle databases. From my reading of
various papers the same techniques *can* be used with DB2 UDB.

We have implemented exactly this technique at a very risk-adverse UK
retailer, albeit on Informix. In Informix it is important to ensure that
a "blocked checkpoint" occurs for the few seconds that the flash copy
takes, to write out all buffer pool data to disk and prevent new
transactions
starting. This gives a physically-consistent database. My careful
reading of the DB2 UDB manual's Crash Recovery section suggests that this
may be unnecessary on DB2, and if it is necessary I can't find a suitable
utility.

Informix supports an external restore from such a "backup" - I've done
this
successfully in DB2 too. Whether or not DB2 supports subsequent
application of logs for a point in time recovery I don't know, but I'd
like to bet that it does.

Why my two servers behaved differently with exactly the same tablespace
data is still unexplained though :-((


Nov 12 '05 #7
"Philip Nelson" <te*****@scotdb .com> wrote in message
news:NW******** *************** @news.easynews. com...
Neil,

Now you have explained what you are trying to achieve I can point you down
another road. What you described is supported by DB2, but again you have
to use the correct DB2 commands to achieve it.

You want to read the "Data Recovery and High Availability Guide and
Reference" for full details. The place to start is Chapter 5 in the
section "High Availability Through Online Split Mirror and Suspended I/O
Support".

The basic process is -

On the source machine -

db2 "set write suspend ..."
Use OS Tools to Split The Mirror (or take your flash copy)
db2 "set write resume ..."

On the target machine -

db2start
db2inidb ...


Beautiful! just what I wanted to know, thank you.
May I be permitted one last question? I found a discussion of this which
states: "Initialize s a mirrored database in a split mirror environment. The
mirrored database can be initialized as a clone of the primary database,
placed in roll forward pending state ..." What would be the steps to apply
backed-up logs from the original server for a roll forward?

cheers
Neil
Nov 12 '05 #8
Neil Truby wrote:
"Philip Nelson" <te*****@scotdb .com> wrote in message
news:NW******** *************** @news.easynews. com...
Neil,

Now you have explained what you are trying to achieve I can point you
down
another road. What you described is supported by DB2, but again you have
to use the correct DB2 commands to achieve it.

You want to read the "Data Recovery and High Availability Guide and
Reference" for full details. The place to start is Chapter 5 in the
section "High Availability Through Online Split Mirror and Suspended I/O
Support".
The basic process is -

On the source machine -

db2 "set write suspend ..."
Use OS Tools to Split The Mirror (or take your flash copy)
db2 "set write resume ..."

On the target machine -

db2start
db2inidb ...


Beautiful! just what I wanted to know, thank you.
May I be permitted one last question? I found a discussion of this which
states: "Initialize s a mirrored database in a split mirror environment.
The mirrored database can be initialized as a clone of the primary
database,
placed in roll forward pending state ..." What would be the steps to
apply backed-up logs from the original server for a roll forward?

cheers
Neil


Neil,

That is described in gory detail in the chapter in the manual I referred to.
It's probably best for you just to read this, rather than have me type up a
summary here. Manuals from -

http://www.software.ibm.com/data/db2/library
Nov 12 '05 #9

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

Similar topics

2
11179
by: Jens Kalkbrenner | last post by:
MS SQL-Server 7.0 Bypassing recovery for database 'EfW_765' because it is marked IN LOAD. What does this mean? Our customer is backing up is maindatabase and is recovering it to this database for testing. Our custumer tries it serveral times and then the recovery works and the data are corrupt. I have written a little programm which does some selects to this database. The program is stopped during recovery but our customer beleves that...
0
1562
by: Author Tarun Tyagi | last post by:
Hi, I am a Data Recovery Specialist and Professional Data Recovery Software Developer in New Delhi. I've placed the Complete SOURCE CODE of One of my Data Recovery Software for Sale (for Educational Purpose) on the following link of my website: http://www.datadoctor.biz/3.htm
10
9545
by: xixi | last post by:
i have db2 udb v8.1 on windows 64 bit 2003 server, after db2 server start , i found this in the db2diag.log, is this error? 2004-05-05-15.28.30.780000 Instance:DB2 Node:000 PID:1692(db2syscs.exe) TID:2860 Appid:AC10040A.GD5F.00FC56D8BEC5 base sys utilities sqledint Probe:30 Crash Recovery is needed. 2004-05-05-15.28.31.890000 Instance:DB2 Node:000
3
2636
by: jignesh shah | last post by:
Hi all, Is there a way to recover a single container if its been corrupted or mark bad without restoring whole tablespace? environment: db28.1/aix5.1/tsm/rs-6000. Regards Jignesh
2
1671
by: Matik | last post by:
Hello, I've follow problem - thing to consider. SQLServer 200 sp3a, ms win 2003 server db simple recovery There is a production database, wich is around 20gb big. Db is backed up each day completely, but it takes up to 30 minutes.
2
3648
by: Racerx | last post by:
Hi All : I use db2 8.1 fixpack 3 on AIX. I recieved the following message in the diaglog ====================================================== ADM7513W Database manager has started. 2007-01-13-18.55.08.262174 Instance:db2inst1 Node:000 PID:467078(db2agent (mumar) 0) TID:1 Appid:GA010302.O03F.01101B9A3444 base sys utilities sqledint Probe:30
2
1868
by: Tin | last post by:
I bought a laptop and burned 4 recovery CDs for recovery purpose. Instead of burning as disc images, I just copied and pasted these 4 CDs to my USB HDD as 4 folders called "RecoveryCD 1", "RecoveryCD 2", "RecoveryCD 3" and "RecoveryCD 4". Now my laptop got problem and I lost my 4 recovery CDs. All I have now is 4 recovery folders in my USB HDD. I burned another 4 CDs as data discs from my USB HDD, but it didn't work out (it didn't boot...
0
2072
by: Winder | last post by:
Computer Data Recovery Help 24/7 Data recovering tools and services is our focus. We will recover your data in a cost effective and efficient manner. We recover all operating systems and media. Call for a free consultation. http://a.uuload.com/Computer-Data-Recovery.htm LiveVault's Online Recovery Service Protect vital data with LiveVault's offsite backup and data storage. http://a.uuload.com/Computer-Data-Recovery.htm
2
1799
by: =?Utf-8?B?c3BhcmtsZWJhbg==?= | last post by:
My recovery disk on vista is almost full. I have performed a back up, deleted all but the most recent recovery point, done a disk clean up and also compressed the recovery disk. It is STILL almost full. What do I do? Can I (and how do I) delete the recovery disk? HELP! -- sparkleban
0
9540
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10222
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10026
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9068
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7564
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.