DB2 “Triggers” on actions beyond update, insert and delete

吃可爱长大的小学妹 提交于 2019-12-25 18:56:07

问题


After researching triggers, I've only come up with thing showing how to update, insert and delete. It seems like that's even part of the syntax itself. DB2 Docs on Triggers

Is there any kind of trigger, or something similar, which would let me track a larger set of actions, things like SELECT and ALTER TABLE?

We (unfortunately) share a database with some teams which we don't strictly trust to not do things like run insane SELECT statements (locking up the databases) or ALTER TABLE without us knowing. We'd like to be able to track when these happen and what user made the change.


Please, no suggestions recommending we get our database separated in some way. We're working towards that in the long term, but we need this in the short term.


回答1:


The link for DB2 docs given in your post points to IBM i. Is your database DB2 for i?

For IBM i, you can use detailed database monitor to capture all SQL statements including DDL commands like alter table. However, running detailed database monitor for all users causes performance problems. We were in same situation as you with multiple teams using same server as database. We ended up writing custom user exits to capture all SQLs (with user details) in our case.

Link to database monitor: https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_72/rzajq/strdbmon.htm



来源:https://stackoverflow.com/questions/48505499/db2-triggers-on-actions-beyond-update-insert-and-delete

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!