如何将数据库从一台计算机复制到另一台计算机?

时间:2022-09-24 18:52:38

I have a database in SQL Server 2008, which I want to copy to another computer.

我在SQL Server 2008中有一个数据库,我想将它复制到另一台计算机。

How do I make such a copy?

我该如何制作这样的副本?

Once this is done, what should I do at the other computer to build the database once again from my copy?

完成这一步后,我应该在另一台计算机上做什么来再次从我的副本构建数据库呢?

5 个解决方案

#1


13  

Simple Answer: Back it up, then restore it on the other computer.

简单的回答:备份,然后在另一台电脑上恢复。

Have a look here: http://technet.microsoft.com/en-us/library/cc966495.aspx

看看这里:http://technet.microsoft.com/en-us/library/cc966495.aspx

There's a lot of stuff there, but essentially, right click on the database, Tasks > Backup. Fill in the options to perform a full backup to somewhere.

这里有很多东西,但本质上,右键单击数据库,任务>备份。填写选项以执行到某处的完整备份。

Once it has created the backup (one big file, by convention with a BAK extension), on the second computer, right click the Databases folder, Restore Database and follow the prompts.

一旦它创建了备份(一个大文件,按惯例有一个BAK扩展名),在第二台计算机上,右键单击Database文件夹,还原数据库并按照提示进行操作。

You can do it as well in SQL if you wish:

如果你愿意,你也可以在SQL中这样做:

There might be times when it's better to detach and move, but this approach always feels a bit safer!

有时最好是分离和移动,但是这种方法总是感觉更安全一些!

This will copy both structure and the data in the database.

这将复制数据库中的结构和数据。

#2


20  

Using SQL Server Management Studio, here are the steps:

使用SQL Server Management Studio,以下是以下步骤:

1.Right-click the database and select Tasks | Backup

1。右键单击数据库并选择任务|备份。

如何将数据库从一台计算机复制到另一台计算机?

2.Make sure that the Backup type is Full

2。确保备份类型已满。

3.Click Add and specify the location and backup name

3所示。单击Add,并指定位置和备份名称。

如何将数据库从一台计算机复制到另一台计算机?

4.Copy the created backup file to another computer

4所示。将创建的备份文件复制到另一台计算机

5.In SQL Server Management Studio on another computer, right-click the SQL Server instance and select Restore Database

5。在另一台计算机上的SQL Server Management Studio中,右键单击SQL Server实例并选择Restore Database

如何将数据库从一台计算机复制到另一台计算机?

6.Select Device and click the elipsis button to navigate to the copied backup file

6。选择Device并单击elipsis按钮,以导航到复制的备份文件

如何将数据库从一台计算机复制到另一台计算机?

#3


1  

Use TSQL backup and restore. This should help http://www.sqlmag.com/article/tsql3/use-t-sql-to-back-up-and-restore-sql-server-user-databases

使用TSQL备份和恢复。这应该有助于http://www.sqlmag.com/article/tsql3/use-t-sql-to-back-up-and-restore-sql-server-user-databases

#4


0  

One of the easiest ways to do this is back up and restore.

最简单的方法之一是备份和恢复。

http://msdn.microsoft.com/en-us/library/ms187048.aspx

http://msdn.microsoft.com/en-us/library/ms187048.aspx

Another option you have is detaching your database from SQL Server, copying the MDF and LDF files to the target machine, and re-attaching there. Note, if you want to keep a copy of the database on the original server, you will also need to attach there too.

另一个选项是将数据库从SQL Server中分离出来,将MDF和LDF文件复制到目标计算机中,并在那里重新附加。注意,如果希望在原始服务器上保留数据库的副本,还需要在那里附加。

http://msdn.microsoft.com/en-us/library/ms190794.aspx

http://msdn.microsoft.com/en-us/library/ms190794.aspx

#5


0  

You can dump the content of your database and restore it on another machine. The same mechanism can be used also for backup purposes. Check the backup&restore functionality of MS SQL.

您可以转储数据库的内容,并将其恢复到另一台机器上。同样的机制也可以用于备份目的。检查MS SQL的备份和恢复功能。

#1


13  

Simple Answer: Back it up, then restore it on the other computer.

简单的回答:备份,然后在另一台电脑上恢复。

Have a look here: http://technet.microsoft.com/en-us/library/cc966495.aspx

看看这里:http://technet.microsoft.com/en-us/library/cc966495.aspx

There's a lot of stuff there, but essentially, right click on the database, Tasks > Backup. Fill in the options to perform a full backup to somewhere.

这里有很多东西,但本质上,右键单击数据库,任务>备份。填写选项以执行到某处的完整备份。

Once it has created the backup (one big file, by convention with a BAK extension), on the second computer, right click the Databases folder, Restore Database and follow the prompts.

一旦它创建了备份(一个大文件,按惯例有一个BAK扩展名),在第二台计算机上,右键单击Database文件夹,还原数据库并按照提示进行操作。

You can do it as well in SQL if you wish:

如果你愿意,你也可以在SQL中这样做:

There might be times when it's better to detach and move, but this approach always feels a bit safer!

有时最好是分离和移动,但是这种方法总是感觉更安全一些!

This will copy both structure and the data in the database.

这将复制数据库中的结构和数据。

#2


20  

Using SQL Server Management Studio, here are the steps:

使用SQL Server Management Studio,以下是以下步骤:

1.Right-click the database and select Tasks | Backup

1。右键单击数据库并选择任务|备份。

如何将数据库从一台计算机复制到另一台计算机?

2.Make sure that the Backup type is Full

2。确保备份类型已满。

3.Click Add and specify the location and backup name

3所示。单击Add,并指定位置和备份名称。

如何将数据库从一台计算机复制到另一台计算机?

4.Copy the created backup file to another computer

4所示。将创建的备份文件复制到另一台计算机

5.In SQL Server Management Studio on another computer, right-click the SQL Server instance and select Restore Database

5。在另一台计算机上的SQL Server Management Studio中,右键单击SQL Server实例并选择Restore Database

如何将数据库从一台计算机复制到另一台计算机?

6.Select Device and click the elipsis button to navigate to the copied backup file

6。选择Device并单击elipsis按钮,以导航到复制的备份文件

如何将数据库从一台计算机复制到另一台计算机?

#3


1  

Use TSQL backup and restore. This should help http://www.sqlmag.com/article/tsql3/use-t-sql-to-back-up-and-restore-sql-server-user-databases

使用TSQL备份和恢复。这应该有助于http://www.sqlmag.com/article/tsql3/use-t-sql-to-back-up-and-restore-sql-server-user-databases

#4


0  

One of the easiest ways to do this is back up and restore.

最简单的方法之一是备份和恢复。

http://msdn.microsoft.com/en-us/library/ms187048.aspx

http://msdn.microsoft.com/en-us/library/ms187048.aspx

Another option you have is detaching your database from SQL Server, copying the MDF and LDF files to the target machine, and re-attaching there. Note, if you want to keep a copy of the database on the original server, you will also need to attach there too.

另一个选项是将数据库从SQL Server中分离出来,将MDF和LDF文件复制到目标计算机中,并在那里重新附加。注意,如果希望在原始服务器上保留数据库的副本,还需要在那里附加。

http://msdn.microsoft.com/en-us/library/ms190794.aspx

http://msdn.microsoft.com/en-us/library/ms190794.aspx

#5


0  

You can dump the content of your database and restore it on another machine. The same mechanism can be used also for backup purposes. Check the backup&restore functionality of MS SQL.

您可以转储数据库的内容,并将其恢复到另一台机器上。同样的机制也可以用于备份目的。检查MS SQL的备份和恢复功能。