It is convenient to add out-of-the-box databases with additional functionality, but sometimes additional database failures occur. So, how do we resolve this issue?
There are two ways to solve this problem
"First Method"
First step: Locate the . mdf file to which you want to add the database, right -click and select Properties .
Second step: Click Security on the Properties page, select authenticated Users, click Edit
Step Three: Authenticated Users to select Full Control , click OK, click on the property interface to determine.
Fourth step: Similarly, right -click the database's . ldf file to open the property . Follow the steps above to set it up again.
Complete the above steps and then attach the database, then you can.
"Second Method"
First step: Open the database instance's installation directory and open the Data folder.
(For example, my instance directory address is: D:\Microsoft SQL server\mssql10.) Mssqlserver\mssql\data may also have installed the fashion in C drive
Step two: The database that will be attached . MDF files and . LDF file , cut or copied to the Data folder .
Complete the above steps to attach the database again. At this point, you can.
SQL Server 2008 attached database failed with error: 5120