Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2004
    Posts
    268

    Unanswered: 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.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    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

  3. #3
    Join Date
    Oct 2004
    Posts
    268
    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 ?

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    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

  5. #5
    Join Date
    Oct 2004
    Posts
    268
    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.

  6. #6
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    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

  7. #7
    Join Date
    Oct 2004
    Posts
    268
    So, there is no command to remove the DB user from the command line.

  8. #8
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    No. There is no single command. Just a bunch of REVOKEs.

    Andy

  9. #9
    Join Date
    Oct 2004
    Posts
    268
    Thanks...............I was asking a command from DB2 software not from people who create their own..........Thanks again...........

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •