I need to give to user TARGETUSER the rights to select/insert/update to all tables of user SOURCEUSER (I can figure this all out from here) and the ability to run all their stored procedures.
Basically, I wouldn't complain if I can give TARGETUSER the ability for all non-ddl activity with SOURCE_USER's objects. How do I do this?
To generate SQL script you could use the following, similar to the solution suggested by DCookie
Generally, I would suggest using roles to avoid granting access rights for each user.
If using roles, run the following SQL as user you are copying roles from. You could also include other options like
admin_option
anddefault_role
.Alternatively you could query
dba_role_privs
to get the roles of a specific user:You can write a simple procedure to do this:
Not sure exactly what else you're asking for. You can modify the above to add additional grants and/or object_types for the privileges you want to provide to targetuser. As @stili implies, you can do a lot with roles, but be careful - some permissions do not work when granted via roles.