Skip to content

Instantly share code, notes, and snippets.

@angoca
Last active May 27, 2018 22:46
Show Gist options
  • Save angoca/0729bf7919fa1742e17e6b553fee5ba8 to your computer and use it in GitHub Desktop.
Save angoca/0729bf7919fa1742e17e6b553fee5ba8 to your computer and use it in GitHub Desktop.
Get all authorization for a given user in DB2 LUW
#!/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
@angoca
Copy link
Author

angoca commented Aug 2, 2016

Creation of the gist that returns all privileges for a given user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment