If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Command to drop orphaned user

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-26-07, 10:09
mdx34 mdx34 is offline
Registered User
 
Join Date: Oct 2004
Posts: 238
Command to drop orphaned user

What is the command to delete/drop a database user from a database ? I know I can delete them from the GUI but is there a command to delete them from a command line ?

AIX 5.2 DB2 8.2 FP3

Thanks.
Reply With Quote
  #2 (permalink)  
Old 03-26-07, 13:31
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
What do you mean delete/drop a user from a database? Do you mean break their connection? Or do you mean revoke the user from total access to the DB (i.e. delete their username/password)?

Andy
Reply With Quote
  #3 (permalink)  
Old 03-26-07, 14:12
mdx34 mdx34 is offline
Registered User
 
Join Date: Oct 2004
Posts: 238
I have backed-up a database on server1 and restored it to server2. The user that belongs to the server1 is still in the database even though it doesn't have access to the database anymore on the server2 since the same O/S user doesn't exist on the server2 (The user now is orphaned).

How can I remove/delete this user using command line ?
Reply With Quote
  #4 (permalink)  
Old 03-26-07, 14:25
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
It depends on what that user is defined through GRANT to be able to do. You will need to execute 1 or more REVOKE commands based on what the user has right on. This is what the GUI is doing.

Andy
Reply With Quote
  #5 (permalink)  
Old 03-26-07, 14:55
mdx34 mdx34 is offline
Registered User
 
Join Date: Oct 2004
Posts: 238
May be I am not making myself clear. If you have access to GUI, you can open the Control Center and drill down to the "Users and Group objects" then select "DB Users" on a database. On the right of the page you have the database users listed under the "Name". Then, you can just right click on the username and choose "Remove" which removes the user from the database.

Is there a command that would do the remove part through the command line ?. The database user is not the db2 instance owner but any other user.
Reply With Quote
  #6 (permalink)  
Old 03-26-07, 15:17
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
I understand what you were doing in the GUI. I did the same thing, but it does not have an option to "View SQL" like the GUI does in a lot of other places. So I have a monitor tool that I used to monitor the dynamic SQL. The GUI actually checks what rights the user has been granted and then revokes them with as many revoke statements as necessary.

Andy
Reply With Quote
  #7 (permalink)  
Old 03-26-07, 15:28
mdx34 mdx34 is offline
Registered User
 
Join Date: Oct 2004
Posts: 238
So, there is no command to remove the DB user from the command line.
Reply With Quote
  #8 (permalink)  
Old 03-26-07, 15:30
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
No. There is no single command. Just a bunch of REVOKEs.

Andy
Reply With Quote
  #9 (permalink)  
Old 03-26-07, 15:42
mdx34 mdx34 is offline
Registered User
 
Join Date: Oct 2004
Posts: 238
Thanks...............I was asking a command from DB2 software not from people who create their own..........Thanks again...........
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On