Show Backup Progress in application

Show Backup Progress in application

Post by David Carl » Sat, 24 Mar 2001 12:37:44



I have a Delphi 5 app connecting to Sql Server 7 using ADO.
I can execute a backup command and it successfully creates the backup
file, but I'd also like to show the user the progress of the backup.
Is there a callback type facility so that my app can show a progress bar
or the percent complete?
Any examples would be appreciated.
TIA.
 
 
 

Show Backup Progress in application

Post by Martin Schroede » Sat, 24 Mar 2001 06:37:29


I dont think so because the DB itself at backup-start doesn't know how
much data is to be backed up. So it cannot calculate a progress bar.

Martin


> I have a Delphi 5 app connecting to Sql Server 7 using ADO.
> I can execute a backup command and it successfully creates the backup
> file, but I'd also like to show the user the progress of the backup.
> Is there a callback type facility so that my app can show a progress bar
> or the percent complete?
> Any examples would be appreciated.
> TIA.


 
 
 

Show Backup Progress in application

Post by Dan Guzma » Sat, 24 Mar 2001 20:32:51


Actually, MSSQL Server does know how much data will be backed up and will
return progress messages when the STATS option of BACKUP and RESTORE is
specified.  However, getting ADO to return these messages during the
operation is another matter.

Hope this helps.

-----------------------
SQL FAQ links (courtesy  Neil Pike):

 http://forumsb.compuserve.com/gvforums/UK/default.asp?SRV=MSDevApps
 (faqxxx.zip in lib 7)
 or www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
 or www.sqlserverfaq.com
 or www.mssqlserver.com/faq
-----------------------


> I dont think so because the DB itself at backup-start doesn't know how
> much data is to be backed up. So it cannot calculate a progress bar.

> Martin


> > I have a Delphi 5 app connecting to Sql Server 7 using ADO.
> > I can execute a backup command and it successfully creates the backup
> > file, but I'd also like to show the user the progress of the backup.
> > Is there a callback type facility so that my app can show a progress bar
> > or the percent complete?
> > Any examples would be appreciated.
> > TIA.

 
 
 

Show Backup Progress in application

Post by David Carl » Sun, 25 Mar 2001 11:41:07



> Actually, MSSQL Server does know how much data will be backed up and will
> return progress messages when the STATS option of BACKUP and RESTORE is
> specified.  However, getting ADO to return these messages during the
> operation is another matter.

> Hope this helps.

> -----------------------
> SQL FAQ links (courtesy  Neil Pike):

>  http://forumsb.compuserve.com/gvforums/UK/default.asp?SRV=MSDevApps
>  (faqxxx.zip in lib 7)
>  or www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
>  or www.sqlserverfaq.com
>  or www.mssqlserver.com/faq
> -----------------------



> > I dont think so because the DB itself at backup-start doesn't know how
> > much data is to be backed up. So it cannot calculate a progress bar.

> > Martin


> > > I have a Delphi 5 app connecting to Sql Server 7 using ADO.
> > > I can execute a backup command and it successfully creates the backup
> > > file, but I'd also like to show the user the progress of the backup.
> > > Is there a callback type facility so that my app can show a progress bar
> > > or the percent complete?
> > > Any examples would be appreciated.
> > > TIA.

Yes, I've noticed that Enterprise Manager shows a progress bar, and that
running the backup from Sql analyzer returns progress messages. The
question, as you say, is how to trap these via ADO.
Any ideas anyone
 
 
 

Show Backup Progress in application

Post by Dan Guzma » Sun, 25 Mar 2001 13:55:49


Have you considered SQLDMO?  I haven't used this for backup but the Backup
object has a PercentComplete event which provides this functionality.

Hope this helps.



> > Actually, MSSQL Server does know how much data will be backed up and
will
> > return progress messages when the STATS option of BACKUP and RESTORE is
> > specified.  However, getting ADO to return these messages during the
> > operation is another matter.

> > Hope this helps.

> > -----------------------
> > SQL FAQ links (courtesy  Neil Pike):

> >  http://forumsb.compuserve.com/gvforums/UK/default.asp?SRV=MSDevApps
> >  (faqxxx.zip in lib 7)
> >  or www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
> >  or www.sqlserverfaq.com
> >  or www.mssqlserver.com/faq
> > -----------------------



> > > I dont think so because the DB itself at backup-start doesn't know how
> > > much data is to be backed up. So it cannot calculate a progress bar.

> > > Martin


> > > > I have a Delphi 5 app connecting to Sql Server 7 using ADO.
> > > > I can execute a backup command and it successfully creates the
backup
> > > > file, but I'd also like to show the user the progress of the backup.
> > > > Is there a callback type facility so that my app can show a progress
bar
> > > > or the percent complete?
> > > > Any examples would be appreciated.
> > > > TIA.

> Yes, I've noticed that Enterprise Manager shows a progress bar, and that
> running the backup from Sql analyzer returns progress messages. The
> question, as you say, is how to trap these via ADO.
> Any ideas anyone

 
 
 

Show Backup Progress in application

Post by David Carl » Mon, 26 Mar 2001 11:08:26



> Have you considered SQLDMO?  I haven't used this for backup but the Backup
> object has a PercentComplete event which provides this functionality.
> I hadn't even heard of it!

Please can you give me a brief overview of what (and wnere) it is?
Thanks
 
 
 

Show Backup Progress in application

Post by Dan Guzma » Mon, 26 Mar 2001 06:00:13


SQL-DMO is short for SQL Distributed Management Objects.  This interface is
used mostly for admin functions.  It is documented in the Books Online under
'Building SQL Server Applications'.

I don't have Delphi installed (i'm pretty rusty anyway) so I wrote a simple
VB app and verified the PercentCompleted worked as expected.  I've included
the code below in case it helps.

Option Explicit
 Public oSQLDMOSQLServer As SQLDMO.SQLServer
 Public WithEvents oSQLDMOBackup As SQLDMO.Backup

Private Sub cmdBackup_Click()
 Set oSQLDMOSQLServer = New SQLDMO.SQLServer
 Set oSQLDMOBackup = New SQLDMO.Backup2
 oSQLDMOSQLServer.LoginSecure = True
 oSQLDMOSQLServer.Connect "ServerName"
 oSQLDMOBackup.Action = 0
 oSQLDMOBackup.Initialize = True
 oSQLDMOBackup.Database = "DatbaseName"
 oSQLDMOBackup.Files = "C:\Backups\DatbaseName.bak"
 oSQLDMOBackup.PercentCompleteNotification = 5
 oSQLDMOBackup.SQLBackup oSQLDMOSQLServer
End Sub

Public Sub oSQLDMOBackup_PercentComplete(ByVal Message As String, ByVal
Percent As Long)
 BackupStatusBar.SimpleText = Message
 BackupProgressBar.Value = Percent
 DoEvents
End Sub

Public Sub oSQLDMOBackup_Complete(ByVal Message As String)
 BackupStatusBar.SimpleText = Message
 DoEvents
End Sub



> > Have you considered SQLDMO?  I haven't used this for backup but the
Backup
> > object has a PercentComplete event which provides this functionality.
> > I hadn't even heard of it!
> Please can you give me a brief overview of what (and wnere) it is?
> Thanks