一、基本参数
SQL Server引擎的启动选项默认使用3个基本参数。
(1) -d
指定了 master 数据库的数据文件的完全限定路径。通常为 C:Program FilesMicrosoft SQL ServerMSSQL.nMSSQLDatamaste.mdf 。
(2) -e
指定了错误日志文件的完全限定路径。通常为 C:Program FilesMicorosft SQL ServerMSSQL.nMSSQLLOGERRORLOG 。
(3) -l
指定了 master 数据库的日志文件的完全限定路径。通常为 C:Program FilesMicrosoft SQL ServerMSSQL.nMSSQLDatamastlog.ldf 。
二、设置启动选项
安装SQL Server时,安装程序将把一组默认的启动选项写入Windows注册表。如果没有在启动选项中提供上述3个参数,则使用现有的注册表参数。
可以使用 SQL Server 配置管理器设置启动选项。SQL Server 2012 与前面的版本稍有差异。
例如,SQL Server 2008 R2
SQL Server 2012 更加简化、便捷
三、查看错误日志文件 每次启动 SQL Server 时,都会循环错误日志扩展编号:将当前错误日志重命名为 errorlog.1;errorlog.1 变为 errorlog.2,errorlog.2 变为 errorlog.3,依次类推。最后生成一个新的ERRORLOG 文件。 当发现SQL Server数据库引擎无法启动,应当首先检查错误日志文件。 如果SQL Server实例已经启动,则可以通过系统存储过程 sp_readerrorlog 查看错误日志文件。 错误日志文件示例如下:2013-08-05 21:05:08.70 Server Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) Apr 2 2010 15:48:46 Copyright (c) Microsoft CorporationStandard Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1)2013-08-05 21:05:08.74 Server (c) Microsoft Corporation.2013-08-05 21:05:08.74 Server All rights reserved.2013-08-05 21:05:08.74 Server Server process ID is 2560.2013-08-05 21:05:08.74 Server System Manufacturer: 'Dell Inc.', System Model: 'PowerEdge R510'.2013-08-05 21:05:08.74 Server Authentication mode is MIXED.2013-08-05 21:05:08.75 Server Logging SQL Server messages in file 'D:Program FilesMicrosoft SQL ServerMSSQL10_50.MSSQLSERVERMSSQLLogERRORLOG'.2013-08-05 21:05:08.76 Server This instance of SQL Server last reported using a process ID of 2572 at 8/5/2013 9:02:22 PM (local) 8/5/2013 1:02:22 PM (UTC). This is an informational message only; no user action is required.2013-08-05 21:05:08.76 Server Registry startup parameters: -d D:Program FilesMicrosoft SQL ServerMSSQL10_50.MSSQLSERVERMSSQLDATAmaster.mdf -e D:Program FilesMicrosoft SQL ServerMSSQL10_50.MSSQLSERVERMSSQLLogERRORLOG -l D:Program FilesMicrosoft SQL ServerMSSQL10_50.MSSQLSERVERMSSQLDATAmastlog.ldf2013-08-05 21:05:08.82 Server SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.2013-08-05 21:05:08.83 Server Detected 24 CPUs. This is an informational message; no user action is required. 如果 ERRORLOG 太多,想要截断,怎么办?
sp_cycle_errorlog 关闭当前的错误日志文件,并循环错误日志扩展编号(就像重新启动服务器)。
可使您循环访问错误日志文件,而不必停止和启动服务器。 新错误日志包含版本和版权信息,以及表明新日志已创建的一行。
截断后的ERRORLOG示例:
2013-09-27 16:09:31.95 spid52 Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (Intel X86)
Jun 17 2011 00:57:23
Copyright (c) Microsoft Corporation
Developer Edition on Windows NT 6.0 (Build 6002: Service Pack 2) (Hypervisor)
2013-09-27 16:09:31.95 spid52 (c) Microsoft Corporation.
2013-09-27 16:09:31.95 spid52 All rights reserved.
2013-09-27 16:09:31.95 spid52 Server process ID is 1696.
2013-09-27 16:09:31.95 spid52 System Manufacturer: 'VMware, Inc.', System Model: 'VMware Virtual Platform'.
2013-09-27 16:09:31.95 spid52 Authentication mode is MIXED.
2013-09-27 16:09:31.95 spid52 Logging SQL Server messages in file 'C:Program FilesMicrosoft SQL ServerMSSQL10_50.MSSQLSERVERMSSQLLogERRORLOG'.
2013-09-27 16:09:31.95 spid52 The error log has been reinitialized. See the previous log for older entries.
如果SQL Server 已经启动,则可以在SSMS中查看日志。
|