简体   繁体   English

在SQL Server 2008中备份

[英]Backup in Sql server 2008

我有一个包含1000万条记录的表。其中有一个名为YEAR的列,通过它可以跟踪记录的年份。是否可以像2010年那样仅备份2年的Backup(.bak) &仅2011年。

If your table is partitioned via the date column, and you have allocated individual filegroups for each Year per partition, then you can use a partial backup . 如果您的表是通过date列进行分区的,并且您已为每个分区的Year分配了单独的filegroups ,则可以使用部分备份 Otherwise, SQL Server doesn't have this capability. 否则,SQL Server不具备此功能。

If Partitioning is an option, here is a great White Paper about Partitioned Table and Index concepts. 如果可以选择“分区”,那么这是有关分区表和索引概念的白皮书 Also, check out the MSDN article about Creating Partitioned Tables and Indexes . 另外,请查看有关创建分区表和索引的MSDN文章。

Some options would be: 一些选择是:

  • bcp the data out bcp数据输出
  • Insert the data into a new table, in a new database and then backup the new DB. 将数据插入新表,新数据库中,然后备份新数据库。
create table table2(column1 varchar(50),column2 date)

insert into table2(column1,column2)
select column1,column2 from table1
where table1.column2='2010' or table1.column2='2011'

----------

now take the backup of this table 现在备份该表

I don't believe this is possible. 我不认为这是可能的。 A backup will backup the full database, with all objects and data. 备份将备份整个数据库以及所有对象和数据。

One option would be to create a new database, with 1 table, and write a script to INSERT into this. 一种选择是创建一个带有1个表的新数据库,然后向其中插入INSERT脚本。 Then backup this new database. 然后备份该新数据库。

INSERT INTO [NewDB].dbo.tbl (Value1, Value2, Year)
SELECT Value1, Value2, Year
FROM [OldDB].dbo.tbl
WHERE Year IN (2010, 2011)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM