Backuping Up and Restoring SQL Server with SMO


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
There have been some inquiries as to how to backup and restore SQL Server databases through an application in the field.  The best approach that we have learned for creating a reusable backup solution is to use SMO.  We have a service that runs within our medical application that automatically backs up the end-users database to a different file name each night...since they don't always do this themselves BigGrin

You can modify this logic to backup and restore individual file groups.  But this sample will at least get you started and shows how to backup and restore a single database using SMO.

Note: You may need to adjust the output folder path and the server settings in order to get this sample to work for you.

Attachments
BackupAndRestoreSql.zip (550 views, 98.00 KB)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search