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