<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ksh script to check db2 database connectivity in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-check-db2-database-connectivity/m-p/4905495#M838071</link>
    <description>Thanks Sandman&lt;BR /&gt;I like you're script, it's clean, simple and best of all it works.&lt;BR /&gt;&lt;BR /&gt;Thanks all for you're help. This forum is great.</description>
    <pubDate>Sat, 11 Jun 2005 11:39:18 GMT</pubDate>
    <dc:creator>Alain Tesserot</dc:creator>
    <dc:date>2005-06-11T11:39:18Z</dc:date>
    <item>
      <title>ksh script to check db2 database connectivity</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-check-db2-database-connectivity/m-p/4905490#M838066</link>
      <description>I have a db2 database that all the sudden stops responding evey few days. How do I write a ksh script to check connection if successful then exit otherwise send email to dba.</description>
      <pubDate>Fri, 03 Jun 2005 06:43:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-check-db2-database-connectivity/m-p/4905490#M838066</guid>
      <dc:creator>Alain Tesserot</dc:creator>
      <dc:date>2005-06-03T06:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script to check db2 database connectivity</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-check-db2-database-connectivity/m-p/4905491#M838067</link>
      <description>&lt;BR /&gt;You don't!!!!&lt;BR /&gt;&lt;BR /&gt;You write it in PERL using db2 modules:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://search.cpan.org/search?query=db2&amp;amp;mode=all" target="_blank"&gt;http://search.cpan.org/search?query=db2&amp;amp;mode=all&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry d brown jr</description>
      <pubDate>Fri, 03 Jun 2005 06:48:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-check-db2-database-connectivity/m-p/4905491#M838067</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2005-06-03T06:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script to check db2 database connectivity</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-check-db2-database-connectivity/m-p/4905492#M838068</link>
      <description>Although I know and prefer perl it's not an option to install it on this production server. My only option is the ksh.</description>
      <pubDate>Fri, 03 Jun 2005 18:39:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-check-db2-database-connectivity/m-p/4905492#M838068</guid>
      <dc:creator>Alain Tesserot</dc:creator>
      <dc:date>2005-06-03T18:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script to check db2 database connectivity</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-check-db2-database-connectivity/m-p/4905493#M838069</link>
      <description>Hey;&lt;BR /&gt;&lt;BR /&gt;I don't know anything about db2; however, the model that I've used for oracle should be workable for db2 as well.  Effectively, you call sqlplus with a here document to query a known table.  If it shows up, everything's good.  If not, send the email.  For instance:&lt;BR /&gt;&lt;BR /&gt;---------------------------&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;&lt;BR /&gt;. $(oracle_environment_file}&lt;BR /&gt;&lt;BR /&gt;( sqlplus /nolog &amp;lt;&amp;lt; eof&lt;BR /&gt;connect 1/2 as sysdba&lt;BR /&gt;select file_name&lt;BR /&gt;from dba_data_files&lt;BR /&gt;order by file_name&lt;BR /&gt;/&lt;BR /&gt;eof&lt;BR /&gt;) &amp;gt; /tmp/dba_data_files.$$&lt;BR /&gt;&lt;BR /&gt;lines=$(wc -l /tmp/dba_data_files.$$ | awk '{print $1}')&lt;BR /&gt;if [ ${lines} -lt 10 ] &lt;BR /&gt;then&lt;BR /&gt;### send email message to pager..&lt;BR /&gt;fi&lt;BR /&gt;--------------------------&lt;BR /&gt;&lt;BR /&gt;Please note that was written on the fly in a web browser, not copied from a functioning script, so it may need some tweaking even on an oracle database.  &lt;BR /&gt;&lt;BR /&gt;Something like that, though, should work for db2 as well.&lt;BR /&gt;&lt;BR /&gt;HTH;&lt;BR /&gt;&lt;BR /&gt;Doug</description>
      <pubDate>Sat, 04 Jun 2005 12:46:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-check-db2-database-connectivity/m-p/4905493#M838069</guid>
      <dc:creator>Doug O'Leary</dc:creator>
      <dc:date>2005-06-04T12:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script to check db2 database connectivity</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-check-db2-database-connectivity/m-p/4905494#M838070</link>
      <description>Alain,&lt;BR /&gt;&lt;BR /&gt;Pasted below is a ksh script that does what you're looking for.&lt;BR /&gt;&lt;BR /&gt;=============================================&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;#&lt;BR /&gt;db2 &amp;lt;&lt;EOT&gt;&lt;/EOT&gt;connect to &lt;DB2 instance="" name=""&gt;&lt;BR /&gt;list tables for all&lt;BR /&gt;disconnect &lt;DB2 instance="" name=""&gt;&lt;BR /&gt;quit&lt;BR /&gt;EOT&lt;BR /&gt;#&lt;BR /&gt;if [ $? -ne 0 ]; then&lt;BR /&gt;   mailx -s "DB2 down!!!" your_email_address&lt;BR /&gt;   exit 1&lt;BR /&gt;else&lt;BR /&gt;   exit 0&lt;BR /&gt;fi&lt;BR /&gt;#&lt;BR /&gt;=============================================&lt;BR /&gt;&lt;BR /&gt;best of luck!!!&lt;/DB2&gt;&lt;/DB2&gt;</description>
      <pubDate>Fri, 10 Jun 2005 18:16:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-check-db2-database-connectivity/m-p/4905494#M838070</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-06-10T18:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script to check db2 database connectivity</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-check-db2-database-connectivity/m-p/4905495#M838071</link>
      <description>Thanks Sandman&lt;BR /&gt;I like you're script, it's clean, simple and best of all it works.&lt;BR /&gt;&lt;BR /&gt;Thanks all for you're help. This forum is great.</description>
      <pubDate>Sat, 11 Jun 2005 11:39:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-check-db2-database-connectivity/m-p/4905495#M838071</guid>
      <dc:creator>Alain Tesserot</dc:creator>
      <dc:date>2005-06-11T11:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script to check db2 database connectivity</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-check-db2-database-connectivity/m-p/4905496#M838072</link>
      <description>Thanks All</description>
      <pubDate>Sat, 11 Jun 2005 11:40:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-check-db2-database-connectivity/m-p/4905496#M838072</guid>
      <dc:creator>Alain Tesserot</dc:creator>
      <dc:date>2005-06-11T11:40:14Z</dc:date>
    </item>
  </channel>
</rss>

