Sql server express localdb
Содержание:
- RDBMS manageability
- Description
- Install LocalDB
- Scale limits
- Версии
- РазрешенияPermissions
- Permissions
- SQL Server editions
- Время существования соединения пользовательского экземпляраLifetime of a User Instance Connection
- Использование
- Scale limits
- Shared instances of LocalDB
- Пользовательские экземплярыUser Instances
RDBMS manageability
Feature | Enterprise | Standard | Web | Express with Advanced Services | Express |
---|---|---|---|---|---|
User instances | No | No | No | Yes | Yes |
LocalDB | No | No | No | Yes | No |
Dedicated admin connection | Yes | Yes | Yes | Yes with trace flag | Yes with trace flag |
SysPrep support 1 | Yes | Yes | Yes | Yes | Yes |
PowerShell scripting support2 | Yes | Yes | Yes | Yes | Yes |
Support for data-tier application component operations — extract, deploy, upgrade, delete | Yes | Yes | Yes | Yes | Yes |
Policy automation (check on schedule and change) | Yes | Yes | Yes | No | No |
Performance data collector | Yes | Yes | Yes | No | No |
Able to enroll as a managed instance in multi-instance management | Yes | Yes | Yes | No | No |
Standard performance reports | Yes | Yes | Yes | No | No |
Plan guides and plan freezing for plan guides | Yes | Yes | Yes | No | No |
Direct query of indexed views (using NOEXPAND hint) | Yes | Yes | Yes | Yes | Yes |
Automatic indexed views maintenance | Yes | Yes | Yes | No | No |
Distributed partitioned views | Yes | No | No | No | No |
Parallel indexed operations | Yes | No | No | No | No |
Automatic use of indexed view by query optimizer | Yes | No | No | No | No |
Parallel consistency check | Yes | No | No | No | No |
SQL Server Utility Control Point | Yes | No | No | No | No |
Buffer pool extension | Yes | Yes | No | No | No |
1 For more information, see Considerations for Installing SQL Server Using SysPrep.
2 On Linux, PowerShell scripts are supported, from Windows computers targeting SQL Servers on Linux.
Description
The LocalDB setup program uses the program to install the necessary files on the computer. Once installed, LocalDB is an instance of SQL Server Express that can create and open SQL Server databases. The system database files for the database are stored in the local AppData path, which is normally hidden. For example, . User database files are stored where the user designates, typically somewhere in the folder.
For more information about including LocalDB in an application, see Visual Studio Local Data Overview, Create a database and add tables in Visual Studio.
For more information about the LocalDB API, see SQL Server Express LocalDB Reference.
The utility can create new instances of LocalDB, start and stop an instance of LocalDB, and includes options to help you manage LocalDB.For more information about the utility, see SqlLocalDB Utility.
The instance collation for LocalDB is set to and cannot be changed. Database-level, column-level, and expression-level collations are supported normally. Contained databases follow the metadata and collations rules defined by Contained Database Collations.
Restrictions
-
LocalDB cannot be a merge replication subscriber.
-
LocalDB does not support FILESTREAM.
-
LocalDB only allows local queues for Service Broker.
-
An instance of LocalDB owned by the built-in accounts such as can have manageability issues due to windows file system redirection. Instead use a normal windows account as the owner.
Automatic and named instances
LocalDB supports two kinds of instances: Automatic instances and named instances.
-
Automatic instances of LocalDB are public. They are created and managed automatically for the user and can be used by any application. One automatic instance of LocalDB exists for every version of LocalDB installed on the user’s computer. Automatic instances of LocalDB provide seamless instance management. There is no need to create the instance; it just works. This feature allows for easy application installation and migration to a different computer. If the target machine has the specified version of LocalDB installed, the automatic instance of LocalDB for that version is available on the target machine as well. Automatic instances of LocalDB have a special pattern for the instance name that belongs to a reserved namespace. Automatic instances prevents name conflicts with named instances of LocalDB. The name for the automatic instance is MSSQLLocalDB.
-
Named instances of LocalDB are private. They are owned by a single application that is responsible for creating and managing the instance. Named instances provide isolation from other instances and can improve performance by reducing resource contention with other database users. Named instances must be created explicitly by the user through the LocalDB management API or implicitly via the app.config file for a managed application (although managed application may also use the API, if desired). Each named instance of LocalDB has an associated LocalDB version that points to the respective set of LocalDB binaries. The instance name of a LocalDB is sysname data type and can have up to 128 characters. (This differs from regular named instances of SQL Server, which limits names to regular NetBIOS names of 16 ASCII chars.) The name of an instance of LocalDB can contain any Unicode characters that are legal within a filename.A named instance that uses an automatic instance name becomes an automatic instance.
Different users of a computer can have instances with the same name. Each instance is a different processes running as a different user.
Install LocalDB
Install LocalDB through the installation wizard or by using the SqlLocalDB.msi program. LocalDB is an option when installing SQL Server Express LocalDB.
Select LocalDB on the Feature Selection/Shared Features page during installation. There can be only one installation of the LocalDB binary files for each major SQL Server Database Engine version. Multiple Database Engine processes can be started and will all use the same binaries. An instance of the SQL Server Database Engine started as the LocalDB has the same limitations as SQL Server Express.
An instance of SQL Server Express LocalDB is managed by using the utility. SQL Server Express LocalDB should be used in place of the SQL Server Express user instance feature, which was deprecated.
Scale limits
Feature | Enterprise | Standard | Web | Express with Advanced Services | Express |
---|---|---|---|---|---|
Maximum compute capacity used by a single instance — SQL Server Database Engine1 | Operating system maximum | Limited to lesser of 4 sockets or 24 cores | Limited to lesser of 4 sockets or 16 cores | Limited to lesser of 1 socket or 4 cores | Limited to lesser of 1 socket or 4 cores |
Maximum compute capacity used by a single instance — Analysis Services or Reporting Services | Operating system maximum | Limited to lesser of 4 sockets or 24 cores | Limited to lesser of 4 sockets or 16 cores | Limited to lesser of 1 socket or 4 cores | Limited to lesser of 1 socket or 4 cores |
Maximum memory for buffer pool per instance of SQL Server Database Engine | Operating System Maximum | 128 GB | 64 GB | 1410 MB | 1410 MB |
Maximum memory for Columnstore segment cache per instance of SQL Server Database Engine | Unlimited memory | 32 GB | 16 GB | 352 MB | 352 MB |
Maximum memory-optimized data size per database in SQL Server Database Engine | Unlimited memory | 32 GB | 16 GB | 352 MB | 352 MB |
Maximum memory utilized per instance of Analysis Services | Operating System Maximum | Tabular: 16 GB MOLAP: 64 GB | N/A | N/A | N/A |
Maximum memory utilized per instance of Reporting Services | Operating System Maximum | 64 GB | 64 GB | 4 GB | N/A |
Maximum relational database size | 524 PB | 524 PB | 524 PB | 10 GB | 10 GB |
1 Enterprise Edition with Server + Client Access License (CAL) based licensing (not available for new agreements) is limited to a maximum of 20 cores per SQL Server instance. There are no limits under the Core-based Server Licensing model. For more information, see Compute Capacity Limits by Edition of SQL Server.
Версии
Версия | Дата релиза | Дата окончания основной поддержки | Дата окончания расширенной поддержки | Поддерживаемые операционные системы |
---|---|---|---|---|
SQL Server 2005 Express Edition | 2005-11-07 | 2011-04-12 | 2016-04-12 | Windows 2000 Service Pack 4, Windows XP Service Pack 2, Windows Server 2003 Service Pack, Windows 7 Service Pack 1 |
SQL Server 2008 Express Edition | 2009-02-08 | 2014-07-08 | 2019-07-09 | Windows XP Service Pack 2, Windows XP Service Pack 3, Windows Vista, Windows Vista Service Pack 1, Windows Server 2003 Service Pack 2, Windows Server 2008 |
SQL Server 2008 R2 Express | 2010-04-16 | 2014-07-08 | 2019-07-09 | Windows XP, Windows Vista, Windows 7, Windows 8, Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2 |
SQL Server 2012 Express | 2012-05-14 | 2017-07-11 | 2022-07-12 | Windows Vista Service Pack 2, Windows 7, Windows 7 Service Pack 1, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2008 R2 SP1, Windows Server 2012, Windows Server 2012 R2 |
SQL Server 2014 Express | 2014-04-01 | 2019-07-09 | 2024-07-09 | Windows 7 Service Pack 1, Windows 8, Windows 8.1, Windows 10, Windows Server 2008 SP2, Windows Server 2008 R2 SP1, Windows Server 2012, Windows Server 2012 R2 |
SQL Server 2016 Express | 2016-06-01 | 2021-07-13 | 2026-07-14 | Windows 8, Windows 8.1, Windows 10, Windows Server 2012, Windows Server 2012 R2, Windows Server 2016 |
SQL Server 2017 Express | 2017-09-29 | 2022-10-11 | 2027-10-12 | Windows 8, Windows 8.1, Windows 10, Windows Server 2012, Windows Server 2012 R2, Windows Server 2016,
Red Hat Enterprise Linux 7.3 или 7.4, SUSE Enterprise Linux Server v12 SP2, Ubuntu 16.04LTS, |
РазрешенияPermissions
SQL Server Express LocalDB — это экземпляр, созданный пользователем для самостоятельного использования.An instance of SQL Server Express LocalDB is an instance created by a user for their use. Любой пользователь компьютера может создать базу данных с помощью экземпляра LocalDB, сохранив файлы в своем пользовательском профиле и запустив процесс со своими учетными данными.Any user on the computer can create a database using an instance of LocalDB, store files under their user profile, and run the process under their credentials. По умолчанию доступ к экземпляру LocalDB имеет только его владелец.By default, access to the instance of LocalDB is limited to its owner. Данные, содержащиеся в LocalDB, защищены средствами файловой системы.The data contained in the LocalDB is protected by file system access to the database files. Если файлы пользовательской базы данных хранятся в общей папке, то базу данных может открыть любой пользователь, имеющий доступ к этой папке, с помощью собственного экземпляра LocalDB.If user database files are stored in a shared location, the database can be opened by anyone with file system access to that location by using an instance of LocalDB that they own. Если файлы базы данных хранятся в защищенном месте, например в папке пользовательских данных, то базу данных может открыть только сам пользователь, а также администратор, обладающий правами доступа к данной папке.If the database files are in a protected location, such as the users data folder, only that user, and any administrators with access to that folder, can open the database. Файлы LocalDB могут быть одновременно открыты только одним экземпляром LocalDB.The LocalDB files can only be opened by one instance of LocalDB at a time.
Примечание
LocalDB всегда запускается в контексте безопасности пользователя. Это означает, что LocalDB никогда не будет запускаться с учетными данными группы локальных администраторов.LocalDB always runs under the users security context; that is, LocalDB never runs with credentials from the local Administrator’s group. То есть доступ ко всем файлам базы данных, используемыми экземпляром LocalDB, возможен по учетной записи их владельца-пользователя Windows, не учитывая принадлежности к группе локальных администраторов.This means that all database files used by a LocalDB instance must be accessible using the owning user’s Windows account, without considering membership in the local Administrators group.
Permissions
An instance of SQL Server Express LocalDB is an instance created by a user for their use. Any user on the computer can create a database using an instance of LocalDB, store files under their user profile, and run the process under their credentials. By default, access to the instance of LocalDB is limited to its owner. The data contained in the LocalDB is protected by file system access to the database files. If user database files are stored in a shared location, the database can be opened by anyone with file system access to that location by using an instance of LocalDB that they own. If the database files are in a protected location, such as the users data folder, only that user, and any administrators with access to that folder, can open the database. The LocalDB files can only be opened by one instance of LocalDB at a time.
Note
LocalDB always runs under the users security context; that is, LocalDB never runs with credentials from the local Administrator’s group. This means that all database files used by a LocalDB instance must be accessible using the owning user’s Windows account, without considering membership in the local Administrators group.
SQL Server editions
The following table describes the editions of SQL Server.
SQL Server edition | Definition |
---|---|
Enterprise | The premium offering, SQL Server Enterprise edition delivers comprehensive high-end datacenter capabilities with blazing-fast performance, unlimited virtualization1 , and end-to-end business intelligence — enabling high service levels for mission-critical workloads and end user access to data insights. |
Standard | SQL Server Standard edition delivers basic data management and business intelligence database for departments and small organizations to run their applications and supports common development tools for on-premises and cloud — enabling effective database management with minimal IT resources. |
Web | SQL Server Web edition is a low total-cost-of-ownership option for Web hosters and Web VAPs to provide scalability, affordability, and manageability capabilities for small to large scale Web properties. |
Developer | SQL Server Developer edition lets developers build any kind of application on top of SQL Server. It includes all the functionality of Enterprise edition, but is licensed for use as a development and test system, not as a production server. SQL Server Developer is an ideal choice for people who build and test applications. |
Express editions | Express edition is the entry-level, free database and is ideal for learning and building desktop and small server data-driven applications. It is the best choice for independent software vendors, developers, and hobbyists building client applications. If you need more advanced database features, SQL Server Express can be seamlessly upgraded to other higher end versions of SQL Server. SQL Server Express LocalDB is a lightweight version of Express that has all of its programmability features, runs in user mode and has a fast, zero-configuration installation and a short list of prerequisites. |
1
Unlimited virtualization is available on Enterprise Edition for customers with Software Assurance. Deployments must comply with the licensing guide. For more information, see our Pricing and Licensing page.
Время существования соединения пользовательского экземпляраLifetime of a User Instance Connection
В отличие от версий SQL Server, которые запускаются как службы, экземпляры SQL Server Express не нужно запускать и останавливать вручную.Unlike versions of SQL Server that run as a service, SQL Server Express instances do not need to be manually started and stopped. Каждый раз, когда пользователь входит в систему и подключается к пользовательскому экземпляру, экземпляр запускается, если он еще не запущен.Each time a user logs in and connects to a user instance, the user instance is started if it is not already running. Для баз данных пользовательских экземпляров задан параметр . Это позволяет автоматически завершать работу базы данных по истечении периода бездействия.User instance databases have the option set so that the database is automatically shut down after a period of inactivity. Запущенный процесс sqlservr.exe выполняется в течение ограниченного времени ожидания после закрытия последнего подключения с экземпляром. Таким образом его не нужно перезапускать при открытии другого подключения до истечения времени ожидания.The sqlservr.exe process that is started is kept running for a limited time-out period after the last connection to the instance is closed, so it does not need to be restarted if another connection is opened before the time-out has expired. Пользовательский экземпляр автоматически завершает работу, если до истечения времени ожидания не будет открыто новое подключение.The user instance automatically shuts down if no new connection opens before that time-out period has expired. Администратор системы на родительском экземпляре может устанавливать длительность времени ожидания для пользовательского экземпляра при помощи процедуры sp_configure, которая изменяет параметр user instance timeout.A system administrator on the parent instance can set the duration of the time-out period for a user instance by using sp_configure to change the user instance timeout option. Значение по умолчанию — 60 минут.The default is 60 minutes.
Примечание
Если в строке подключения используется со значением больше нуля, то пул подключений всегда будет поддерживать несколько открытых подключений, и пользовательский экземпляр не завершит работу автоматически.If is used in the connection string with a value greater than zero, the connection pooler will always maintain a few opened connections, and the user instance will not automatically shut down.
Использование
Варианты установки
Microsoft SQL Server Express представлен в вариантах:
- SQL Server Express с пакетом обновления
- Базовый экспресс-выпуск сервера базы данных, включающий функциональный модуль базы данных, который подходит для принятия удаленных подключений или удаленного администрирования. Доступен бесплатно.
- SQL Server Express c дополнительными сервисами
- Дополнительные возможности, имеющиеся в экспресс-выпуске, включая модуль базы данных, сервисы отчетности и полнотекстовый поиск. Доступен бесплатно при присоединении к программе Visual Studios Dev Essentials.
- SQL Server Express LocalDB
- Встраиваемый в приложения SQL Server Express с использованием LocalDB — упрощенной версии экспресс-выпуска. Доступен бесплатно в качестве одного из вариантов при скачивании SQL Server 2017 Express с пакетом обновления.
В бесплатной версии Express, 2005 года, был предложен следующий стандартный подход к вариантам установки. Как правило, установщики SQL 2005 Express поставляются со следующим согласованным соглашением об именовании:
- SQLEXPR.EXE
- Имеет установщики для 32-разрядных и 64-разрядных процессоров, но c базовыми установками.
- SQLEXPR32.EXE
- Имеет только установщик для 32-битных процессоров (все еще базовыми установками).
- SQLEXPRWT.EXE
- Имеет установщики для 32-разрядных и 64-разрядных процессоров и SQL Server Management Studio Express (SSMSE) (2008 R2).
- SQLEXPR_ADV.EXE
- Имеет основы и SQL Server Management Studio Express (SSMSE) + отчеты и полнотекстовые запросы.
- SQLEXPR_TOOLKIT.EXE
- Имеет основы SSMSE и Business Intelligence Development Studio (BIDS) .
Архитектура
Рисунок 1 — Архитектура Microsoft SQL Server Express
Внешний доступ предоставляется через слой протоколов SQL Server. Все операции в SQL Server могут быть выполнены путем обращения через определенный формат, называемый Tabular Data Stream (TDS). TDS протокол уровня приложения, используемый для передачи данных между сервером и клиентом. TDS может быть обернут другими физическими и транспортными протоколами, включая TCP/IP. Следовательно, доступ к SQL Server доступен и вне него. Архитектура можно увидеть на рисунке 1.
Кроме того, есть нативная поддержка Common Language Runtime (CLR), что позволяет эффективно использовать инструменты разработки Microsoft.
Scale limits
Feature | Enterprise | Standard | Web | Express withAdvanced Services | Express |
---|---|---|---|---|---|
Maximum compute capacity used by a single instance — SQL Server Database Engine1 | Operating system maximum | Limited to lesser of 4 sockets or 24 cores | Limited to lesser of 4 sockets or 16 cores | Limited to lesser of 1 socket or 4 cores | Limited to lesser of 1 socket or 4 cores |
Maximum compute capacity used by a single instance — Analysis Services or Reporting Services | Operating system maximum | Limited to lesser of 4 sockets or 24 cores | Limited to lesser of 4 sockets or 16 cores | Limited to lesser of 1 socket or 4 cores | Limited to lesser of 1 socket or 4 cores |
Maximum memory for buffer pool per instance of SQL Server Database Engine | Operating System Maximum | 128 GB | 64 GB | 1410 MB | 1410 MB |
Maximum memory for Columnstore segment cache per instance of SQL Server Database Engine | Unlimited memory | 32 GB | 16 GB | 352 MB | 352 MB |
Maximum memory-optimized data size per database in SQL Server Database Engine | Unlimited memory | 32 GB | 16 GB | 352 MB | 352 MB |
Maximum memory utilized per instance of Analysis Services | Operating System Maximum | 16 GB2 64 GB3 | N/A | N/A | N/A |
Maximum memory utilized per instance of Reporting Services | Operating System Maximum | 64 GB | 64 GB | 4 GB | N/A |
Maximum relational database size | 524 PB | 524 PB | 524 PB | 10 GB | 10 GB |
1 Enterprise Edition with Server + Client Access License (CAL) based licensing (not available for new agreements) is limited to a maximum of 20 cores per SQL Server instance. There are no limits under the Core-based Server Licensing model. For more information, see Compute Capacity Limits by Edition of SQL Server.
2 Tabular
3 MOLAP
To support scenarios where multiple users of the computer need to connect to a single instance of LocalDB, LocalDB supports instance sharing. An instance owner can choose to allow the other users on the computer to connect the instance. Both automatic and named instances of LocalDB can be shared. To share an instance of LocalDB, a user selects a shared name (alias) for it. Because the shared name is visible to all users of the computer, this shared name must be unique on the computer. The shared name for an instance of LocalDB has the same format as the named instance of LocalDB.
Only an administrator on the computer can create a shared instance of LocalDB. A shared instance of LocalDB can be unshared by an administrator or by the owner of the shared instance of LocalDB. To share and unshared an instance of LocalDB, use the and methods of the LocalDB API, or the share and unshared options of the utility.
Пользовательские экземплярыUser Instances
Пользовательский экземпляр — это отдельный экземпляр ядра базы данных SQL Server Express, который создается родительским экземпляром SQL Server Express.A user instance is a separate instance of the SQL Server Express database engine that is generated by a parent instance of SQL Server Express. Основное назначение пользовательского экземпляра состоит в том, чтобы дать возможность пользователям, эксплуатирующим операционную систему Windows под управлением учетной записи пользователя с минимальными разрешениями, получить права системного администратора () по отношению к экземпляру SQL Server Express на своем локальном компьютере.The primary goal of a user instance is to allow users who are running Windows under a least-privilege user account to have system administrator () privileges on the SQL Server Express instance on their local computer. Пользовательские экземпляры не предназначены для пользователей, которые имеют права системных администраторов на своих собственных компьютерах.User instances are not intended for users who are system administrators on their own computers.
Пользовательский экземпляр создается на основе исходного экземпляра SQL Server или SQL Server Express от имени пользователя.A user instance is generated from a primary instance of SQL Server or SQL Server Express on behalf of a user. Он функционирует как пользовательский процесс в контексте безопасности Windows самого пользователя, а не службы.It runs as a user process under the Windows security context of the user, not as a service. Применение имен входа SQL Server не разрешено; поддерживаются только имена входа Windows.SQL Server logins are disallowed; only Windows logins are supported. Благодаря этому исключается возможность вносить с помощью программного обеспечения, применяемого в рамках пользовательского экземпляра, такие общесистемные изменения, разрешения на выполнение которых пользователь не имеет.This prevents software executing on a user instance from making system-wide changes that the user would not have permissions to make. Пользовательский экземпляр именуется также дочерним или клиентским экземпляром, а иногда обозначается с помощью сокращения RANU (run as normal user — эксплуатируемый с правами обычного пользователя).A user instance is also known as a child or client instance, and is sometimes referred to by using the RANU acronym («run as normal user»).
Каждый пользовательский экземпляр изолирован от своего родительского экземпляра и от других пользовательских экземпляров, работающих на том же компьютере.Each user instance is isolated from its parent instance and from other user instances running on the same computer. Базы данных, установленные для пользовательских экземпляров, открываются только в однопользовательском режиме; возможность подключения к ним нескольких пользователей отсутствует.Databases installed on user instances are opened in single-user mode only; multiple users cannot connect to them. Репликация, распределенные запросы и удаленные соединения для пользовательских экземпляров не разрешены.Replication, distributed queries and remote connections are disabled for user instances. Пользователи, подключенные к пользовательскому экземпляру, не имеют каких-либо особых прав по отношению к родительскому экземпляру SQL Server Express.When connected to a user instance, users do not have any special privileges on the parent SQL Server Express instance.