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 -attribute of key are miss in result set . db2 錯誤DB2
- db2 reorg,runstatsDB2
- DB2的STMTIDDB2
- Db2 備份DB2
- DB2 安裝DB2
- DB2 SQL改寫DB2SQL
- DB2 HADR效能分析DB2
- The Db2 Recovery History FileDB2
- db2 load dumpfile for exceptionDB2Exception
- Oracle連線Db2OracleDB2
- 常用的DB2命令DB2
- DB2 export詳解DB2Export
- db2 資料庫DB2資料庫
- db2 資訊中心DB2
- Golang 如何操作DB2的?GolangDB2
- db2 hadr_spool_limitDB2MIT
- db2大表統計DB2
- DB2常用命令DB2
- DB2 Port (Network Security) RequirementsDB2UIREM
- DB2效能最佳化DB2
- DB2日誌相關DB2
- db2 客戶端安裝DB2客戶端
- DB2 HADR的heartbeat檢測DB2
- DB2備份與恢復DB2
- DB2執行計劃分析DB2
- DB2 Linux環境安裝DB2Linux
- db2 建立bufferpool,表空間DB2
- db2 事件監視器型別DB2事件型別
- 如何寫出更快的 SQL (db2)SQLDB2
- 一次DB2 DR演練DB2
- Python Uses ibm_db connect to DB2PythonIBMDB2
- db2 構造測試資料DB2
- db2常用動態效能檢視DB2
- DB2 HADR對效能的影響DB2
- DB2常用命令彙總DB2
- DB2常用傻瓜問題1000問DB2
- DB2 修改表列相關屬性DB2
- db2中的SYSIBM.SYSDUMMY1DB2IBM