Hi Fabrice,

If you write a script anyway, just avoid the -i option of dbmcli:

#!/bin/sh
#
SUFFIX=`date +%y%m%d%H%M`


dbmcli -n machine -d DB -u XXX,XXX << EOF
db_admin
util_connect
medium_put Master H:\MasterBackup\MASTER_COM_$SUFFIX FILE
backup_start Master DATA
db_online
EOF

dbmcli -d DB -u YYY,YYY << EOF
db_admin
util_connect
medium_put Master /pathtodatabase/MASTER_COM_$SUFFIX FILE DATA
db_activate RECOVER Master DATA
load_systab -u YYY,YYY -ud ZZZ
util_connect
util_execute SET LOG AUTO OVERWRITE ON
util_release
db_online



The advantage of a ADMIN-backup is the very well controlled state of the
database content. The advantage of ONLINE-backup is its non-disturbing
nature. If you use your backups for recovery purposes only, there is no
need to do ADMIN-backups.

Best regards,
Tilo Heinrich
SAP Labs Berlin

-----Original Message-----
From: Fabrice Bourdel [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 29, 2005 11:23 AM
To: maxdb
Subject: how to automate backup and restore with a filename that vary

Hello,

i have to automate (via cron sheduler) then backup and restore from
a maxdb 7.5.0.26 database on winxp to a maxdb 7.5.0.26 linux database.
I want to do a full backup and then a restore with initialisation on
another machine.
I will tell cron to do this job dayly

But i have problem to send a parameter, a suffix to the backup file
name.

Context :
 - the database to backup is on a winxp machine
 - the cron and dbmcli and "restore database" is on the linux machine
 - because the os's are different, i do a loadsystab
 - actually (but temporary), the 2 databases (backup and restored) are
   with the log overwrite to on > the restored database need to get
telled
   to set the log to be overwrited

The file witch will be launched dayly by the cron task :

>>> File mycommand.sh
#!/bin/sh
#
SUFFIX=`date +%y%m%d%H%M`
dbmcli -n machine -d DB -u XXX,XXX -i mybackup.txt $SUFFIX
dbmcli -d DB -u YYY,YYY -i myrestore.txt $SUFFIX
>>> EOF

The $SUFFIX variable is intended to get the date in the form YYMMDDHHMM

But then $SUFFIX variable is interpreted as a dbmcli commande and
naturally,
this command doesn't exist.

>>> File mybackup.txt
db_admin
util_connect
medium_put Master$1 H:\MasterBackup\MASTER_COM_$1 FILE
backup_start Master$1 DATA
db_online
quit
>>> EOF

$1 is intended to get le suffix parameter, but don't work

>>> File myrestore.txt
db_admin
util_connect
medium_put Master$SUFFIX /pathtodatabase/MASTER_COM_$1 FILE DATA
db_activate RECOVER Master$1 DATA
load_systab -u YYY,YYY -ud ZZZ
util_connect
util_execute SET LOG AUTO OVERWRITE ON
util_release
db_online
quit>>> EOF

$1 is intended to get le suffix parameter too, but don't work too

How to write correcty to pass the suffix parameter to the backup file ?

And another question : is it better to get the database in admin mode,
or is it no problem  to let the database running ?

Thanks for responses


-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]


--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to