Unable to load dataset using IBM DB2 LOAD tool - sql

Error for batch element #1: "WQX79824" does not have the privilege to perform operation "IMPLICIT CREATE SCHEMA".. SQLCODE=-552, SQLSTATE=42502, DRIVER=4.26.14
Number of occurrences: 1

This is not a programming issue, instead it is a configuration issue.
Either ask your DBA to grant the relevant authority and permissions to the authID you use (WQX79824) to connect to the database, or alternately connect to the database with a different authID which already has the required permissions and authorities to create objects and do loads etc.

Related

-567 Rebind Authorization error for Auth ID IBM Db2 native stored procedure

A user is unable to create a native stored procedure via IBM data studio and faces -567 rebind authorization error for a particular auth id say DBAXXYY.The schema name is also same as the authid
But I am able to create the stored procedure successfully without any issues using the same authid.
Could any of you kindly help in determining what privilege does the other user lack and what privilege I have different to him? Also, provide the syntax for any grant privilege that will be needed to create the stored procedure from his end using the same authid DBAXXYY.
I tried providing GRANT BINDADD TO DBAXXYY to that authid but still it didn't work.
Error :
Create stored procedure returns SQLCODE: -567, SQLSTATE:42591.
DBAXXYY.SP_SAMP: 0: REBIND AUTHORIZATION ERROR USING
DBAXXYY AUTHORITY PACKAGE =
LOCATION.DBAXXYY.SP_SAMP.(V1) PRIVILEGE = CREATE IN.
SQLCODE=-567, SQLSTATE=42501,
DRIVER=4.18.60
DBAXXYY.SP_SAMP - Deploy failed.
DBAXXYY.SP_SAMP - Roll back completed successfully.
The exception states that the user account lacks the CREATEIN privilege on the target schema. There may be other missing privileges, but you will be able to resolve these either by carefully studing the details of each exception, or by comparing your priviliges with those of the other user. Do that by querying the relvant catalog tables.
For the immediate problem, try:
GRANT CREATEIN ON SCHEMA ... TO ...
(where the first name is the schema name , and the second name is the other user name).
If , on the other hand, your security configuration uses ROLES then you need to grant that privilege to a role which the other user has.
Documentation link, adjust for your version of Db2 and platform.
At last I was able to provide the required privilege to the user and he is now able to create the native stored procedure.
I gave the following grant on the collection DBAXXYY to the auth id DBAXXYY and this solved the problem.
GRANT CREATE IN COLLECTION DBAXXYY TO DBAXXYY; COMMIT;

how to change schema owner to system? (DB2)

how to change myschema owner to system?
when i try execute
TRANSFER OWNERSHIP OF SCHEMA MYSCHEMA TO USER SYSIBM REVOKE PRIVILEGES
get error
SQL Error [42602]: The operation failed because the specified authorization name does not meet the identifier naming rules. Authorization name: "SYSIBM".. SQLCODE=-567, SQLSTATE=42602, DRIVER=4.26.14
As per comments, Db2 does not allow you to explicitly make objects (or transfer ownerships) into system schemas (those beginning with SYS*).
Those SYS* schemas are reserved for use by Db2 itself and are managed only by IBM. The reserved schema names are platform specific. So they can differ between Db2-for-i, Db2-for-Linux/Unix/Windows, Db2-for-Z/OS.
You did not explain why you wanted to do such a thing, but if your real motivation was to protect MYSCHEMA then you must achieve your aim within the capabilities of the REVOKE and GRANT statements. Take a look at revoking from PUBLIC for example.

SQL Server - Creating User Defined Table Type - Creating User Does not have Execute Permission?

I don't think this is a replica question - I've seen the other responses to questions of a similar nature here:
The EXECUTE permission is denied on the user-defined table types?
Table valued parameter in a stored procedure gets execute permissions denied error
My question is - how come when I create a User-Defined Table Type with a user, why does that user not have execute permission on it?
For example, I'm logged in with user myuser, using this user I create a UDT, and a stored procedure that uses the UDT. With the same user, I then try to execute the procedure, but get the error
'The EXECUTE permission was denied on the object 'MyUdt', database 'MyDb', schema 'dbo'.'
Now, I would assume that since it's the same user that created the UDT, this would automatically have the right permissions on it? You cannot use the GRANT EXECUTE command as suggested in the above posts, as you cannot grant permissions to yourself.
In summary - I wish to create a UDT, a procedure that uses it and be able to execute it all using the same user - why am I unable to do this? Am I missing something?
Sounds like you are being a victim of Ownership and User-Schema Separation in SQL Server:
By default, when developers create objects in a schema, the objects are owned by the security principal that owns the schema, not the developer.
Even though you've been granted permission to create an object, the object it belongs to the owner of the schema into which you created the object (dbo schema). Knowing what the problem is, you can settle on one of the several possible solutions (eg. use your own schema rather than dbo, transfer the ownership explicitly, use code signing etc).

tSQL to set up user with View Definition permission on SQL Azure

I'm trying to export a SQL Azure database to a .bacpac file using the Azure portal. The administrator username on my database contains a *. When I use it in the username field I get this error.
The login name must meet the following requirements:
It must be a SQL Identifier.
It cannot be a system name, for example:
- admin, administrator, sa, root, dbmanager, loginmanager, etc.
- Built-in database user or role like dbo, guest, public, etc.
It cannot contain:
- White space like spaces, tabs, or returns
- Unicode characters
- Nonalphabetic characters ("|:*?\/#&;,%=)
It cannot begin with:
- Digits (0 through 9)
- #, $, +
So I add a new user to the database using the following tSQL.
USE master;
CREATE LOGIN gu6t6rdb WITH PASSWORD = 'kjucuejcj753jc8j'
USE MyActualDB;
CREATE USER gu6t6rdb FOR LOGIN gu6t6rdb
The portal export form accepts that username but later errors with the following message.
Error encountered during the service operation. Could not extract
package from specified database. The reverse engineering operation
cannot continue because you do not have View Definition permission on
the 'MyActualDB' database.
To fix this I tried the following tSQL
GRANT VIEW ANY DEFINITION TO gu6t6rdb
which throws the following error
Securable class 'server' not supported in this version of SQL Server
How should I use tSQL to provide an additional user on my database and give the user sufficient privileges to export the database through the Azure portal to a .bacpac file in an Azure blobstore?
This will not work on sql azure. You will need to grant view definition at the database level. (without the ANY keyword)
GRANT VIEW DEFINITION TO gu6t6rdb
P.S: I hit the exact same issue and this seemed to solve my problem. I also had to do a Grant Execute (but it depends on what your bacpac is applying to the database)
Got it. I can add the user to the db_owner role and then the export proceeds without error.
EXEC sp_addrolemember 'db_owner', 'gu6t6rdb'
as of now, GRANT VIEW DEFINITION TO [username] works in Azure SQL, I just verified it myself. See https://learn.microsoft.com/en-us/sql/relational-databases/security/permissions-database-engine?view=sql-server-ver15 for reference:
So in order to successfully export database as bacpak file you can created contained user (no need in CREATE LOGIN... command) and give the following permissions:
CREATE USER [user_from_azure_AD] FROM EXTERNAL PROVIDER;
ALTER ROLE db_datareader ADD MEMBER [user_from_azure_AD]
GRANT VIEW DEFINITION TO [user_from_azure_AD]

create db2 schema using jdbc

What is the correct syntax or what are the correct steps for creating a schema in DB2 using JDBC?
When running create schema test1 or create schema test1 authorization db2admin as db2admin, I consistently get DB2 SQL Error: SQLCODE=-552, SQLSTATE=42502, SQLERRMC=DB2ADMIN;CREATE SCHEMA, DRIVER=3.64.106
The exact same command works fine using the DB2 command-line tools.
I found it.
It turns out that for some reason DB2 Express-C does not grant the DBADM privilege to db2admin by default.
This can be fixed by connecting to the DB and then issuing
GRANT DBADM ON DATABASE to db2admin
Thanks Ian Bjorhovde for providing the inspiration spark!
Looks like it is not a matter of Syntax but authentication, you have to check the credentials that you are passing through JDBC:
-552 authorization-id DOES NOT HAVE THE PRIVILEGE TO PERFORM OPERATION operation
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.db2z9.doc.codes%2Fsrc%2Ftpc%2Fn552.htm