表级备份 [英] Table-level backup

查看:111
本文介绍了表级备份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在MS SQL Server 2005/2008中进行表级备份(转储)?

How to take table-level backup (dump) in MS SQL Server 2005/2008?

推荐答案

您不能使用 BACKUP DATABASE 命令来备份单个表,当然,除非所涉及的表已分配给它自己的 FILEGROUP

You cannot use the BACKUP DATABASE command to backup a single table, unless of course the table in question is allocated to it's own FILEGROUP.

您可以按照建议执行的操作是将表数据导出到CSV文件。现在,为了获得表的定义,您可以编写 CREATE TABLE 脚本。

What you can do, as you have suggested is Export the table data to a CSV file. Now in order to get the definition of your table you can 'Script out' the CREATE TABLE script.

您可以在SQL Server Management Studio中执行此操作,方法如下:

You can do this within SQL Server Management Studio, by:


右键单击数据库>任务>生成脚本

right clicking Database > Tasks > Generate Script

然后可以选择要编写脚本的表,还可以选择包括任何关联的对象,例如约束和索引。

You can then select the table you wish to script out and also choose to include any associated objects, such as constraints and indexes.

为了获取 DATA 以及 schema ,您必须选择<设置脚本选项标签上的code>高级,然后在 GENERAL 部分中将数据类型设置为脚本选择模式和数据

in order to get the DATA along with just the schema, you've got to choose Advanced on the set scripting options tab, and in the GENERAL section set the Types of data to script select Schema and Data

希望这样做有帮助,但请直接与我联系如果您需要进一步的帮助。

Hope this helps but feel free to contact me directly if you require further assitance.

这篇关于表级备份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆