Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does SQL Server 2012 create single user databases by default?

When I create a database - it creates it as (single user):

  1. Why is that my default? Do I have it in my settings?
  2. How do I change an existing database from single to multi?
like image 488
Bick Avatar asked Dec 26 '22 00:12

Bick


1 Answers

Whenever you create a new database, what you get is a copy of the model database, so it sounds like your model database has been set to single user.

When a CREATE DATABASE statement is issued, the first part of the database is created by copying in the contents of the model database. The rest of the new database is then filled with empty pages.

If you modify the model database, all databases created afterward will inherit those changes. For example, you could set permissions or database options, or add objects such as tables, functions, or stored procedures.

(My emphasis)

To change a database back to concurrent usage, run:

ALTER DATABASE <dbName> set multi_user

Replacing <dbName> with the name of the database to change.

like image 149
Damien_The_Unbeliever Avatar answered Dec 28 '22 13:12

Damien_The_Unbeliever