Help setting up a multi volume database restore command

Posted by Robert Cohen on 17-May-2017 10:05

I am trying to change some of my backup script and testing some options as back file is becoming quite large

 

Current backup run the following command to back the database

 

$DLC/bin/probkup online $DBDIR/crp/mfgcrp $BACKUPDIR/crp/db/mfgcrp.backup -com >> /tmp/backup.log 2>&1

 

So I want to change it to do multi volume database backup as below

 

$DLC/bin/probkup $DBDIR/crp/mfgcrp $BACKUPDIR/crp/db/mfgcrp.backup -com -vs 244000 <<eof >> /tmp/backup.log 2>&1

$BACKUPDIR/crp/db/mfgcrp.backup1

$BACKUPDIR/crp/db/mfgcrp.backup2

$BACKUPDIR/crp/db/mfgcrp.backup3

$BACKUPDIR/crp/db/mfgcrp.backup4

$BACKUPDIR/crp/db/mfgcrp.backup5

$BACKUPDIR/crp/db/mfgcrp.backup6

$BACKUPDIR/crp/db/mfgcrp.backup7

$BACKUPDIR/crp/db/mfgcrp.backup8

$BACKUPDIR/crp/db/mfgcrp.backup9

$BACKUPDIR/crp/db/mfgcrp.backup10

eof

 

The current restore uses the following command

 

$DLC/bin/prorest $DBDIR/crp/mfgcrp $BACKUPDIR/crp/db/mfgcrp.backup < /apps/scripts/yesfile >> /tmp/backup.log 2>&1

 

Where /apps/scripts/yesfile contains just the letter "y"

 

I always used to do a prodel and then create and then restore but some time ago it was suggested to me by Tom Bascom that I don't need to do all those step and can just restore into the current backup and have been doing this as it is faster - see note below

 

Trying to setup the multi volume restore without doing a delete and create and I am not sure how to get the "yes" file to work and where to place it with regards to the here-document. The code below does not seem to work, nore does placing it within the here-document, any help please

 

$DLC/bin/prorest $DBDIR/$ENVNAME/$DB $BACKUPDIR/$RESTENV/db/$RESTDB.backup < /apps/scripts/yesfile <<eof >> /tmp/backup.log 2>&1

$BACKUPDIR/$ENVNAME/db/$DB.backup1

$BACKUPDIR/$ENVNAME/db/$DB.backup2

$BACKUPDIR/$ENVNAME/db/$DB.backup3

$BACKUPDIR/$ENVNAME/db/$DB.backup4

$BACKUPDIR/$ENVNAME/db/$DB.backup5

$BACKUPDIR/$ENVNAME/db/$DB.backup6

$BACKUPDIR/$ENVNAME/db/$DB.backup7

$BACKUPDIR/$ENVNAME/db/$DB.backup8

$BACKUPDIR/$ENVNAME/db/$DB.backup9

$BACKUPDIR/$ENVNAME/db/$DB.backup10

eof

 

 

##############################################################################

# see note from Tom Bascom - no need to delete

##############################################################################

# NOTE: If doing a restore without a delete you need to provide a "yes" file

#       as the prorest knows the the /apps/qaddb/crp/mfgcrp already exists.

#       and asks "Do you want to over write it? [y/n]:" so you need to send yes

#       If you do the crpel you need to provide the "yes" file to the delete

#       and not to the prorest

# in testing with the delete and restore (no create) take +/- 1 min 10 sec but

# doing just a straight restore takes +/- 35 seconds

##############################################################################

Posted by ChUIMonster on 17-May-2017 10:32

How big is "quite large"?

The simple things is to put a "y" as the first line of the file with the list of segments to restore.

All Replies

Posted by ChUIMonster on 17-May-2017 10:32

How big is "quite large"?

The simple things is to put a "y" as the first line of the file with the list of segments to restore.

Posted by George Potemkin on 17-May-2017 10:49

> $BACKUPDIR/crp/db/mfgcrp.backup9

> $BACKUPDIR/crp/db/mfgcrp.backup10

> eof

Add QUIT right before "eof". Otherwise probkup (or prorest) will hang if the specified number of the backup volumes is not enough for your database that became much bigger after you create the script. It's more safely with "QUIT".

Posted by Robert Cohen on 17-May-2017 10:49

Tom,
 
“Quite large” is relative, for you I would think you would say it is not that big but the single backup around 12 GIG’s. I am sure that this is not that large for some people but I don’t  feel all that comfortable with files that size
 
I will try just a “Y” rather than a file in the here-document – first line
 
ROBERT COHEN
Manager IT and Logistics
DYNACAST LTD
 
P / 1.705.748.9522 x 2454
E / rcohen@dynacast.com
 
710 Neal Drive
Peterborough, ON, CANADA
K9J 6X7
WWW.DYNACAST.COM
 

Posted by Robert Cohen on 17-May-2017 11:10

Thanks for this info George

Posted by ChUIMonster on 17-May-2017 11:14

True, these days I don't get very worried about file sizes that are less than 64GB and I've successfully worked with some that were in the half terabyte range (although those did make me nervous they worked).

Mike Furgal will probably jump in and mention large backups on Windows.

And he might mention that there is a hard limit on db extent size of 1TB.  (I believe that he found that the hard way... although it could have been worse, at least it wasn't PROD.)

Anyhow -- your mileage may vary and you should definitely test your local systems etc.  In my experience on reasonably modern systems you can very happily sling around some pretty good sized files.

Posted by Robert Cohen on 17-May-2017 12:52

Tom,
 
I am not having any luck with where to put the “Y”
 
I have tried – below and it fails
$DLC/bin/prorest $DBDIR/$ENVNAME/$DB $BACKUPDIR/$RESTENV/db/$RESTDB.backup y <<eof >> /tmp/backup.log 2>&1
$BACKUPDIR/$ENVNAME/db/$DB.backup1
$BACKUPDIR/$ENVNAME/db/$DB.backup2
$BACKUPDIR/$ENVNAME/db/$DB.backup3
$BACKUPDIR/$ENVNAME/db/$DB.backup4
$BACKUPDIR/$ENVNAME/db/$DB.backup5
$BACKUPDIR/$ENVNAME/db/$DB.backup6
$BACKUPDIR/$ENVNAME/db/$DB.backup7
$BACKUPDIR/$ENVNAME/db/$DB.backup8
$BACKUPDIR/$ENVNAME/db/$DB.backup9
$BACKUPDIR/$ENVNAME/db/$DB.backup10
eof
I have tried – below and it fails as well
$DLC/bin/prorest $DBDIR/$ENVNAME/$DB $BACKUPDIR/$RESTENV/db/$RESTDB.backup <<eof >> /tmp/backup.log 2>&1
y
$BACKUPDIR/$ENVNAME/db/$DB.backup1
$BACKUPDIR/$ENVNAME/db/$DB.backup2
$BACKUPDIR/$ENVNAME/db/$DB.backup3
$BACKUPDIR/$ENVNAME/db/$DB.backup4
$BACKUPDIR/$ENVNAME/db/$DB.backup5
$BACKUPDIR/$ENVNAME/db/$DB.backup6
$BACKUPDIR/$ENVNAME/db/$DB.backup7
$BACKUPDIR/$ENVNAME/db/$DB.backup8
$BACKUPDIR/$ENVNAME/db/$DB.backup9
$BACKUPDIR/$ENVNAME/db/$DB.backup10
eof
 
I am not sure I can do this with the here file
 

Posted by Rob Fitzpatrick on 17-May-2017 12:55

With regard to restoring overtop of an existing db, you can also use a pipeline instead of input redirection.  It saves you the risk of having a "yesfile" and losing it at some point.

Example: echo y | prorest demo demo.pbk

Posted by Robert Cohen on 17-May-2017 13:56

Tom,
 
Your suggestion worked but the “Y” had to be in column 1 in the here file as in
    $DLC/bin/probkup $DBDIR/crp/mfgcrp $BACKUPDIR/crp/db/mfgcrp.backup -com -vs 244000 <<eof >> /tmp/backup.log 2>&1
Y
$BACKUPDIR/crp/db/mfgcrp.backup1
 
My code was indented due to an If statement higher up.  The database files can have space before the file name but not the “Y” like the “eof” marker
 
Thanks

This thread is closed