Invalid SQL Server error 9003:LSN (invalid log scan number), repair of the database

Source: Internet
Author: User
Tags microsoft sql server create database

Invalid SQL Server error 9003:LSN (invalid log scan number)

Today, I got a problem database file and log file from my friend, and when I use sql2000 and sql2005 to attach the database,

SQL Server error message: "The log scan number (2806:120:1) of the log scan operation passed to the database ' POS ' is invalid.

This error may indicate data corruption, or the log file (. ldf) does not match the data file (. mdf).

If this error occurs during replication, recreate the publication. Otherwise, if the problem causes an error during startup, restore from backup.

Unable to open new database ' POS '. CREATE DATABASE aborted. (Microsoft SQL Server, Error: 9003) "

A look at the 9003 error, it is possible because of the log file reasons, and then look at the database file may be corrupted, so think of the DBCC CHECKDB directives.

The method is as follows:

1. We use the default method to establish a database (such as POS) for recovery use. Can be built in sq Server Enterprise manager.

2. Deactivate the database server.

3. Delete the log file pos_log.ldf the database you just generated, overwriting the database data file you just generated with the database MDF file you want to recover pos_data.mdf.

4. Start the database server. You will see that the status of the database pos is "suspect." No action can be made on this database at this time.

5. Setting the database allows direct operating system tables. This allows you to select the database server in sq server Enterprise Manager, right-click, select Properties, and select the Allow direct modifications to system directory on the server Settings page. You can also use the following statement to implement it.

use   master
go
exec sp_configure   'allow updates',1
go
reconfigure   with   override
go  

6. Set up POS for Emergency Repair mode update sysdatabases set status=-32768 where dbid=DB_ID('pos')

You can see in SQL Server Enterprise Manager that the database is in "read only \ suspect \ offline \ Emergency mode" to see the tables inside the database, but only the system tables

7. The following performs a real recovery operation to rebuild the database log file

go

dbcc rebuild_log('pos','D:\Program Files\Microsoft SQL Server\MSSQL\Data\pos_log.ldf')

go

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.