How SQL Server 2008 Imports MDF,LDF files

Source: Internet
Author: User
Tags microsoft sql server mssql mssqlserver

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 on the database (2) and 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 Add a database file when you get a bug: such as: You may have encountered this problem, the solution is as follows : Scenario One: Switch login mode This occurs because of the "Mixed authentication Mode" (SQL Server Authentication) log on to the database, as long as the login to the "Windows authentication method" Login To resolve the problem, the additional success after the Exchange          Login with "Mixed authentication Mode" 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 SQL Server (MSSQLSERVER), options, and right-click: 5. Configuration succeeded: This will not make an error attaching the database after the configuration. If the above method still has problems! Then use the following method to solve: (1) The possible MDF file property is read-only property, then only need to modify can also be in the MDF file properties--security (to all users that I lower three users choose "Edit", the color pen out of the place full control that tick) I was using the modified SQ L Server Configuration manager inside the SQL Server (SQLEXPRESS) property, and then replace the local user to modify the read-only properties of the MDF file and "Full Control" to succeed the last thing you want to say is that the best place to store your log files is in c:\p Rogram Files\Microsoft SQL Server\mssql10. Mssqlserver\mssql\data, even if placed in other places, it is best not to appear Chinese space, etc.

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.