How to fix a deleted SQL log file

Source: Internet
Author: User
Tags execution log microsoft sql server mssql query return
1, determine the SQL database installation path and the SQL database name used.
such as: e:\Program Files\Microsoft SQL Server\mssql\data\j200.mdf '
2, the database J200 renamed to other names, such as J2008, what names can.
3. Use the system you use to recreate a new "J200" database.
4, click Start-Program--microsoft SQL server--Query Analyzer--OK, into the software, in the blank directly enter the following command:
EXEC sp_detach_db @dbname = ' J200 '
Return
EXEC sp_attach_single_file_db @dbname = ' J200 ',
@physname = ' e:\Program Files\Microsoft SQL Server\mssql\data\j200.mdf '
The above command separates the J200 database from the log file.
5, after the input command, click menu Query-execution, the following dialog box appears command command has been successfully completed.
6, will just enter the command in the "EXEC sp_detach_db @dbname = ' J2002 ' return" Delete, retain the following command:
EXEC sp_attach_single_file_db @dbname = ' J200 ',
@physname = ' e:\Program Files\Microsoft SQL Server\mssql\data\j200.mdf '
7, into the installation of SQL database path will be J200 two files deleted, and then the "J2008" file renamed to "J200."
8, repeat the 5th procedure, click Menu Query-execution. The system will receive a command device activation error for the following dialog box. The physical filename ' D:\Program Files\Microsoft SQL Server\mssql\data\j200.ldf ' may be incorrect. Created named ' D:\Program Files\Microsoft SQL server\mssql\data\j200. LDF ' new log file.
9, exit can be.

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.