sql-server-2008 – 如何使用损坏的模型db启动MSSQL Server

前端之家收集整理的这篇文章主要介绍了sql-server-2008 – 如何使用损坏的模型db启动MSSQL Server前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
移动一些数据库(恢复,删除等)后,我们遇到了创建新数据库的问题.具体来说,当尝试创建新数据库MSsql Server时,它失败了,因为“数据库’模型’被标记为RESTORING并且处于不允许运行恢复的状态”.正如一些在线解决方案所建议的,我们尝试启动和停止MSsql服务.服务不会重新启动,因为“无法创建tempdb.您可能没有足够的可用磁盘空间.通过删除tempdb驱动器上的其他文件释放额外的磁盘空间”(仅供参考:驱动器有100GB的可用空间).尝试重新启动运行MSsql Server的计算机.当服务器重新上线时,我们收到了同样的错误.我们尝试删除tempdb.mdf并从templates文件夹中恢复modeldb,但这些都没有解决问题.即使在单用户模式下,我们也无法连接到数据库.许多在线解决方案让我们对服务器运行sql命令,但是我们无法连接(甚至在单用户模式下)数据库以对服务器运行命令.

特定错误消息:

数据库’model’无法打开.它正处于恢复过程中. (Microsoft sql Server,错误:927)

sql Server(MSsqlSERVER)服务正在启动.
无法启动sql Server(MSsqlSERVER)服务.

发生特定于服务的错误:1814.

我们需要尽快启动并运行服务器.

解决方法

这实际上已经修复了一段时间(早在12年7月),微软付费支持电话.

由于这已经获得了如此多的观点,我决定在微软的电话会议中添加我们“电子邮件摘要”的编辑版本.

发布是一个指向pastebin的链接http://pastebin.com/QqNz7xYd

希望此信息可以帮助解决此问题的任何人

Problem Description:
=============================
You Microsoft sql Server 2008 R2 (RTM) - 10.50.1600.1 (X64)  default instance on SERVERNAME server and you were trying to start the sql SERVER service which was failing to start.


Analysis\Troubleshooting:
=============================

We checked the sqlS SERVER ERRORLOG

===========================
2012-06-20 19:33:41.48 Server      Microsoft sql Server 2008 R2 (RTM) - 10.50.1600.1 (X64)
 Apr  2 2010 15:48:46
 Copyright (c) Microsoft Corporation
Enterprise Edition (64-bit) on Windows NT 6.0 <X64> (Build 6001: Service Pack 1)

2012-06-20 19:33:41.50 Server      (c) Microsoft Corporation.
2012-06-20 19:33:41.50 Server      All rights reserved.
2012-06-20 19:33:41.50 Server      Server process ID is 2596.
2012-06-20 19:33:41.51 Server      System Manufacturer: 'HP',System Model: 'ProLiant DL360 G5'.
2012-06-20 19:33:41.51 Server      Authentication mode is MIXED.
2012-06-20 19:33:41.51 Server      Logging sql Server messages in file 'D:\Mssql\Data\MSsql10_50.MSsqlSERVER\MSsql\Log\ERRORLOG'.
2012-06-20 19:33:41.51 Server      This instance of sql Server last reported using a process ID of 2816 at 6/20/2012 6:10:15 PM (local) 6/20/2012 10:10:15 PM (UTC). This is an informational message only; no user action is required.
2012-06-20 19:33:41.51 Server      Registry startup parameters:
  -d D:\Mssql\Data\MSsql10_50.MSsqlSERVER\MSsql\DATA\master.mdf
  -e D:\Mssql\Data\MSsql10_50.MSsqlSERVER\MSsql\Log\ERRORLOG
  -l D:\Mssql\Data\MSsql10_50.MSsqlSERVER\MSsql\DATA\mastlog.ldf
2012-06-20 19:33:41.56 Server      sql Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2012-06-20 19:33:41.56 Server      Detected 4 cpus. This is an informational message; no user action is required.
2012-06-20 19:33:41.65 Server      Using locked pages for buffer pool.
2012-06-20 19:33:41.88 Server      Using dynamic lock allocation.  Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node.  This is an informational message only.  No user action is required.
2012-06-20 19:33:42.33 Server      Node configuration: node 0: cpu mask: 0x000000000000000f:0 Active cpu mask: 0x000000000000000f:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
2012-06-20 19:33:42.49 spid7s      Starting up database 'master'.
2012-06-20 19:33:42.86 spid7s      Resource governor reconfiguration succeeded.
2012-06-20 19:33:42.86 spid7s      sql Server Audit is starting the audits. This is an informational message. No user action is required.
2012-06-20 19:33:42.87 spid7s      sql Server Audit has started the audits. This is an informational message. No user action is required.
2012-06-20 19:33:42.87 spid7s      FILESTREAM: effective level = 0,configured level = 0,file system access share name = 'MSsqlSERVER'.
2012-06-20 19:33:43.02 spid7s      sql Trace ID 1 was started by login "sa".
2012-06-20 19:33:43.03 spid7s      Starting up database 'mssqlsystemresource'.
2012-06-20 19:33:43.05 spid7s      The resource database build version is 10.50.1600. This is an informational message only. No user action is required.
2012-06-20 19:33:43.24 spid10s     Starting up database 'model'.
2012-06-20 19:33:43.24 spid7s      Server name is 'SERVERNAME'. This is an informational message only. No user action is required.
2012-06-20 19:33:43.27 spid10s     The database 'model' is marked RESTORING and is in a state that does not allow recovery to be run.
2012-06-20 19:33:43.28 spid10s     Error: 927,Severity: 14,State: 2.
2012-06-20 19:33:43.28 spid10s     Database 'model' cannot be opened. It is in the middle of a restore.
2012-06-20 19:33:43.36 spid10s     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.
2012-06-20 19:33:43.36 spid10s     sql Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required.
===========================

From ERRORLOG we can see that sql SERVER trying to bring model database online but since model database in recovery state hence we were unable to run database recovery.

We also know that whenever sql SERVER start we recreate TEMPDB database by coping the content from model database.

Now since model database didn’t started hence TEMPDB startup also Failed which is one of critical system database and this caused sql SERVER service to Failed


Solution:
=====================================
·         To fix this issue we started sql SERVER EXE with following parameter from command prompt


sqlSERVR.EXE -c -T3608

·         Then after we detached model database using following T-sql


sp_detach_db model

·         Then after we attach the model database using following T-sql


================================
USE MASTER
GO
CREATE DATABASE MODEL
      ON (FILENAME = 'C:\PROGRAM FILES\MICROSOFT sql SERVER\MSsql10_50.MSsqlSERVER\MSsql\DATA\MODEL.MDF')
      FOR ATTACH ;
================================

·         After that sql SERVER service came online successfully
原文链接:https://www.f2er.com/mssql/79920.html

猜你在找的MsSQL相关文章