471,831 Members | 1,633 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,831 software developers and data experts.

script to automate table grants like a current user?

aj
DB2 WSE LUW 8.1 FP5
Red Hat AS 2.1

I would like to grant a new database user the same privileges
(across many tables and views) that a current user has.

Rather than doing it by hand, might anyone have a script that
automates this?

TIA

aj
Nov 12 '05 #1
2 1577
Write a query using "union all" selecting the data from the (10)
authorization tables. Use literals in the query to build the
authorization statements and include a statement terminator literal at
the end of each output row. Case constructs can be used to turn encoded
authorizations back into literals for the statements you are
constructing. Use the current user as a predicate to match
authorizations to a specific user.

Ship the output to a file then read it back into the command processor
to execute your statements.

Phil Sherman
aj wrote:
DB2 WSE LUW 8.1 FP5
Red Hat AS 2.1

I would like to grant a new database user the same privileges
(across many tables and views) that a current user has.

Rather than doing it by hand, might anyone have a script that
automates this?

TIA

aj

Nov 12 '05 #2
Ian
aj wrote:
DB2 WSE LUW 8.1 FP5
Red Hat AS 2.1

I would like to grant a new database user the same privileges
(across many tables and views) that a current user has.

Rather than doing it by hand, might anyone have a script that
automates this?


db2look -x ... | sed -e 's/OLDUSER/NEWUSER'

:-)
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Richard Holliingsworth | last post: by
1 post views Thread by Tim Pascoe | last post: by
2 posts views Thread by Federica T | last post: by
3 posts views Thread by muzamil | last post: by
reply views Thread by YellowAndGreen | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.