[Ms-sql]20130806_localdb_dos command uses

Source: Internet
Author: User
Tags compact sql 2008 management studio sql server management sql server management studio sql server express

For ease of management, LOCALDB provides a command-line-based database management tool, SqlLocalDB.exe. Here is the path to the SqlLocalDB.exe:

    1. %ProgramFiles%\Microsoft SQL Server\110\tools\binn
You can also find an EXE file by using the WHERE command:

We can run SqlLocalDB.exe on the cmd command line of the Windows operating system:

    1. Cd%programfiles%\microsoft SQL Server\110\tools\binn
    2. Sqllocaldb

Sqllocaldb use a space as a delimiter, so if the instance name contains spaces or other special characters, we need to quote them in quotation marks. For example:

    1. SQLLOCALDB create "My LocalDB Instance"

An administrator or developer can create an LOCALDB instance using the Create option, and the-s option will launch the instance after the instance is created. For example:

    1. SQLLOCALDB create "Mylocaldb" 11.0-s

You can view the status information for the MYLOCALDB instance using the following command:

    1. SQLLOCALDB Info "Mylocaldb"

To start and stop an LOCALDB instance:

    1. Sqllocaldb start "Mylocaldb"
    2. Sqllocaldb Stop "Mylocaldb"

To delete a LocalDB instance:

    1. SQLLOCALDB Delete "Mylocaldb"

The above is a brief summary of the use of the SqlLocalDB.exe command-line utility to manage LocalDB, and more features to be explored by the reader, remember to ask for help with the SqlLocalDB.exe/? command.

Finally, you can find the db that you created in the following path.

C:\Users\< login username >\appdata\local\microsoft\microsoft sql Server Local db\instances

unshare "Projects"

Here are the instructions to create a common and un-shared command:

When you install LocalDB, if you want to manage the Management through studio, it is recommended that you use SQL Server Management Studio to connect, because the new version of Management Studio The connection string is connected to the LocalDB, and its server name format becomes:(localdb) \ Execute the name , as shown below:

At this point, you might boring ask, "I don't seem to have the library yet." How did you connect directly? Can you connect? 」

SQL Server Express LocalDB is special, and when you try to connect LocalDB with SQL, it will be self-activating, and you don't have to hand-activate the LocalDB you want to connect to the other side of the line. "

When you connect with Management Studio (localdb) \v11.0 , you can start working with a " work manager " to see what you will find in the current login status Sqlservr.exe The program has been initiated, because this is a unique SQL Executive, so the ability to eat memory is similar to the previous, you just have to think of the LocalDB as a stand-alone SQL Server Express to do the same thing!

The interface and all the features will be exactly the same as SQL Server Express:

If you want to connect LocalDB with an older version of Management Studio (earlier than SQL 2008), it's a little annoying, you have to start with SqlLocalDB.exe's start command to activate LocalDB named Executive. , and then use the Info command to get the name of the pipe that performs the line (pipe name):

Start v11.0
Info v11.0

Please note : Only the LocalDB that have been initiated will have a pipe name, and each time a reboot will have different pipe names, which is also a troublesome place. So it's a little easier to recommend that you change your SQL Server Management Studio.

Here is the connection I used to connect the LocalDB with SQL Server Management Studio:

The simplest way to connect LocalDB with a. NET program is to connect to the current user's own self -operation, and in the case of a non-specified repository, its connection string is as follows:

server= (localdb) \v11.0; Integrated security=true

Please note : Each of the executive bodies is executed in different ways with different user identities, so the UserA and UserB will be completely different from each other when the above string is used in the same host machine, and so on.

If you want to specify an information library connection, you can refer to the following string:

server= (LocalDB) \v11.0 attachdbfilename=D:\Data\MyDB1.mdf

If you want to connect to a shared named executive, the format of the Server parameters in the connection string must be different, as in the following example:

(localdb)\. \Projectsshare

Stop SQL Server Express LocalDB

We already know that SQL Server Express LocalDB will be self-initiated when the user tries to connect, but when does it stop doing it? There are two ways to actually stop doing it:

    1. As long as there is no Active connection to the body, a few minutes of the action will automatically stop (the program disappears)
    2. Through the SqlLocalDB.exe tool program, you can force a specific command to stop, as follows:
      SqlLocalDB.exe Stop v11.0

SQL Server Express LocalDB compare to other versions of SQL Server

Prior to SQL Server 2012, SQL Server had different versions of the different executive environments, and there were different restrictions on how to perform them, such as:

    • SQL Server Enterprise (Enterprise Edition, suitable for a large amount of information or high availability environment)
    • SQL Server Standards (Standard Edition, suitable for general Information warehouse environment)
    • SQL Server Express (lightweight version, suitable for the environment of a single machine or a small amount of repositories)
    • SQL Server Compact (simplified, aka SQL CE, for inline or embedded system environments)

And what is the location of SQL Server Express LocalDB? I will re-order it according to the complexity of its repository system as follows:

    • SQL Server Enterprise > Standard > Express > LocalDB > Compact

Because SQL Server Express LocalDB is similar to SQL Server R2 Express in front edition, the limitations are:

    • LocalDB's executive order is set to sql_latin1_general_cp1_ci_as, not to change.
      • But it supports the hierarchy of information , the level of the material and the order of the formula.
      • That is to say, you simply specify the order when you set up the repository , or you can load other library files that have been moved, or the original files from other repositories will not have problems.
      • The self-contained repositories follow the information and tempdb sequencing rules that are determined by the Autonomous library order.
    • LocalDB is not allowed to repeat the subscribers for the merged type.
    • LocalDB does not support FILESTREAM.
    • LocalDB pin to Service Broker only allowed Nin column.

Experience sharing

This edition of SQL Server Express LocalDB is really great, so you can create different repositories at any time, so that developers can test all the new features of SQL Server 2012, and not be afraid of destroying the existing development library environment, and so on.

In addition to developing outside the environment, it can also be very handy for virtual machines with multiple sites on the same host machine, because different application sets or native applications can be very convenient to create unique, completely non-web site or application program to develop the conflict, and radically reduce the SQL Server in the end of the whole. The management complexity of the Express, but also greatly enhance the convenience of the information warehouse!

In addition, it is actually more convenient for developers to launch and release the Code first, because the repository can be fully executed in its own identity without having to open the Management Studio again, so it is not necessary to open the system. Pre-set security or create a library, and so on, through the unique implementation of the body and do not worry about using code first to launch a program to run the towed to a multi-user development repository, it is very easy to set up a test repository on the computer automatically.

Connected

    • Download Microsoft SQL Server Express
    • SQL Server Express LocalDB (MSDN)
    • SqlClient support for LocalDB (MSDN)
    • Sqllocaldb Utility
    • Introducing LocalDB, an improved SQL Express
    • SQL Server LocalDB Management Tour

Film Teaching and Learning

The following recording is a multi-odd Digital Creative Co., Ltd. in 2012/11/07 in the company's internal technology sharing video, this 50 minutes of sharing includes SQL Server Express LocalDB, Management LocalDB the method and trap, the perception Vis UAL Studio 2012 's repository management tools, as well as daily notes on the use of LocalDB, etc.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.