Restore Database
-
If a database is dettached and its log file (.ldf) has been deleted, I am trying to attach this database again , but i am facing some problems. Do someone have a solution for me ?
-
If a database is dettached and its log file (.ldf) has been deleted, I am trying to attach this database again , but i am facing some problems. Do someone have a solution for me ?
The command is sp_attach_db. Example:
EXEC sp_attach_db @dbname = N'pubs', @filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf', @filename2 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs_log.ldf'
I prefer using a backup/restore approach. -
The command is sp_attach_db. Example:
EXEC sp_attach_db @dbname = N'pubs', @filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf', @filename2 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs_log.ldf'
I prefer using a backup/restore approach.