If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > User Account

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-22-05, 13:57
tuvarsha tuvarsha is offline
Registered User
 
Join Date: Dec 2005
Posts: 39
User Account

Do I need to use the syscat.dbauth table to retrieve useraccounts and groupnames in DB2 UDB for LUW? Thanks.
Reply With Quote
  #2 (permalink)  
Old 12-22-05, 14:12
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
DB2 uses the user accounts and groups of the operating system.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 12-22-05, 14:14
tuvarsha tuvarsha is offline
Registered User
 
Join Date: Dec 2005
Posts: 39
Hmm. So is there a query to retrieve those??
Reply With Quote
  #4 (permalink)  
Old 12-22-05, 14:15
tuvarsha tuvarsha is offline
Registered User
 
Join Date: Dec 2005
Posts: 39
I checked sysibm.sysuserauth table. Basically, I need to retrieve users, groups and privileges.
Reply With Quote
  #5 (permalink)  
Old 12-22-05, 15:23
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
If you are looking to get a list of groups who have access on the db run this:
db2look -d dbname -z schema -x

This will give you all of the grants that are defined on that particular db.

then if you need to get a list of users in those groups assuming you are on AIX run lsgroup &groupname to get the list of people in that group, or do
cat /etc/groups
to get the list of ALL of the groups that are defined on the os.
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #6 (permalink)  
Old 12-22-05, 16:10
tuvarsha tuvarsha is offline
Registered User
 
Join Date: Dec 2005
Posts: 39
Thanks! But I am looking for queries which can accomplish that.
Reply With Quote
  #7 (permalink)  
Old 12-22-05, 17:27
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Yes, all the authorized users and groups that have been granted DB2 access are in the catalog somewhere, and you can query it with SQL. You may have to check several of the "AUTH" tables, depending on what you are looking for.

However, the DB2 catalog does not contain all the users and groups, just the ones who have already been granted DB2 access. You would have to issue an operating system command to get all the users and groups. You could write a C Stored Procedure to issue the OS commands.

When you grant access to DB2 objects in the Control Center, it gets a list of users or groups from the OS.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #8 (permalink)  
Old 12-22-05, 17:59
tuvarsha tuvarsha is offline
Registered User
 
Join Date: Dec 2005
Posts: 39
Ok. Out of 4 users, I have 3 of them listed in syscat.tabauth and the remaining one along with 2 of those was listed in syscat.dbauth. How to get all of them? Is there something called a UNION so that I can retrieve this 1 user name from syscat.tabauth and others from syscat.dbauth??
Reply With Quote
  #9 (permalink)  
Old 12-22-05, 18:03
tuvarsha tuvarsha is offline
Registered User
 
Join Date: Dec 2005
Posts: 39
ok I got it. It's UNION ALL.
Reply With Quote
  #10 (permalink)  
Old 12-22-05, 18:21
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
UNION is similar to UNION all, but UNION will eliminate any duplicate rows (based only on the columns you select).

You need to look at all the syscat "AUTH" views. Some may be empty, but they could contain authorization data. They are documented in the SQL Reference VOL 1, Appendix.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #11 (permalink)  
Old 12-22-05, 18:33
tuvarsha tuvarsha is offline
Registered User
 
Join Date: Dec 2005
Posts: 39
Yeah. UNION eliminated all duplicate rows. syscat AUTH views? Arent those syscat.dbauth, syscat.tabauth, syscat.schemaauth primarily? I am using the first 2 to get my data.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On