如何从SQL Server 2005备份还原单个表?

时间:2022-03-01 10:06:41

I've got a backup made using the regular SQL Server 2005 backup command. Is there a way to restore just a single table, not the whole DB?

我使用常规的SQL Server 2005备份命令进行了备份。有没有办法只恢复一个表,而不是整个数据库?

4 个解决方案

#1


20  

Restore the whole database to another machine (or temporary database), then copy the table seems like the easiest to me.

将整个数据库还原到另一台机器(或临时数据库),然后复制表似乎对我来说最简单。

#2


7  

This is not natively supported in SSMS but it’s possible using third party tools.

这在SSMS中本身不受支持,但可以使用第三方工具。

Apart from Red Gate (great tools btw) you can try SQL Diff (restore object) and SQL Data Diff (restore data) from ApexSQL.

除了Red Gate(伟大的工具btw),你可以尝试从ApexSQL中获取SQL Diff(恢复对象)和SQL Data Diff(恢复数据)。

Disclaimer: I’m not affiliated with ApexSQL but we are their customers and use their tools

免责声明:我不隶属于ApexSQL,但我们是他们的客户并使用他们的工具

#3


5  

The unit of backup and recovery in SQL Server is the database (it is the outer boundary of referential integrity).

SQL Server中的备份和恢复单元是数据库(它是参照完整性的外部边界)。

Red Gate has some pretty good tools for row-level restore (SQL Data Compare and SQL Backup), but they come at a price.

Red Gate有一些非常好的行级还原工具(SQL数据比较和SQL备份),但它们需要付出代价。

#4


1  

Detach the current database then restore the database with the date of the tbl you need to a new location (make a sub folder) to put it in keep it separate from your production databases, then restore the database to that sub folder, when completed find the tbl you need and script it to a create script file save to a file, your done with the database delete it then reattached the original one, now scroll down to the tbl you want to restore and script it to a create file (this is a backup only) now delete the tbl, make sure your database is selected and the active one next load the the scripted file you just created with the other database in the query analyzer and run it, it should report successful now check to see if your tbl has been replaced. your done

分离当前数据库,然后使用所需的tbl日期将数据库还原到新位置(创建子文件夹)以将其与生产数据库分开,然后将数据库还原到该子文件夹,完成后查找你需要的tbl并将其编写为创建脚本文件保存到文件,完成数据库删除然后重新附加原始文件,现在向下滚动到要恢复的tbl并将其编写为创建文件(这是现在删除tbl,确保你的数据库被选中,然后活动的数据库加载你刚刚用查询分析器中的另一个数据库创建的脚本文件并运行它,它应该报告成功现在检查你是否tbl已被替换。你做完了

#1


20  

Restore the whole database to another machine (or temporary database), then copy the table seems like the easiest to me.

将整个数据库还原到另一台机器(或临时数据库),然后复制表似乎对我来说最简单。

#2


7  

This is not natively supported in SSMS but it’s possible using third party tools.

这在SSMS中本身不受支持,但可以使用第三方工具。

Apart from Red Gate (great tools btw) you can try SQL Diff (restore object) and SQL Data Diff (restore data) from ApexSQL.

除了Red Gate(伟大的工具btw),你可以尝试从ApexSQL中获取SQL Diff(恢复对象)和SQL Data Diff(恢复数据)。

Disclaimer: I’m not affiliated with ApexSQL but we are their customers and use their tools

免责声明:我不隶属于ApexSQL,但我们是他们的客户并使用他们的工具

#3


5  

The unit of backup and recovery in SQL Server is the database (it is the outer boundary of referential integrity).

SQL Server中的备份和恢复单元是数据库(它是参照完整性的外部边界)。

Red Gate has some pretty good tools for row-level restore (SQL Data Compare and SQL Backup), but they come at a price.

Red Gate有一些非常好的行级还原工具(SQL数据比较和SQL备份),但它们需要付出代价。

#4


1  

Detach the current database then restore the database with the date of the tbl you need to a new location (make a sub folder) to put it in keep it separate from your production databases, then restore the database to that sub folder, when completed find the tbl you need and script it to a create script file save to a file, your done with the database delete it then reattached the original one, now scroll down to the tbl you want to restore and script it to a create file (this is a backup only) now delete the tbl, make sure your database is selected and the active one next load the the scripted file you just created with the other database in the query analyzer and run it, it should report successful now check to see if your tbl has been replaced. your done

分离当前数据库,然后使用所需的tbl日期将数据库还原到新位置(创建子文件夹)以将其与生产数据库分开,然后将数据库还原到该子文件夹,完成后查找你需要的tbl并将其编写为创建脚本文件保存到文件,完成数据库删除然后重新附加原始文件,现在向下滚动到要恢复的tbl并将其编写为创建文件(这是现在删除tbl,确保你的数据库被选中,然后活动的数据库加载你刚刚用查询分析器中的另一个数据库创建的脚本文件并运行它,它应该报告成功现在检查你是否tbl已被替换。你做完了