我的SQL 2014的虚拟机在迁移的时候, 存放TempDB的LUN被删掉了. 在虚拟机的操作系统启动了之后, SQL Server Instance却启动不起来了. 检查Event Log, 报错.

于是, 找到了这篇文章. 其目标是强制SQL Server启动, 并允许接收sqlcmd的修改一些选项的命令.  一旦SQL可以接受命令, 那我们就可以重新指定tempdb的路径了.

 

然而, 使用文章中的步骤, 我还是无法强制启动SQL Server.

检查Sqlservr.exe /f /c的输出, 发现报错如下:

2014-09-18 15:51:36.88 spid10s     Clearing tempdb database.
2014-09-18 15:51:36.89 spid10s     Error: 5123, Severity: 16, State: 1.
2014-09-18 15:51:36.89 spid10s     CREATE FILE encountered operating system erro
r 3(The system cannot find the path specified.) while attempting to open or crea
te the physical file 'E:\SQLDatabaseData\tempdb.mdf'.
2014-09-18 15:51:36.89 spid10s     Error: 5123, Severity: 16, State: 1.
2014-09-18 15:51:36.89 spid10s     CREATE FILE encountered operating system erro
r 3(The system cannot find the path specified.) while attempting to open or crea
te the physical file 'F:\SQLServerDatabaseLog\templog.ldf'.
2014-09-18 15:51:36.90 spid10s     Error: 17204, Severity: 16, State: 1.
2014-09-18 15:51:36.90 spid10s     FCB::Open failed: Could not open file E:\SQLD
atabaseData\tempdb.mdf
for file number 1.  OS error: 3(The system cannot find th
e path specified.).
2014-09-18 15:51:36.91 spid10s     Error: 5120, Severity: 16, State: 101.
2014-09-18 15:51:36.91 spid10s     Unable to open the physical file "E:\SQLDatab
aseData\tempdb.mdf
". Operating system error 3: "3(The system cannot find the pat
h specified.)".
2014-09-18 15:51:36.91 spid10s     Error: 1802, Severity: 16, State: 4.
2014-09-18 15:51:36.91 spid10s     CREATE DATABASE failed. Some file names liste
d could not be created. Check related errors.
2014-09-18 15:51:36.91 spid10s     Could not create tempdb. You may not have eno
ugh 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.
2014-09-18 15:51:36.92 spid15s     The SQL Server Network Interface library succ
essfully deregistered the Service Principal Name (SPN) [ MSSQLSvc/SQL2014-1.SPS.
P51359 ] for the SQL Server service.

看来即使是强制启动SQL, tempdb文件所在的原始路径还是需要存在的. 于是笔者给这台虚拟重新分配了两个虚拟硬盘. 把相应路径都建立好. SQL Server Instance终于可以强制启动了.

后面照着文章所讲的步骤就可以成功解决问题了.

 

========================

为方便将来查找和防止原文的丢失, 我把重要的步骤列在这里:

Following are the steps needed to add a new file to TEMPDB and then restart SQL Server.

1)   Open command prompt window #1 as ADMIN and go to the BINN directory where SQL Server is installed. This is typically in

C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Binn

OR

C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn

2) Then execute command like

Sqlservr.exe /f /c

3)   Then open one more command window #2 and if this is a default instance then open SQLCMD  using the following command

SQLCMD –S localhost –E

4)   This will open a SQL command prompt there where you can type the following commands

1> USE MASTER

2> GO

3> ALTER DATABASE tempdb MODIFY FILE

4> (NAME = tempdev, FILENAME = 'C:\NEWPATH\datatempdb.mdf')

5> GO

6> quit

5)   Now go back to Command window #1 and hit CTRL C.It will ask if you want to stop the instance. Y/N. Enter Y

 

6)   Now start the SQL Server instance from configuration manager. You should see the new data file created and SQL Server started.

 

参考资料

========================

How to start SQL Server if you lost TEMPDB Data files?

http://blogs.xtivia.com/home/-/blogs/how-to-start-sql-server-if-you-lost-tempdb-data-files-

SQL Server Instance无法启动了, 因为TempDB所在的分区没有了, 怎么办?的更多相关文章

  1. 解决Window Azure: Failed to start Development Storage: the SQL Server instance ‘localhost\SQLExpress’ could not be found.

    运行Window Arzure 项目,报如下错误: Windows Azure Tools: Failed to initialize Windows Azure storage emulator. ...

  2. windows10下sql server 2005 无法运行或sql server服务无法启动的完美解决方案

    问题:升级windows10后,sql server 2005 无法运行或sql server服务&sql server agent无法启动,如下图,怎么办? 一般情况下,我们第一反应就是sq ...

  3. SQL Server代理服务无法启动的处理方法(转载)

    SQL Server代理服务无法启动问题的确很让我们头疼,下面就为您介绍SQL Server代理服务无法启动的处理方法,希望对您能有所帮助. --==配置环境服务器环境为32位Intel® Xeon® ...

  4. 在Windows2008下安装SQL Server 2005无法启动服务的解决办法

    在Windows2012下安装SQL Server 2005无法启动服务的解决办法 1.正常安装任一版本的SQL Server 2005. 2.安装到SqlServer服务的时候提示启动服务失败  此 ...

  5. 在 Windows Server Container 中运行 Azure Storage Emulator(二):使用自定义的 SQL Server Instance

    上一节,我们解决了 Azure Storage Emulator 自定义监听地址的问题,这远远不够,因为在我们 DEV/QA 环境有各自的 SQL Server Instance,我们需要将 ASE ...

  6. 修改Windows帐户密码,导致Sql Server 2000无法启动

    修改Windows帐户密码,导致Sql Server 2000无法启动. --现象以管理员或同等权限用户登录 Windows XP,建立 Sql Server 2000 数据库.之后,在修改此 Win ...

  7. net start sql server (instance)

    如何启动 SQL Server 实例(net 命令) 其他版本   可以使用 Microsoft Windows net 命令启动 Microsoft SQL Server 服务. 启动 SQL Se ...

  8. SQL Server分区表,能否按照多个列作为分区函数的分区依据(转载)

    问: Hi, I have a table workcachedetail with 40 million rows which has 8 columns.We decided to partiti ...

  9. MS SQL SERVER搜索某个表的主键所在的列名

    原文:MS SQL SERVER搜索某个表的主键所在的列名 SELECT SYSCOLUMNS.name  FROM SYSCOLUMNS,SYSOBJECTS,SYSINDEXES,SYSINDEX ...

随机推荐

  1. Bunch 转换为 HDF5 文件:高效存储 Cifar 等数据集

    关于如何将数据集封装为 Bunch 可参考 关于 『AI 专属数据库的定制』的改进. PyTables 是 Python 与 HDF5 数据库/文件标准的结合.它专门为优化 I/O 操作的性能.最大限 ...

  2. 解决mongo 端口占用问题

    在打开mongod之后如果不用了就按ctrl + c ,就不会出现以下的问题了 执行mongod报错 mongod 2016-08-03T14:31:15.691+0800 I CONTROL [in ...

  3. 【转】高效率编辑器VIM

    最近实习的时候需要在服务器上做Debug,不得不用到vim的相关操作.以前对vim这种被码农无数赞扬的神器望而却步,但今天试了之后感觉还是不错的.以后争取少用鼠标,少用insert模式. 这是从网上看 ...

  4. grunt自动化

    1.安装模块 npm install grunt -g npm install grunt-cli -g #! --save-dev 既会把模块安装到项目node_modules下,也会安装到依赖文件 ...

  5. centos+uwsgi+nginx+python+django服务器安装配置

    1.ssh登录后使用fdisk –l查看需要格式化硬盘的名称: 2.运行fdisk /dev/vdb,对数据盘进行分区,按照提示,依次输入n,p,1,两次回车,wq,分区开始.(注意数据盘的名称,和阿 ...

  6. BZOJ 4066 简单题(KD树)

    [题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=4066 [题目大意] 要求维护矩阵内格子加点和矩阵查询 [题解] 往KD树上加权值点,支 ...

  7. 【漏洞预警】Intel爆CPU设计问题,导致win和Linux内核重设计(附测试poc)

    目前研究人员正抓紧检查 Linux 内核的安全问题,与此同时,微软也预计将在本月补丁日公开介绍 Windows 操作系统的相关变更. 而 Linux 和 Windows 系统的这些更新势必会对 Int ...

  8. 【洛谷】4304:[TJOI2013]攻击装置【最大点独立集】【二分图】2172: [国家集训队]部落战争【二分图/网络流】【最小路径覆盖】

    P4304 [TJOI2013]攻击装置 题目描述 给定一个01矩阵,其中你可以在0的位置放置攻击装置. 每一个攻击装置(x,y)都可以按照“日”字攻击其周围的8个位置(x-1,y-2),(x-2,y ...

  9. Codeforces Round #355 (Div. 2) B. Vanya and Food Processor 水题

    B. Vanya and Food Processor 题目连接: http://www.codeforces.com/contest/677/problem/B Description Vanya ...

  10. BZOJ 1007: [HNOI2008]水平可见直线 栈/计算几何

    1007: [HNOI2008]水平可见直线 Time Limit: 1 Sec  Memory Limit: 162 MB 题目连接 http://www.lydsy.com/JudgeOnline ...