怎么查看mssqllocaldb的表_SqlLocalDB 实用工具

SqlLocalDB 实用工具SqlLocalDB Utility

08/09/2016

本文内容

适用于:Applies to: SQL ServerSQL Server(所有支持的版本)SQL ServerSQL Server (all supported versions)适用于:Applies to: SQL ServerSQL Server(所有支持的版本)SQL ServerSQL Server (all supported versions)

SqlLocalDB 实用工具可用于创建 MicrosoftMicrosoftSQL Server 2016 ExpressSQL Server 2016 Express LocalDB 实例。Use the SqlLocalDB utility to create an instance of MicrosoftMicrosoftSQL Server 2016 ExpressSQL Server 2016 Express LocalDB. SqlLocalDB 实用工具 (SqlLocalDB.exe) 是一款简易命令行工具,可方便用户和开发人员创建和管理 SQL Server ExpressSQL Server Express LocalDB 实例。The SqlLocalDB utility (SqlLocalDB.exe) is a simple command line tool to enable users and developers to create and manage an instance of SQL Server ExpressSQL Server Express LocalDB. For information about how to use LocalDB, see SQL Server 2016 Express LocalDB.

语法Syntax

SqlLocalDB.exe

{

[ create | c ] \ \ [-s ]

| [ delete | d ] \

| [ start | s ] \

| [ stop | p ] \ [ -i ] [ -k ]

| [ share | h ] [" " | " " ] " \ " " \ "

| [ unshare | u ] " \ "

| [ info | i ] \

| [ versions | v ]

| [ trace | t ] [ on | off ]

| [ help | -? ]

}

参数Arguments

[ create | c ] [ -s ][ create | c ] [-s ]

新建 SQL Server ExpressSQL Server ExpressLocalDB实例。Creates a new of instance of SQL Server ExpressSQL Server ExpressLocalDB. SqlLocalDB 使用由 参数指定的 SQL Server ExpressSQL Server Express 版本的二进制文件。SqlLocalDB uses the version of SQL Server ExpressSQL Server Express binaries specified by argument. 版本号以数字格式指定,至少有一个小数点。The version number is specified in numeric format with at least one decimal. 次要版本号 (Service Pack) 是可选的。The minor version numbers (service packs) are optional. 例如,下面的两个版本号均可接受:11.0 或 11.0.1186。For example the following two version numbers are both acceptable: 11.0, or 11.0.1186. 必须在计算机上安装指定的版本。The specified version must be installed on the computer. 如果未指定,版本号默认为 SqlLocalDB 实用工具的版本。If not specified, the version number defaults to the version of the SqlLocalDB utility. 添加 -s 可启动新的 LocalDB 实例。Adding -s starts the new instance of LocalDB.

[ 共享 | h ][ share | h ]

使用指定的共享名称共享指定的 LocalDB 私有实例。Shares the specified private instance of LocalDB using the specified shared name. 如果省略该用户 SID 或帐户名称,则默认为当前用户。If the user SID or account name is omitted, it defaults to the current user.

[ unshared | u ][ unshared | u ]

停止共享指定的 LocalDB共享实例。Stops the sharing of the specified shared instance of LocalDB.

[ delete | d ] [ delete | d ]

删除指定的 SQL Server ExpressSQL Server ExpressLocalDB实例。Deletes the specified instance of SQL Server ExpressSQL Server ExpressLocalDB.

[ start | s ] " "[ start | s ] ""

启动指定的 SQL Server ExpressSQL Server ExpressLocalDB实例。Starts the specified instance of SQL Server ExpressSQL Server ExpressLocalDB. 成功后,该语句返回 LocalDB的命名管道地址。When successful the statement returns the named pipe address of the LocalDB.

[ stop | p ] [ -i ] [ -k ][ stop | p ] [-i ] [-k ]

停止指定的 SQL Server ExpressSQL Server ExpressLocalDB实例。Stops the specified instance of SQL Server ExpressSQL Server ExpressLocalDB. 添加 -i 可请求使用 NOWAIT 选项关闭实例。Adding -i requests the instance shutdown with the NOWAIT option. 添加 -k 可终止实例进程,而无需联系它。Adding -k kills the instance process without contacting it.

[ info | i ] [ ][ info | i ] [ ]

列出当前用户拥有的所有 SQL Server ExpressSQL Server ExpressLocalDB 实例。Lists all instance of SQL Server ExpressSQL Server ExpressLocalDB owned by the current user.

返回指定的 SQL Server ExpressSQL Server ExpressLocalDB 实例的名称、版本、状态(正在运行或已停止)、上次启动时间,以及 LocalDB 的本地管道名称。 returns the name, version, state (Running or Stopped), last start time for the specified instance of SQL Server ExpressSQL Server ExpressLocalDB, and the local pipe name of the LocalDB.

[ trace | t ] on | off[ trace | t ] on | off

trace on 为当前用户启用针对 SqlLocalDB API 调用的跟踪。trace on enables tracing for the SqlLocalDB API calls for the current user. trace off 禁用跟踪。trace off disables tracing.

-?-?

返回每个 SqlLocalDB 选项的简短说明。Returns brief descriptions of each SqlLocalDB option.

备注Remarks

实例名称 参数必须遵循 SQL ServerSQL Server 标识符规则,或者必须将该参数放入双引号。The instance name argument must follow the rules for SQL ServerSQL Server identifiers or it must be enclosed in double quotes.

执行不带参数的 SqlLocalDB 将返回帮助文档。Executing SqlLocalDB without arguments returns the help text.

只能在属于当前已登录用户的实例上执行启动以外的其他操作。Operations other than start can only be performed on an instance belonging to currently logged in user. 共享的 SQLLOCALDB 实例只能由该实例的所有者启动和停止。An SQLLOCALDB Instance, when shared, can only be started and stopped by the owner of the instance.

示例Examples

A.A. 创建 LocalDB 实例Creating an Instance of LocalDB

下面的示例使用 SQL Server ExpressSQL Server Express二进制文件创建了一个名为 的 DEPARTMENT LocalDB SQL Server 2019 (15.x)SQL Server 2019 (15.x) 实例,并启动该实例。The following example creates an instance of SQL Server ExpressSQL Server ExpressLocalDB named DEPARTMENT using the SQL Server 2019 (15.x)SQL Server 2019 (15.x) binaries and starts the instance.

SqlLocalDB.exe create "DEPARTMENT" 12.0 -s

B.B. 使用 LocalDB 的共享实例Working with a Shared Instance of LocalDB

使用管理员权限打开一个命令提示符。Open a command prompt using Administrator privileges.

SqlLocalDB.exe create "DeptLocalDB"

SqlLocalDB.exe share "DeptLocalDB" "DeptSharedLocalDB"

SqlLocalDB.exe start "DeptLocalDB"

SqlLocalDB.exe info "DeptLocalDB"

REM The previous statement outputs the Instance pipe name for the next step

sqlcmd -S np:\\.\pipe\LOCALDB#\tsql\query

CREATE LOGIN NewLogin WITH PASSWORD = 'Passw0rd!!@52';

GO

CREATE USER NewLogin;

GO

EXIT

执行以下代码,使用 登录名连接到 LocalDB NewLogin 的共享实例。Execute the following code to connect to the shared instance of LocalDB using the NewLogin login.

sqlcmd -S (localdb)\.\DeptSharedLocalDB -U NewLogin -P Passw0rd!!@52

另请参阅See Also

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值