Article ID: 822852 - Last Review: May 12, 2007 - Revision: 2.5 An instance of SQL Server may not start successfully after you restore the model database by using the WITH NORECOVERY optionSYMPTOMSWhen you try to start an instance of SQL Server after you
restore the model system database by using the WITH NORECOVERY option, the instance
of SQL Server may not start successfully. Additionally, you may notice the
following error messages in the SQL Server error log files: 2003-04-18 09:37:38.85 spid5 Starting up database 'model'. 2003-04-18 09:37:39.24 spid5 Bypassing recovery for database 'model' because it is marked IN LOAD. 2003-04-18 09:37:39.65 spid5 Database 'model' cannot be opened. It is in the middle of a restore. CAUSEWhen you restore the model system database by using the WITH NORECOVERY option, the restore
leaves the model database in an unrecovered state. Therefore, the model database can no longer be used as expected. RESOLUTIONTo resolve this problem, clear the "Loading" status of the model database in the instance of SQL Server. To do this, follow these
steps:
MORE INFORMATIONFor an instance of SQL Server to start successfully, the
three system databases must be restored successfully. The three system
databases are the master database, the model database, and the tempdb database. The model database is used as a template to create the tempdb system database. If the model database is not recovered successfully, SQL Server cannot create
the tempdb database, and the instance of SQL Server does not start
successfully. When you restore a SQL Server database by using the WITH NORECOVERY option, the database remains in a non-operational state even after the restore operation is completed. SQL Server leaves the database in a non-operational state after a restore operation is completed so that additional transaction log backups can be restored. In such a scenario, the database is marked "Loading" after the restore operation is completed. Unless the "Loading" status is cleared, the SQL Server database cannot be used. For a user database in an instance of SQL Server, you can clear the "Loading" status by running the following Transact-SQL statement in SQL Query Analyzer: However, if the model system database has a "Loading" status, the instance of SQL Server will not start as expected, and you cannot run the specified Transact-SQL statement to clear the "Loading" status. To prevent this problem, we recommend that you restore the model database by using the WITH RECOVERY option. If you do this, the model database will be operational after the restore operation is completed. By default, the RESTORE command uses the WITH RECOVERY option in SQL Server. The RESTORE command in SQL Server does not leave the database non-operational in a "Loading" status unless you explicitly specify this. However, there are some third-party restore solutions that use the WITH NORECOVERY option by default. Use of the WITH NORECOVERY option leaves the database non-operational. Therefore, if you use a third-party restore solution and you decide to restore the model database, make sure that you restore the model database by using the WITH RECOVERY option. Note that after the model database is restored by using the WITH NORECOVERY option, the instance of SQL Server continues to run without any problem. However, when you restart the instance of SQL Server, the problem that is mentioned in the "Symptoms" section occurs. Therefore, we suggest that you check the SQL Server error log files every time that a database is restored. Although the SQL Server error log files do not specify the recovery option that is being used during a restore operation, the information can help you confirm that the model database was restored successfully. After a successful restore operation, you may notice a message that is similar to the following in the SQL Server error log files: 2003-06-18 06:51:15.42 backup Database restored: Database: model, creation date(time): 2003/01/09(11:16:43), first LSN: 5:161:1, last LSN: 5:165:1, number of dump devices: 1, device information: (FILE=1, TYPE=DISK: {'c:\model.bak'}). REFERENCESFor more information about the restore operation in SQL
Server, see the following topic in SQL Server Books Online: http://msdn2.microsoft.com/en-us/library/aa238405(SQL.80).aspx (http://msdn2.microsoft.com/en-us/library/aa238405(SQL.80).aspx)
| Article Translations
|
Back to the top
