[英]Restore .bak file to remote database
I have a test.bak
file in my local machine. 我的本地计算机上有一个
test.bak
文件。 I need to restore this file to remote machine's database. 我需要将此文件还原到远程计算机的数据库。 How do I do that?
我怎么做?
When I try this, the remote database throws an error that it is not able to find test.bak
on the local filesystem. 当我尝试此操作时,远程数据库将引发错误,它无法在本地文件系统上找到
test.bak
。
Query 询问
RESTORE DATABASE TESTPROJECT
FROM DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.ICON3\MSSQL\Backup\test.bak'
Error 错误
Cannot open backup device 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.ICON3\MSSQL\Backup\test.bak'. Operating system error 2(The system cannot find the file specified.).
How can I achieve this? 我该如何实现? I am using Microsoft SQL Server 2008.
我正在使用Microsoft SQL Server 2008。
In the context of this answer - remote
refers to your machine, local
is the database server. 在此答案的上下文中-
remote
是指您的计算机, local
是数据库服务器。
Restore from local
filesystem 从
local
文件系统还原
Copy the backup file to the local
filesystem, and restore directly from this copy. 将备份文件复制到
local
文件系统,然后直接从该副本还原。
Prerequisites 先决条件
test.bak
to C:\\test.bak
on the server test.bak
复制到服务器上的C:\\test.bak
Syntax 句法
RESTORE DATABASE TESTPROJECT FROM DISK = N'C:\test.bak';
Restore from remote
filesystem 从
remote
文件系统还原
Alternatively you can restore from the remote
backup file using UNC syntax . 或者,您可以使用UNC语法从
remote
备份文件中还原。 I typically don't use this option, but it is useful if there won't be enough disk space on local
filesystem for both the backup file and the restored database. 我通常不使用此选项,但是如果
local
文件系统上没有足够的磁盘空间用于备份文件和已还原的数据库,则该选项很有用。
The success of this option depends on some variables - permissions on the remote
filesystem assigned to the database service account, network health, and others. 此选项是否成功取决于某些变量-分配给数据库服务帐户的
remote
文件系统的权限,网络运行状况等。
Prerequisites 先决条件
Remote
machine name is remotemachine
Remote
机器名称是remotemachine
remote
at 'C:\\test.bak'
'C:\\test.bak'
remote
位置 remote
administrator share C$
remote
管理员共享C$
Syntax 句法
RESTORE DATABASE TESTPROJECT FROM DISK = N'\\remotemachine\c$\test.bak';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.