cancel
Showing results for 
Search instead for 
Did you mean: 

Run external program (dos batch) after database backup (Newbie!)

former_member193399
Active Participant
0 Kudos

I am implementing an intermediate database backup solution for our SAP systems in our SANDBOX environment. The idea behind is backup SQL Database using DB13 to the local disk and then run a windows batch file to copy the files to the external file server. After doing some research, I am able to define and run a batch program using SM36 (Job maintenance). I scheduled database backup using DB13. Now I am trying to run the job I defined in SM36 after the scheduled database backup in DB13 automatically.

I also did some research on background events, how to create user defined events and how to raise events in ABAP program and from external programs using SAPEVT. I came up with two options:

Option 1:

1. Identify the job which I scheduled in DB13 under SM36.

2. Add this job as step1

3. Add the external program (batch file) as step2

Questions Regarding Option1:

1. Is it possible to add the database backup job as a step in SM36?

Option 2

1. Create user defined event.

2. Create job with the external program with the job marked as “after event”.

3. Raise this user defined event after database backup (scheduled using DB13).

Questions Regarding Option2:

1. Is it possible to raise user defined event after completion of the database backup in DB13?

The following are the alternative options. But I am trying to do everything within SAP:

<b>1) Schedule backup in SQL Server using Management Studio using SSIS with custom task.

2) Schedule the DOS batch file under control panel. This requires a longer gap so that the database backup does not conflict.

3) Use backup software agents (vertias) to directly backup the database.

</b>

Let me know if you think of any alternative options.

Any help towards this is highly appreciated.

Message was edited by:

R.T.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member193399
Active Participant
0 Kudos

Thanks for your replies. Very good suggestions...

But I wanted to find a way to do everything within SAP using SAP GUI since I may not have access to physical server all the time due to security restrictions. I have bolded some alternative options but in my original post but I cannot do those. I will award points accordingly.

Please Let me know if anyone have any other options within SAP. I can create a OS batch file but wanted to schedule it within SAP. I can definitely give a long delay say 3-4 hours after the database backup. But wanted to explore whether to trigger the OS batch job within SAP after scheduled database backup in DB13.

R.T.

former_member204746
Active Contributor
0 Kudos

Ok, you can create an OS script for your backup,

then create an SM36/SM37 job with 2 steps:

1. call OS script for backup, use "EXTERNAL PROGRAM"

2. so whatever else you want to do after backup.

former_member193399
Active Participant
0 Kudos

Eric,

In Step2 how do I add the task to backup the database which I scheduled using db13? It may be asking a stupid question without knowing the fundamental architecture of db13 and sm36.

For example in DTS/SSIS i can execute a batch job and then backup the databse using command task and backup task by creating a workflow. But in SAP I schedule the batch job using SM36/SM37 and schedule database backup in DB13. How can I connect these two?

Does this make sense?

rolfc_weber
Contributor
0 Kudos

Hi,

Why focusing so much on doing the database backup from DB13?

You should be able to create a (DOS) batchfile to do the backup also.

And when you can do that, you could do every thing you want to do in one single command file.

As you can start a script (External command) from within SAP (SM36) as Eric has described, you are done.

Hope you could follow me...

Regards

Rolf

former_member204746
Active Contributor
0 Kudos

simply call an OS script that calls BRBACKUP.

check your last DB13 job to know which parameters were used.

Forget about DB13 or trying to fetch the DB13/SM37 generated job.

Former Member
0 Kudos

deleted

null

former_member193399
Active Participant
0 Kudos

As far as my knowledge goes BRBackup is an oracle tool.

Anyway folks thanks for the input. It was a good brain storm session for me.

I might do it using Management Studio using maintenance plan instead of OS batch since eitherway I have to take it outside SAP. The downside is the default installation of SQL Server 2005 by SAP does not install SSIS. So i have to install SSIS in order for the maintenace plan to work. Again thanks for all your input.

former_member204746
Active Contributor
0 Kudos

sorry for that, yes BRBACKUP is for ORAcle and Informix databases, not MS-SQL.

anyway, you can still check which command is executed in DB13 backup logs and use it at Os level.

Former Member
0 Kudos

Any manual possibility for me to know the dynamic variants created by SAP ?

If this is possible then I can prefer sm37.(Iam not sure).

Let me know

former_member204746
Active Contributor
0 Kudos

option 1 may not work. DB13 creates jobs with dynamic variants.

anyway, I would not use DB13 to schedule such a thing. I would prefer using OS scripts to accomplish your needs.

Former Member
0 Kudos

What about just setting up a scheduled task at the O/S level?

If you know the backup takes e.g. 2 hrs and always starts at midnight, then have your auxilary job start at 3:00 a.m and all should be OK.

former_member204746
Active Contributor
0 Kudos

Lyell has a great idea and I will extend it further.

in the same backup job (through a script at OS level, call program SAPEVT at OS level to trigger a job in SAP.

More info about SAPEVT at http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCDWBLIB/BCDWBLIB.pdf