How to duplicate/clone a user in ANOTHER database?
I have found some hints on how to duplicate a user (with the same privileges and grants) on the SAME database.
But how do I clone a user from Database 1 on computer A into a Database 2 on computer B ?
Can I somehow output the current CREATE USER statement and all GRANTS and additional (role) assignments
into a file and perfom this creation script on the other, new Database?
This script must be fault tolerant. If the original tablespace does not exist then it should either create the necessary tablespace
or prompt for another. If TABLEs for GRANTing do not exist just a warning should be outputted but the script should not aborted.
Furthermor assume the user clone "todo" list consist of:
CREATE USER
GRANT 1
GRANT 2
GRANT 3
A smart script should be applicable a second time even when user does exist but e.g. GRANT2 not.
So in such a situation warnings for CREATE USER, GRANT 1 and GRANT 3 should be displayed but GRANT 2 should be executed.
Is there such an advanced tool/script for user cloning?
As second best minimum (complete !) step-by-step cooking recipe on how to do this manually are appreciated as well.
Peter