asked on
ASKER
EXEC sp_attach_db @dbname = N'NEWDBNAME',
@filename1 = N'c:\data\dbfile.mdf',
CREATE DATABASE [NEWDBNAME] ON
(filename = N'c:\data\dbfile.mdf')
FOR ATTACH_REBUILD_LOG
ASKER
ASKER
Msg 5120, Level 16, State 101, Line 1
Unable to open the physical file "D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\hotline_log.ldf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".
File activation failure. The physical file name "D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\hotline_log.ldf" may be incorrect.
The log cannot be rebuilt because the database was not cleanly shut down.
Msg 1813, Level 16, State 2, Line 1
Could not open new database 'hotline052412'. CREATE DATABASE is aborted.
ASKER
ASKER
Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.
TRUSTED BY
Pehaps you should backup the orginal database as a .bak file using the backup routines, then doing a Restore from the bak file.
This should allow you to restore as a newly named DB and the MDF and LDF files should automatically be named as per the new DB name which should be unique, hence not giving a "Cannot attach a database with the same name as an existing database" error.