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 ...
随机推荐
- Xamarin.Android编译CPU类型选择方式
Xamarin.Android编译CPU类型选择方式 在Xamarin.Android编译的时候,默认提供了5种CPU类型供大家选择.它们分别为armeabi.armeabi-v7a.arm64-v8 ...
- bug记录
1>-[DYMessageNewsTableView _contentOffsetForScrollingToRowAtIndexPath:atScrollPosition:]: row (37 ...
- LightOJ1360 Skyscraper(DP)
题目大概是,一个数轴上n个线段,每个线段都有起始坐标.长度和权值,问从中取出没有公共交点的线段的最大权和. 取k次是个经典的最小费用最大流问题,不过这题建容量网络有20W个点,离散化最多也要6W个点, ...
- VC创建预编译文件
Building a simple "hello world" Ogre application can take several seconds on a modern mach ...
- DevExpress DXperience 的ASPxFilterControl 不显示 Like 菜单的方法
当使用Linq 作为数据源时,如果使用 ASPxFilterControl 的 Like 菜单筛选数据,就会出现以下错误 LINQ to Entities does not recognize the ...
- ibatis 灵活的配置文件
<select id="selectAllMmsRepairBySth" parameterClass="hashmap" resultMap=" ...
- 打造离线使用的Mobile Web App
最近公司举办技术大赛,我和同事一起制作了一个叫做10K Hours的Mobile Web App,可以帮助你通过一万小时的努力,成为某个领域的专家.正好前段时间翻译了一本书<HTML5 Mobi ...
- python 根据对象和方法名,返回提供这个方法的定义的类
def find_defining_class(obj, method_name): for ty in type(obj).mro(): if method_name in ty.__dict__: ...
- 洛谷 P1541 乌龟棋 Label:O(n^4)的dp
题目背景 小明过生日的时候,爸爸送给他一副乌龟棋当作礼物. 题目描述 乌龟棋的棋盘是一行N个格子,每个格子上一个分数(非负整数).棋盘第1格是唯一的起点,第N格是终点,游戏要求玩家控制一个乌龟棋子从起 ...
- 【wikioi】1282 约瑟夫问题
题目链接:http://www.wikioi.com/problem/1282/ 算法:线段树(名次树) 说明在代码里有了,直接上代码. #include <cstdio> using n ...