sqlserver backup and restore -- partital restore
Like a tratitional database, sqlserver not only could resotre full database but also do restore one part of it.
There are two important base physical file in sqlserver: Primary group and others group. Any situation, we must restore primary group at
least.
Here is an example.
USE [master]
GO
ALTER DATABASE [AdventureWorksDW2014] SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE AdventureWorksDW2014 ADD FILEGROUP new_customers
ALTER DATABASE AdventureWorksDW2014 ADD FILEGROUP sales
GO
ALTER DATABASE AdventureWorksDW2014 ADD FILE
(NAME='mywind_data_1',FILENAME=N'D:\Program Files\Microsoft SQL Server\mssql2014\mw.dat1') TO FILEGROUP new_customers
ALTER DATABASE AdventureWorksDW2014 ADD FILE
(NAME='mywind_data_2',FILENAME=N'D:\Program Files\Microsoft SQL Server\mssql2014\mw.dat2') TO FILEGROUP sales
GO
BACKUP DATABASE [AdventureWorksDW2014] TO DISK = N'D:\Program Files\Microsoft SQL Server\mssql2014\AdventureWorksDW2014.bak' WITH NOFORMAT, NOINIT, NAME = N'AdventureWorksDW2014-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, COMPRESSION, STATS = 10
GO
-----> generate a database and create two extra file group
USE AdventureWorksDW2014
GO
CREATE TABLE t1 (id int) ON new_customers
CREATE TABLE t2 (id int) ON sales
GO
BACKUP LOG [AdventureWorksDW2014] TO DISK = N'D:\Program Files\Microsoft SQL Server\mssql2014\AdventureWorksDW2014.trn' WITH NOFORMAT, NOINIT, NAME = N'AdventureWorksDW2014-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, COMPRESSION, STATS = 10
---> create two tables and each table on separate file groups
-- new_customers is not online in new database (must primary group & logfile are include)
RESTORE DATABASE AdventureWorksDW2014_part
FILEGROUP = 'PRIMARY', FILEGROUP = 'sales'
FROM DISK = N'D:\Program Files\Microsoft SQL Server\mssql2014\AdventureWorksDW2014.bak'
WITH FILE=1,NORECOVERY,PARTIAL,
MOVE 'AdventureWorksDW2014_Data' TO N'D:\Program Files\Microsoft SQL Server\mssql2014\new\AdventureWorksDW2014_Data.mdf',
MOVE 'AdventureWorksDW2014_Log' TO N'D:\Program Files\Microsoft SQL Server\mssql2014\new\AdventureWorksDW2014_Log.ldf',
MOVE 'mywind_data_2' TO N'D:\Program Files\Microsoft SQL Server\mssql2014\new\mw2.dat2'
GO
RESTORE LOG AdventureWorksDW2014_part
FROM DISK = N'D:\Program Files\Microsoft SQL Server\mssql2014\AdventureWorksDW2014.trn' WITH FILE=1,RECOVERY
GO
---> we could not need restore all filegroups beside primary group. You see ? That is possible/
So, Please make your primary group at less size as your can..
sqlserver backup and restore -- partital restore的更多相关文章
- SQL Server Database Backup and Restore in C#
SQL Server Database Backup and Restore in C# Syed Noman Ali Shah, 7 Feb 201 ...
- how to backup and restore database of SQL Server
Back up 1,右键选中需要备份的数据库,Tasks-->Backup 2.General中,Destination,先remove掉之前的,然后再Add 需要注意的是,add的文件,必须要 ...
- SQL2005中使用backup、restore来备份和恢复数据库
在SQL2005数据库中利用SQL语句进行数据备份与还原: 备份backup:backup database 数据库名称 tO disk = 备份路径例:BACKUP DATABASE test TO ...
- How to restore and recover a database from an RMAN backup. (Doc ID 881395.1)
APPLIES TO: Oracle Database - Enterprise Edition - Version 10.1.0.2 to 11.2.0.2 [Release 10.1 to 11. ...
- Subversion Backup and Restore
Backup Specified Revision Backup specified revision (here is 20): $ cd /opt/svnRepo $ svnadmin dump ...
- DB restore point and datagurad
######## 12.5.1 Flashing Back a Physical Standby Database to a Specific Point-in-Time The following ...
- Checklist for an RMAN Restore (Doc ID 1554636.1)
Checklist for an RMAN Restore (Doc ID 1554636.1) APPLIES TO: Oracle Database - Enterprise Edition - ...
- O060、Restore Volume 操作
参考https://www.cnblogs.com/CloudMan6/p/5668872.html 前面我们学习了backup操作,现在我们来学习如何使用backup进行restore. r ...
- 闪回还原点(Flashback Restore Point)
Flashback Restore Point(闪回还原点) 闪回还原点分两种,一种是Normal Restore Points(正常还原点),另一种是Guaranteed Restore Point ...
随机推荐
- C++ 模板常见特性(函数模板、类模板)
背景 C++ 是很强大,有各种特性来提高代码的可重用性,有助于减少开发的代码量和工作量. C++ 提高代码的可重用性主要有两方面: 继承 模板 继承的特性我已在前面篇章写过了,本篇主要是说明「模板」的 ...
- 快速开发架构Spring Boot 从入门到精通 附源码
导读 篇幅较长,干货十足,阅读需花费点时间.珍惜原创,转载请注明出处,谢谢! Spring Boot基础 Spring Boot简介 Spring Boot是由Pivotal团队提供的全新框架,其设计 ...
- 【转】Algorithms -离散概率值(discrete)和重置、洗牌(shuffle)算法及代码
离散概率值(discrete) 和 重置\洗牌(shuffle) 算法 及 代码 本文地址: http://blog.csdn.net/caroline_wendy/article/details/1 ...
- 《C++Primer》第五版习题答案--第二章【学习笔记】
C++Primer第五版习题解答---第二章 ps:答案是个人在学习过程中书写,可能存在错漏之处,仅作参考. 作者:cosefy Date: 2020/1/9 第二章:变量和基本类型 练习2.1: 类 ...
- 数据量不足,MedicalNet 如何助力医疗影像 AI 突破瓶颈?
导读 |近日,云+社区技术沙龙“腾讯开源技术”圆满落幕.本次沙龙邀请了多位腾讯技术专家,深度揭秘了腾讯开源项目TencentOS tiny.TubeMQ.Kona JDK.TARS以及Medical ...
- NOIP提高组2018试题解析 Day1 T1 铺设道路 P5019
题目描述 春春是一名道路工程师,负责铺设一条长度为 nn 的道路. 铺设道路的主要工作是填平下陷的地表.整段道路可以看作是 nn 块首尾相连的区域,一开始,第 ii 块区域下陷的深度为 d_idi ...
- 第一篇:python中的判断语句和循环
python与C语言的代码格式区别: 需注意:1.python中语句结束没有分号 “;” 2.python中严格要求缩进,且在判断和循环等语句中把括号用冒号代替. 3.经常使用tab键进行缩进. 4. ...
- Dijkstra求解单源最短路径
Dijkstra(迪杰斯特拉)单源最短路径算法 Dijkstra思想 Dijkstra是一种求单源最短路径的算法. Dijkstra仅仅适用于非负权图,但是时间复杂度十分优秀. Dijkstra算法主 ...
- [uoj#34] [洛谷P3803] 多项式乘法(FFT)
新技能--FFT. 可在 \(O(nlogn)\) 时间内完成多项式在系数表达与点值表达之间的转换. 其中最关键的一点便为单位复数根,有神奇的折半性质. 多项式乘法(即为卷积)的常见形式: \[ C_ ...
- 「 深入浅出 」集合List
第一篇文章 「 深入浅出 」java集合Collection和Map 主要讲了对集合的整体介绍,本篇文章主要讲List相对于Collection新增的一些重要功能以及其重要子类ArrayList.Li ...