I'd like to create event monitor on DB2 z/OS 9.2
i have spent a lot of time trying resolve this problem.
So i suggest this link: http://www.ibm.com/developerworks/data/library/techarticle/0303kolluru/0303kolluru.html
and trying to make this steps:
db2 => connect to dbname user username using password
db2 => update monitor switches using statement on
db2 => create event monitor rkmon for statements write to file '/tmp'
db2 => set event monitor rkmon state=1
but when I put command: create event monitor rkmon for statements write to file '/tmp'
Db2 throw me an error:
"DB2ADMIN" does not have the privilege to perform operation "CREATE EVENT MONITOR".. SQLCODE=-552, SQLSTATE=42502, DRIVER=3.58.81
so, then i try add some privilege to my db2admin user:
grant DBADM to db2admin
but get another error:
The name "DBADM" cannot be used because the specified identifier is reserved for system use.. SQLCODE=-707, SQLSTATE=42939, DRIVER=3.58.81
Now, I don't have any idea what shoould i do to resolve this problem.
Maybe, there is some othere way to logs sql queries sends to my db2 ?
(I develop some java apps using hibernate and db2, and sometimes quickest way to resolve some problem is see what sql queries is send to db).
Any ideas ?
Thanks
I think the "ON DATABASE" clause is mandatory in the GRANT statement. Try:
grant DBADM on database to user db2admin
GRANT (database authorities)
statement
Related
I am trying to execute an ant sql task, which is supposed to execute a number of queries to a local database. I already enabled the 'sa' user, it is the dbo of of the database, the authentication to the server is mixed mode and I still get the following exception, when trying to run it:
sql-exception
I already read and tried everything possible about the exception, so if somebody has any idea how to solve this, I would really appreciate it.
We are running SQL Server 2016. For in-house political reasons, I can't restrict access the way I want to. Assume that I can't change the premise.
We have a user that is used in SSIS packages. Unfortunately, some devs are logging directly into the db with ssms using this user. I need to prevent this without changing the password or something. What I need is to be able to allow a user access to the database ONLY if it is running from an SSIS package and NOT if it is coming in any other way.
I am not looking for other suggestions of how to fix this issue. I understand most of them already, I am stuck because of management decisions that I cannot change.
Can anyone tell me how to restrict a user in such a way?
An approach is to use a LOGON trigger
A first blush approach might be to reject any process that look's like the SSMS application
CREATE OR ALTER TRIGGER logon_developer_check
ON ALL SERVER
FOR LOGON
AS
BEGIN
IF (ORIGINAL_LOGIN() = 'triskydeveloper'
and EXISTS
(
SELECT
*
FROM
sys.sysprocesses AS S
WHERE
S.spid = ##SPID
AND S.program_name LIKE 'Microsoft SQL Server Management%'
)
BEGIN
ROLLBACK
END
END
But developers, being devious little buggers, will then write their own .NET application or use SQLCMD so you'd fall into a rat race trying to identify all the program_names that might show up.
I would instead look at the hostname column on sys.sysprocesses - if the connection isn't coming from the server itself, just reject it. Unless you have to deal with developers able to RDP onto the server.
Oh and if you mangle the logon trigger and it's rejecting everything, use SQLCMD and the dedicated admin console, DAC, and
sqlcmd.exe -S localhost -d master -Q "DISABLE TRIGGER ALL ON SERVER" -A
I have created a local db using SQLEXPRESS through Visual Basic.
I intend to use LINQ to connect to the database from the application. Here is my statement to initially connect to the database:
Dim db As New DataContext("Data Source=localhost\SQLEXPRESS; Initial Catalog=master; Integrated Security=True;")
Ideally, my database would be entered for Initial Catalog, but that was giving me authentication errors for some reason. Now that this statement executes, my next step is to connect to my specific database. However, when I try to connect with a statement like this:
Dim TestCommand = db.ExecuteCommand("Use MyDB.mdf")
I get an error that the database does not exist.
When I query my database with the following commands:
SELECT name FROM master.sys.databases
The returned values are master, tempdb, model, msdb, and C:USERS\MY NAME\DOCUMENTS\MyDB.mdf
I have tried the above "TestCommand" writing out the directory for the database, but I get an error at "C:".
So, my db exists, but can someone explain to me the syntax I should use to "USE" my database?
You should not use the use command this way! You must connect to the application's database directly by setting it as Initial Catalog. If you're not authorized to do so, a use command won't let you either, by the way. So you have to fix the authorization for the database: create a login for your windows account in Sql Server Management Studio and grant it read/write access to the application's database.
I'm trying to execute a SSIS package on a SQL Server 2008R2. The script retrieve data on a remote server and copy them to its local database.
This job is scheduled every hour, the SQL Agent use a proxy to authenticate itself to the remote machine. Authentication seems to be ok but I get an error during loading of the SSIS package.
This is what I get:
Could not load package because of error 0xC001404A. Description: While trying to find a folder on SQL an OLE DB error was encountered with error code 0x80040E09 (The EXECUTE permission was denied on the object 'sp_ssis_getfolder', database 'msdb', schema 'dbo'.).
When I add the role of sysadmin to this user, the script works well. I don't know which kind of right I have to add to user on database 'mdb' to avoid this error.
Anybody could help me, please ?
Thanks in advance
You could
GRANT EXECUTE ON MSDB.DBO.sp_ssis_getfolder to [proxy]
Or you could try adding that user to one of the dts/ssis operator/executor roles - starting with user, then operator, then admin to see what level it needs - or read the documentation.
db_ssisadmin
db_ssisoperator
db_ssisltduser
See the section under msdb here: http://msdn.microsoft.com/en-us/library/ms189121.aspx
I'm trying to drop a database from PgAdmin 3 and I get this error message:
ERROR: can't delete current database
SQL state: 55006
how can I force the delete/fix this error, of this database?
Quick fix in PgAdmin: just create another empty database. Select it. Delete the first one. Voila.
You can also connect to the command line without selecting a specific database, and drop your database.
The problem here is not that other users are connected to the database, but that you are.
This post by Leeladharan Achar was helpful for me in working with this error.
It essentially boils down to:
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'target_db'
AND pid <> pg_backend_pid();
DROP DATABASE 'target_db';
Simplest fix for this is restart the postgresql. After that You can get rid of database!
If you want to use the pgAdmin4 interface, you have to first delete/drop the db, then, before waiting for the error, you have to immediatelly disconnect from the same database, then it gets deleted without problem.
Instead of creating new database he can simply connect to postgres database, which is created by default in all new PostgreSQL installations. And even if it is not there - template1 should be always there.
The best method to drop user is below mentioned
Like i have a user name is "X" and it have access permission to database name : "Test" .
And now we are created connection with "Test" database
If we try: drop user "X" this will be definality show below mentioned error:
ERROR: user "X" cannot be dropped because the user has a privilege on some object SQL State=55006
First of all connection should not be created with "Test" db.because it currently use so we are not able to delete the user.
create connection with any of database except eg "Test"
Now again try
drop user test
It should be worked fine on my side,let me know if you are facing issue on your side
The easiest and perhaps the neatest fix is to go to services and stop the PostgreSQL server and then start it, and then run the drop database yourdbname; command again. That should disconnect any sessions and allow you to drop the current database.