数据库备份:
backup database @dbName to disk=@BackFileName with init
@dbName备份的数据库名称
@BackFileName备份的数据库文件地址,这里是数据库服务器的地址目录
数据库的还原
USE [master]
ALTER DATABASE " +Database + " SET SINGLE_USER WITH ROLLBACK IMMEDIATE
RESTORE DATABASE " +Database + " FROM DISK = @backFile WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 5
ALTER DATABASE " +Database + " SET MULTI_USER
USE " +Database + "
执行语句可以参考SQLserver用手动操作转成的脚本进行使用