针对组合状态的运行状况监视器警报操作
警报操作是在运行状况指示器进入警报状态时运行的任务或脚本。
每次对表空间设置单一警报状态时,针对该状态来为运行状况指示器 ts.ts_op_status 定义的运行状况监视器警报操作都会运行,而无论其他组合状态为何。 这使得可以对特定表空间状态运行警报操作,即使该状态与其他状态一起设置。
在以下示例中,即使在表空间状态同时为 QUIESCED:share 和 QUIESCE:update 时,针对注意状态 QUIESCED:share 定义的警报操作 script1 也会运行。
db2 call SYSPROC.ADMCMD('update alert cfg for tablespaces using ts.ts_op_status
set actionsenabled yes')
db2 call SYSPROC.ADMCMD('update alert cfg for tablespaces using ts.ts_op_status
add action script /home/guest001/script1 type operating system command line
parameters userParam working directory /home/guest001/
on attention QUIESCED_SHARE on aix1 user guest001 using passw0rd')
在以下示例中,当且仅当表空间状态同时为 QUIESCED:share 和 QUIESCED:update 时,使用组合状态(QUIESCED:share + QUIESCED:update = 3)定义的警报操作才执行。
db2 call SYSPROC.ADMCMD('update alert cfg for tablespaces using ts.ts_op_status
set actionsenabled yes')
db2 call SYSPROC.ADMCMD('update alert cfg for tablespaces using ts.ts_op_status
add action script /home/guest001/script1 type operating system command line
parameters userParam working directory /home/guest001/
on attention 3 on aix1 user guest001 using passw0rd')
以相同操作属性(名称、工作目录、命令行参数、主机、用户和密码)针对一个对象定义的运行状况监视器警报操作仅运行一次,即使针对多种警报状态来定义该操作也是如此。
在以下示例中,对两个不同的警报状态定义了同一操作。 即使表空间状态同时为 QUIESCED:share 和 QUIESCED:update,也只能对给定表空间执行一次该操作。
db2 call SYSPROC.ADMCMD('update alert cfg for tablespaces using ts.ts_op_status
add action script /home/guest001/script1 type operating system command line
parameters userParam working directory /home/guest001/
on attention QUIESCED_SHARE on aix1 user guest001 using passw0rd')
db2 call SYSPROC.ADMCMD('update alert cfg for tablespaces using ts.ts_op_status
add action script /home/guest001/script1 type operating system command line
parameters userParam working directory /home/guest001/
on attention QUIESCED_UPDATE on aix1 user guest001 using passw0rd')