SQL Server MDF up-compatible additional database (unable to open database ' xxxxx ' version 611. Please upgrade the database to the latest version. )
Recently working with a sqlserver2005 version of MDF file, no log file is now required
Attached to the sqlserver2012, after a search online, the whole process is served, for your reference
Create a database First
Set the database compatibility again (this step can be omitted after the attempt)
Stop the SQL Server service, replace the MDF file that will need the attachment with the MDF that created the data, and delete the corresponding LDF file
Start the SQL Server service again
Execute the following script
Script one:
ALTER DATABASE hunlianjiaoyou SET EMERGENCY
ALTER DATABASE hunlianjiaoyou SET single_user
ALTER DATABASE hunlianjiaoyou REBUILD LOG on (name=hunlianjiaoyou_log, filename= ' C:\Program Files\Microsoft SQL Server\ MSSQL11. Mssqlserver\mssql\data\hunlianjiaoyou_log.ldf ')
There may be a warning "warning: the Log for database ' Hunlianjiaoyou ' has been regenerated. The consistency of the transaction has been lost. The RESTORE chain is broken and the server no longer has the context of the previous log files, so you need to know what they are. You should run DBCC CHECKDB to verify physical consistency. The database has been placed in dbo-only mode. When you are ready to make the database available, you need to reset the database options and remove any extra log files. ”
Re-start the database service
Then execute the following script
Script two:
ALTER DATABASE hunlianjiaoyou SET multi_user
ALTER DATABASE hunlianjiaoyou SET ONLINE
and restart the database service
Done!
Ps:
Execute script Two as soon as you try to execute the script in the process.
Throws an exception: unable to open database ' hunlianjiaoyou ' version 611. Please upgrade the database to the latest version.
Later found only need to finish the script one, restart the service, then execute the script two there is no problem, there will be no scripting compatibility issues
--DBCC CHECKDB (HUNLIANJIAOYOU1, Repair_allow_data_loss)
--Database is emergency mode execute the following statement ALTER DATABASE hunlianjiaoyou SET ONLINE, restore normal mode
"Upgrade to SQL 2012" SQL Server MDF up-compatible additional database (unable to open database ' xxxxx ' version 611.) Please upgrade the database to the latest version. )