3

I have sql server 2005, I need to create separate database login to support engineer of my software vendor to access their own database. My only worry is deny him to take backup from our database while he connected remotely to resolve any incident in the application.

To sum up,

1- How to create login with access to specific database only 2- How to monitor his activity on database (what query he runs, is he try to took any backup and when) 3-Deny Any backup and restore task (I want to keep this only to sysadmin)

Leigh Riffel
23.9k17 gold badges80 silver badges155 bronze badges
asked Dec 11, 2012 at 16:13
0

1 Answer 1

3

I - To create a login with access to specific database only:

  1. Use SSMS and connect to the SQL server instance
  2. Open Security -> right click Logins -> New Login (e.g. login named SE)

enter image description here

3 Enter the login details. In Server Roles, make sure only 'public' is checked

enter image description here

4 In User Mapping, make sure only the vendor database is selected. enter image description here

If public role for the vendor database is not enough, grant the necessary permissions but only on the vendor database

Another solution is to deny access to all databases and then grant just to the vendor database

DENY VIEW ANY DATABASE TO [SE]

See more info here: http://msdn.microsoft.com/en-us/library/ms177518.aspx

II- How to monitor his activity on database (what query he runs, is he try to took any backup and when)

I suggest using some third party tools. Transaction logs don't capture info about executed queries

III-Deny Any backup and restore task (I want to keep this only to sysadmin)

Having public role will prevent the user to backup or restore databases

he'll get the following messages when he tries to backup or restore a database

enter image description here

enter image description here

T-SQL statement to deny creating backups is:

DENY BACKUP ANY DATABASE to [SE]

answered Dec 17, 2012 at 9:36
1
  • Does DENY BACKUP ANY DATABASE actually exist in SQL Server? I usually have to create a server trigger on CREATE DATABASE to add DENY BACKUP to each specific database... Commented Aug 13, 2014 at 11:18

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.