Home  >  Article  >  php教程  >  Sql server数据库备份还原另一方法

Sql server数据库备份还原另一方法

WBOY
WBOYOriginal
2016-06-13 10:04:37936browse

直接拷贝数据文件把数据库的数据文件(*.mdf)和日志文件(*.ldf)都拷贝到目的服务器,在SQL Server Query Analyzer中用语句进行恢复: EXEC sp_attach_db @dbname = 'test', @filename1 = 'd:mssql7data est_data.mdf', @filename2 = 'd:mssql7data est_log.ldf' 这样就把test数据库附加到SQL Server中,可以照常使用。如果不想用原来的日志文件,可以用如下的命令: EXEC sp_detach_db @dbname = 'test' EXEC sp_attach_single_file_db @dbname = 'test', @physname = 'd:mssql7data est_data.mdf' 这个语句的作用是仅仅加载数据文件,日志文件可以由SQL Server数据库自动添加,但是原来的日志文件中记录的数据就丢失了。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn