How to enable users to access only specific databases (MSSQL)

Source: Internet
Author: User
Tags mssql

Background

There are multiple vendor databases on the client's SQL Server instance, each of which is maintained by the respective factory provider,

In order to limit the maintenance personnel of different vendors to access their own databases, it is necessary to restrict the permissions to each vendor so that they can log on to SQL Server only to see the authorized database and not see other databases.

Solution Solutions

1. Create a different login name for each vendor (see below for a vendor example)

2. Add the login name to the public server role and click OK

3. Assign the Dbowner of the database to be authorized to that user

 Use [xjcs] Go EXEC dbo.sp_changedbowner N'provider1'

When you log in to SQL Server with ' provider1 ', you can only see the specified user database (except the system database)

Description

I previously wanted to set up a user mapping for the login in the 2nd step to implement this requirement, such as, but no effect, after logging into SQL Server or not seeing the user database,

So the above method is used:

How to enable users to access only specific databases (MSSQL)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.