How SQL Server 2008 Imports MDF,LDF filesOn the internet to find a lot of solution SQL Server import other computer copy of the MDF file, most of it is not complete. Encountered the solution is not the same as the problem, the bottom is found to solve the problem of the most comprehensive method!
The MDF. LDF file into a SQL Server 2008 database, there are two ways to do this: the First:(1) Select right-click the database
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvegxnzw4xntczodc=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">
(2) then click "Attach".
The following interface appears. Then choose Join. Add the MDF file you want to add.
Another way is to create a new query, and then enter the following statement,
EXEC sp_attach_db @dbname = ' YourDatabaseName ', @filename1 = ' x:\ path \mssql\data\ Pubs.mdf ', @filename2 = ' x:\ path \mssql\data.ldf
Another method may prompt a problem near the SQL language (I don't know what the problem is??). )
The above two types of errors may occur: (assuming that both processes are successful, congratulations!) SQLSERVER2008 error message when you attach a database error 5 (Deny access) error 5120 for a workaround for Sql Server2008 to attach a database file when you pop up a bug: for example:
Perhaps everyone has encountered such a problem, the solution is as follows: Scenario One: Switch login mode occurs because of the "Mixed authentication Mode" (SQL Server Authentication) logon database, only to change the logon mode to "Windows Authentication Mode" Log on to resolve the issue. After the addition of the success of the "Mixed authentication Mode" Landing there is no problem.
Scenario Two: Change service Select All Programs-sql Server 2005-Configuration Tools-Select SQL Server Configuration Manager or SQL Server Config Manager. Open the SQL Server Configuration Manager config interface. On the left side, select SQL Server 2008 services, right-click on the "SQL Server (SQLEXPRESS)" property, and change the network SERVICE--"net services"to the local system in the built-in account-" Local System". Click "Start Again" and then attach the database is OK. (After the attached database is successful, assume that you worry about changing the settings after the use of the "Local System" in the built-in account can be changed back to "Network Service", the database can still be opened. Main configuration steps For example with: 1. Open the SQL Server Configuration Manager Config interface: 2. Select SQL Server (MSSQLSERVER), options. And Right-click:
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvegxnzw4xntczodc=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">
5. Configuration success: This will not be an error when attaching the database after configuration.
Suppose the above method still fails!
The following method is used to resolve: (1) The possible MDF file property is a read only property. You just need to change it to
Also need to be in the MDF file properties---Security (select "Edit" for all users and three users below me.) Put the color pen out of the place completely control that tick)
I was using the properties of SQL Server (SQLEXPRESS) that changed inside SQL Server Configuration Manager. Then change the local user to change the MDF file only read-only properties and "Full Control" was successful. Finally, I wish you success in operation!
(Note: Part of the content of the http://www.2cto.com/database/201308/235344.html)
Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.
How SQL Server 2008 Imports MDF,LDF files