Solved

Question about Sql Accounts and Deletion Management

Posted on 2016-09-21
1
64 Views
Last Modified: 2016-09-23
Question about Sql users.  I have a sql user that is added in the security section of the actual database.  I have the same user located in the instance level of security.  I deleted the user at the instance level but the user remained at the database level.  What is the proper way to delete a user if I totally want to rid the instance and all databases of this user login.

Also, all of the users in question should not be a owner of the database.

Question.... is there any danger in data being inaccessible after deletion of these users.

also, if i happen to delete a database owner..... i can always reassign that role to another user from an SA login.... Please verify.
0
Comment
Question by:jamesmetcalf74
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 50

Accepted Solution

by:
Vitor Montalvão earned 500 total points
ID: 41808899
I have a sql user that is added in the security section of the actual database.  I have the same user located in the instance level of security.  I deleted the user at the instance level but the user remained at the database level.  
That's because the first is a SQL Login and the second a Database User.

What is the proper way to delete a user if I totally want to rid the instance and all databases of this user login.
Proper way is to delete both (Login and database user).
DROP LOGIN <loginName>
GO
USE databaseName
DROP USER <userName>

Open in new window


Question.... is there any danger in data being inaccessible after deletion of these users.
For user that user won't be able to access the data anymore but others users still can. Just be sure you let at least one login with sysadmin server role to fix the things if needed.

also, if i happen to delete a database owner..... i can always reassign that role to another user from an SA login
True. For that run the following:
USE DatabaseName
EXEC sp_changedbowner 'UserName'

Open in new window

1

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question