---
title: "model db in RESTORING state,can't start SQL Server"  
description: "model db in RESTORING state,can't start SQL Server"  
author: "Anonymous User"  
published: 2015-09-23  
updated: 2015-09-23  
canonical: https://www.mindstick.com/forum/33467/model-db-in-restoring-state-can-t-start-sql-server  
category: "mssql server"  
tags: ["database", "mssql server"]  
reading_time: 3 minutes  

---

# model db in RESTORING state,can't start SQL Server

[problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) started when sysadmin received error that [model](https://yourviews.mindstick.com/view/81334/america-is-reopening-after-corona-lockdown-but-on-swedish-model) is recovering.\
Sometime later [vendor](https://yourviews.mindstick.com/view/10392/how-is-the-vendor-lifecycle-impacting-the-energy-sector-in-north-america) tried to do some upgrades to the [database](https://www.mindstick.com/articles/12226/use-of-database-in-sencha-extjs-and-insert-record-from-user-form-using-ajax). When they restarted [SQL Server](https://www.mindstick.com/articles/12999/what-is-table-valued-function-in-sql-server) it [failed](https://www.mindstick.com/forum/160484/error-failed-to-launch-debug-adapter-additional-information-may-be-available-in-the-output-window) to start.\
Looking at [error log](https://www.mindstick.com/interview/34179/how-to-to-create-async-error-log-monitor-in-c-sharp-using-file-system). I found the following error\

```
Error The database 'model' is marked RESTORING and is in a state that does not allow recovery to be run. Error: 927, Severity: 14, State: 2. Database 'model' cannot be opened. It is in the middle of a restore. Could not create tempdb. You may not have enough disk space available. Free additional disk space by deleting other files on the tempdb drive and then restart SQL Server. Check for additional errors in the event log that may indicate why the tempdb files could not be initialized.
```

## Replies

### Reply by Anonymous User

After trying large number of alternative steps was able to fix the problem and get the database started.\
Here are the steps I took:\
On another [SQL](https://www.mindstick.com/articles/13115/types-of-keys-in-sql-or-oracle-database) [Server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over) 2008 R2, I moved my model and temp db files to same location as on my problem server. Refer to this http://technet.microsoft.com/en-us/library/ms345408.aspx\
Replaced model and tempdb .mdf and .ldf files on my problem server. Old files I saved in another directory just incase.\
Tried to start the SQL Server services, verified [error](https://yourviews.mindstick.com/view/88527/fixing-quickbooks-error-4120-reinstalling-vs-repairing) message\
The database 'model' is marked RESTORING and is in a state that does not allow recovery to be run. Error: 927, Severity: 14, State: 2. Database 'model' cannot be opened. It is in the middle of a restore. Could not create tempdb. You may not have enough disk space available. Free additional disk space by deleting other files on the tempdb drive and then restart SQL Server. Check for additional errors in the event log that may indicate why the tempdb files could not be initialized.After that I opened two separate Command Prompt windows.\
Below to make it easier I call first command prompt windows CPA, and second one CPB.\
in CPA run Sqlservr.exe -sInstanceName -T3608 -c -f -T3609 (note: I had to navigate to binary location) don't forget to replace InstanceName with yours-T3608 only starts master Trace Flags documentation-T3609 skips creation of tempdbin CPB run SQLCMD -E -SADMIN:Servername\InstanceName replace with your ServerName\InstanceName. Using a Dedicated Administrator Connectionin CPB run sp_detach_db 'model' then goin CPB run the following code, just replace with your file location.

```
CREATE DATABASE [model] ON( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.R2\MSSQL\DATA\model.mdf' ),( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.R2\MSSQL\DATA\modellog.ldf' ) FOR ATTACH
```

goin CPA you should see Starting 'MODEL' messsagein CPA hit Ctrl+C that will show message if you want to exit hit YUsing SQL Server Configuration Manager or Services page start SQL Server service.\
After I was able to connect using SSMS.


---

Original Source: https://www.mindstick.com/forum/33467/model-db-in-restoring-state-can-t-start-sql-server

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
