Question

What is the benefit of creating a named instance in SqlLocalDB instead of using the default v11.0 instance? In my scenario I am attaching a database file using AttachDbFileName option in connection string.

A helper question: is it possible to have different settings for different LocalDB instances? If so, what kind of settings (I read that you cannot change eg. collation)?

Was it helpful?

Solution 2

I can see two possible benefits, performance and ability to control your configuration.

LocalDB is limited the same way as other SQL Express instances, CPU and RAM limits are applied per-instance. If your application uses its own instance it will get it all for itself and won't need to share with other applications. Using default instance means your application has to share with other apps using default instance.

You might also use named instance if you need to make any special instance-wide configuration that might break other applications. Or if you're concerned that some other misbehaving application might make changes to the default instance that break your application, and have your customers blame you. Works both ways :-)

OTHER TIPS

Be aware that you can only install one default instance but you can install multiple named instances. It is better to install only the default instance per host unless you have a special need to install multiple SQL Server instances on the same host, such as running different versions concurrently, clustering or other isolation requirements. Any additional instance must be named (obviously for differentiation reasons).

The underlying difference between a default and named instance is mostly a matter of network connectivity. Clients can connect to the default instance using only the host name over the well-known 1433 port. To connect to a named instance, clients specify the host and instance name (e.g. "MyHost\My_Instance") and the SQL Server Browser service returns the port the named instance is listening on.

In the real world, the reasons for having multiple instances varies from organization to organization. Here are some of the most common reasons:

Application functional or load testing

  • Load Testing - Ability to have multiple code bases loaded, coordinate stopping the needed instances to perform load testing, conduct the load testing then restart all of the instances once you are complete. Functional Testing
  • Ability to have multiple code bases and be able to test independently with a pre-allocated amount of resources.

Server Consolidation

  • One of the recent trends is consolidating multiple instances of SQL Server on to a single server. With multiple SQL Server instances, it is possible to perform full SQL Server backups and restorations to a single instance to maintain the same functionality as the original server.

Internal Hosting\Departmental Server Sharing

  • With SQL Server originally considered a departmental solution, it is possible to have multiple instances of SQL Server on 1 physical server to equally share the server's resources (large number of CPUs and memory).
  • This scenario is ideal for charge backs to the departments for organizations following that paradigm.

Security

  • Multiple instances are ideal for those pesky third party applications that require elevated SQL Server privileges where you do not want to commingle applications on the same instance.

Demos

  • Multiple instances are ideal to support demo's where it is necessary to demonstrate a particular application and how it affects SQL Server.

Sources :

Nice to read :

If you wanted multiple instances of SQL Server running on the same machine, you would have to name them to differentiate them. Other than that there's no real "benefit", as far as normal usage goes.

Multiple instances are useful if you need different server configurations, or even different versions. Say for example that you have a database made for Sql 2008 and want a new one for a new application with Sql 2012. You could host both on the same machine and use features for the most advanced version while keeping the old one working as it is.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top