Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi My application uses SQL Server 2005.
Database is on server and all of the clients use that. How can add a backup service to my application? (I want to add a "Backup" button to application) And how can I recover data from the backup?
Posted

1 solution

You can issue backup SQL commands against your database.

It's pretty much standard syntax that you can execute against a connection object.

http://technet.microsoft.com/en-us/library/ms191304.aspx[^]

However, this comes with some security issues that you would need to consider and naming considerations due to the multi-user environment

e.g

BACKUP DATABASE and BACKUP LOG permissions default to members of the sysadmin  fixed server role and the db_owner and db_backupoperator  fixed database roles. 


So your client application that is issuing the backup command would need to have the appropriate permissions

Personally, I think this is a terrible approach to backups. If you want regular backups of a database, just schedule a job to perform them once per hour or whatever.

If you need to restore a db from backup, this is definitely something that should sit with a DBA in a multi-user environment. You wouldn't want your client application being able to do this, that way madness lies
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900