Controlling visibility of databases and server level setting by Contained Database

Introduction:

Contained Database is a new feature of SQL Server 2012. A contained database is a database that is isolated from other databases and from the instance of SQL Server that hosts the database. SQL Server supports contained database users for both Windows and SQL Server authentication.

Issue:

  1. Unauthorized logins can see list of databases and names.
  2. Unauthorized logins can see few instance level settings and details.
  3. During the migration need to migrate logins and users
  4. Dual work creating login and user

Steps to created contained database and user

  1. Change the setting at instance level.

Right click on instance → Properties→ Advanced Enable Contained Databases true

                               

 

Else we can run the command to change instance level setting.

Command:  sp_configure ‘contained database authentication’,1

GO

RECONFIGURE

GO

  1. Create new database and with containment type ‘Partial’

3.Create user on database

Expand the contained database à security user

New user

Right click Users → new user (user id and password)

 

 

Provide permissions whatever needed

How to connect contained database.

  1. Click connect and enter username and password.

 

 

  1. Please mention contained database name at the connect to database
  2. Once connected that person can see only that particular database (contained database which that login has permission only)

 

 

Conclusion:

We can control of visibility of all databases names which are available in instance, isolated database connections, server level settings and during migration not required to move logins separately

 

Recent Posts

Start typing and press Enter to search