<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Zhobur's</title>
	<atom:link href="http://zhobur.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://zhobur.wordpress.com</link>
	<description>File inventory</description>
	<lastBuildDate>Sun, 25 Sep 2011 02:16:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='zhobur.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Zhobur's</title>
		<link>http://zhobur.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://zhobur.wordpress.com/osd.xml" title="Zhobur&#039;s" />
	<atom:link rel='hub' href='http://zhobur.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Dump Oracle Metadata To SQL File</title>
		<link>http://zhobur.wordpress.com/2011/06/08/dump-oracle-metadata-to-sql-file/</link>
		<comments>http://zhobur.wordpress.com/2011/06/08/dump-oracle-metadata-to-sql-file/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 05:52:12 +0000</pubDate>
		<dc:creator>zhobur</dc:creator>
				<category><![CDATA[Oracle PL/SQL]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://zhobur.wordpress.com/?p=55</guid>
		<description><![CDATA[DumpObjectSQL *) Description : Create Data Definition Language from your Oracle Database Object, using Oracle DBMS_METADATA and cx_Oracle. *) Dependency: cx_Oracle Oracle 10g2 Client *) Usage: 1. Create output directory sample: mkdir -p /app/dump_out/TABLE mkdir -p /app/dump_out/VIEW mkdir -p /app/dump_out/PACKAGE mkdir -p /app/dump_out/PROCEDURE mkdir -p /app/dump_out/TRIGGER mkdir -p /app/dump_out/SEQUENCE mkdir -p /app/dump_out/TYPE 2. call DumpObjectSQL.py [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=55&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>DumpObjectSQL</strong></p>
<p>*) Description :<br />
<em>Create Data Definition Language from your Oracle Database Object,<br />
using Oracle DBMS_METADATA and cx_Oracle.<br />
</em></p>
<p>*) Dependency:<br />
cx_Oracle<br />
Oracle 10g2 Client</p>
<p>*) Usage:<br />
1. Create output directory<br />
   sample:<br />
   mkdir -p /app/dump_out/TABLE<br />
   mkdir -p /app/dump_out/VIEW<br />
   mkdir -p /app/dump_out/PACKAGE<br />
   mkdir -p /app/dump_out/PROCEDURE<br />
   mkdir -p /app/dump_out/TRIGGER<br />
   mkdir -p /app/dump_out/SEQUENCE<br />
   mkdir -p /app/dump_out/TYPE</p>
<p>2. call DumpObjectSQL.py<br />
run command :<br />
python DumpObjectSQL.py [user] [password] [sid] [object type] [output directory]</p>
<p>user = database user<br />
password = database password<br />
sid = database service id<br />
object type = [TABLE, VIEW, PACKAGE, PROCEDURE, TRIGGER, SEQUENCE, TYPE]<br />
output directory = output directory you created</p>
<p>git://github.com/sroctadian/DumpObjectSQL.git</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zhobur.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zhobur.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zhobur.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zhobur.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/zhobur.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/zhobur.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/zhobur.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/zhobur.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zhobur.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zhobur.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zhobur.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zhobur.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zhobur.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zhobur.wordpress.com/55/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=55&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://zhobur.wordpress.com/2011/06/08/dump-oracle-metadata-to-sql-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f220aafe6e689be76efee350cc539b2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">zhobur</media:title>
		</media:content>
	</item>
		<item>
		<title>zooapps module</title>
		<link>http://zhobur.wordpress.com/2009/05/28/zooapps-module/</link>
		<comments>http://zhobur.wordpress.com/2009/05/28/zooapps-module/#comments</comments>
		<pubDate>Thu, 28 May 2009 08:00:12 +0000</pubDate>
		<dc:creator>zhobur</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://zhobur.wordpress.com/?p=50</guid>
		<description><![CDATA[<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=50&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><pre class="brush: python;">
#-import library
import os, sys
import optparse

#-import zooapps library
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), &quot;lib&quot;))
import zooappslib

#-class definition
#NOT IMPLEMENTED YET

#-main program
parser = optparse.OptionParser()

parser.add_option(
    '-r','--run',
    dest='run_flag',
    action='store_true',
    default=False,
    help='''Running plugin as thread.'''
)

parser.add_option(
    '-i','--input',
    dest='input_file',
    action='store',
    default='',
    help='''Input filename use for plugin.'''
)

parser.add_option(
    '-o','--output',
    dest='output_file',
    action='store',
    default='',
    help='''Output filename use for plugin.'''
)

parser.add_option(
    '-p','--plugin',
    dest='plugin_name',
    action='store',
    default='',
    help='''Plugin name to be loaded.'''
)

options, args = parser.parse_args()

if options.run_flag == True:
    #-fetch all parameters
    plugin_directory   = os.path.join(os.path.dirname(os.path.abspath(__file__)), &quot;plugins&quot;)
    params = {'INPUT_FILE':options.input_file, 'OUTPUT_FILE': options.output_file, 'PLUGIN_NAME': options.plugin_name, 'PLUGIN_DIR': plugin_directory}
    
    #-extent zooappslib plugin manager
    app = zooappslib.Zooapps(params)
    obj = app.loadPlugins()
    main = obj['MODULE'].Main()
    main.start()
    main.join()
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zhobur.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zhobur.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zhobur.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zhobur.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/zhobur.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/zhobur.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/zhobur.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/zhobur.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zhobur.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zhobur.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zhobur.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zhobur.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zhobur.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zhobur.wordpress.com/50/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=50&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://zhobur.wordpress.com/2009/05/28/zooapps-module/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f220aafe6e689be76efee350cc539b2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">zhobur</media:title>
		</media:content>
	</item>
		<item>
		<title>zooappslib module</title>
		<link>http://zhobur.wordpress.com/2009/05/28/zooappslib-module/</link>
		<comments>http://zhobur.wordpress.com/2009/05/28/zooappslib-module/#comments</comments>
		<pubDate>Thu, 28 May 2009 07:56:21 +0000</pubDate>
		<dc:creator>zhobur</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://zhobur.wordpress.com/?p=48</guid>
		<description><![CDATA[Download zooappslib module.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=48&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><pre class="brush: python;">
#-import library
import os, sys, glob
import logging

#-import others library
import parameters

#-classs definition
class Zooapps:
    &quot;&quot;&quot;
        Zooapps plugins manager application.
    &quot;&quot;&quot;
        
    def __init__(self, params = {}):
        self.version            = '0.0.1.alpha'
        self.plugin_ext         = 'zooapps-plugin'
        self.params             = params
        self.plugins            = {}
        logging.basicConfig(level=logging.DEBUG,
                            format='%(asctime)s %(levelname)s %(message)s',
                            filename=os.path.dirname(os.path.abspath(__file__)) + os.path.sep + 'zooappslib.log',
                            filemode='a')

    def setPluginsDir(self, plugin_dir):
        self.params['PLUGIN_DIR'] = plugin_dir

    def registerPlugins(self, plugins):
        self.plugins[plugins['PLUGIN_NAME']] = plugins['MODULE']
        logging.info('Register plugins ' + plugins['PLUGIN_NAME'] + '.')

    def removePlugins(self, plugin_name):
        self.plugins.pop(plugin_name)
        logging.info('Remove plugins ' + plugin_name + '.')

    def loadPlugins(self):
        logging.info('Loading plugins ' + self.params['PLUGIN_NAME'])
        if self.checkPlugins() == True:
            if self.checkSuffix() == True:
                cfg = self.loadParameters()
                sys.path.append(self.params['PLUGIN_DIR'])
                obj = __import__(cfg['MODULE'])
                cfg['MODULE'] = obj
                return cfg
        return None

    def checkSuffix(self):
        logging.info('Validating plugins ' + self.params['PLUGIN_NAME'])
        if self.params['PLUGIN_NAME'].endswith(self.plugin_ext):
            return True
        
        logging.warning('Invalid Plugins ' + self.params['PLUGIN_NAME'] + '.')
        return False

    def checkPlugins(self):
        if os.path.exists(self.params['PLUGIN_DIR'] + os.path.sep + self.params['PLUGIN_NAME']):
            return True
        
        logging.warning('Plugins ' + self.params['PLUGIN_NAME'] + ' not found.')
        return False

    def loadParameters(self):
        par = parameters.Parameter()
        cfg = par.getParams(self.params['PLUGIN_DIR'] + os.path.sep + self.params['PLUGIN_NAME'])
        return cfg


</pre></p>
<p>Download zooappslib module.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zhobur.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zhobur.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zhobur.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zhobur.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/zhobur.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/zhobur.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/zhobur.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/zhobur.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zhobur.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zhobur.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zhobur.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zhobur.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zhobur.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zhobur.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=48&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://zhobur.wordpress.com/2009/05/28/zooappslib-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f220aafe6e689be76efee350cc539b2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">zhobur</media:title>
		</media:content>
	</item>
		<item>
		<title>Plug-in manager with python</title>
		<link>http://zhobur.wordpress.com/2009/05/28/plug-in-manager-with-python/</link>
		<comments>http://zhobur.wordpress.com/2009/05/28/plug-in-manager-with-python/#comments</comments>
		<pubDate>Thu, 28 May 2009 07:53:49 +0000</pubDate>
		<dc:creator>zhobur</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://zhobur.wordpress.com/?p=45</guid>
		<description><![CDATA[Plugins manager is a tool to manage plugins of you application, with plugin you can easy to add or remove functionality from you application. Now i will try to describe a simple plugin manager that i build with python, plugin manager need some of standard code that you are used. I will try to describe [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=45&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Plugins manager is a tool to manage plugins of you application, with plugin you can easy to add or remove functionality from you application. Now i will try to describe a simple plugin manager that i build with python, plugin manager need some of standard code that you are used.</p>
<p>I will try to describe some standard i use to:<br />
<strong>1. Plugins Description file</strong><br />
    Format file           : [name you will use]-zooapps-plugin<br />
    Layout                :<br />
                                #-plugin configurations<br />
                                PLUGIN_NAME=File Object<br />
                                MODULE=FileObject<br />
                                VERSION=0.0.1.alpha<br />
                                DEVELOPER=Syahreza Octadian<br />
                                DESCRIPTION=Objects plugins to handle file processing<br />
                                CREATED_DATE=13-May-2009</p>
<p>    Description          :<br />
    <em>PLUGIN_NAME</em> mean name of your plugins<br />
    <em>MODULE</em> mean python module of your plugins<br />
    <em>VERSION, DEVELOPER, DESCRIPTION, CREATED_DATE</em> just other information that you use to describe your plugin.</p>
<p><strong>2. Plugins directory</strong><br />
    Plugins directory is important to tell the plugins manager where to load plugin.</p>
<p>How to make plugins manager:<br />
1. Append you plugins directory to python path<br />
<pre class="brush: python;">
import sys

sys.path.append('your/plugins/directory')
</pre></p>
<p>2. Read your plugins description file<br />
<pre class="brush: python;">
    def loadParameters(self):
        par = parameters.Parameter()
        cfg = par.getParams(self.params['PLUGIN_DIR'] + os.path.sep + self.params['PLUGIN_NAME'])
        return cfg
</pre></p>
<p>3. Load your pluguins module describe<br />
<pre class="brush: python;">
obj = __import__(cfg['MODULE'])
</pre></p>
<p>see complete code.</p>
<p>To use this script you will need <a href="http://zhobur.wordpress.com/2009/04/21/handle-parameter-with-python/">parobjects</a> module.</p>
<p>Good Luck</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zhobur.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zhobur.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zhobur.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zhobur.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/zhobur.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/zhobur.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/zhobur.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/zhobur.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zhobur.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zhobur.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zhobur.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zhobur.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zhobur.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zhobur.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=45&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://zhobur.wordpress.com/2009/05/28/plug-in-manager-with-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f220aafe6e689be76efee350cc539b2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">zhobur</media:title>
		</media:content>
	</item>
		<item>
		<title>Zooapps version 0.0.1.alpha</title>
		<link>http://zhobur.wordpress.com/2009/05/22/zooapps-version-0-0-1-alpha/</link>
		<comments>http://zhobur.wordpress.com/2009/05/22/zooapps-version-0-0-1-alpha/#comments</comments>
		<pubDate>Fri, 22 May 2009 02:15:04 +0000</pubDate>
		<dc:creator>zhobur</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://zhobur.wordpress.com/?p=39</guid>
		<description><![CDATA[zooapps is simple example application with plugins capability, easy to used and easy to extent plugins. All you need only create plugins description and python module for plugins. Standar Code 1. Plugins description 2. Python module create new class and extend Thread class so zooapps will able to run your module. sample : Just run [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=39&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>zooapps is simple example application with plugins capability, easy to used and easy to extent plugins. All you need only create plugins description and python module for plugins.</p>
<p><strong>Standar Code</strong><br />
1. Plugins description<br />
<pre class="brush: python;">
#-plugin configurations
PLUGIN_NAME=File Object
MODULE=FileObject
VERSION=0.0.1.alpha
DEVELOPER=Syahreza Octadian
DESCRIPTION=Objects plugins to handle file processing
CREATED_DATE=13-May-2009
</pre></p>
<p>2. Python module<br />
create new class and extend Thread class so zooapps will able to run your module.<br />
sample :<br />
<pre class="brush: python;">
class Test(Thread):
   def __init__(self):
       self.name = 'hello world'
       Thread.__init__(self)
   def run(self):
       print self.name
</pre></p>
<p>Just run like this<br />
python zooapps.py -r -i hello -o hello.out -p Test-zooapps-plugin</p>
<p>output:<br />
hello world</p>
<p>See full <a href="http://zhobur.wordpress.com/2009/05/28/zooapps-module/">source code</a><br />
Simple isn&#8217;t. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zhobur.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zhobur.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zhobur.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zhobur.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/zhobur.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/zhobur.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/zhobur.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/zhobur.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zhobur.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zhobur.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zhobur.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zhobur.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zhobur.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zhobur.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=39&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://zhobur.wordpress.com/2009/05/22/zooapps-version-0-0-1-alpha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f220aafe6e689be76efee350cc539b2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">zhobur</media:title>
		</media:content>
	</item>
		<item>
		<title>Make you loading faster with parallel processing</title>
		<link>http://zhobur.wordpress.com/2009/05/05/make-you-loading-faster-with-parallel-processing/</link>
		<comments>http://zhobur.wordpress.com/2009/05/05/make-you-loading-faster-with-parallel-processing/#comments</comments>
		<pubDate>Tue, 05 May 2009 09:10:43 +0000</pubDate>
		<dc:creator>zhobur</dc:creator>
				<category><![CDATA[Oracle PL/SQL]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://zhobur.wordpress.com/?p=37</guid>
		<description><![CDATA[After know how to unloading data using OCIULDR, it time to Load your data to the original table. Just like the last post this script using list of table as the input and the data using pattern like [table_name].dat just like output from the script before. Sample list of table: filename : list_of_tables.txt content : [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=37&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After know how to unloading data using OCIULDR, it time to Load your data to the original table. Just like the last post this script using list of table as the input and the data using pattern like [table_name].dat just like output from the script before.<br />
Sample list of table:<br />
filename : list_of_tables.txt<br />
content  :<br />
table_a<br />
table_b</p>
<p>Using pattern above the data will be like this<br />
table_a.dat<br />
table_b.dat</p>
<p>and the scripts are :<br />
1. run<br />
<pre class="brush: python;">
#/bin/bash

if [ $# -lt 6 ]
then
   echo &quot;Please use arguments, $0 [USERNAME] [PASSWORD] [SID] [LIST OF TABLE] [THREADNAME] [MAX THREAD]&quot;
   exit 1
fi

#[ Configure your directory ] 
CTLDIR=....
BADDIR=....
LOGDIR=....
INDIR=....

USERNAME=$1
PASSWORD=$2
SID=$3
sList=$4
THREADNAME=$5
max_thread=$6

THREADID=0
##########MAIN PROGRAM
######################################################################################################
echo &quot;Start loading process : `date`&quot;

for FILENAME in `cat $sList`
do
   ##identified any threads
   sFlag=0
   while [ $sFlag -eq 0 ]
   do
      NEXT_PROC=`ls ${THREADNAME}_*.lock | wc -l`
      if [ $NEXT_PROC -le $max_thread ]
      then
         sFlag=1
      else
         sleep 15
      fi
   done

   #running others threads
   touch ${THREADNAME}_${THREADID}.lock
   DATAFILE=${FILENAME}.dat

   if [ -e ${INDIR}/${DATAFILE} ]
   then

      echo &quot;Loading.......${DATAFILE}&quot;
      . loader $USERNAME $PASSWORD $SID ${FILENAME} ${THREADNAME}_${THREADID} &amp;

   else
      echo &quot;File $DATAFILE tidak ditemukan.&quot; &gt;&gt; RUNNER_LOADING.log
      echo &quot;Releasing lock&quot;
      rm ${THREADNAME}_${THREADID}.lock
   fi

   let &quot;THREADID+=1&quot;

done
</pre></p>
<p>2. loader<br />
<pre class="brush: python;">
#/bin/bash

if [ $# -lt 5 ]
then
   echo &quot;Please use arguments, $0 [USERNAME] [PASSWORD] [SID] [FILENAME] [THREAD NAME]&quot;
   exit 1
fi

USERNAME=$1
PASSWORD=$2
SID=$3
FILENAME=$4
THREADNAME=$5

###THIS IS MANDATORY
##ORACLE LIBRARY
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

########MAIN PROGRAM
CTLFILE=${CTLDIR}/${FILENAME}._sqlldr.ctl
BADFILE=${BADDIR}/${FILENAME}.bad
LOGFILE=${LOGDIR}/${FILENAME}.log
DATAFILE=${INDIR}/${FILENAME}.dat


echo &quot;Start time : `date` $THREADNAME&quot; 
echo &quot;Loading CTLFILE : ${CTLFILE}&quot;
echo &quot;Loading FILENAME : ${DATAFILE}&quot;


# Load data into table
sqlldr ${USERNAME}/${PASSWORD}@${SID} control=${CTLFILE} data=${DATAFILE} log=${LOGFILE} bad=${BADFILE} direct=true parallel=yes errors=1000000


if [ -a ${THREADNAME}.lock ]
then
   rm ${THREADNAME}.lock
fi

echo &quot;End time : `date`&quot;
echo &quot;&quot;
##END PROGRAM
</pre></p>
<p>Implementation:<br />
Don&#8217;t forget to configure this part with your own<br />
#[ Configure your directory ]<br />
CTLDIR=&#8230;.<br />
BADDIR=&#8230;.<br />
LOGDIR=&#8230;.<br />
INDIR=&#8230;.</p>
<p>after that you can run with command<br />
./run [USERNAME] [PASSWORD] [SID] [LIST OF TABLE] [THREADNAME] [MAX THREAD]</p>
<p>Good Luck<br />
SRO</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zhobur.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zhobur.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zhobur.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zhobur.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/zhobur.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/zhobur.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/zhobur.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/zhobur.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zhobur.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zhobur.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zhobur.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zhobur.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zhobur.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zhobur.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=37&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://zhobur.wordpress.com/2009/05/05/make-you-loading-faster-with-parallel-processing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f220aafe6e689be76efee350cc539b2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">zhobur</media:title>
		</media:content>
	</item>
		<item>
		<title>SSH Manager</title>
		<link>http://zhobur.wordpress.com/2009/04/27/ssh-manager/</link>
		<comments>http://zhobur.wordpress.com/2009/04/27/ssh-manager/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 10:10:37 +0000</pubDate>
		<dc:creator>zhobur</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://zhobur.wordpress.com/?p=30</guid>
		<description><![CDATA[SSH Manager is application to manager your ssh connection, you can create your own list of connection and can easy to connect. Download SSH Manager.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=30&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>SSH Manager is application to manager your ssh connection, you can create your own list of connection and can easy to connect. </p>
<p><img src="http://zhobur.files.wordpress.com/2009/04/sshman.png?w=600" alt="SSH Manager" /></p>
<p><a href="http://www.ziddu.com/download/4517731/sshmanager-0.0.1.linux-i686.tar.gz.html">Download</a> SSH Manager.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zhobur.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zhobur.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zhobur.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zhobur.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/zhobur.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/zhobur.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/zhobur.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/zhobur.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zhobur.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zhobur.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zhobur.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zhobur.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zhobur.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zhobur.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=30&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://zhobur.wordpress.com/2009/04/27/ssh-manager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f220aafe6e689be76efee350cc539b2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">zhobur</media:title>
		</media:content>

		<media:content url="http://zhobur.files.wordpress.com/2009/04/sshman.png" medium="image">
			<media:title type="html">SSH Manager</media:title>
		</media:content>
	</item>
		<item>
		<title>Simple SNMP Poller with Python</title>
		<link>http://zhobur.wordpress.com/2009/04/22/simple-snmp-poller-with-python/</link>
		<comments>http://zhobur.wordpress.com/2009/04/22/simple-snmp-poller-with-python/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 03:57:28 +0000</pubDate>
		<dc:creator>zhobur</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://zhobur.wordpress.com/?p=23</guid>
		<description><![CDATA[Just want to share how to implement simple SNMP Poller with pySNMP, this code using Oracle Database to save MIB dimension, save pool result and others. OID Dimension Table definition: Server Parameter Table definition : OID Server To Be Check Table definition : Reporting Table definition: Poller class definition: GET Poller command class definition: Main [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=23&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Just want to share how to implement simple SNMP Poller with pySNMP, this code using Oracle Database to save MIB dimension, save pool result and others.</p>
<p>OID Dimension Table definition:<br />
<pre class="brush: sql;">
CREATE TABLE &quot;NMS&quot;.&quot;DIM_OID&quot; 
   (	&quot;OID&quot; VARCHAR2(150 BYTE), 
	&quot;ALIAS&quot; VARCHAR2(150 BYTE), 
	&quot;DESCRIPTION&quot; VARCHAR2(150 BYTE), 
	 CONSTRAINT &quot;DIM_OID_UK1&quot; UNIQUE (&quot;OID&quot;)
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE &quot;NMS&quot;  ENABLE
   ) PCTFREE 0 PCTUSED 40 INITRANS 1 MAXTRANS 255 COMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE &quot;NMS&quot; ;
</pre></p>
<p>Server Parameter Table definition :<br />
<pre class="brush: sql;">
  CREATE TABLE &quot;NMS&quot;.&quot;PAR_SERVER&quot; 
   (	&quot;ID&quot; NUMBER(9,0), 
	&quot;HOSTNAME&quot; VARCHAR2(50 BYTE), 
	&quot;DESCRIPTION&quot; VARCHAR2(150 BYTE), 
	&quot;IP_ADDRESS&quot; VARCHAR2(15 BYTE), 
	&quot;RO_COMMUNITY&quot; VARCHAR2(50 BYTE), 
	&quot;RW_COMMUNITY&quot; VARCHAR2(50 BYTE), 
	&quot;AUTH_USER&quot; VARCHAR2(50 BYTE), 
	&quot;AUTH_PASS&quot; VARCHAR2(50 BYTE), 
	&quot;STATUS&quot; VARCHAR2(4 BYTE), 
	&quot;SNMP_VERSION&quot; VARCHAR2(3 BYTE), 
	 CONSTRAINT &quot;PAR_SERVER_UK1&quot; UNIQUE (&quot;ID&quot;)
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE &quot;NMS&quot;  ENABLE
   ) PCTFREE 0 PCTUSED 40 INITRANS 1 MAXTRANS 255 COMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE &quot;NMS&quot; ;
</pre></p>
<p>OID Server To Be Check Table definition :<br />
<pre class="brush: sql;">
  CREATE TABLE &quot;NMS&quot;.&quot;DIM_SERVER_CHECK&quot; 
   (	&quot;HOSTNAME&quot; VARCHAR2(50 BYTE), 
	&quot;OID&quot; VARCHAR2(150 BYTE), 
	 CONSTRAINT &quot;DIM_SERVER_CHECK_UK1&quot; UNIQUE (&quot;HOSTNAME&quot;, &quot;OID&quot;)
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE &quot;NMS&quot;  ENABLE
   ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE &quot;NMS&quot; ;
</pre></p>
<p>Reporting Table definition:<br />
<pre class="brush: sql;">
  CREATE TABLE &quot;NMS&quot;.&quot;RPT_STATISTIC&quot; 
   (	&quot;ID&quot; NUMBER(9,0), 
	&quot;HOSTNAME&quot; VARCHAR2(50 BYTE), 
	&quot;OID&quot; VARCHAR2(150 BYTE), 
	&quot;VALUE&quot; VARCHAR2(200 BYTE), 
	&quot;QUERY_TIME&quot; DATE
   ) PCTFREE 0 PCTUSED 40 INITRANS 1 MAXTRANS 255 COMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE &quot;NMS&quot; ;
 
  CREATE INDEX &quot;NMS&quot;.&quot;RPT_STATISTIC_INDEX1&quot; ON &quot;NMS&quot;.&quot;RPT_STATISTIC&quot; (&quot;HOSTNAME&quot;, &quot;OID&quot;, &quot;QUERY_TIME&quot;) 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE &quot;NMS&quot; ;
 
  CREATE OR REPLACE TRIGGER &quot;NMS&quot;.&quot;TRG_RPT_STATISTIC&quot; 
 BEFORE INSERT ON RPT_STATISTIC
 FOR EACH ROW
BEGIN
  :NEW.QUERY_TIME := SYSDATE;
END;


/
ALTER TRIGGER &quot;NMS&quot;.&quot;TRG_RPT_STATISTIC&quot; ENABLE;
</pre></p>
<p>Poller class definition:<br />
<pre class="brush: python;">

import sys, os
import cx_Oracle

sys.path.append(os.environ['NMS_LIB'])
import parameters, logger, GetPoller

## [ Class Definition ]
class ServerInformation:
    server = None

    def __init__(self):
        self.server = {&quot;hostname&quot;:&quot;&quot;, &quot;ip_address&quot;:&quot;&quot;, &quot;ro_community&quot;:&quot;&quot;, &quot;rw_community&quot;:&quot;&quot;, &quot;auth_user&quot;:&quot;&quot;, &quot;auth_password&quot;:&quot;&quot;}


class Poller:
    connection = None
    getPoller = GetPoller.GetPoller()

    def __init__(self):
        None

    def createOracleConnection(self, config):
        try:
            self.connection = cx_Oracle.connect(config['username'] + '/' + config['password'] + '@' + config['sid'])
            return self.connection
        except Exception, errmsg:
            logger.write(errmsg)
            exit(1)
    
    def getTargetHost(self):
        try:
            result = []
            
            q_host = &quot;SELECT hostname, ip_address, ro_community, rw_community, auth_user, auth_pass FROM PAR_SERVER WHERE STATUS = 'UP'&quot;
            stmt = self.connection.cursor()
            stmt.execute(q_host)
            ##fetching all host information
            rs = stmt.fetchall()
            for res in rs:
                ##print res
                serverInformation = ServerInformation()
                serverInformation.server[&quot;hostname&quot;] = str(res[0])
                serverInformation.server[&quot;ip_address&quot;] = res[1]
                serverInformation.server[&quot;ro_community&quot;] = res[2]
                serverInformation.server[&quot;rw_community&quot;] = res[3]
                serverInformation.server[&quot;auth_user&quot;] = res[4]
                serverInformation.server[&quot;auth_password&quot;] = res[4]
                result.append(serverInformation)
            stmt.close()
    
            ##print result
            return result
        except Exception, errmsg:
            logger.write(errmsg)
            exit(1)

    def getConnection(self):
        return self.connection

    def insertStatistic(self, info, param):
        try:
            q_insert = &quot;INSERT INTO RPT_STATISTIC (ID, HOSTNAME, OID, VALUE) VALUES (SEQ_RPT_STAT.nextval, :p_hostname, :p_oid, :p_value)&quot;
            binSel = {&quot;p_hostname&quot;:info.server[&quot;hostname&quot;], &quot;p_oid&quot;:param[&quot;oid&quot;], &quot;p_value&quot;:param[&quot;value&quot;]}

            stmt = self.getConnection().cursor()
            stmt.execute(q_insert, binSel)
            self.getConnection().commit()
            stmt.close()
        except Exception, errmsg:
            logger.write(errmsg)

    def getOidList(self):
        try:
            result = []
            
            
            q_host = &quot;SELECT oid, alias FROM DIM_OID&quot;
            stmt = self.connection.cursor()
            stmt.execute(q_host)
            ##fetching all host information
            rs = stmt.fetchall()
            for res in rs:
                info = {&quot;oid&quot;:&quot;&quot;, &quot;alias&quot;:&quot;&quot;}
                info[&quot;oid&quot;] = str(res[0])
                info[&quot;alias&quot;] = res[1]
                result.append(info)
            stmt.close()
    
            return result
        except Exception, errmsg:
            logger.write(errmsg)
            exit(1)
</pre></p>
<p>GET Poller command class definition:<br />
<pre class="brush: python;">

import os, sys
from pysnmp.entity.rfc3413.oneliner import cmdgen

sys.path.append(os.environ['NMS_LIB'])
import logger
##[ Global Variable Definition ]


## [ Class Definition ]
class ServerInformation:
    server = None

    def __init__(self):
        self.server = {&quot;hostname&quot;:&quot;&quot;, &quot;ip_address&quot;:&quot;&quot;, &quot;ro_community&quot;:&quot;&quot;, &quot;rw_community&quot;:&quot;&quot;, &quot;auth_user&quot;:&quot;&quot;, &quot;auth_password&quot;:&quot;&quot;}


class GetPoller:
    commandGenerator = cmdgen.CommandGenerator()
    serverInformation = ServerInformation()
    udpTransport = None
    comdata = None
    oid = None
    
    def __init__(self):
        None

    def initialize(self, serverInformation):
        self.serverInformation = serverInformation
        ##print 'setup connectio to SNMP agent.'
        self.udpTransport = cmdgen.UdpTransportTarget((self.serverInformation.server[&quot;ip_address&quot;], 161))
        self.comdata = cmdgen.CommunityData(self.serverInformation.server[&quot;auth_user&quot;], self.serverInformation.server[&quot;ro_community&quot;], 0)
        ##print 'done.'

    def get(self, oid):
        self.oid = self.createOID(oid.split(&quot;.&quot;))
        errorIndication, errorStatus, errorIndex, varBinds = self.commandGenerator.getCmd(self.comdata, self.udpTransport, self.oid)
        for oid, val in varBinds:
            return val.prettyPrint() 

    def createOID(self, tokens):
        result = ()
        for token in tokens:
            result += (int(token),)
        return result

</pre></p>
<p>Main program of poller:<br />
<pre class="brush: python;">

import sys, os
import socket
import threading
import time

sys.path.append(os.environ['NMS_LIB'])
import parameters, logger, GetPoller, Poller

##[ Global Variable Definition ]
par = parameters.Parameter()
confFileName = os.environ['NMS_HOME'] + os.path.sep + 'config' + os.path.sep + 'connections.cfg'
dbConf = par.getParams(confFileName)


pollerConf= os.environ['NMS_HOME'] + os.path.sep + 'config' + os.path.sep + 'poller.cfg'
pollerConfig = par.getParams(pollerConf)

## [ Class Definition ]
class Starter(threading.Thread):
    def __init__(self, lock):
        self.lock= lock
        threading.Thread.__init__ ( self )
        
    def run(self):
        poller = Poller.Poller()
        ##setup oracle connection
        print 'setup oracle connection....'
        conn = poller.createOracleConnection(dbConf)
        
        print 'initialize target host to query....'
        serverList = poller.getTargetHost()
        
        print 'initialize oid target host to be query'
        oidList = poller.getOidList()
        
        print 'polling query to agent....'
        
        for server in serverList:
            ##print server.server
            poller.getPoller.initialize(server)
            for info in oidList:
                ##print  info[&quot;oid&quot;]
                param = {&quot;oid&quot;:&quot;&quot;, &quot;value&quot;:&quot;&quot;}
                param[&quot;oid&quot;] = info[&quot;oid&quot;]
                param[&quot;value&quot;] = poller.getPoller.get(info[&quot;oid&quot;])
        
                if param[&quot;value&quot;] != '':
                    poller.insertStatistic(server, param)
        
        print 'process complete.....'
        conn.close()


class ClientThread(threading.Thread):
    # Override Thread's __init__ method to accept the parameters needed:
    def __init__ ( self, channel, details, lock ):
        self.channel = channel
        self.details = details
        self.lock = lock

        threading.Thread.__init__ ( self )

    def run ( self ):
        flag = True
        while flag:
            command = self.channel.recv ( 1024 )
            command = command.strip()
            
            print 'Received connection:', self.details [ 0 ]
            print command

            if command == &quot;shutdown&quot;:
                self.channel.send(&quot;SNMP Poller agent will be shutdown.....\nPlease close your connection.....\n&quot;)
                os.remove(self.lock)
            elif command == &quot;close&quot;:
                flag = False
            elif command == &quot;help&quot;:
                ##print help command
                self.channel.send(&quot;___________________________________________________\n&quot;)
                self.channel.send(&quot;&quot;&quot;SNMP Poller agent version 0.1\nHelp:\nshutdown\t: Used to shutdown SNMP Poller agent.\nclose\t\t: Used to close connection session.\n&quot;&quot;&quot;)
                self.channel.send(&quot;___________________________________________________\n&quot;)
            else:
                self.channel.send(&quot;Unknow command, type help to see detail.\n&quot;)

        self.channel.close()



class Server(threading.Thread):
    def __init__(self, lock):
        self.lock = lock
        self.flag = True
        threading.Thread.__init__(self)
        ##create lock on server
        lock = open(self.lock,&quot;w&quot;)
        lock.close()

    def run(self):
        ## Set up the server:
        
        server = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
        server.bind ( ( '', int(pollerConfig[&quot;port&quot;]) ) )
        server.listen ( int(pollerConfig[&quot;max_connection&quot;]) )

        while self.flag == True:
            channel, details = server.accept()
            ClientThread ( channel, details , self.lock).start()
            self.flag = os.path.exists(self.lock)
            if flag == False:
                break

        server.close()


##[ Procedure or Function Definition ]



##[ Main Program ]

##create lock on server
lockFilename = os.environ['NMS_HOME'] + os.path.sep + 'config' + os.path.sep + &quot;SNMPpoller.lock&quot;
lock = open(lockFilename, &quot;w&quot;)
lock.close()

##setup socket server
Server(lockFilename).start()

##running poller
flag = True
while flag == True:
    time.sleep(int(pollerConfig[&quot;sleep&quot;]))
    Starter(lockFilename).start()
    flag = os.path.exists(lockFilename)
    if flag == False:
        break


sys.exit()
##[ End Program ]
</pre></p>
<p>This poller program using some of configuration, configuration for connection to database and poller server configuration.<br />
Sample connections.cfg :<br />
username=nms<br />
password=nms<br />
sid=oratunggul</p>
<p>Sample poller.cfg :<br />
sleep=300<br />
max_connection=1<br />
port=2728</p>
<p>Hopefully this will be useful..</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zhobur.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zhobur.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zhobur.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zhobur.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/zhobur.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/zhobur.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/zhobur.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/zhobur.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zhobur.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zhobur.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zhobur.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zhobur.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zhobur.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zhobur.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=23&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://zhobur.wordpress.com/2009/04/22/simple-snmp-poller-with-python/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f220aafe6e689be76efee350cc539b2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">zhobur</media:title>
		</media:content>
	</item>
		<item>
		<title>Extract Oracle and Mysql With Java</title>
		<link>http://zhobur.wordpress.com/2009/04/21/extract-oracle-and-mysql-with-java/</link>
		<comments>http://zhobur.wordpress.com/2009/04/21/extract-oracle-and-mysql-with-java/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 10:11:09 +0000</pubDate>
		<dc:creator>zhobur</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://zhobur.wordpress.com/?p=20</guid>
		<description><![CDATA[Spooit is simple scripts to extract data from Oracle or MySQL database with Java using jdbc. Configuration file : DATABASE=[database type (oracle/mysql)] INSTANCE=[database name] HOST=[database host] USER=[database user] PASSWORD=[database password] QUERY=[query to run] OUTFILE=[output filename] DELIMITER=[column delimiter] #this mean comment #DEFAULT FETCHSIZE 1024 FETCHSIZE=1024 How to run : java -cp pat_to_jdbc:path_to_your_class SpoolIt<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=20&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Spooit is simple scripts to extract data from Oracle or MySQL database with Java using jdbc.</p>
<p><pre class="brush: java;">
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.io.*;

public class SpoolIt {
	//variable or behaviour
	private static String vDb = &quot;&quot;;
	private static String vUser = &quot;&quot;;
	private static String vPassword = &quot;&quot;;
	private static String vHost = &quot;&quot;;
	private static String vURL = &quot;&quot;;
	private static String vQuery = &quot;&quot;;
	private static String vDbType = &quot;&quot;;
	private static String vOutFile = &quot;&quot;;
	private static String vDelim = &quot;|&quot;;
	private static int FETCHSIZE = 1024;

	//default constructor
	public SpoolIt() {}

	//method
	public static void getParameters(String parFile) {
		String[] values;
		String str;
		String tmp;

		try {
			/* sample parameter
			HOST=localhost
			USER=syahreza
			*/
			BufferedReader in = new BufferedReader(new FileReader(parFile));
			//read parameter file
			System.out.println(&quot;Configuration file&quot;);
			while ((str = in.readLine()) != null) {
				values = str.split(&quot;=&quot;);
				tmp = values[0];
				try {
					if(tmp.equals(&quot;DATABASE&quot;)) {
						vDbType = values[1];
						//System.out.println(&quot;Database	\t: &quot; + vDbType);
					}
					if(tmp.equals(&quot;INSTANCE&quot;)) {
						vDb = values[1];
						//System.out.println(&quot;Instanse	\t: &quot; + vDb);
					}
					if(tmp.equals(&quot;HOST&quot;)) {
						vHost = values[1];
						//System.out.println(&quot;Host		\t: &quot; + vHost);
					}
					if(tmp.equals(&quot;USER&quot;)) {
						vUser = values[1];
						//System.out.println(&quot;User Name	\t: &quot; + vUser);
					}
					if(tmp.equals(&quot;PASSWORD&quot;)) {
						vPassword = values[1];
						//System.out.println(&quot;Password	\t: &quot; + vPassword);
					}
					if(tmp.equals(&quot;QUERY&quot;)) {
						vQuery = values[1];
						//System.out.println(&quot;Query		\t: &quot; + vQuery);
					}
					if(tmp.equals(&quot;OUTFILE&quot;)) {
						vOutFile = values[1];
						//System.out.println(&quot;OutFile		\t: &quot; + vOutFile);
					}
					if(tmp.equals(&quot;DELIMITER&quot;)) {
						vDelim = values[1];
						//System.out.println(&quot;DELIMITER		\t: &quot; + vDelim);
					}
					if(tmp.equals(&quot;FETCHSIZE&quot;)) {
						FETCHSIZE = Integer.valueOf(values[1]);
						//System.out.println(&quot;DELIMITER		\t: &quot; + vDelim);
					}
				} catch(ArrayIndexOutOfBoundsException ex) {
					//use default setting
					continue;
				}
			}
			in.close();
		} catch (IOException e) {
		}
	}

	//main program
	public static void main(String[] args) throws Exception {
		String parfile = &quot;&quot;;
		Connection conn = null;
		Statement stmt = null;
		ResultSet rs = null;
		ResultSetMetaData rsmd = null;
		int n = 0;
		long oldTime, curTime, sumTime, avgTime = 0;
		int rows = 0;
		try {
			parfile = args[0];
		} catch(Exception exc) {
			System.out.println(&quot;Please use SpoolIt [configuration file]&quot;);
			System.exit(1);
		}

		try {
			System.out.println(&quot;------------------------------------------------------------&quot;);
			System.out.println(&quot;                Spool IT Version 0.1.0&quot;);
			System.out.println(&quot;------------------------------------------------------------&quot;);
			//record start time
			oldTime = System.currentTimeMillis();
			//read parameter file
			getParameters(parfile);

			System.out.print(&quot;\n-------------------- Configuration -------------------------\n&quot;);
			System.out.println(&quot;Database product     : &quot; + vDbType);
			System.out.println(&quot;Database Instance    : &quot; + vDb);
			System.out.println(&quot;Database User ID     : &quot; + vUser);
			System.out.println(&quot;SQL Query for export : &quot; + vQuery);

			System.out.println(&quot;\n-------------------- Dump File -----------------------------&quot;);
			System.out.println(&quot;Path : &quot; +vOutFile );
			System.out.println(&quot;Type : Variable length separated by delimeter \&quot;&quot; + vDelim + &quot;\&quot;&quot;);
			System.out.println(&quot;Rows Fetch Size : &quot; + FETCHSIZE);

			//load driver
			LoadDriver ld = new LoadDriver();
			ld.loadNow(vDbType);

			//create connection to database
			if(vDbType.equals(&quot;mysql&quot;)){
				vURL = &quot;jdbc:&quot; + vDbType + &quot;://&quot; + vHost + &quot;/&quot; + vDb + &quot;?user=&quot; + vUser + &quot;&amp;password=&quot; + vPassword;
				conn = DriverManager.getConnection(vURL);
			}else if(vDbType.equals(&quot;oracle&quot;)) {
				//vURL = &quot;jdbc:oracle:thin:@(description=(address=(host=&quot; + vHost + &quot;) (protocol=tcp)(port=1521))(connect_data=(sid=&quot; + vDb + &quot;)))&quot;;
				//conn = DriverManager.getConnection(vURL, vUser, vPassword);

				conn = DriverManager.getConnection( &quot;jdbc:oracle:thin:@&quot; + vHost + &quot;:1521:&quot; + vDb,vUser,vPassword);

			}

			//Implementation
			try {
				stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);

				stmt.setFetchSize(FETCHSIZE);
				System.out.print(&quot;\nExecuting query...&quot;);
				//change fetch size on result set
				//rs.setFetchSize(FETCHSIZE);
				//rs.setFetchDirection(ResultSet.FETCH_FORWARD);
				//rs = stmt.executeQuery(vQuery);

				if(stmt.execute(vQuery)) {
					System.out.print(&quot;Done\n&quot;);
					//change fetch size on result set
					rs = stmt.getResultSet();
					rs.setFetchSize(FETCHSIZE);
					rsmd = rs.getMetaData();
					n = rsmd.getColumnCount();
					//fetch data and save to file
					BufferedWriter out = new BufferedWriter(new FileWriter(vOutFile));
					String tmpStr = &quot;&quot;;
					System.out.print(&quot;Exporting data to &quot; + vOutFile + &quot;\n&quot;);
					while(rs.next()) {
						try {
							tmpStr = &quot;&quot;;

							for(int index=1; index&lt;=n; index++) {
								if(index != n)
									tmpStr = tmpStr + rs.getString(index) + vDelim;
								else
									tmpStr = tmpStr + rs.getString(index) + &quot;\n&quot;;
							}
							//tmpStr = rs.getString(1) + &quot;\n&quot;;
							out.write(tmpStr);
							rows++;
						} catch (IOException e) {
						}
						//sleep milisecond
					}
					//close dump file
					out.close();
					System.out.println(&quot;Export succesfully&quot;);
				}
			} finally {
				try {
					if(rs != null) {
						rs.close();
					}
					rs = null;
					if(stmt != null) {
						stmt.close();
					}
					stmt = null;
				} catch (SQLException sqlEx) { }
			}
			try {
				//release connection
				conn.close();
			} catch(SQLException sqlEx) {}
			//summary of time execution
			curTime = System.currentTimeMillis();
			sumTime = (curTime - oldTime);

			System.out.println(&quot;\n-------------------- Performance ---------------------------&quot;);
			System.out.println(&quot;Total rows exported : &quot; + rows + &quot; rows&quot;);
			System.out.println(&quot;Overall dump speed  : &quot; + sumTime + &quot; miliseconds&quot;);
			//System.out.println(&quot;Started  : Wed Sep  5 01:10:54 2007&quot;);
			//System.out.println(&quot;Finished : Wed Sep  5 01:10:55 2007&quot;);
			//create log file

		} catch(SQLException ex) {
			System.out.println(&quot;SQLException : &quot; + ex.getMessage());
		}
	}
}

//class to load driver
class LoadDriver {
	//default constructor
	public LoadDriver() {}

	public void loadNow(String dbType) {
		try {
			// The newInstance() call is a work around for some
			// broken Java implementations
			if(dbType.equals(&quot;mysql&quot;)) {
				Class.forName(&quot;com.mysql.jdbc.Driver&quot;).newInstance();
			} else if(dbType.equals(&quot;oracle&quot;)) {
				Class.forName(&quot;oracle.jdbc.driver.OracleDriver&quot;).newInstance();
			}
		} catch (Exception ex) {
			// handle the error
		}
	}
}

</pre></p>
<p>Configuration file :<br />
DATABASE=[database type (oracle/mysql)]<br />
INSTANCE=[database name]<br />
HOST=[database host]<br />
USER=[database user]<br />
PASSWORD=[database password]<br />
QUERY=[query to run]<br />
OUTFILE=[output filename]<br />
DELIMITER=[column delimiter]</p>
<p>#this mean comment<br />
#DEFAULT FETCHSIZE 1024<br />
FETCHSIZE=1024</p>
<p>How to run :<br />
java -cp pat_to_jdbc:path_to_your_class SpoolIt</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zhobur.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zhobur.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zhobur.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zhobur.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/zhobur.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/zhobur.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/zhobur.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/zhobur.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zhobur.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zhobur.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zhobur.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zhobur.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zhobur.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zhobur.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=20&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://zhobur.wordpress.com/2009/04/21/extract-oracle-and-mysql-with-java/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f220aafe6e689be76efee350cc539b2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">zhobur</media:title>
		</media:content>
	</item>
		<item>
		<title>Extract Oracle Data with OCIULDR</title>
		<link>http://zhobur.wordpress.com/2009/04/21/extract-oracle-data-with-ociuldr/</link>
		<comments>http://zhobur.wordpress.com/2009/04/21/extract-oracle-data-with-ociuldr/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 09:46:49 +0000</pubDate>
		<dc:creator>zhobur</dc:creator>
				<category><![CDATA[Oracle PL/SQL]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://zhobur.wordpress.com/?p=15</guid>
		<description><![CDATA[Main script : Runner thread script: Implementation : Just configure the scripts such as ORACLE_HOME, LD_LIBRARY_PATH, OCI_HOME, OUT_DIR and TMP_DIR as yours. To use this scripts you have to download ociuldr software in the official site.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=15&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Main script :</p>
<p><pre class="brush: python;">
#/bin/bash

if [ $# -lt 6 ]
then
   echo &quot;Please use arguments, $0 [USERNAME] [PASSWORD] [SID] [SQLFILE] [SCHEMA] [MAX THREAD]&quot;
   exit 1
fi

######INITIAL PARAMETER
#-[ You must configure this directory ] -----------------------------#
OUTDIR=/oth02/spoll/
TMPDIR=/oth02/spoll/tmp

USERNAME=$1
PASSWORD=$2
SID=$3
sList=$4
SCHEMA=$5
max_thread=$6

THREADID=0
##max_thread=5


######FUNCTION
function cSQL(){
  tablename=$1
  cat &lt;&lt; EOF &gt; ${TMPDIR}/${tablename}.sql
  SELECT *
  FROM $tablename

EOF
}

function start() {
for tablename in `cat $sList`
do
   ##identified any threads
   sFlag=0
   while [ $sFlag -eq 0 ]
   do
      NEXT_PROC=`ls ${SCHEMA}_*.lock | wc -l`
      if [ $NEXT_PROC -le $max_thread ]
      then
         sFlag=1
      else
         sleep 15
      fi
   done

   #running others threads
   touch ${SCHEMA}_${THREADID}.lock
   cSQL $tablename
   . ociuldr $USERNAME $PASSWORD $SID ${TMPDIR}/${tablename}.sql ${OUTDIR}/${SCHEMA}/${tablename}.dat ${SCHEMA}_${THREADID} &amp;

   let &quot;THREADID+=1&quot;

done
}

######MAIN PROGRAM
start

exit 0
#-[ LICENSE ] -----------------------------------------------------------#
#                                                                        #
#  Scripts Runner Extract Oracle Table Using OCIULDR                     #
#  Copyright (C) 2009 Syahreza Octadian                                  #
#  All rights reserved.                                                  #
#                                                                        #
#                                                                        #
#  Permission is granted to anyone to use this software for any purpose, #
#  including commercial applications, and to alter it and redistribute   #
#  it freely, subject to the following restrictions:                     #
#                                                                        #
#  1. The origin of this software must not be misrepresented; you must   #
#     not claim that you wrote the original software.  If you use this   #
#     software in a product, an acknowledgment in the product            #
#     documentation would be appreciated but is not required.            #
#                                                                        #
#  2. Altered source versions must be plainly marked as such, and must   #
#     not be misrepresented as being the original software.              #
#                                                                        #
#  3. This notice may not be removed or altered from any source          #
#     distribution.                                                      #
#                                                                        #
#------------------------------------------------------------------------#

</pre></p>
<p>Runner thread script:<br />
<pre class="brush: python;">
#/bin/bash

if [ $# -lt 6 ]
then
   echo &quot;Please use arguments, $0 [USERNAME] [PASSWORD] [SID] [SQLFILE] [OUTFILE] [THREAD NAME]&quot;
   exit 1
fi


USERNAME=$1
PASSWORD=$2
SID=$3
SQLFILE=$4
OUTFILE=$5
THREADNAME=$6

######THIS IS MANDATORY
######ORACLE LIBRARY
#-[ You must configure this directory ] -----------------------------#
export LD_LIBRARY_PATH=/data01/oradw/oracle/product/10.2.0/Db_1/lib32/:/data01/oradw/oracle/product/10.2.0/Db_1/lib

######OCI PROGRAM
OCI_HOME=/oth02/spoll/oci


######MAIN PROGRAM
echo &quot;&quot; &gt;&gt; ${USERNAME}.log
echo &quot;Start time : `date` $THREADNAME&quot; &gt;&gt; ${USERNAME}.log
echo &quot;Running SQLFILE : ${SQLFILE}&quot; &gt;&gt; ${USERNAME}.log
echo &quot;Running OUTFILE : ${OUTFILE}&quot; &gt;&gt; ${USERNAME}.log

#-[ You must configure oci program ] -----------------------------#
$OCI_HOME/ociuldr_solaris user=${USERNAME}/${PASSWORD}@${SID} sql=${SQLFILE} file=${OUTFILE} field=0x7c &gt;&gt; ${OCI_HOME}/ociuldr_solaris.log

if [ -a ${SQLFILE} ]
then
   echo &quot;Removing SQLFILE : ${SQLFILE}&quot; &gt;&gt; ${USERNAME}.log
   rm ${SQLFILE}
fi

if [ -a ${THREADNAME}.lock ]
then
   rm ${THREADNAME}.lock
fi

echo &quot;End time : `date`&quot; &gt;&gt; ${USERNAME}.log
echo &quot;&quot; &gt;&gt; ${USERNAME}.log

#-[ LICENSE ] -----------------------------------------------------------#
#                                                                        #
#  Scripts Runner Extract Oracle Table Using OCIULDR                     #
#  Copyright (C) 2009 Syahreza Octadian                                  #
#  All rights reserved.                                                  #
#                                                                        #
#                                                                        #
#  Permission is granted to anyone to use this software for any purpose, #
#  including commercial applications, and to alter it and redistribute   #
#  it freely, subject to the following restrictions:                     #
#                                                                        #
#  1. The origin of this software must not be misrepresented; you must   #
#     not claim that you wrote the original software.  If you use this   #
#     software in a product, an acknowledgment in the product            #
#     documentation would be appreciated but is not required.            #
#                                                                        #
#  2. Altered source versions must be plainly marked as such, and must   #
#     not be misrepresented as being the original software.              #
#                                                                        #
#  3. This notice may not be removed or altered from any source          #
#     distribution.                                                      #
#                                                                        #
#------------------------------------------------------------------------#
</pre></p>
<p>Implementation :<br />
Just configure the scripts such as ORACLE_HOME, LD_LIBRARY_PATH, OCI_HOME, OUT_DIR and TMP_DIR as yours.<br />
To use this scripts you have to download <a href="http://www.dbatools.net/mytools/unload_oracle_with_ociuldr.html">ociuldr</a> software in the official site.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zhobur.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zhobur.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zhobur.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zhobur.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/zhobur.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/zhobur.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/zhobur.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/zhobur.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zhobur.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zhobur.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zhobur.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zhobur.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zhobur.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zhobur.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zhobur.wordpress.com&amp;blog=7428768&amp;post=15&amp;subd=zhobur&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://zhobur.wordpress.com/2009/04/21/extract-oracle-data-with-ociuldr/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f220aafe6e689be76efee350cc539b2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">zhobur</media:title>
		</media:content>
	</item>
	</channel>
</rss>
