Skip to content

Commit 858df1c

Browse files
committed
INCLUDE file maintenance: refresh LocalDB article and remove ssexpcurrent-md
1 parent 3d3031d commit 858df1c

2 files changed

Lines changed: 115 additions & 101 deletions

File tree

docs/includes/ssexpcurrent-md.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/tools/sqllocaldb-utility.md

Lines changed: 115 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,126 @@
11
---
22
title: "SqlLocalDB Utility"
33
description: The SqlLocalDB utility command line tool allows users and developers to create and manage an instance of SQL Server Express LocalDB.
4-
ms.custom: seo-lt-2019
5-
ms.date: "08/09/2016"
4+
author: markingmyname
5+
ms.author: maghan
6+
ms.reviewer: randolphwest
7+
ms.date: 12/29/2022
68
ms.service: sql
7-
ms.reviewer: ""
89
ms.subservice: tools-other
910
ms.topic: conceptual
10-
helpviewer_keywords:
11+
ms.custom: seo-lt-2019
12+
helpviewer_keywords:
1113
- "SqlLocalDB utility [SQL Server]"
1214
- "local database runtime utility"
1315
- "LocalDB, SqlLocalDB Utility"
14-
ms.assetid: d785cdb7-1ea0-4871-bde9-1ae7881190f5
15-
author: markingmyname
16-
ms.author: maghan
1716
---
18-
# SqlLocalDB Utility
17+
# SqlLocalDB utility
18+
1919
[!INCLUDE[sqlserver](../includes/applies-to-version/sqlserver.md)]
20-
Use the **SqlLocalDB** utility to create an instance of [!INCLUDE[msCoName](../includes/msconame-md.md)] [!INCLUDE[ssExpCurrent](../includes/ssexpcurrent-md.md)] **LocalDB**. The **SqlLocalDB** utility (SqlLocalDB.exe) is a simple command line tool to enable users and developers to create and manage an instance of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)] **LocalDB**. For information about how to use **LocalDB**, see [SQL Server 2016 Express LocalDB](../database-engine/configure-windows/sql-server-express-localdb.md).
21-
22-
## Syntax
23-
24-
```
25-
SqlLocalDB.exe
26-
{
27-
[ create | c ] \<instance-name> \<instance-version> [-s ]
28-
| [ delete | d ] \<instance-name>
29-
| [ start | s ] \<instance-name>
30-
| [ stop | p ] \<instance-name> [ -i ] [ -k ]
31-
| [ share | h ] [" <user_SID> " | " <user_account> " ] " \<private-name> " " \<shared-name> "
32-
| [ unshare | u ] " \<shared-name> "
33-
| [ info | i ] \<instance-name>
34-
| [ versions | v ]
35-
| [ trace | t ] [ on | off ]
36-
| [ help | -? ]
37-
}
38-
```
39-
40-
## Arguments
41-
[ **create** | **c** ] *\<instance-name>* *\<instance-version>* [**-s** ]
42-
Creates a new of instance of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)]**LocalDB**. **SqlLocalDB** uses the version of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)] binaries specified by *\<instance-version>* argument. The version number is specified in numeric format with at least one decimal. The minor version numbers (service packs) are optional. 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. If not specified, the version number defaults to the version of the **SqlLocalDB** utility. Adding **-s** starts the new instance of **LocalDB**.
43-
44-
[ **share** | **h** ]
45-
Shares the specified private instance of **LocalDB** using the specified shared name. If the user SID or account name is omitted, it defaults to the current user.
46-
47-
[ **unshared** | **u** ]
48-
Stops the sharing of the specified shared instance of **LocalDB**.
49-
50-
[ **delete** | **d** ] *\<instance-name>*
51-
Deletes the specified instance of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)]**LocalDB**.
52-
53-
[ **start** | **s** ] "*\<instance-name>*"
54-
Starts the specified instance of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)]**LocalDB**. When successful the statement returns the named pipe address of the **LocalDB**.
55-
56-
[ **stop** | **p** ] *\<instance-name>* [**-i** ] [**-k** ]
57-
Stops the specified instance of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)]**LocalDB**. Adding **-i** requests the instance shutdown with the **NOWAIT** option. Adding **-k** kills the instance process without contacting it.
58-
59-
[ **info** | **i** ] [ *\<instance-name>* ]
60-
Lists all instance of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)]**LocalDB** owned by the current user.
61-
62-
*\<instance-name>* returns the name, version, state (Running or Stopped), last start time for the specified instance of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)]**LocalDB**, and the local pipe name of the **LocalDB**.
63-
64-
[ **trace** | **t** ] **on** | **off**
65-
**trace on** enables tracing for the **SqlLocalDB** API calls for the current user. **trace off** disables tracing.
66-
67-
**-?**
68-
Returns brief descriptions of each **SqlLocalDB** option.
69-
70-
## Remarks
71-
The *instance name* argument must follow the rules for [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] identifiers or it must be enclosed in double quotes.
72-
73-
Executing SqlLocalDB without arguments returns the help text.
74-
75-
Operations other than start can only be performed on an instance belonging to currently logged in user. An SQLLOCALDB Instance, when shared, can only be started and stopped by the owner of the instance.
76-
77-
## Examples
78-
79-
### A. Creating an Instance of LocalDB
80-
The following example creates an instance of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)]**LocalDB** named `DEPARTMENT` using the [!INCLUDE[ssnoversion](../includes/ssnoversion-md.md)] binaries and starts the instance.
81-
82-
```
83-
SqlLocalDB.exe create "DEPARTMENT" 12.0 -s
84-
```
85-
86-
### B. Working with a Shared Instance of LocalDB
87-
Open a command prompt using Administrator privileges.
88-
89-
```
90-
SqlLocalDB.exe create "DeptLocalDB"
91-
SqlLocalDB.exe share "DeptLocalDB" "DeptSharedLocalDB"
92-
SqlLocalDB.exe start "DeptLocalDB"
93-
SqlLocalDB.exe info "DeptLocalDB"
94-
REM The previous statement outputs the Instance pipe name for the next step
95-
sqlcmd -S np:\\.\pipe\LOCALDB#<use your pipe name>\tsql\query
96-
CREATE LOGIN NewLogin WITH PASSWORD = 'Passw0rd!!@52';
97-
GO
98-
CREATE USER NewLogin;
99-
GO
100-
EXIT
101-
```
102-
103-
Execute the following code to connect to the shared instance of **LocalDB** using the `NewLogin` login.
104-
105-
```
106-
sqlcmd -S (localdb)\.\DeptSharedLocalDB -U NewLogin -P Passw0rd!!@52
107-
```
108-
109-
## See Also
110-
[SQL Server 2016 Express LocalDB](../database-engine/configure-windows/sql-server-express-localdb.md)
111-
[Command-Line Management Tool: SqlLocalDB.exe](../relational-databases/express-localdb-instance-apis/command-line-management-tool-sqllocaldb-exe.md)
20+
21+
Use the **SqlLocalDB** utility to create an instance of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)] **LocalDB**. The **SqlLocalDB** utility (SqlLocalDB.exe) is a command line tool to enable users and developers to create and manage an instance of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)] **LocalDB**. For information about how to use **LocalDB**, see [SQL Server 2016 Express LocalDB](../database-engine/configure-windows/sql-server-express-localdb.md).
22+
23+
## Syntax
24+
25+
```console
26+
SqlLocalDB.exe
27+
{
28+
[ create | c ] <instance-name> <instance-version> [-s ]
29+
| [ delete | d ] <instance-name>
30+
| [ start | s ] <instance-name>
31+
| [ stop | p ] <instance-name> [ -i ] [ -k ]
32+
| [ share | h ] ["<user_SID>" | "<user_account>" ] "<private-name>" "<shared-name>"
33+
| [ unshare | u ] "<shared-name>"
34+
| [ info | i ] <instance-name>
35+
| [ versions | v ]
36+
| [ trace | t ] [ on | off ]
37+
| [ help | -? ]
38+
}
39+
```
40+
41+
## Arguments
42+
43+
#### [ create | c ] *\<instance-name>* *\<instance-version>* [-s ]
44+
45+
Creates a new of instance of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)] **LocalDB**. **SqlLocalDB** uses the version of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)] binaries specified by *\<instance-version>* argument. The version number is specified in numeric format with at least one decimal. The minor version numbers (service packs) are optional. 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. If not specified, the version number defaults to the version of the **SqlLocalDB** utility. Adding `-s` starts the new instance of **LocalDB**.
46+
47+
#### [ share | h ]
48+
49+
Shares the specified private instance of **LocalDB** using the specified shared name. If the user SID or account name is omitted, it defaults to the current user.
50+
51+
#### [ unshared | u ]
52+
53+
Stops the sharing of the specified shared instance of **LocalDB**.
54+
55+
#### [ delete | d ] *\<instance-name>*
56+
57+
Deletes the specified instance of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)] **LocalDB**.
58+
59+
#### [ start | s ] "*\<instance-name>*"
60+
61+
Starts the specified instance of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)] **LocalDB**. When successful the statement returns the named pipe address of the **LocalDB**.
62+
63+
#### [ stop | p ] *\<instance-name>* [-i ] [-k ]
64+
65+
Stops the specified instance of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)] **LocalDB**. Adding `-i` requests the instance shutdown with the `NOWAIT` option. Adding `-k` kills the instance process without contacting it.
66+
67+
#### [ info | i ] [ *\<instance-name>* ]
68+
69+
Lists all instance of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)] **LocalDB** owned by the current user.
70+
71+
*\<instance-name>* returns the name, version, state (Running or Stopped), last start time for the specified instance of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)] **LocalDB**, and the local pipe name of the **LocalDB**.
72+
73+
#### [ trace | t ] on | off
74+
75+
**trace on** enables tracing for the **SqlLocalDB** API calls for the current user. **trace off** disables tracing.
76+
77+
#### `-?`
78+
79+
Returns brief descriptions of each **SqlLocalDB** option.
80+
81+
## Remarks
82+
83+
The *instance name* argument must follow the rules for [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] identifiers or it must be enclosed in double quotes.
84+
85+
Executing **SqlLocalDB** without arguments returns the help text.
86+
87+
Operations other than start can only be performed on an instance belonging to the currently signed-in user. A `SQLLOCALDB` instance, when shared, can only be started and stopped by the owner of the instance.
88+
89+
## Examples
90+
91+
### A. Create an instance of LocalDB
92+
93+
The following example creates an instance of [!INCLUDE[ssExpress](../includes/ssexpress-md.md)] **LocalDB** named `DEPARTMENT` using the [!INCLUDE[ssnoversion](../includes/ssnoversion-md.md)] binaries and starts the instance.
94+
95+
```console
96+
SqlLocalDB.exe create "DEPARTMENT" 12.0 -s
97+
```
98+
99+
### B. Work with a shared instance of LocalDB
100+
101+
Open a command prompt using Administrator privileges.
102+
103+
```console
104+
SqlLocalDB.exe create "DeptLocalDB"
105+
SqlLocalDB.exe share "DeptLocalDB" "DeptSharedLocalDB"
106+
SqlLocalDB.exe start "DeptLocalDB"
107+
SqlLocalDB.exe info "DeptLocalDB"
108+
REM The previous statement outputs the Instance pipe name for the next step
109+
sqlcmd -S np:\\.\pipe\LOCALDB#<use your pipe name>\tsql\query
110+
CREATE LOGIN NewLogin WITH PASSWORD = 'Passw0rd!!@52';
111+
GO
112+
CREATE USER NewLogin;
113+
GO
114+
EXIT
115+
```
116+
117+
Execute the following code to connect to the shared instance of **LocalDB** using the `NewLogin` login.
118+
119+
```console
120+
sqlcmd -S (localdb)\.\DeptSharedLocalDB -U NewLogin -P Passw0rd!!@52
121+
```
122+
123+
## See also
124+
125+
- [SQL Server 2016 Express LocalDB](../database-engine/configure-windows/sql-server-express-localdb.md)
126+
- [Command-Line Management Tool: SqlLocalDB.exe](../relational-databases/express-localdb-instance-apis/command-line-management-tool-sqllocaldb-exe.md)

0 commit comments

Comments
 (0)