Db2

 View Only

 db2 privilege issue

Aviv Finezilber's profile image
Aviv Finezilber posted Mon September 15, 2025 02:29 PM

Hello community!

Im doing a course in Udemy – "DB2 for beginners", and im currently stuck in the course because I have a privilege problem in db2.

In my pc (windows 11) I downloaded and installed DB2 12.1.   in the installing process a user "db2admin"  was created.

Now in one of the steps of the course I need to run a script that create a table and also set few parameters in this table. Its in an existing database that is created few steps earlier in the course.

Anyway – when I try to run the script I receive an sql error:

SQL0552N  "DB2ADMIN" does not have the privilege to perform operation "CREATE

TABLE".  SQLSTATE=42502

Why the user that is created during the installation doesn’t have admin privileges? Could you help me with it?

It tried to get help from AI and from the course instructor , but both didn’t helped me much. And since its an online course it also takes days to get a response from the instructor.

Greg Palgrave's profile image
Greg Palgrave

Hello Aviv

I haven't done a Windows install in some time, but did you follow the post-install procedures from IBM?

In particular: Adding your user ID to the DB2ADMNS and DB2USERS user groups (Windows) - IBM Documentation

Good Luck!

Jan Nelken's profile image
Jan Nelken IBM Champion

Hi,

Account you specified during installation is an account under which Db2 services are being run. This account does not have priviledges on database. 
I am assuming that either you logged on as db2admin or used "runas .." to open session (you can verify by command whoami).

Db2admin - has the ability to create a database - and create tables in such created database - but not necessarily to create table in other databases.

If you need anything else -0 let us know...

 

Samuel Pizarro's profile image
Samuel Pizarro

You may have created the db using your own windows session Id.  not the db2admin,  

hence the db2admin user has no privileges against your db.   if that was the case, you need to grant it access, like DBADM, using the same ID your DB was created with, which should have the proper privilege to grant it.  

Confused !? 

Mark Barinstein's profile image
Mark Barinstein

What's the result of these queries in your database?

SELECT *
FROM TABLE(AUTH_LIST_AUTHORITIES_FOR_AUTHID('DB2ADMIN', 'U'))
WHERE AUTHORITY IN ('DBADM', 'CREATETAB', 'IMPLICIT_SCHEMA')
;

SELECT GRANTEE, GRANTEETYPE, DBADMAUTH, CREATETABAUTH, IMPLSCHEMAAUTH, SECURITYADMAUTH
FROM SYSCAT.DBAUTH
WHERE 'Y' IN (DBADMAUTH, CREATETABAUTH, IMPLSCHEMAAUTH, SECURITYADMAUTH)
;
Khalid Qrines's profile image
Khalid Qrines

Hi,

Did you add the user (db2admin) to the administrator group on the server? if not please add it.

Most likely you follow default installation, where the database creation and their objects will be under C: drive.

For that and other stuff you will need system permission regardless of the database permission.

Thanks ..

Khalid