Showing posts with label restores. Show all posts
Showing posts with label restores. Show all posts

Thursday, March 8, 2012

Backup and Restore using VBScript (ActiveX)

We are trying to setup a central job server that will perform the backups, restores, and other automated tasks for all of our SQL servers. The goal is that we have one place to check the status of all of our jobs. I have a couple of problems, though.

The first is that, to backup a database on a remote server, we are using VBScript as an ActiveX Script type of step. The script uses SQLDMO. The jobs mostly run fine, but there seems to be a problem with concurrent jobs running against the same server. For instance, I have 4 backup jobs that I kick off at 7:00PM. One of them (not always the same one) will fail with:

Error Code: 0 Error Source= Microsoft SQL-DMO Error Description: [SQL-DMO]The application is busy. Error on Line 11. The step failed.

The databses are all quite small (master, msdb, and a couple of utility dbs we have). Are there threading issues in using SQL-DMO such that I can't run jobs concurrently? The remote server is SQL2000, so I don't believe I can use SMO. My script is at the end of this post.

My second problem is trying to remotely kick off a restore. Currently, when using the local scheduler, we use the RESTORE DATABASE command right after an ALTER DATABASE SET SINGLE_USER WITH ROLLBACK IMMEDIATE command. This command is necessary to kill any processes currently using the DB so that a restore will succeed. In DMO I can't find anyway to duplicate this functionality. Any ideas?

Thanks

Steve

-- Backup Script --

Dim sServer, sDatabase, sPath, sDumpFile, oSQLServer, oBackup

sServer = "PRDSQL01"
sDatabase = "master"
sPath = "E:\MSSQL\DUMP\"
sDumpFile = "master.dmp"

Set oSQLServer = CreateObject("SQLDMO.SQLServer")
Set oBackup = CreateObject("SQLDMO.BackUp")

oSQLServer.loginsecure = true
oSQLServer.Connect sServer

oBackup.Database = sDatabase
oBackup.Files = sPath & sDumpFile
oBackUp.BackupSetDescription = "Backup - " & sDatabase
oBackup.Initialize = "TRUE"
oBackup.SQLBackup oSQLServer

oSQLServer.Disconnect

Set sServer = nothing
Set sDatabase = nothing
Set sPath = nothing
Set sDumpFile = nothing
Set oSQLServer = nothing
Set oBackup = nothing

Hi Stev

Vimal , here ,

sir its helpful to take backup ,please tell me script for restore the taken dump file.

Vimal

Backup and Restore using VBScript (ActiveX)

We are trying to setup a central job server that will perform the backups, restores, and other automated tasks for all of our SQL servers. The goal is that we have one place to check the status of all of our jobs. I have a couple of problems, though.

The first is that, to backup a database on a remote server, we are using VBScript as an ActiveX Script type of step. The script uses SQLDMO. The jobs mostly run fine, but there seems to be a problem with concurrent jobs running against the same server. For instance, I have 4 backup jobs that I kick off at 7:00PM. One of them (not always the same one) will fail with:

Error Code: 0 Error Source= Microsoft SQL-DMO Error Description: [SQL-DMO]The application is busy. Error on Line 11. The step failed.

The databses are all quite small (master, msdb, and a couple of utility dbs we have). Are there threading issues in using SQL-DMO such that I can't run jobs concurrently? The remote server is SQL2000, so I don't believe I can use SMO. My script is at the end of this post.

My second problem is trying to remotely kick off a restore. Currently, when using the local scheduler, we use the RESTORE DATABASE command right after an ALTER DATABASE SET SINGLE_USER WITH ROLLBACK IMMEDIATE command. This command is necessary to kill any processes currently using the DB so that a restore will succeed. In DMO I can't find anyway to duplicate this functionality. Any ideas?

Thanks

Steve

-- Backup Script --

Dim sServer, sDatabase, sPath, sDumpFile, oSQLServer, oBackup

sServer = "PRDSQL01"
sDatabase = "master"
sPath = "E:\MSSQL\DUMP\"
sDumpFile = "master.dmp"

Set oSQLServer = CreateObject("SQLDMO.SQLServer")
Set oBackup = CreateObject("SQLDMO.BackUp")

oSQLServer.loginsecure = true
oSQLServer.Connect sServer

oBackup.Database = sDatabase
oBackup.Files = sPath & sDumpFile
oBackUp.BackupSetDescription = "Backup - " & sDatabase
oBackup.Initialize = "TRUE"
oBackup.SQLBackup oSQLServer

oSQLServer.Disconnect

Set sServer = nothing
Set sDatabase = nothing
Set sPath = nothing
Set sDumpFile = nothing
Set oSQLServer = nothing
Set oBackup = nothing

Hi Stev

Vimal , here ,

sir its helpful to take backup ,please tell me script for restore the taken dump file.

Vimal

Wednesday, March 7, 2012

Backup and restore scripts

Any one have implemented backup, recovery stored procedures which
takes the uments for dbname, date, time ime and restores till that
time?
Look at http://www.winnetmag.com/Article/Art...09/42009.html. If
that's not enough, I can send you my script.
Quentin
"tram" <tram_e@.hotmail.com> wrote in message
news:26ee1067.0407080734.94bd55f@.posting.google.co m...
> Any one have implemented backup, recovery stored procedures which
> takes the uments for dbname, date, time ime and restores till that
> time?
|||Thanks for the reply. I am looking for centralized scripts where we
should able to able to restore any database by giving arguments as DB
name, time, standby restore/normal restore. We should able to run it
from centralized server. Any ideas?
"Quentin Ran" <ab@.who.com> wrote in message news:<uulGraTZEHA.2388@.TK2MSFTNGP11.phx.gbl>...[vbcol=seagreen]
> Look at http://www.winnetmag.com/Article/Art...09/42009.html. If
> that's not enough, I can send you my script.
> Quentin
>
> "tram" <tram_e@.hotmail.com> wrote in message
> news:26ee1067.0407080734.94bd55f@.posting.google.co m...

Backup and restore scripts

Any one have implemented backup, recovery stored procedures which
takes the uments for dbname, date, time ime and restores till that
time?Look at http://www.winnetmag.com/Article/ArticleID/42009/42009.html. If
that's not enough, I can send you my script.
Quentin
"tram" <tram_e@.hotmail.com> wrote in message
news:26ee1067.0407080734.94bd55f@.posting.google.com...
> Any one have implemented backup, recovery stored procedures which
> takes the uments for dbname, date, time ime and restores till that
> time?|||Thanks for the reply. I am looking for centralized scripts where we
should able to able to restore any database by giving arguments as DB
name, time, standby restore/normal restore. We should able to run it
from centralized server. Any ideas?
"Quentin Ran" <ab@.who.com> wrote in message news:<uulGraTZEHA.2388@.TK2MSFTNGP11.phx.gbl>...
> Look at http://www.winnetmag.com/Article/ArticleID/42009/42009.html. If
> that's not enough, I can send you my script.
> Quentin
>
> "tram" <tram_e@.hotmail.com> wrote in message
> news:26ee1067.0407080734.94bd55f@.posting.google.com...
> > Any one have implemented backup, recovery stored procedures which
> > takes the uments for dbname, date, time ime and restores till that
> > time?

Backup and restore scripts

Any one have implemented backup, recovery stored procedures which
takes the uments for dbname, date, time ime and restores till that
time?Look at http://www.winnetmag.com/Article/Ar...009/42009.html. If
that's not enough, I can send you my script.
Quentin
"tram" <tram_e@.hotmail.com> wrote in message
news:26ee1067.0407080734.94bd55f@.posting.google.com...
> Any one have implemented backup, recovery stored procedures which
> takes the uments for dbname, date, time ime and restores till that
> time?|||Thanks for the reply. I am looking for centralized scripts where we
should able to able to restore any database by giving arguments as DB
name, time, standby restore/normal restore. We should able to run it
from centralized server. Any ideas?
"Quentin Ran" <ab@.who.com> wrote in message news:<uulGraTZEHA.2388@.TK2MSFTNGP11.phx.gbl>...[
vbcol=seagreen]
> Look at http://www.winnetmag.com/Article/Ar...009/42009.html. If
> that's not enough, I can send you my script.
> Quentin
>
> "tram" <tram_e@.hotmail.com> wrote in message
> news:26ee1067.0407080734.94bd55f@.posting.google.com...