Last active
May 27, 2018 22:46
-
-
Save angoca/0729bf7919fa1742e17e6b553fee5ba8 to your computer and use it in GitHub Desktop.
Get all authorization for a given user in DB2 LUW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Returns all privileges on a database granted to a user. | |
# The user is passes as first parameter. | |
# | |
# Author: Andres Gomez Casanova (AngocA) | |
# Version: 2016-08-02 | |
# Made in COLOMBIA | |
DBUSER=$1 | |
for i in COLAUTH DBAUTH INDEXAUTH LIBRARYAUTH MODULEAUTH PACKAGEAUTH PASSTHRUAUTH ROLEAUTH ROUTINEAUTH SCHEMAAUTH SEQUENCEAUTH TABAUTH ; do | |
echo ">>$i<<" | |
db2 -x "select distinct '$i' as table, varchar(grantee, 32) as user from syscat.$i where upper(grantee) like upper('${DBUSER}%')" | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Creation of the gist that returns all privileges for a given user.