首页 > 解决方案 > 如何将本地服务器上运行的数据库迁移到另一台机器上

问题描述

我在 SSMS 18 中构建了一个关系数据库,并用一些数据填充了它。我即将退回我新买的笔记本电脑,我的数据库当前正在运行,因此我想知道将数据库(表、数据、关系......)迁移到新电脑的本地服务器的最简单方法是什么。

我只是想确保在重置电脑之前,我已经备份了恢复数据库所需的所有文件,然后再返回它

标签: sqlsql-serverdatabasedatabase-backups

解决方案


使用内置备份工具备份数据库。这将创建整个数据库的备份。然后,您将备份创建的文件复制到目标计算机,并从备份程序创建的文件中恢复数据库。

1) Select the database you want to back up in SQL Server Management Studio on your left.
2) Right Click and select 'Tasks.'
3) Click on backup in the popup menu. 
4) Note where the backup files are going in the file system.
5) Run the backup
6) Copy the files from the backup to the target machine.
7) In the target machine start SQL Server Management Studio.
8) Select 'Databases.'
9) Right click and select Restore Databases/
10) Click on devices and select your physical backup files you copied in step 6.
11) Restore the database.

推荐阅读