sql数据库备份语句


sql数据库备份语句

文章插图
【sql数据库备份语句】--完整备份Backup Database NorthwindCSTo disk='G:\Backup\NorthwindCS_Full_20070908.bak'--差异备份Backup Database NorthwindCSTo disk='G:\Backup\NorthwindCS_Diff_20070908.bak'With Differential--日志备份 , 默认截断日志Backup Log NorthwindCSTo disk='G:\Backup\NorthwindCS_Log_20070908.bak'--日志备份 , 不截断日志Backup Log NorthwindCSTo disk='G:\Backup\NorthwindCS_Log_20070908.bak'With No_Truncate--截断日志不保留Backup Log NorthwindCSWith No_Log--或者Backup Log NorthwindCSWith Truncate_Only--截断之后日志文件不会变小--有必要可以进行收缩--文件备份Exec Sp_Helpdb NorthwindCS --查看数据文件Backup Database NorthwindCSFile='NorthwindCS' --数据文件的逻辑名To disk='G:\Backup\NorthwindCS_File_20070908.bak'--文件组备份Exec Sp_Helpdb NorthwindCS --查看数据文件Backup Database NorthwindCSFileGroup='Primary' --数据文件的逻辑名To disk='G:\Backup\NorthwindCS_FileGroup_20070908.bak'With init--分割备份到多个目标--恢复的时候不允许丢失任何一个目标Backup Database NorthwindCSTo disk='G:\Backup\NorthwindCS_Full_1.bak',disk='G:\Backup\NorthwindCS_Full_2.bak'--镜像备份--每个目标都是相同的Backup Database NorthwindCSTo disk='G:\Backup\NorthwindCS_Mirror_1.bak'Mirror To disk='G:\Backup\NorthwindCS_Mirror_2.bak'With Format --第一次做镜像备份的时候格式化目标--镜像备份到本地和远程Backup Database NorthwindCSTo disk='G:\Backup\NorthwindCS_Mirror_1.bak'Mirror To disk='\\192.168.1.200\Backup\NorthwindCS_Mirror_2.bak'With Format--每天生成一个备份文件Declare @Path Nvarchar(2000)Set @Path ='G:\Backup\NorthwindCS

    推荐阅读