What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

To use SQL Server Shared Memory, connect from a client running on the same Windows computer as the Database Engine, make sure Shared Memory is enabled for both the client and the target SQL Server instance, and verify the result from the session itself. For a default instance, start with Server=(local);Database=AdventureWorks;Trusted_Connection=True;, then run the query below. Replace the example database with one that exists on your server.

SELECT net_transport
FROM sys.dm_exec_connections
WHERE session_id = @@SPID;

A Shared Memory connection should report Shared memory. A local-looking server name alone does not prove which transport was selected.

What Shared Memory does

Shared Memory is a SQL Server client/server protocol for communication between processes on the same computer. Unlike TCP/IP, it does not connect to a remote host through the network stack. It is useful for local development, diagnostics, or an application and database that intentionally run on one Windows host. Microsoft documents it as available when the client connects to a Database Engine instance on the same computer: Configure client protocols.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

It is not a remote-access method: localhost always means the machine running the client process. If the client is on another computer, localhost points to that other computer, not to the SQL Server host.

Shared Memory avoids network transport, but that does not guarantee a noticeable application speedup. Query execution, disk I/O, locking, serialization, and client work often matter more than the transport. Choose it for local-only behavior when that is the goal, not as a performance promise.

Enable Shared Memory on both sides

Client and server protocol settings are separate. Check both before troubleshooting the connection string.

Enable it for the SQL Server instance

  1. Open SQL Server Configuration Manager.
  2. Expand SQL Server Network Configuration.
  3. Select Protocols for <instance name> for the instance you intend to use.
  4. Confirm Shared Memory is enabled; enable it if necessary.
  5. Follow any restart prompt. If the change appears not to take effect, restart the relevant SQL Server service according to the instructions for your SQL Server version.

Enable it for the client

  1. In Configuration Manager, find the client network-protocol settings and open Client Protocols.
  2. Confirm Shared Memory is enabled.
  3. If you change client protocol settings, open a fresh client session before testing.

The exact node names vary with SQL Server generation and installed client components. Microsoft’s current page describes client protocol configuration in Configuration Manager and notes that protocol order, aliases, and application-specific choices can affect selection. Newer applications may use Microsoft.Data.SqlClient or Microsoft ODBC Driver for SQL Server rather than the legacy SQL Native Client, so do not assume every client has identical configuration labels or connection-string syntax. Configuration Manager is not itself a substitute for installing the appropriate client libraries.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Enabling Shared Memory does not expose the instance to other computers. Conversely, if you disable TCP/IP and Named Pipes and leave only Shared Memory enabled, ordinary client access will be limited to processes on the same computer.

Use a local server name

For a default instance, try one of these local names:

Server=(local);Database=AdventureWorks;Trusted_Connection=True;
Server=localhost;Database=AdventureWorks;Trusted_Connection=True;
Server=.;Database=AdventureWorks;Trusted_Connection=True;

For a named instance, include the actual instance name. For example, if it is named SQLEXPRESS:

Server=(local)SQLEXPRESS;Database=AdventureWorks;Trusted_Connection=True;
Server=.SQLEXPRESS;Database=AdventureWorks;Trusted_Connection=True;

Do not assume that SQLEXPRESS, a default instance, or the example AdventureWorks database is installed. Use the instance and database that exist on your system. A wrong instance name can make a sound connection string appear to fail or reach a different instance than expected.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some SQL Server clients support a protocol-specific server-name prefix such as lpc: for Shared Memory. Support and syntax depend on the client tool and driver. Do not treat that legacy form as universal; the broadly useful approach is to use a local name and inspect net_transport in the resulting session.

Examples in common clients

SQL Server Management Studio

In the connection dialog, enter (local) for a default instance or .SQLEXPRESS for the example named instance. Connect with valid credentials, open a query window on that connection, and run the verification query below. The query must run in the session whose transport you want to check.

ADO.NET-style application

var connectionString =
    "Server=(local);Database=AdventureWorks;" +
    "Trusted_Connection=True;";

With Microsoft.Data.SqlClient, this is also a common form:

var connectionString =
    "Server=(local);Database=AdventureWorks;" +
    "Integrated Security=True;";

Use the syntax documented for the provider your application actually loads; connection-string keywords and protocol controls are not guaranteed to be identical across providers and versions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

sqlcmd

For a default instance:

sqlcmd -S "(local)" -E

For the example named instance:

sqlcmd -S ".SQLEXPRESS" -E

At the prompt, run:

SELECT net_transport
FROM sys.dm_exec_connections
WHERE session_id = @@SPID;
GO

Client versions differ in their options for specifying a protocol directly. Microsoft notes that some clients, including sqlcmd.exe, can specify protocol information in connection details; check the syntax for the installed version rather than assuming a prefix works everywhere.

Verify the transport actually in use

Run this query in the connection being tested:

SELECT
    session_id,
    net_transport,
    protocol_type,
    encrypt_option,
    auth_scheme,
    client_net_address,
    local_net_address,
    local_tcp_port
FROM sys.dm_exec_connections
WHERE session_id = @@SPID;

net_transport reports the physical transport for the connection. Typical values include Shared memory, TCP, and Named pipe. With Multiple Active Result Sets (MARS), additional logical connection rows can report Session; inspect the row for the current session. The address and port columns are most useful for TCP connections and may not be populated meaningfully for Shared Memory. See Microsoft’s reference for sys.dm_exec_connections.

Filtering on @@SPID makes this a practical self-check. Broader inspection of connections can require elevated permissions, such as VIEW SERVER STATE or, on newer SQL Server versions, VIEW SERVER PERFORMANCE STATE, depending on version and platform.

If it still reports TCP or the connection fails

  1. Confirm where the client runs. The client process and Database Engine must be on the same computer for Shared Memory. This excludes a remote workstation and is not automatically satisfied by a VM, container, or cloud endpoint; those boundaries and configurations are environment-dependent.
  2. Confirm the service and instance. Make sure the Database Engine service is running and verify the actual instance name. A successful login to the wrong instance is still the wrong test.
  3. Check both protocol settings. Shared Memory must be enabled in the client configuration and for the target instance. A protocol disabled on one side cannot be used.
  4. Remove TCP-specific targeting. An address such as 127.0.0.1 is a TCP-style endpoint, not a Shared Memory example. Also check for an explicit TCP prefix or endpoint syntax.
  5. Inspect aliases and protocol order. A client alias can map a server name to another endpoint or protocol. Enabled protocol order can affect which one a client tries. Review client aliases and the protocol settings in Configuration Manager.
  6. Start a genuinely new session. Applications may pool connections. Close and reopen the application, or clear/recycle the provider’s pool when supported, then reconnect and rerun the DMV query. The query reports a connection’s transport; it does not change it.
  7. Separate transport errors from login and database errors. If TCP works but Shared Memory does not, focus on Shared Memory configuration, targeting, and client behavior. If transport connects but authentication fails, check credentials and authentication configuration. If login succeeds but the requested database cannot be opened, verify the database name and access. These are different failure stages.

If all usable protocols are disabled or unavailable, a local connection can fail even while SQL Server is running. If Shared Memory is disabled but another protocol is enabled, the client may use that protocol instead, depending on selection rules and the client. SQL Server Browser and named-instance resolution behavior can vary by configuration; test the exact instance name and inspect the instance’s protocol settings rather than assuming discovery is the cause.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Shared Memory, TCP/IP, and Named Pipes

Consideration Shared Memory TCP/IP Named Pipes
Same-computer connection Yes Yes Yes
Remote connection No Yes Can support network scenarios, subject to configuration
Useful when testing production-like networking No Yes Sometimes, depending on deployment
Best fit for a local-only deployment Often Possible, but network protocol remains enabled Possible, depending on requirements

Choose Shared Memory when local-only connectivity is intentional. Prefer TCP/IP if the application may move to another host, if network behavior or encryption must be tested, or if clients span operating systems or network boundaries. Named Pipes is a distinct protocol, not another name for Shared Memory. Microsoft lists TCP/IP, Named Pipes, and Shared Memory as separate client protocols: client protocol configuration.

Shared Memory is a transport choice, not an authentication or authorization policy. Continue to use appropriate SQL Server logins or integrated authentication, database permissions, and encryption settings for the provider and deployment. The DMV’s encrypt_option can help inspect the current session, but a local transport should not be treated as a blanket security guarantee.

Frequently Asked Questions

Does localhost always use Shared Memory?

No. A local name can allow a local connection, but aliases, protocol settings, explicit endpoint syntax, and the client can affect selection. Check net_transport in the connected session.

Can I use Shared Memory from another computer?

No. Shared Memory is for a client process and SQL Server Database Engine on the same computer. Use a network protocol such as TCP/IP for a remote client.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does Shared Memory work with Azure SQL Database?

No, not as a local Shared Memory connection: Azure SQL Database is a remote service, not a Database Engine process on the client computer.

Do I need to restart SQL Server after enabling Shared Memory?

The exact restart behavior depends on the SQL Server version and the change. Follow any Configuration Manager prompt; if the change does not take effect, restart the relevant service as directed for that version.

Is Shared Memory faster than TCP/IP?

It avoids network transport on the same computer, but that alone does not establish a meaningful application-level speed advantage. Query workload and other costs can dominate.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.