从SQL Server数据库进行备份 [英] Making backup from a SQL Server database
问题描述
嗨
我的应用程序使用SQL Server2005.
数据库在服务器上,所有客户端都使用该数据库.如何为我的应用程序添加备份服务? (我想向应用程序添加备份"按钮)以及如何从备份中恢复数据?
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?
推荐答案
您可以对数据库发出备份SQL命令.
您可以针对连接对象执行几乎所有标准语法.
http://technet.microsoft.com/en-us/library/ms191304.aspx [ ^ ]
但是,这会带来一些安全问题,由于多用户环境,您需要考虑这些问题并命名注意事项
例如
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.
因此,发出备份命令的客户端应用程序将需要具有适当的权限
我个人认为这是一种糟糕的备份方法.如果要定期备份数据库,只需安排一个作业每小时执行一次备份即可.
如果您需要从备份中还原数据库,那么在多用户环境中,DBA应该绝对适合这种情况.您不希望您的客户端应用程序能够执行此操作,那样会发疯
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
这篇关于从SQL Server数据库进行备份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!