cancel
Showing results for 
Search instead for 
Did you mean: 

Backu scripts on windows using batch scripts

Former Member
0 Kudos

Hi all,

I am writing a batch file to take a backup of NW04 and NW04s on Windows with Database. I have executed the same

successfully on linux using shell scripts.But I am unable to execute some of the DB commands that I could execute on shell.They are as follows..

echo "#MaxDB backup commands to backup database instance"

#medium_cmd="medium_put $SID"_"$SUFFIX /sapdata/backup/$SID"_"$SUFFIX.DB FILE DATA"

medium_cmd="medium_put $SID"_"$SUFFIX $SID"_"$SUFFIX.DB FILE DATA"

echo $medium_cmd

backup_cmd="backup_start $SID"_"$SUFFIX DATA"

echo $backup_cmd

echo "executing complete data backup..."

_o=`cat <<EOF | dbmcli -d $SID -u control,control -uUTL

db_admin

util_connect

$medium_cmd

$backup_cmd

db_online

EOF`

the varaible like SID are taken from the user. Now I am not able to execute the same using DOS. My question is how to execute the DB commands as a single commands. Please help me as It is of high priority.

Thanks a heap in advance.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member204746
Active Contributor
0 Kudos

try this:

dbmcli -d $SID -u control,control -uUTL db_admin

dbmcli -d $SID -u control,control -uUTL util_connect

dbmcli -d $SID -u control,control -uUTL $medium_cmd

dbmcli -d $SID -u control,control -uUTL $backup_cmd

dbmcli -d $SID -u control,control -uUTL $db_online

Former Member
0 Kudos

ahh,

and don't forget,

dos variable are addressed like this: %sid%,

for example echo %sid%,

I hope this would help you,

ilan shani

Former Member
0 Kudos

I'm not sure I had understood your linux script,

here are some tips for dos, which might help you:

the command: set /p sid=

would input information from the user.

the command: dbconnect < input.txt

would table the input of dbconnect from the file input.txt

Former Member
0 Kudos

use powershell.

It is available for download (free).

much much powerfull.

With the DOS-Shell you really can't do scripting very well.

regards

Peter