Unfortunately today, the power is stopped when the computer is started in the morning and the password is entered. After a call in the afternoon, the SQL server cannot start. The following error occurs when viewing database logs:
Error: 9003, severity: 20, status: 1
The lsn (6:222:1) passed to log scan in database 'model' is invalid.
Error: 9003, severity: 20, status: 1
The lsn (6:222:1) is invalid. This lsn is passed to the log scan operation in the database 'model.
Check the online help. Reinstalling the database is irrelevant to the data on your own machine. Fortunately, everything on the server is normal. You only need to import data from the server. However, in order to save the trouble of Reinstallation, I searched the internet first. Try to fix the error, which is always better than reinstallation.
The search results are as follows:
The data file or log file is damaged.
1 ) Set the database to emergency mode.
Stop the SQL Server service;
Remove the data file xxx_data.mdf of the application database;
Re-create a database xxx with the same name;
Stop the SQL service;
Overwrite the original data file;
Run the following statement to set the database to emergency mode;
Run" Use Master
Go
Sp_configure ' Allow updates ' , 1
Reconfigure With Override
Go "
Execution result:
DBCC The execution is complete. If DBCC An error message is output. Contact the system administrator.
Configuration Options ' Allow updates ' Slave 0 Change 1 . Run Reconfigure Statement to install.
Then run" Update Sysdatabases Set Status = 32768 Where Name = ' Xxx ' "
Restart the SQL Server service;
Run the following statement to set the application database to single user mode;
Run "sp_dboption ' Xxx ' , ' Single User ' , ' True ' "
Execution result:
The command is successfully completed.
DBCC checkdb;
Run" DBCC Checkdb ( ' Xxx ' )"
Run the following statement to disable the system table modification option;
Run "sp_resetstatus" XXX"
Go
Sp_configure ' Allow updates ' , 0
Reconfigure With Override
Re-establish another database XXX. lost;
2 ) DTS export wizard
Run the DTs export wizard;
In this way, the XXX. Lost database can replace the original application database.
after reading the Article , I found that the solution was complicated. I checked the log and found that the problem lies in the model database. I think it is better for me to copy the model database in another database instance directly. Anyway, the model database is used as a template for all databases created on the system. The model database in the instance should be similar to the one to be restored. Later, we overwrite model. MDF in the instance database and restart the database service. It's okay. It's okay after a while. OK! The problem is solved.
experience: it seems that in the future, we cannot reload the system, so that we can improve ourselves.