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 ?
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.
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.