Difference between revisions of "Snippets"

From dbawiki
Jump to: navigation, search
(References)
(Create a comma separated list of columns from a select statement)
Line 1: Line 1:
 +
===Restart ITM Monitoring agent===
 +
To see if the Oracle module is installed
 +
<pre>
 +
export ITM_HOME=/opt/IBM/ITM
 +
$ITM_HOME/bin/cinfo -i
 +
</pre>
 +
See which instances have been setup to be monitored
 +
<pre>
 +
export ITM_HOME=/opt/IBM/ITM
 +
$ITM_HOME/smitools/scripts/kdyedit -h /opt/IBM/ITM list
 +
</pre>
 +
Restart the agent
 +
<pre>
 +
export ITM_HOME=/opt/IBM/ITM
 +
$ITM_HOME/smitools/scripts/StartAgent.sh start or
 +
</pre>
 +
Check the agent is running
 +
<pre>
 +
ps -ef | grep koragent
 +
</pre>
 +
Reconfigure agent
 +
<pre>
 +
export ITM_HOME=/opt/IBM/ITM
 +
$ITM_HOME/bin/itmcmd config -A or
 +
</pre>
 +
 
===Create a comma separated list of columns from a select statement===
 
===Create a comma separated list of columns from a select statement===
 
Method 1:
 
Method 1:

Revision as of 18:55, 29 June 2013

Restart ITM Monitoring agent

To see if the Oracle module is installed

export ITM_HOME=/opt/IBM/ITM
$ITM_HOME/bin/cinfo -i

See which instances have been setup to be monitored

export ITM_HOME=/opt/IBM/ITM
$ITM_HOME/smitools/scripts/kdyedit -h /opt/IBM/ITM list

Restart the agent

export ITM_HOME=/opt/IBM/ITM
$ITM_HOME/smitools/scripts/StartAgent.sh start or

Check the agent is running

ps -ef | grep koragent

Reconfigure agent

export ITM_HOME=/opt/IBM/ITM
$ITM_HOME/bin/itmcmd config -A or

Create a comma separated list of columns from a select statement

Method 1:

SELECT parent_id,
       RTRIM(XMLAGG(XMLELEMENT(e,child_id || ',')).EXTRACT('//text()'),',') AS "Children"
FROM   parentChildTable
WHERE  parent_id = 0
GROUP  BY parent_id
/

or

SELECT parent_id,
       LISTAGG(child_id, ',') WITHIN GROUP (ORDER BY child_id) AS "Children"
  FROM parentChildTable
 WHERE parent_id = 0
 GROUP BY parent_id
/

Method 2 (undocumented and cannot therefore be relied on to continue working in the same manner):

SELECT wmsys.wm_concat(<column_name>)
FROM <table_name>
/

References