I have the following:
DB1 - Live DB QMLive.mdf / OMLive.ldf - Currently Running
DB2 - QMLive.mdf / OMLive.ldf (3 Days Prior from a Backup)
I need to Attach DB 2 as MonthEnd.mdf / MonthEnd.ldf as I do not have a .bak file (had issues with SQL Network Auth on a NAS)
When I rename DB2 Files and try to attach it, I get an error that I can't mount it... I guess the DB2 has the same Name as DB1 stored in a Table or something.
CodePudding user response:
In the following example I created a MyDB (MyDB.mdf MyDB_log.ldf) Database. Then I made a copy of these files: MyDB-2.mdf MyDB-2_log.ldf
I then attached the "-2" files as "MyDB-2" database to SQL Server using this procedure:
- Right click on "Database" and select "Attach..."
- Add the "MyDB-2.mdf" using the "Add..." button
- Manually edit the highlighed sections adding "-2" to "Attach as" and "Current File Path"
This way both databases are attached: