Adjuntar archivos mdf sin ldf - sqlserver

Páginas: 2 (281 palabras) Publicado: 19 de julio de 2010
SQL SERVER – Attach mdf file without ldf file in Database

Technical Talk:
If the database is shutdown gracefully and there was no abrupt shutdown (power outrages,pulling plugs to machines, machine crashes or any other reasons), it is possible (there’s no guarantee) to attach .mdf file only to the server. Please note that there can bemany more reasons for a database that is not getting attached or restored. In my case, the database had a clean shutdown and there were no complex issues. I was able torecreate a transaction log file and attached the received .mdf file.
There are multiple ways of doing this. I am listing all of them here. Before using any of them, pleaseconsult the Domain Expert in your company or industry. Also, never attempt this on live/production server without the presence of a Disaster Recovery expert.
USE [master]
GO-- Method 1: I use this method
EXEC sp_attach_single_file_db @dbname='TestDb',@physname=N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\TestDb.mdf'
GO
-- Method 2:
CREATE DATABASE TestDb ON
(FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\TestDb.mdf')
FOR ATTACH_REBUILD_LOG
GOMethod 2: If one or more log files are missing, they are recreated again.
There is one more method which I am demonstrating here but I have not used myself before.According to Book Online, it will work only if there is one log file that is missing. If there are more than one log files involved, all of them are required to undergo the sameprocedure.
-- Method 3:
CREATE DATABASE TestDb ON
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\TestDb.mdf')
FOR ATTACH
GO
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Mdf. and Ldf. files
  • Archivo Adjunto
  • Enviar correo electrónico con o sin archivo adjunto
  • archivo adjunto
  • adjuntar archivo
  • Cómo puedo enviar un archivo adjunto de gran tamaño
  • como adjuntar archivos
  • Como adjuntar archivos

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS