On 9/5/2012 1:44 PM, istanbullu wrote:
<snip>
Now, here is the failing scenario:

1) I take a DB back-up by enabling log archive mode
2) I delete a subset of files under seg0 directory of the original DB (say
c5*.dat)
3) Then, I run rollforward recovery script, and I DO NOT see the deleted
files restored from the backed-up DB created in step 1.  I run consistency
check and it fails.

Note that the only difference is that in successful scenario all files under
seg0 are deleted.

My scripts are along the lines of code snippets discussed in this
developerworks article:

http://www.ibm.com/developerworks/data/library/techarticle/dm-0502thalamati/index.html

Any comments appreciated.


Thank you so much for thinking about backup and recovery and pointing to the article. I didn't know this article existed and will bookmark it and promote it!

I have always instructed people restoring after corruption to make a zip archive of the database for analysis and then remove a corrupt (or any existing database) before restoring to that location. I often see corruptions that occur from restoring one database on top of another (usually with operating system commands.)

I see now that the documentation says restore should delete the existing database :

http://db.apache.org/derby/docs/10.8/adminguide/tadminhubbkup44.html

so what you are describing sounds like a bug.

I tried reproducing on 10.8.2.2 - (1181258) and trunk as follows: ( I am using cygwin so pardon the shell commands on windows)

I created the database:

 $java org.apache.derby.tools.ij
ij version 10.8
ij> connect 'jdbc:derby:wombat;create=true';
ij> create table t (i int);
0 rows inserted/updated/deleted
ij> create table t2 (i int);
0 rows inserted/updated/deleted
ij> exit;

Found a file under seg0:
$ls -l wombat/seg0/c470.dat
-rwxrwxrwx 1 kmarsden None 8192 Sep  6 13:08 wombat/seg0/c470.dat


$ Backed up with log archive mode
 $java org.apache.derby.tools.ij
ij version 10.8
ij> connect 'jdbc:derby:wombat';
ij> CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE('c:/cygwin/tmp/backuplogarc/09_06_2012',1);
0 rows inserted/updated/deleted
ij> exit;

Deleted the file:
$rm wombat/seg0/c470.dat
$ls -l wombat/seg0/c470.dat
ls: cannot access wombat/seg0/c470.dat: No such file or directory

Restored with roll forward recovery:
ij>connect 'jdbc:derby:wombat;rollForwardRecoveryFrom=c:/cygwin/tmp/backuplogarc/09_06_2012/wombat';
ij> exit;

My file was restored:

 $ls -l wombat/seg0/c470.dat
rwxrwx 1 kmarsden None 8192 Sep  6 13:13 wombat/seg0/c470.dat

Can you provide a reproduction where the files don't get restored?

Also could you include the full Derby version from the derby.log? Was Derby or network server fully shutdown before attempting the restore?

Thanks

Kathey

Reply via email to