I have a running database that I cannot take offline. I also have an mdf-file copy of that same database (snapshot of a HDD backup taken at earlier time), but no ldf file.
I need to attach this database MDF file under a new name on the same server.
So I need to attach the DB without the log file and rebuild the log file at a new location (b/c the current log file location is obviously in use).
How do I do that? I tried this, but didn't work:
CREATE DATABASE [dbname] ON (FILENAME = N'E:\db_copy.mdf' ), --this file DOES exist (FILENAME = N'E:\log_copy.ldf' ) --this file DOES NOT exist FOR ATTACH_REBUILD_LOG