How SQL Server 2008 Imports MDF,LDF files

Source: Internet
Author: User
Tags mssql

How SQL Server 2008 Imports MDF,LDF filesOnline find a lot of solution SQL Server import other computer copy the MDF file, most of it is not complete, the solution is not the same as the problem, the bottom is to find the most comprehensive method to solve the problem!
Import the MDF, LDF file into the SQL Server 2008 database, which provides two ways: The first type:(1) Select right-click Database
(2) then click "Attach". The following interface appears. Then choose Add, plus the MDF file you want to add.
The second method is to create a new query, and then enter the following statements.
          EXEC     sp_attach_db     @dbname     =     ' YourDatabaseName ',                            @filename1     =     ' x:\ path \mssql\data\ Pubs.mdf ',                            @filename2     =     ' x:\ path \mssql\data.ldf
The second method may prompt a problem near the SQL language (I don't know what the problem is??). )
This error can occur on both of the above: (if the two processes are successful, congratulations!) SQLSERVER2008 error message when attaching a database error 5 (Access denied) error 5120 resolution SQL Server2008 When attaching a database file:


Perhaps everyone has encountered this problem, the solution is as follows: Scenario One: Toggle logon mode This occurs because of a "Mixed Authentication" (SQL Server Authentication) logon to the database, as long as the logon mode is changed to "Windows Authentication Mode"          Log in to solve the problem, after the addition of the success of the "Mixed authentication Mode" Landing there is no problem. Scenario Two: Modify the service Select All Programs-sql Server 2005-Configuration Tools-Select SQL Server Configuration Manager or SQL Server Config Manager to open the S QL server Configuration Manager config interface, select SQL Server 2008 service on the left, and right-click on the right side of the SQLEXPRESS to open the properties of SQL Server, and set the network service in the built-in account--" Network Service"Change to Local system--" Local System", click" Restart "and then attach the database is OK. (If you are concerned about changing the settings after a successful additional database, you can change the "Local System" in the built-in account back to "Network Service" and the database can still be opened.) The main configuration process is as follows: 1. Open the SQL Server Configuration Manager Config interface: 2. Select the SQL Server (MSSQLSERVER) option, and right-click:

5. Configuration success: This will not be an error when attaching the database after configuration. If the above method still has problems!
The following method is used to resolve: (1) The possible MDF file property is read-only property, you can only modify
Also need to be in the MDF file properties--security (to all users, the three users below me select "Edit", the color pen out of the place full control that tick)



I was using the modifiedSQL Server Configuration manager inside the SQL Server (SQLEXPRESS) property, and then replace the local user to modify the MDF file's read-only properties and "Full Control" to succeed, and finally wish you a successful operation!
(Note: Some of the contents refer to http://www.2cto.com/database/201308/235344.html)

How SQL Server 2008 Imports MDF,LDF files

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.