MSSQL2005_数据库备份语句
--完整备份
Backup Database NorthwindCS
To disk='G:BackupNorthwindCS_Full_20070908.bak'
--差异备份
Backup Database NorthwindCS
To disk='G:BackupNorthwindCS_Diff_20070908.bak'
With Differential
--日志备份,默许截断日志
Backup Log NorthwindCS
To disk='G:BackupNorthwindCS_Log_20070908.bak'
--日志备份,不截断日志
Backup Log NorthwindCS
To disk='G:BackupNorthwindCS_Log_20070908.bak'
With No_Truncate
--截断日志不保存
Backup Log NorthwindCS
With No_Log
--或者
Backup Log NorthwindCS
With Truncate_Only
--截断之后日志文件不会变小
--有必要可以举行紧缩
--文件备份
Exec Sp_Helpdb NorthwindCS --检察数据文件
Backup Database NorthwindCS
File='NorthwindCS' --数据文件的逻辑名
To disk='G:BackupNorthwindCS_File_20070908.bak'
--文件组备份
Exec Sp_Helpdb NorthwindCS --检察数据文件
Backup Database NorthwindCS
FileGroup='Primary' --数据文件的逻辑名
To disk='G:BackupNorthwindCS_FileGroup_20070908.bak'
With init
--分割备份到多个目标
--恢复的时候不容许丧失任何一个目标
Backup Database NorthwindCS
To disk='G:BackupNorthwindCS_Full_1.bak'
,disk='G:BackupNorthwindCS_Full_2.bak'
--镜像备份
--每个目标都是相同的
Backup Database NorthwindCS
To disk='G:BackupNorthwindCS_Mirror_1.bak'
Mirror
To disk='G:BackupNorthwindCS_Mirror_2.bak'
With Format --第一次做镜像备份的时候款式化目标
--镜像备份到本地和长途
Backup Database NorthwindCS
To disk='G:BackupNorthwindCS_Mirror_1.bak'
Mirror
To disk='\192.168.1.200BackupNorthwindCS_Mirror_2.bak'
With Format
--每天生成一个备份文件
Declare @Path Nvarchar(2000)
Set @Path ='G:BackupNorthwindCS_Full_'
+Convert(Nvarchar,Getdate(),112)+'.bak'
Backup Database NorthwindCS
To disk=@Path
--从NoRecovery或者
--Standby形式恢单数据库为可用
Restore Database NorthwindCS_Bak
With Recovery
--检察目标备份中的备份集
Restore HeaderOnly
From Disk ='G:BackupNorthwindCS_Full_20070908.bak'
--检察目标备份的第一个备份集的信息
Restore FileListOnly
From Disk ='G:BackupNorthwindCS_Full_20070908_2.bak'
With File=1
--检察目标备份的卷标
Restore LabelOnly
From Disk ='G:BackupNorthwindCS_Full_20070908_2.bak'
--备份设置暗码保护备份
Backup Database NorthwindCS
To disk='G:BackupNorthwindCS_Full_20070908.bak'
With Password = '123',init
Restore Database NorthwindCS
From disk='G:BackupNorthwindCS_Full_20070908.bak'
With Password = '123'
- 文章作者: 福州军威计算机技术有限公司
军威网络是福州最专业的电脑维修公司,专业承接福州电脑维修、上门维修、IT外包、企业电脑包年维护、局域网网络布线、网吧承包等相关维修服务。
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出处 、作者信息和声明。否则将追究法律责任。
TAG:
评论加载中...
|