I have a copy of the mdf and log files of a database. The database is a MSSQL 2012 database. To use it, I did the following steps (a bit by chance actually, because I was trying to copy a mdf and log file out of the data directory first, and it wouldn't let me while the server was using them):
- I stopped the MSSQL server process in Windows
- Copied them into the
DATA
directory. - Then I started the MSSQL servcer process again.
In SQL server management studio, the new database appeared. I thought I might have needed to attach it.
Does MSSQL server automatically attach all mdf's in the data directory? I'm worried it is not working as it should, even though it looks like it.
because I was trying to copy a mdf and log file out of the data directory first
-> why? These are not spreadsheet files and this is not how you move them around. See blogs.sentryone.com/aaronbertrand/bad-habits-file-backups