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 ...
随机推荐
- schedule of 2016-11-7~2016-11-10(Monday~Thursday)——1st semester of 2nd Grade
most important things to do 1.joint phd preparations 2.journal paper to write 3.solid fundamental kn ...
- Flask 作者 Armin Ronacher:我不觉得有异步压力
英文 | I'm not feeling the async pressure[1] 原作 | Armin Ronacher,2020.01.01 译者 | 豌豆花下猫@Python猫 声明 :本翻译 ...
- 揭发233的docker/machine
继手动滑稽之golang-vmware-driver广告篇,今天把vmware-driver完成 然而我却要发一篇牢骚,这是对docker公信力的挑战!!! 本来很简单的升级到vmware 15.x的 ...
- CS0656 缺少编译器要求的成员“Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create”
问题出现原因:在net core使用动态类型dynamic,在编译的时候提示错误信息如上. 解决方案: 1.不用dynamic类型 2.在使用的地方添加一个dll,Microsoft.CSharp,或 ...
- Flask快速实现简单python接口
Flask 是一个轻量级 web 框架,自由.灵活.可扩展性强.Flask 本身相当于一个内核,大部分功能都需要扩展第三方库. Flask 框架有多“轻量”呢,之前写过一篇 Django实现restf ...
- Spring Boot2 系列教程 (十三) | 整合 MyBatis (XML 版)
前言 如题,今天介绍 SpringBoot 与 Mybatis 的整合以及 Mybatis 的使用,之前介绍过了 SpringBoot 整合MyBatis 注解版的使用,上一篇介绍过 MyBatis ...
- kubernetes concepts (一)
Concepts The Concepts section helps you learn about the parts of the Kubernetes system and the abstr ...
- B-Tree 和 B+Tree 结构及应用,InnoDB 引擎, MyISAM 引擎
1.什么是B-Tree 和 B+Tree,他们是做什么用的? B-Tree是为了磁盘或其它存储设备而设计的一种多叉平衡查找树,B-Tree 和 B+Tree 广泛应用于文件存储系统以及数据库系统中. ...
- 从源码上理解Netty并发工具-Promise
前提 最近一直在看Netty相关的内容,也在编写一个轻量级的RPC框架来练手,途中发现了Netty的源码有很多亮点,某些实现甚至可以用苛刻来形容.另外,Netty提供的工具类也是相当优秀,可以开箱即用 ...
- WeihanLi.Npoi 根据模板导出Excel
WeihanLi.Npoi 根据模板导出Excel Intro 原来的导出方式比较适用于比较简单的导出,每一条数据在一行,数据列虽然自定义程度比较高,如果要一条数据对应多行就做不到了,于是就想支持根据 ...