The fastest way is to connect to the server and execute SQL commands to back up and restore SQL Server databases directly. Google to get the syntax; For fallback syntax; Tsql msdn backup database restore syntax; Tsql msdn recovery database
There are alternatives to the foregoing.
Use SMO (SQL Management Objects), the .Net library used to manage SQL from a .Net Application. There will be a link with many links to some reference materials that will be useful; http://social.msdn.microsoft.com/Forums/en-US/sqlsmoanddmo/thread/5638666e-cd2e-467d-bd03-6d20e2cbbe1b/
Use SQL itself. Did you know that SQL service plans can back up and restore to more than a local server and can be scheduled to run at any time. You may need to complete the task to copy the backup files to an alternate server. In the worst case scenario, you can use a combination of plans on two servers.
My preference is to try service plans first. Consider the fact that the database administrator will see that he knows about it and will be able to change it to adapt to the business environment. You can also turn off error messaging, which is sent by e-mail or logged when it fails, and all of them are built into the functionality.
If you really want or need to write an application, consider the SQL command option, because SMO is limited to specific versions of SQL Server. Older versions use DMO. I donβt know what the next version will be =)
source share