SQL backup&restore
--完整备份
Backup Database NorthwindCS
To disk='G:\Backup\NorthwindCS_Full_20070908.bak'
--差异备份
Backup Database NorthwindCS
To disk='G:\Backup\NorthwindCS_Diff_20070908.bak'
With Differential
--日志备份,默认截断日志
Backup Log NorthwindCS
To disk='G:\Backup\NorthwindCS_Log_20070908.bak'
--日志备份,不截断日志
Backup Log NorthwindCS
To disk='G:\Backup\NorthwindCS_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:\Backup\NorthwindCS_File_20070908.bak'
--文件组备份
Exec Sp_Helpdb NorthwindCS --查看数据文件
Backup Database NorthwindCS
FileGroup='Primary' --数据文件的逻辑名
To disk='G:\Backup\NorthwindCS_FileGroup_20070908.bak'
With init
--分割备份到多个目标
--恢复的时候不允许丢失任何一个目标
Backup Database NorthwindCS
To disk='G:\Backup\NorthwindCS_Full_1.bak'
,disk='G:\Backup\NorthwindCS_Full_2.bak'
--镜像备份
--每个目标都是相同的
Backup Database NorthwindCS
To disk='G:\Backup\NorthwindCS_Mirror_1.bak'
Mirror
To disk='G:\Backup\NorthwindCS_Mirror_2.bak'
With Format --第一次做镜像备份的时候格式化目标
--镜像备份到本地和远程
Backup Database NorthwindCS
To 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_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:\Backup\NorthwindCS_Full_20070908.bak'
--查看目标备份的第一个备份集的信息
Restore FileListOnly
From Disk ='G:\Backup\NorthwindCS_Full_20070908_2.bak'
With File=1
--查看目标备份的卷标
Restore LabelOnly
From Disk ='G:\Backup\NorthwindCS_Full_20070908_2.bak'
--备份设置密码保护备份
Backup Database NorthwindCS
To disk='G:\Backup\NorthwindCS_Full_20070908.bak'
With Password = '123',init
Restore Database NorthwindCS
From disk='G:\Backup\NorthwindCS_Full_20070908.bak'
With Password = '123'
SQL backup&restore的更多相关文章
- SQL Service Database BACKUP & RESTORE
1. 完整恢复模式下的数据库备份 USE master; ALTER DATABASE AdventureWorks2012 SET RECOVERY FULL; GO -- Back up the ...
- SQL 2012 Restore HeaderOnly
--USE [master] GO /****** Object: StoredProcedure [dbo].[zsp_RestoreHeaderOnly] Script Date: 2014/1/ ...
- INFORMATICA 的部署实施之 BACKUP&RESTORE
当一套BI 解决方案成熟运行后,公司会快速扩大客户群,这时快速的将开发出来的SOLUTION 应用到全新的生产环境中就很重要了,下面谈谈我做这样项目(INFORMATICA BACKUP&RE ...
- SQL Server Backup & Restore
USE [master]; GO CREATE DATABASE test; GO CREATE DATABASE test2; GO BACKUP DATABASE test TO DISK = ' ...
- 转 RMAN: RAC Backup, Restore and Recovery using RMAN
PURPOSE The purpose of this document is to give a quick guide for using RMAN on RAC databases. We wi ...
- MySQL 5.7 Reference Manual :: 4.5.4 mysqldump & mysql — Database Backup & Restore Program
MySQL :: MySQL 5.7 Reference Manual :: 4.5.4 mysqldump — A Database Backup Programhttps://dev.mysql. ...
- sql server restore DB issue
error occurs when restoring the backup file of sql server(DB.bak) to run the above t-sql will shoot ...
- 驱动备份还原命令——驅動備份還原命令——Driver Backup/Restore
以管理員身份啓動命令提示符,輸入以下命令: 1.驅動備份(备份Backup)命令: Dism /online /export-driver /destionation:D:\DriverBackup ...
- MS SQL backup database的俩个参数
http://msdn.microsoft.com/zh-cn/library/ms186865.aspx 数据传输选项 BUFFERCOUNT = { buffercount | @bufferco ...
随机推荐
- http://jingyan.baidu.com/album/d8072ac47baf0eec95cefdca.html?picindex=4
http://jingyan.baidu.com/album/d8072ac47baf0eec95cefdca.html?picindex=4
- 递推DP URAL 1119 Metro
题目传送门 /* 题意:已知起点(1,1),终点(n,m):从一个点水平或垂直走到相邻的点距离+1,还有k个抄近道的对角线+sqrt (2.0): 递推DP:仿照JayYe,处理的很巧妙,学习:) 好 ...
- 计算几何 2013年山东省赛 A Rescue The Princess
题目传送门 /* 已知一向量为(x , y) 则将它旋转θ后的坐标为(x*cosθ- y * sinθ , y*cosθ + x * sinθ) 应用到本题,x变为(xb - xa), y变为(yb ...
- 如何在 .Net Framework 4.0 项目上使用 OData?
最新的 Microsoft ASP.NET Web API 2.1 OData 5.1.0 已只能在 .Net Framework 4.5 的安装了,如果要在 VS2010的 .Net Framewo ...
- python 代码片段9
#coding=utf-8 # 字符串指示符号 r表示raw u表示unicode mystring=u'this is unicode!--by' print mystring # 'raw'表示告 ...
- tiledmap2
1 1.1 将tiledmap 保存为xml格式 1.2 在unity当中设置摄像机为"Orthogonal", 1.3 拖拽tiledmap prefab从project视图到H ...
- extjs 远程数据源
1本地数据源组合框 Ext.onReady(function(){ //创建数据模型 Ext.regModel('PostInfo', { fields: [{name: 'province'}, { ...
- word统计章节字数
只有我这么无聊了..写论文的时候发现每次想看这个章节的字数统计时,还需要全选然后再看字数统计,太麻烦了.所以想着用宏写个能直接查看选定章节的字数统计. 具体方法如下: 建立宏:视图--宏--录制宏-- ...
- Html - 仿QQ空间右下角工具浮动块
仿QQ空间右下角工具浮动块 <style type="text/css"> .cy-tp-area>.cy-tp-fixbtn>.cy-tp-text { ...
- SharedPreferences封装类SPUtils
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.uti ...