导出SQL Server MDF和LDF数据库文件

时间:2022-07-01 00:02:36

How do I export a SQL Server 2000/2005 database to MDF/LDF files? I do not have access to detach the database nor do I have access to login to the database server to copy the files directly.

如何向MDF/LDF文件导出SQL Server 2000/2005数据库?我没有权限分离数据库,也没有权限登录数据库服务器直接复制文件。

2 个解决方案

#1


5  

Can you run commands against the database from a query window? Do you know of a network path accessible to both you and the SQL Server instance? If so then you can issue the following query (instead of trying to coax some backup through the UI):

可以从查询窗口对数据库运行命令吗?您知道您和SQL Server实例都可以访问的网络路径吗?如果是,那么您可以发出以下查询(而不是试图通过UI进行一些备份):

BACKUP DATABASE dbname TO DISK = '\\some_network_path_you\have_access_to\db.bak' 
  WITH COPY_ONLY, INIT;

COPY_ONLY is important so that you don't disrupt the production server's log chain.

COPY_ONLY非常重要,这样就不会破坏生产服务器的日志链。

Then you can copy that file and run RESTORE DATABASE wherever you like.

然后,您可以复制该文件,并运行恢复数据库,无论您喜欢。

You don't want to somehow get access to the MDF / LDF files. For one, in order to copy those, you need to shut down the source SQL Server and detach them. This can lead to many bad things, but most importantly downtime on the production server, and the risk that if something should go wrong, you now have ZERO copies of your database.

您不希望以某种方式访问MDF / LDF文件。首先,为了复制它们,需要关闭源SQL服务器并分离它们。这可能会导致很多糟糕的事情,但最重要的是生产服务器的停机时间,以及如果发生错误,现在数据库的副本为零的风险。

#2


0  

Then you request that your dba provide the data to you.

然后请求dba向您提供数据。

#1


5  

Can you run commands against the database from a query window? Do you know of a network path accessible to both you and the SQL Server instance? If so then you can issue the following query (instead of trying to coax some backup through the UI):

可以从查询窗口对数据库运行命令吗?您知道您和SQL Server实例都可以访问的网络路径吗?如果是,那么您可以发出以下查询(而不是试图通过UI进行一些备份):

BACKUP DATABASE dbname TO DISK = '\\some_network_path_you\have_access_to\db.bak' 
  WITH COPY_ONLY, INIT;

COPY_ONLY is important so that you don't disrupt the production server's log chain.

COPY_ONLY非常重要,这样就不会破坏生产服务器的日志链。

Then you can copy that file and run RESTORE DATABASE wherever you like.

然后,您可以复制该文件,并运行恢复数据库,无论您喜欢。

You don't want to somehow get access to the MDF / LDF files. For one, in order to copy those, you need to shut down the source SQL Server and detach them. This can lead to many bad things, but most importantly downtime on the production server, and the risk that if something should go wrong, you now have ZERO copies of your database.

您不希望以某种方式访问MDF / LDF文件。首先,为了复制它们,需要关闭源SQL服务器并分离它们。这可能会导致很多糟糕的事情,但最重要的是生产服务器的停机时间,以及如果发生错误,现在数据库的副本为零的风险。

#2


0  

Then you request that your dba provide the data to you.

然后请求dba向您提供数据。