DB2 WLM
最近遇到一個問題,一個不合理的SQL執行佔用了400G的臨時表空間,差點把資料庫搞down,因此對某些使用者的查詢要做限制,我這裡限制條件
1.返回1百萬和記錄
or
2 .執行時間超過30分鐘
對這樣的查詢,force掉
####create service class, name is read_worktype_subclass, its super class is read_sc
db2 "create service class read_sc disable"
db2 "create service class read_worktype_subclass under read_sc disable"
####create workload for user readusr, the workload name is read_WID, and attach the workload to super class
db2 "create workload read_WID system_user('READUSR') disable service class read_sc position at 1"
db2 "grant usage on workload read_WID to public"
####create class set and action set
db2 "create work class set read_WCS(work class READ_WORKTYPE work type read position at 1)"
db2 "create work action set read_WAS for service class read_sc using work class set read_WCS(work action read_worktype_to_read_worktype_subclass on work class READ_WORKTYPE map activity to read_worktype_subclass) disable"
####Create threshold
db2 "create threshold ROWS_RETURNED_THRESH for service class read_worktype_subclass under read_sc activities enforcement database disable when SQLROWSRETURNED > 1000000 stop execution"
db2 "create threshold DBMAX1HOURRUNTIME for service class read_worktype_subclass under read_sc activities enforcement database disable WHEN ACTIVITYTOTALTIME > 30 minutes stop execution"
####enable all of the objects created
db2 "alter service class read_sc enable"
db2 "alter service class read_worktype_subclass under read_sc enable"
db2 "alter workload read_WID enable"
db2 "alter work action set read_WAS enable"
db2 "alter threshold ROWS_RETURNED_THRESH enable"
db2 "alter threshold DBMAX1HOURRUNTIME enable"
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/725820/viewspace-2215148/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DB2負載管理(WLM)(一)DB2負載
- DB2負載管理(WLM)(二)DB2負載
- DB2負載管理(WLM)(三)DB2負載
- DB2:ksh: db2: not found.DB2
- DB2系列之DB2安裝DB2
- [DB2]DB2備份和恢復DB2
- [DB2]db2重定向恢復DB2
- DB2 explainDB2AI
- DB2 listenerDB2
- db2概念DB2
- DB2 INFOCENTERDB2
- join (db2)DB2
- DB2 CLPDB2
- The DB2 environmentDB2
- DB2 CRASHDB2
- db2 -attribute of key are miss in result set . db2 錯誤DB2
- [DB2]linux下安裝db2 v9.7DB2Linux
- db2 資訊中心DB2
- db2 reorg,runstatsDB2
- DB2 安裝DB2
- Db2 備份DB2
- DB2程式模型DB2模型
- DB2監控DB2
- DB2 Q&ADB2
- DB2 刪除DB2
- db2巡檢DB2
- db2 修改表列DB2
- DB2 quiesced 模式DB2UI模式
- DB2 export and importDB2ExportImport
- DB2 License expiredDB2
- DB2 730DB2
- DB2恢復DB2
- DB2精華帖DB2
- 初識DB2DB2
- DB2歷史DB2
- JDBC differences between the DB2 Universal JDBC Driver and other DB2 JDBC driversJDBCDB2
- DB2傻瓜1000問(三)DB2例項部分DB2
- 常用的DB2命令DB2