<?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/"
	>
<channel>
	<title>blog.nicolas.pawlak.fr &#187; Oracle</title>
	<atom:link href="http://blog.nicolas.pawlak.fr/categories/bases-de-donnees/oracle/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nicolas.pawlak.fr</link>
	<description>Tux ne sait pas voler, c&#039;est normal : ce n&#039;est pas un pingouin...</description>
	<lastBuildDate>Sun, 31 Jul 2011 14:56:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Linux : attention aux mots de passe Oracle sur sqlplus !</title>
		<link>http://blog.nicolas.pawlak.fr/2010/06/29/linux-attention-aux-mots-de-passe-oracle-sur-sqlplus/</link>
		<comments>http://blog.nicolas.pawlak.fr/2010/06/29/linux-attention-aux-mots-de-passe-oracle-sur-sqlplus/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 10:00:56 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[connect]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mot]]></category>
		<category><![CDATA[nolog]]></category>
		<category><![CDATA[passe]]></category>
		<category><![CDATA[ps]]></category>
		<category><![CDATA[sqlplus]]></category>
		<category><![CDATA[system]]></category>
		<category><![CDATA[xe]]></category>
		<guid isPermaLink="false">http://blog.nicolas.pawlak.fr/?p=970</guid>
		<description><![CDATA[Une petite piqûre de rappel sur la façon dont se connecter à une instance Oracle sous Linux, afin de tordre le cou au sacro-saint sqlplus identifiant/motdepasse@instance &#8230; &#91;ora102@bddhost&#93;# sqlplus SYSTEM/manager@XE &#160; SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jun 8 10:49:35 2010 &#160; Copyright &#40;c&#41; 1982, 2005, Oracle. All rights reserved. &#160; Connected to: Oracle [...]]]></description>
			<content:encoded><![CDATA[<p>Une petite piqûre de rappel sur la façon dont se connecter à une <a href="http://oracle.developpez.com/guide/architecture/archiinstance/">instance Oracle</a> sous Linux, afin de tordre le cou au sacro-saint <em>sqlplus  identifiant/motdepasse@instance</em> &#8230;</p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>ora102<span style="color: #000000; font-weight: bold;">@</span>bddhost<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># sqlplus SYSTEM/manager@XE</span>
&nbsp;
SQL<span style="color: #000000; font-weight: bold;">*</span>Plus: Release 10.2.0.1.0 - Production on Tue Jun <span style="color: #000000;">8</span> <span style="color: #000000;">10</span>:<span style="color: #000000;">49</span>:<span style="color: #000000;">35</span> <span style="color: #000000;">2010</span>
&nbsp;
Copyright <span style="color: #7a0874; font-weight: bold;">&#40;</span>c<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">1982</span>, <span style="color: #000000;">2005</span>, Oracle.  All rights reserved.
&nbsp;
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
&nbsp;
SQL<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>
<p>Ouvrons un autre <a href="http://doc.ubuntu-fr.org/terminal">terminal</a>, et voyons ce qui se passe lors d&#8217;une commande <em><a href="http://chl.be/glmf/www.linuxmag-france.org/old/lm3/ps.html">ps</a></em> :</p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>bddhost<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># ps -ef | grep sqlplus | grep -v grep</span>
root      <span style="color: #000000;">9207</span>  <span style="color: #000000;">9193</span>  <span style="color: #000000;">0</span> <span style="color: #000000;">10</span>:<span style="color: #000000;">49</span> pts<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span>    00:00:00 sqlplus SYSTEM<span style="color: #000000; font-weight: bold;">/</span>manager<span style="color: #000000; font-weight: bold;">@</span>XE
root      <span style="color: #000000;">9208</span>  <span style="color: #000000;">9207</span>  <span style="color: #000000;">0</span> <span style="color: #000000;">10</span>:<span style="color: #000000;">49</span> pts<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1</span>    00:00:00 sqlplus</pre></div></div>
<p>Plutôt gênant, non ? </p>
<p>Une bonne pratique est l&#8217;utilisation de l&#8217;option /nolog :</p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>ora102<span style="color: #000000; font-weight: bold;">@</span>bddhost<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># sqlplus /nolog</span>
&nbsp;
SQL<span style="color: #000000; font-weight: bold;">*</span>Plus: Release 10.2.0.1.0 - Production on Tue Jun <span style="color: #000000;">8</span> <span style="color: #000000;">10</span>:<span style="color: #000000;">53</span>:<span style="color: #000000;">48</span> <span style="color: #000000;">2010</span>
&nbsp;
Copyright <span style="color: #7a0874; font-weight: bold;">&#40;</span>c<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">1982</span>, <span style="color: #000000;">2005</span>, Oracle.  All rights reserved.
&nbsp;
SQL<span style="color: #000000; font-weight: bold;">&gt;</span> connect SYSTEM<span style="color: #000000; font-weight: bold;">/</span>manager<span style="color: #000000; font-weight: bold;">@</span>XE
Connected.
SQL<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>
<p>Le résultat de la commande <em>ps</em> :</p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>bddhost<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># ps -ef | grep sqlplus | grep -v grep</span>
root      <span style="color: #000000;">9314</span>  <span style="color: #000000;">9193</span>  <span style="color: #000000;">0</span> <span style="color: #000000;">10</span>:<span style="color: #000000;">53</span> pts<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span>    00:00:00 sqlplus <span style="color: #000000; font-weight: bold;">/</span>nolog
root      <span style="color: #000000;">9315</span>  <span style="color: #000000;">9314</span>  <span style="color: #000000;">0</span> <span style="color: #000000;">10</span>:<span style="color: #000000;">53</span> pts<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1</span>    00:00:00 sqlplus</pre></div></div>
<p>C&#8217;est mieux !</p>
<p>Enfin, pour une utilisation hors scripts, il vaut mieux éviter de saisir de cette façon son mot de passe et privilégier la solution suivante :</p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>ora102<span style="color: #000000; font-weight: bold;">@</span>bddhost<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># sqlplus /nolog</span>
&nbsp;
SQL<span style="color: #000000; font-weight: bold;">*</span>Plus: Release 10.2.0.1.0 - Production on Tue Jun <span style="color: #000000;">8</span> <span style="color: #000000;">10</span>:<span style="color: #000000;">56</span>:<span style="color: #000000;">55</span> <span style="color: #000000;">2010</span>
&nbsp;
Copyright <span style="color: #7a0874; font-weight: bold;">&#40;</span>c<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">1982</span>, <span style="color: #000000;">2005</span>, Oracle.  All rights reserved.
&nbsp;
SQL<span style="color: #000000; font-weight: bold;">&gt;</span> connect SYSTEM<span style="color: #000000; font-weight: bold;">@</span>XE
Enter password: <span style="color: #000000; font-weight: bold;">*******</span>
Connected.
SQL<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.nicolas.pawlak.fr/2010/06/29/linux-attention-aux-mots-de-passe-oracle-sur-sqlplus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Améliorer l&#8217;utilisation de SQL*Plus (Oracle) sous Linux avec rlwrap</title>
		<link>http://blog.nicolas.pawlak.fr/2010/01/08/ameliorer-lutilisation-de-sqlplus-oracle-sous-linux-avec-rlwrap/</link>
		<comments>http://blog.nicolas.pawlak.fr/2010/01/08/ameliorer-lutilisation-de-sqlplus-oracle-sous-linux-avec-rlwrap/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 13:00:16 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[flèches]]></category>
		<category><![CDATA[historique]]></category>
		<category><![CDATA[rlwrap]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[sqlplus]]></category>
		<guid isPermaLink="false">http://blog.nicolas.pawlak.fr/?p=390</guid>
		<description><![CDATA[L&#8217;utilisation de l&#8217;outil SQL*Plus d&#8217;Oracle sous un environnement Linux présente une particularité : il n&#8217;est pas possible de revenir dans l&#8217;historique des commandes passées avec les flèches, comme c&#8217;est possible sous Windows. Démonstration ora102@bddhost:~$ sqlplus /nolog &#160; SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jan 7 23:18:28 2010 &#160; Copyright (c) 1982, 2005, Oracle. All [...]]]></description>
			<content:encoded><![CDATA[<p>L&#8217;utilisation de l&#8217;outil SQL*Plus d&#8217;Oracle sous un environnement Linux présente une particularité : il n&#8217;est pas possible de revenir dans l&#8217;historique des commandes passées avec les flèches, comme c&#8217;est possible sous Windows. </p>
<p><strong>Démonstration</strong></p>
<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">ora102@bddhost:~$ sqlplus /nolog
&nbsp;
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jan 7 23:18:28 2010
&nbsp;
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
&nbsp;
SQL&gt; connect SYSTEM@XE
Enter password:
Connected.
SQL&gt; alter user SYSTEM identified by drowssap;
&nbsp;
User altered.
&nbsp;
SQL &gt;</pre></div></div>
<p>Jusqu&#8217;ici, tout va bien. Essayons à présent de remonter dans l&#8217;historique avec les flèches :</p>
<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">SQL&gt; ^[[A^[[B^[[A          &quot; - rest of line ignored.
SQL&gt; ^C2: unknown command &quot;</pre></div></div>
<p>Le moins que l&#8217;on puisse dire, c&#8217;est que c&#8217;est loin d&#8217;être fonctionnel&#8230; et on a très vite fait d&#8217;appuyer sur les flèches par habitude.</p>
<p><strong>La solution SQL*Plus</strong></p>
<p>Pour remonter dans l&#8217;historique avec SQL*Plus sous Linux, il faut en fait utiliser les commandes <em>L</em> et <em>R</em> :</p>
<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">SQL&gt; alter user SYSTEM identified by drowssap;
&nbsp;
User altered.
&nbsp;
SQL&gt; L
  1* alter user SYSTEM identified by drowssap
SQL&gt; R
  1* alter user SYSTEM identified by drowssap
&nbsp;
User altered.
&nbsp;
SQL&gt; c/drowssap/password
  1* alter user SYSTEM identified by password
SQL&gt; R
  1* alter user SYSTEM identified by password
&nbsp;
User altered.</pre></div></div>
<p>La commande L permet de visualiser la dernière action, la commande R permet de la rejouer. Pour modifier la dernière action, il faut utiliser la commande <em>c/texte_avant/texte_apres</em>.</p>
<p><strong>La solution rlwrap</strong></p>
<p>Derrière ce nom se cache un petit utilitaire qui vient se greffer à SQL*Plus et rajoute l&#8217;utilisation de la bibliothèque <em>readline</em> afin de permettre d&#8217;utiliser l&#8217;historique SQL*Plus avec les flèches. </p>
<p>Il est disponible dans les dépôts Debian/Ubuntu/Fedora (liste sans doute non exhaustive). A défaut, vous pouvez télécharger la source <a href="http://utopia.knoware.nl/~hlub/rlwrap/">ici</a> afin de l&#8217;installer.</p>
<p>Une fois installé, vous devez remplacer vos commandes &laquo;&nbsp;sqlplus&nbsp;&raquo; par &laquo;&nbsp;rlwrap sqlplus&nbsp;&raquo; :</p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ora102<span style="color: #000000; font-weight: bold;">@</span>bddhost:~$ rlwrap sqlplus <span style="color: #000000; font-weight: bold;">/</span>nolog</pre></div></div>
<p>Afin de rendre son utilisation plus transparente, il est possible de l&#8217;utiliser via un alias. Ajoutons-le :</p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ora102<span style="color: #000000; font-weight: bold;">@</span>bddhost:~$ <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;alias sqlplus='rlwrap sqlplus'&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bashrc</pre></div></div>
<p>Puis appliquons les changements apportés :</p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ora102<span style="color: #000000; font-weight: bold;">@</span>bddhost:~$ <span style="color: #7a0874; font-weight: bold;">source</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bashrc</pre></div></div>
<p>C&#8217;est fini. Désormais, en appelant l&#8217;exécutable sqlplus, rlwrap sera appelé de façon transparente et permettra l&#8217;utilisation des flèches pour visualiser ou modifier l&#8217;historique des commandes PL/SQL jouées.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nicolas.pawlak.fr/2010/01/08/ameliorer-lutilisation-de-sqlplus-oracle-sous-linux-avec-rlwrap/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

