Backup a Database


Author
Message
Geoff Hirst
Geoff Hirst
StrataFrame User (323 reputation)StrataFrame User (323 reputation)StrataFrame User (323 reputation)StrataFrame User (323 reputation)StrataFrame User (323 reputation)StrataFrame User (323 reputation)StrataFrame User (323 reputation)StrataFrame User (323 reputation)StrataFrame User (323 reputation)
Group: Forum Members
Posts: 123, Visits: 3.5K
Chaps,

I want to offer my users a backup routine from my application, which may or may not be on the same machine as SQL Server Express. My users are not SQL Server literate and as such I want to protect them from it as much as I can.

I have a routine from a while ago, that allows the application I have written to backup the SQL Server Express database that it uses. This routine was written for an application that ran on the same machine as SQL Server Express.

Is there any routine built into SF, that will undertake backup and possibly restore? If not, can you advise how I get the Microfour.Strataframe.DBEngine.SQL.SQLServerInfo structure populated? It has everything in it that I need to modify my existing application.

 Your advice, as always is appreciated.

regards

Geoff Hirst

Replies
Geoff Hirst
Geoff Hirst
StrataFrame User (323 reputation)StrataFrame User (323 reputation)StrataFrame User (323 reputation)StrataFrame User (323 reputation)StrataFrame User (323 reputation)StrataFrame User (323 reputation)StrataFrame User (323 reputation)StrataFrame User (323 reputation)StrataFrame User (323 reputation)
Group: Forum Members
Posts: 123, Visits: 3.5K
Hi Trent,

your example for backup and restore is great. Do you have any pointers for actually integrating it into a client that isn't running on the server machine?

I keep getting tripped up by this. Having the backup on the server is fine, I would just like the client to be able to run it rather than it be a server invoked task.

thanks

Geoff.

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
your example for backup and restore is great. Do you have any pointers for actually integrating it into a client that isn't running on the server machine?

Either create a service that runs on your clients machine or create an external EXE that you run as a scheduled task.  The latter is a litte more simple in regards to installations, but the service would be easier in regards to ensuring that it ran regardless of which user is logged into the machine or even logged in at all.  But both ways would get the job done.

Also, you can change the logic to run from a client.  You would then just have the backup update on the local disk of the server (the only way you can do this) and then copy the files up to the network.  You could just provide a preference in your app that specified the network path and the UNC path or something to the server to get to the files on disk.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
You would just make a sproc to backup your database(s) (on the server of course) then run it in some BO using the ExecuteNonQuery() method (in the client). You could simply create a class that inherits BusinessLayer, than add the method:

Public Class AdminBO

Inherits BusinessLayer

Public Sub BackDb()

'-- Just use a SQL Command object to do the work

Using cmd As New SqlCommand()

cmd.CommandType = StoredProcedure

cmd.CommandText = "BackupDatabase"

Me.ExecuteNonQuery(cmd)

End Using

End Sub

End Class

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search