sqlservr 应用程序sqlservr Application

适用对象: yesSQL ServeryesAzure SQL 数据库noAzure SQL 数据仓库no并行数据仓库APPLIES TO: yesSQL Server noAzure SQL Database noAzure SQL Data Warehouse noParallel Data Warehouse

sqlservr 应用程序可以在命令提示符下启动、停止、暂停和继续 MicrosoftMicrosoft SQL ServerSQL Server 的实例。The sqlservr application starts, stops, pauses, and continues an instance of MicrosoftMicrosoft SQL ServerSQL Server from a command prompt.

语法Syntax

sqlservr [-s instance_name] [-c] [-d master_path] [-f] 
     [-e error_log_path] [-l master_log_path] [-m]
     [-n] [-T trace#] [-v] [-x]

参数Arguments

-s instance_name 指定SQL ServerSQL Server要连接到的实例。-s instance_name Specifies the instance of SQL ServerSQL Server to connect to. 如果未指定命名实例, sqlservr 将启动 SQL ServerSQL Server的默认实例。If no named instance is specified, sqlservr starts the default instance of SQL ServerSQL Server.

重要

启动 SQL ServerSQL Server实例时,必须在该实例的相应目录中使用 sqlservr 应用程序。When starting an instance of SQL ServerSQL Server, you must use the sqlservr application in the appropriate directory for that instance. 对于默认实例,从 \MSSQL\Binn 目录运行 sqlservrFor the default instance, run sqlservr from the \MSSQL\Binn directory. 对于命名实例,从 \MSSQL$ instance_name \Binn 目录运行sqlservrFor a named instance, run sqlservr from the \MSSQL$instance_name\Binn directory.

-c 指示独立于 Windows 服务控制管理器启动 SQL ServerSQL Server 实例。-c Indicates that an instance of SQL ServerSQL Server is started independently of the Windows Service Control Manager. 从命令提示符下启动 SQL ServerSQL Server 时可使用此选项,以缩短 SQL ServerSQL Server 的启动时间。This option is used when starting SQL ServerSQL Server from a command prompt, to shorten the amount of time it takes for SQL ServerSQL Server to start.

备注

使用此选项时,将无法通过使用 SQL ServerSQL Server 服务管理器或 SQL ServerSQL Server net stop 命令停止 。如果注销计算机,则 SQL ServerSQL Server 将停止。)When you use this option, you cannot stop SQL ServerSQL Server by using SQL ServerSQL Server Service Manager or the net stop command, and if you log off the computer, SQL ServerSQL Server is stopped.)

-d master_path 指示 master 数据库文件的完全限定路径。-d master_path Indicates the fully qualified path for the master database file. -dmaster_path之间没有空格。There are no spaces between -d and master_path. 如果没有提供此选项,则使用现有的注册表参数。If you do not provide this option, the existing registry parameters are used.

-f 以最小配置启动 SQL ServerSQL Server 的实例。-f Starts an instance of SQL ServerSQL Server with minimal configuration. 在配置值的设置(例如,过度分配内存)妨碍服务器启动时,这非常有用。This is useful if the setting of a configuration value (for example, over-committing memory) has prevented the server from starting.

-e error_log_path 指示错误日志文件的完全限定路径。-e error_log_path Indicates the fully qualified path for the error log file. 如果未指定, 则默认位置为*\<Drive>*:\Program Files\Microsoft SQL Server\MSSQL\Log\Errorlog默认实例和*\<Drive>*:\Program Files\Microsoft SQL Server\MSSQL$*instance_name*\Log\Errorlog命名实例的默认位置。If not specified, the default location is *\<Drive>*:\Program Files\Microsoft SQL Server\MSSQL\Log\Errorlog for the default instance and *\<Drive>*:\Program Files\Microsoft SQL Server\MSSQL$*instance_name*\Log\Errorlog for a named instance. -eerror_log_path之间没有空格。There are no spaces between -e and error_log_path.

-l master_log_path 指示 master 数据库事务日志文件的完全限定路径。-l master_log_path Indicates the fully qualified path for the master database transaction log file. -lmaster_log_path之间没有空格。There are no spaces between -l and master_log_path.

-m 指示以单用户模式启动 SQL ServerSQL Server 的实例。-m Indicates to start an instance of SQL ServerSQL Server in single-user mode. 如果以单用户模式启动 SQL ServerSQL Server ,则只有一个用户可以连接。Only a single user can connect when SQL ServerSQL Server is started in single-user mode. 确保将已完成事务定期从磁盘缓存写入数据库设备的 CHECKPOINT 机制将不启动。The CHECKPOINT mechanism, which guarantees that completed transactions are regularly written from the disk cache to the database device, is not started. 通常情况下,在遇到需要修复系统数据库这样的问题时才使用该选项。启用 sp_configure allow updates 选项。(Typically, this option is used if you experience problems with system databases that require repair.) Enables the sp_configure allow updates option. 默认情况下, allow updates 被禁用。By default, allow updates is disabled.

-n 用于启动 SQL ServerSQL Server 的命名实例。-n Allows you to start a named instance of SQL ServerSQL Server. 如果不设置 -s 参数,则尝试启动默认实例。Without the -s parameter set, the default instance attempts to start. 必须先在命令提示符处切换到实例的相应 BINN 目录,然后才能启动 sqlservr.exeYou must switch to the appropriate BINN directory for the instance at a command prompt before starting sqlservr.exe. 例如,如果 Instance1 为其二进制文件使用了 \mssql$Instance1,则用户必须位于 \mssql$Instance1\binn 目录中才能启动 sqlservr.exe -s instance1For example, if Instance1 were to use \mssql$Instance1 for its binaries, the user must be in the \mssql$Instance1\binn directory to start sqlservr.exe -s instance1. 如果用 SQL ServerSQL Server -n 选项启动 实例,则最好也使用 -e 选项,否者将不会记录 SQL ServerSQL Server 事件。If you start an instance of SQL ServerSQL Server with the -n option, it is advisable to use the -e option too, or SQL ServerSQL Server events are not logged.

-T trace# 指示 SQL ServerSQL Server 实例启动时,指定的跟踪标志 (trace# ) 应同时生效。-T trace# Indicates that an instance of SQL ServerSQL Server should be started with a specified trace flag (trace#) in effect. 跟踪标记用于以非标准行为启动服务器。Trace flags are used to start the server with nonstandard behavior. 有关详细信息,请参阅跟踪标志 (Transact-SQL)For more information, see Trace Flags (Transact-SQL).

重要

指定跟踪标志时,请使用 -T 来传递跟踪标志号。When specifying a trace flag, use -T to pass the trace flag number. 接受小写的 t ( -t SQL ServerSQL Server);但是 -t 通常用于设置 SQL ServerSQL Server 支持工程师所需的其他内部跟踪标志。A lowercase t (-t) is accepted by SQL ServerSQL Server; however, -t sets other internal trace flags required by SQL ServerSQL Server support engineers.

-v 显示服务器的版本号。-v Displays the server version number.

-x 不保留 CPU 时间和高速缓存命中率统计信息。-x Disables the keeping of CPU time and cache-hit ratio statistics. 可获得最大性能。Allows maximum performance.

RemarksRemarks

多数情况下,sqlservr.exe 程序只用于故障排除或主要维护。In most cases, the sqlservr.exe program is only used for troubleshooting or major maintenance. 在命令提示符下使用 sqlservr.exe 启动 SQL ServerSQL Server 时, SQL ServerSQL Server 不作为服务启动,因此无法使用 SQL ServerSQL Server net 命令停止When SQL ServerSQL Server is started from the command prompt with sqlservr.exe, SQL ServerSQL Server does not start as a service, so you cannot stop SQL ServerSQL Server using net commands. 用户可以连接到 SQL ServerSQL Server,但 SQL ServerSQL Server 工具将显示服务的状态,以便 SQL ServerSQL Server 配置管理器正确指示服务已停止。Users can connect to SQL ServerSQL Server, but SQL ServerSQL Server tools show the status of the service, so SQL ServerSQL Server Configuration Manager correctly indicates that the service is stopped. SQL Server Management StudioSQL Server Management Studio 可以与服务器连接,但它也可以指示服务已停止。can connect to the server, but it also indicates that the service is stopped.

兼容性支持Compatibility Support

以下参数已过时, 且在中SQL Server 2017SQL Server 2017不受支持。The following parameters are obsolete and not supported in SQL Server 2017SQL Server 2017.

参数Parameter 详细信息More information
-h-h 启用 AWE 时,在 SQL ServerSQL Server 早期版本的 32 位实例中为热添加内存元数据保留虚拟内存地址空间。In earlier versions of 32-bit instances of SQL ServerSQL Server to reserve virtual memory address space for Hot Add memory metadata when AWE is enabled. 支持通过SQL Server 2014 (12.x)SQL Server 2014 (12.x)Supported through SQL Server 2014 (12.x)SQL Server 2014 (12.x). 有关详细信息,请参阅 SQL Server 2016 中不再使用的 SQL Server 功能For more information, see Discontinued SQL Server Features in SQL Server 2016.
-g-g memory_to_reservememory_to_reserve

适用于的早期版本的32位实例SQL ServerSQL ServerApplies to earlier versions of 32-bit instances of SQL ServerSQL Server. 支持通过SQL Server 2014 (12.x)SQL Server 2014 (12.x)Supported through SQL Server 2014 (12.x)SQL Server 2014 (12.x). 指定 SQL ServerSQL Server 为位于 SQL ServerSQL Server 进程中但在 SQL ServerSQL Server 内存池之外的内存分配保留的内存整数量 (MB)。Specifies an integer number of megabytes (MB) of memory that SQL ServerSQL Server leaves available for memory allocations within the SQL ServerSQL Server process, but outside the SQL ServerSQL Server memory pool. 有关详细信息, 请参阅有关服务器内存配置选项的 SQL Server 2014 文档For more information, see the SQL Server 2014 documentation on Server Memory Configuration Options.
   

另请参阅See Also

数据库引擎服务启动选项Database Engine Service Startup Options