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

<channel>
	<title>dbamac</title>
	<atom:link href="http://dbamac.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://dbamac.wordpress.com</link>
	<description>Patience is a virtue... that I don't have !!!!</description>
	<lastBuildDate>Thu, 11 Sep 2008 12:14:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='dbamac.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>dbamac</title>
		<link>http://dbamac.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://dbamac.wordpress.com/osd.xml" title="dbamac" />
	<atom:link rel='hub' href='http://dbamac.wordpress.com/?pushpress=hub'/>
		<item>
		<title>How to get the dependencies</title>
		<link>http://dbamac.wordpress.com/2008/09/11/how-to-get-the-dependencies/</link>
		<comments>http://dbamac.wordpress.com/2008/09/11/how-to-get-the-dependencies/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 12:14:43 +0000</pubDate>
		<dc:creator>macdba</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[dependency]]></category>

		<guid isPermaLink="false">http://dbamac.wordpress.com/?p=97</guid>
		<description><![CDATA[There are two ways you may check the dependencies of a table: 1) Using Toad you can see the dependecies of a table 2) Yaping Chen recommends using a procedure with &#8220;dbma_utility.GET_DEPENDENCY&#8221; example: sys@TEST&#62;exec dbms_utility.GET_DEPENDENCY(&#8216;TABLE&#8217;,'TEST&#8217;,'T1&#8242;); - DEPENDENCIES ON TEST.T1 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; *TABLE TEST.T1() *   FUNCTION TEST.FUN_T1_01() *      FUNCTION TEST.FUN_T1_02() PL/SQL procedure successfully completed.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=97&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There are two ways you may check the dependencies of a table:</p>
<p>1) Using Toad you can see the dependecies of a table</p>
<p>2) Yaping Chen recommends using a procedure with &#8220;dbma_utility.GET_DEPENDENCY&#8221;</p>
<p>example:</p>
<div><a title="mailto:sys@TEST&gt;exec" href="mailto:sys@TEST%3Eexec">sys@TEST&gt;exec</a> dbms_utility.GET_DEPENDENCY(&#8216;TABLE&#8217;,'TEST&#8217;,'T1&#8242;);<br />
-<br />
DEPENDENCIES ON  TEST.T1<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
*TABLE  TEST.T1()<br />
*   FUNCTION TEST.FUN_T1_01()<br />
*      FUNCTION  TEST.FUN_T1_02()</div>
<div>PL/SQL procedure successfully completed.</div>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dbamac.wordpress.com/97/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dbamac.wordpress.com/97/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dbamac.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dbamac.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dbamac.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dbamac.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dbamac.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dbamac.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dbamac.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dbamac.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dbamac.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dbamac.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dbamac.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dbamac.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dbamac.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dbamac.wordpress.com/97/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=97&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dbamac.wordpress.com/2008/09/11/how-to-get-the-dependencies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5e75dbdf30b85ad9166dc9d1801193d7?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">macdba</media:title>
		</media:content>
	</item>
		<item>
		<title>Enabling ARCHIVELOG Mode</title>
		<link>http://dbamac.wordpress.com/2008/08/12/enabling-archivelog-mode/</link>
		<comments>http://dbamac.wordpress.com/2008/08/12/enabling-archivelog-mode/#comments</comments>
		<pubDate>Tue, 12 Aug 2008 20:07:58 +0000</pubDate>
		<dc:creator>macdba</dc:creator>
				<category><![CDATA[ORACLE]]></category>
		<category><![CDATA[archive log]]></category>

		<guid isPermaLink="false">http://dbamac.wordpress.com/?p=90</guid>
		<description><![CDATA[This is a good review of enabling archive log &#8211; an article coming from cuddletech(http://www.cuddletech.com/articles/oracle/node58.html) Most of the High Availability features of Oracle require you to enable ARCHIVELOG mode for your database. When you enable this mode redo logs will be archived instead of overwritten. The archivelogs are stored in a seperate place usually can [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=90&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h1><a name="SECTION001210000000000000000"> </a></h1>
<p>This is a good review of enabling archive log &#8211; an article coming from cuddletech(http://www.cuddletech.com/articles/oracle/node58.html)</p>
<p>Most of the High Availability features of Oracle require you to enable ARCHIVELOG mode for your database.  When you enable this mode redo logs will be <em>archived</em> instead of overwritten.  The archivelogs are stored in a seperate place usually can backed up regularly by your standard filesystem backup system (NetBackup or whatever). Archive logs are utilized by RMAN, Data Guard, Flashback and many others.</p>
<p>If your going to enable archivelog mode on a <em>real</em> database thats important to you, I would recommend shutting down the database and doing a cold backup just in case.  Keeping a &#8220;final noarchivelog mode backup&#8221; seems to be a good and excepted practice.</p>
<p>Enabling archive mode is simple, just connect to your database in mounted but closed mode (startup mount) and alter the database.  But if you don&#8217;t tune alittle you&#8217;ll run into problems down the road, so lets specify some parameters too.  Namely, consider LOG_ARCHIVE_DEST.</p>
<p>Lets start by checking the current archive mode.</p>
<pre>SQL&gt; SELECT LOG_MODE FROM SYS.V$DATABASE;

LOG_MODE
------------
NOARCHIVELOG</pre>
<p>So we&#8217;re in NOARCHIVELOG mode and we need to change.   We can use a database alter statement, but that won&#8217;t be perminant, so lets just update the pfile directly. The pfile should be in either $ORACLE_BASE/admin/SID/pfile or $ORACLE_HOME/admin/SID/pfile.  I&#8217;ll add the following lines to the end of the file:</p>
<pre>############################
# Archive Log Destinations -benr(10/15/04)
############################
log_archive_dest_1='location=/u02/oradata/cuddle/archive'
log_archive_start=TRUE</pre>
<p>Note that we&#8217;re not actually required to specify the location of the log destination, but if you don&#8217;t it&#8217;ll end up  in strange places (in my test it went to $ORACLE_HOME/dbs making a mess). You can specify as many as 10 diffrent archive log destinations by using the paramters log_archive_dest_1 through log_archive_dest_10. Remember, if you run out of space in your archive log destination the database will <em>shut down</em>!</p>
<p>Now we can startup the database in mount mode and put it in  archivelog mode.</p>
<pre>[oracle@vixen pfile]$sqlplus sys/passwd as sysdba;
SQL*Plus: Release 10.1.0.2.0 - Production on Fri Oct 15 16:00:58 2004
Copyright (c) 1982, 2004, Oracle.  All rights reserved.
Connected to an idle instance.

SQL&gt; startup mount
ORACLE instance started.

Total System Global Area  184549376 bytes
Fixed Size                  1300928 bytes
Variable Size             157820480 bytes
Database Buffers           25165824 bytes
Redo Buffers                 262144 bytes
Database mounted.

SQL&gt; alter database archivelog;
Database altered.

SQL&gt; alter database open;
Database altered.</pre>
<p>You can see here that we put the database in ARCHIVELOG mode by using the SQL statement &#8220;alter database archivelog&#8221;, but  Oracle won&#8217;t let us do this unless the instance is mounted but not open.  To make the change we shutdown the instance, and then startup the instance again but this time with the &#8220;mount&#8221; option which will mount the instance but not open it.  Then we can enable ARCHIVELOG mode and open the database fully with the &#8220;alter database open&#8221; statement.</p>
<p>There are several system views that can provide us with  information reguarding archives, such as:</p>
<dl>
<dt><strong>V$DATABASE</strong></dt>
<dd>Identifies whether the database is in ARCHIVELOG or NOARCHIVELOG mode and whether MANUAL (archiving mode) has been specified. </dd>
<dt><strong>V$ARCHIVED_LOG</strong></dt>
<dd>Displays historical archived log information from the control file. If you use a recovery catalog, the RC_ARCHIVED_LOG view contains similar information. </dd>
<dt><strong>V$ARCHIVE_DEST</strong></dt>
<dd>Describes the current instance, all archive destinations, and the current value, mode, and status of these destinations. </dd>
<dt><strong>V$ARCHIVE_PROCESSES</strong></dt>
<dd>Displays information about the state of the various archive processes for an instance. </dd>
<dt><strong>V$BACKUP_REDOLOG</strong></dt>
<dd>Contains information about any backups of archived logs. If you use a recovery catalog, the RC_BACKUP_REDOLOG contains similar information. </dd>
<dt><strong>V$LOG</strong></dt>
<dd>Displays all redo log groups for the database and indicates which need to be archived. </dd>
<dt><strong>V$LOG_HISTORY</strong></dt>
<dd>Contains log history information such as which logs have been archived and the SCN range for each archived log. </dd>
</dl>
<p>Using these tables we can verify that we are infact in ARCHIVELOG mode:</p>
<pre>SQL&gt; select log_mode from v$database;

LOG_MODE
------------
ARCHIVELOG

SQL&gt; select DEST_NAME,STATUS,DESTINATION from V$ARCHIVE_DEST;</pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dbamac.wordpress.com/90/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dbamac.wordpress.com/90/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dbamac.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dbamac.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dbamac.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dbamac.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dbamac.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dbamac.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dbamac.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dbamac.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dbamac.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dbamac.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dbamac.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dbamac.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dbamac.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dbamac.wordpress.com/90/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=90&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dbamac.wordpress.com/2008/08/12/enabling-archivelog-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5e75dbdf30b85ad9166dc9d1801193d7?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">macdba</media:title>
		</media:content>
	</item>
		<item>
		<title>VI Editor Quick Reference</title>
		<link>http://dbamac.wordpress.com/2008/08/08/vi-editor-quick-reference/</link>
		<comments>http://dbamac.wordpress.com/2008/08/08/vi-editor-quick-reference/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 20:58:43 +0000</pubDate>
		<dc:creator>macdba</dc:creator>
				<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://dbamac.wordpress.com/?p=85</guid>
		<description><![CDATA[The following tables contain all the basic vi commands. Starting vi Command Description vi file start at line 1 of file vi +n file start at line n of file vi + file start at last line of file vi +/pattern file start at pattern in file vi -r file recover file after a system crash Saving files and quitting vi Command Description [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=85&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The following tables contain all the basic <strong>vi</strong> commands.<br />
<a name="0002"></a></p>
<p><strong>Starting vi</strong></p>
<table border="1">
<tbody>
<tr valign="top">
<th align="left"> Command</th>
<th align="left"> Description</th>
</tr>
<tr valign="top">
<td>vi <strong><em>file</em></strong></td>
<td>start at line 1 of <strong><em>file</em></strong></td>
</tr>
<tr valign="top">
<td>vi +n <strong><em>file</em></strong></td>
<td>start at line <strong><em>n</em></strong> of <strong><em>file</em></strong></td>
</tr>
<tr valign="top">
<td>vi + <strong><em>file</em></strong></td>
<td>start at last line of <strong><em>file</em></strong></td>
</tr>
<tr valign="top">
<td>vi +/<strong><em>pattern</em></strong> <strong><em>file</em></strong></td>
<td>start at <strong><em>pattern</em></strong> in <strong><em>file</em></strong></td>
</tr>
<tr valign="top">
<td>vi -r <strong><em>file</em></strong></td>
<td>recover <strong><em>file</em></strong> after a system crash</td>
</tr>
</tbody>
</table>
<p><a name="0003"></a> <a name="0004"></a> <a name="0005"></a></p>
<p><strong>Saving files and quitting vi</strong></p>
<table border="1">
<tbody>
<tr valign="top">
<th align="left"> Command</th>
<th align="left"> Description</th>
</tr>
<tr valign="top">
<td>:e <strong><em>file</em></strong></td>
<td>edit <strong><em>file</em></strong> (save current file with <strong>:w</strong> first)</td>
</tr>
<tr valign="top">
<td>:w</td>
<td>save (write out) the file being edited</td>
</tr>
<tr valign="top">
<td>:w <strong><em>file</em></strong></td>
<td>save as <strong><em>file</em></strong></td>
</tr>
<tr valign="top">
<td>:w! <strong><em>file</em></strong></td>
<td>save as an existing <strong><em>file</em></strong></td>
</tr>
<tr valign="top">
<td>:q</td>
<td>quit <strong>vi</strong></td>
</tr>
<tr valign="top">
<td>:wq</td>
<td>save the file and quit <strong>vi</strong></td>
</tr>
<tr valign="top">
<td> <img src='http://s2.wp.com/wp-includes/images/smilies/icon_mad.gif' alt=':x' class='wp-smiley' /> </td>
<td>save the file if it has changed and quit <strong>vi</strong></td>
</tr>
<tr valign="top">
<td>:q!</td>
<td>quit <strong>vi</strong> without saving changes</td>
</tr>
</tbody>
</table>
<p><a name="0006"></a></p>
<p><strong>Moving the cursor</strong></p>
<table border="1">
<tbody>
<tr valign="top">
<th align="left"> Keys pressed</th>
<th align="left"> Effect</th>
</tr>
<tr valign="top">
<td>h</td>
<td>left one character</td>
</tr>
<tr valign="top">
<td>l or &lt;Space&gt;</td>
<td>right one character</td>
</tr>
<tr valign="top">
<td>k</td>
<td>up one line</td>
</tr>
<tr valign="top">
<td>j or &lt;Enter&gt;</td>
<td>down one line</td>
</tr>
<tr valign="top">
<td>b</td>
<td>left one word</td>
</tr>
<tr valign="top">
<td>w</td>
<td>right one word</td>
</tr>
<tr valign="top">
<td>(</td>
<td>start of sentence</td>
</tr>
<tr valign="top">
<td>)</td>
<td>end of sentence</td>
</tr>
<tr valign="top">
<td>{</td>
<td>start of paragraph</td>
</tr>
<tr valign="top">
<td>}</td>
<td>end of paragraph</td>
</tr>
<tr valign="top">
<td>1G</td>
<td>top of file</td>
</tr>
<tr valign="top">
<td><strong><em>n</em></strong>G</td>
<td>line <strong><em>n</em></strong></td>
</tr>
<tr valign="top">
<td>G</td>
<td>end of file</td>
</tr>
<tr valign="top">
<td>&lt;Ctrl&gt;W</td>
<td>first character of insertion</td>
</tr>
<tr valign="top">
<td>&lt;Ctrl&gt;U</td>
<td>up ½ screen</td>
</tr>
<tr valign="top">
<td>&lt;Ctrl&gt;D</td>
<td>down ½ screen</td>
</tr>
<tr valign="top">
<td>&lt;Ctrl&gt;B</td>
<td>up one screen</td>
</tr>
<tr valign="top">
<td>&lt;Ctrl&gt;F</td>
<td>down one screen</td>
</tr>
</tbody>
</table>
<p><a name="0007"></a></p>
<p><strong>Inserting text</strong></p>
<table border="1">
<tbody>
<tr valign="top">
<th align="left"> Keys pressed</th>
<th align="left"> Text inserted</th>
</tr>
<tr valign="top">
<td>a</td>
<td>after the cursor</td>
</tr>
<tr valign="top">
<td>A</td>
<td>after last character on the line</td>
</tr>
<tr valign="top">
<td>i</td>
<td>before the cursor</td>
</tr>
<tr valign="top">
<td>I</td>
<td>before first character on the line</td>
</tr>
<tr valign="top">
<td>o</td>
<td>open line below current line</td>
</tr>
<tr valign="top">
<td>O</td>
<td>open line above current line</td>
</tr>
</tbody>
</table>
<p><a name="0008"></a></p>
<p><strong>Changing and replacing text</strong></p>
<table border="1">
<tbody>
<tr valign="top">
<th align="left"> Keys pressed</th>
<th align="left"> Text changed or replaced</th>
</tr>
<tr valign="top">
<td>cw</td>
<td>word</td>
</tr>
<tr valign="top">
<td>3cw</td>
<td>three words</td>
</tr>
<tr valign="top">
<td>cc</td>
<td>current line</td>
</tr>
<tr valign="top">
<td>5cc</td>
<td>five lines</td>
</tr>
<tr valign="top">
<td>r</td>
<td>current character only</td>
</tr>
<tr valign="top">
<td>R</td>
<td>current character and those to its right</td>
</tr>
<tr valign="top">
<td>s</td>
<td>current character</td>
</tr>
<tr valign="top">
<td>S</td>
<td>current line</td>
</tr>
<tr valign="top">
<td>~</td>
<td>switch between lowercase and uppercase</td>
</tr>
</tbody>
</table>
<p><a name="0009"></a></p>
<p><strong>Deleting text</strong></p>
<table border="1">
<tbody>
<tr valign="top">
<th align="left"> Keys pressed</th>
<th align="left"> Text deleted</th>
</tr>
<tr valign="top">
<td>x</td>
<td>character under cursor</td>
</tr>
<tr valign="top">
<td>12x</td>
<td>12 characters</td>
</tr>
<tr valign="top">
<td>X</td>
<td>character to left of cursor</td>
</tr>
<tr valign="top">
<td>dw</td>
<td>word</td>
</tr>
<tr valign="top">
<td>3dw</td>
<td>three words</td>
</tr>
<tr valign="top">
<td>d0</td>
<td>to beginning of line</td>
</tr>
<tr valign="top">
<td>d$</td>
<td>to end of line</td>
</tr>
<tr valign="top">
<td>dd</td>
<td>current line</td>
</tr>
<tr valign="top">
<td>5dd</td>
<td>five lines</td>
</tr>
<tr valign="top">
<td>d{</td>
<td>to beginning of paragraph</td>
</tr>
<tr valign="top">
<td>d}</td>
<td>to end of paragraph</td>
</tr>
<tr valign="top">
<td>:1,. d</td>
<td>to beginning of file</td>
</tr>
<tr valign="top">
<td>:.,$ d</td>
<td>to end of file</td>
</tr>
<tr valign="top">
<td>:1,$ d</td>
<td>whole file</td>
</tr>
</tbody>
</table>
<p><a name="0010"></a> <a name="0011"></a></p>
<p><strong>Using markers and buffers</strong></p>
<table border="1">
<tbody>
<tr valign="top">
<th align="left"> Command</th>
<th align="left"> Description</th>
</tr>
<tr valign="top">
<td>mf</td>
<td>set marker named &#8220;f&#8221;</td>
</tr>
<tr valign="top">
<td>`f</td>
<td>go to marker &#8220;f&#8221;</td>
</tr>
<tr valign="top">
<td>´f</td>
<td>go to start of line containing marker &#8220;f&#8221;</td>
</tr>
<tr valign="top">
<td>&#8220;s12yy</td>
<td>copy 12 lines into buffer &#8220;s&#8221;</td>
</tr>
<tr valign="top">
<td>&#8220;ty}</td>
<td>copy text from cursor to end of paragraph into buffer &#8220;t&#8221;</td>
</tr>
<tr valign="top">
<td>&#8220;ly1G</td>
<td>copy text from cursor to top of file into buffer &#8220;l&#8221;</td>
</tr>
<tr valign="top">
<td>&#8220;kd`f</td>
<td>cut text from cursor up to marker &#8220;f&#8221; into buffer &#8220;k&#8221;</td>
</tr>
<tr valign="top">
<td>&#8220;kp</td>
<td>paste buffer &#8220;k&#8221; into text</td>
</tr>
</tbody>
</table>
<p><a name="0012"></a></p>
<p><strong>Searching for text</strong></p>
<table border="1">
<tbody>
<tr valign="top">
<th align="left"> Search</th>
<th align="left"> Finds</th>
</tr>
<tr valign="top">
<td>/and</td>
<td>next occurrence of &#8220;and&#8221;, for example, &#8220;and&#8221;, &#8220;stand&#8221;, &#8220;grand&#8221;</td>
</tr>
<tr valign="top">
<td>?and</td>
<td>previous occurrence of &#8220;and&#8221;</td>
</tr>
<tr valign="top">
<td>/^The</td>
<td>next line that starts with &#8220;The&#8221;, for example, &#8220;The&#8221;, &#8220;Then&#8221;, &#8220;There&#8221;</td>
</tr>
<tr valign="top">
<td>/^The\&gt;</td>
<td>next line that starts with the word &#8220;The&#8221;</td>
</tr>
<tr valign="top">
<td>/end$</td>
<td>next line that ends with &#8220;end&#8221;</td>
</tr>
<tr valign="top">
<td>/[bB]ox</td>
<td>next occurrence of &#8220;box&#8221; or &#8220;Box&#8221;</td>
</tr>
<tr valign="top">
<td>n</td>
<td>repeat the most recent search, in the same direction</td>
</tr>
<tr valign="top">
<td>N</td>
<td>repeat the most recent search, in the opposite direction</td>
</tr>
</tbody>
</table>
<p><a name="0013"></a></p>
<p><strong>Searching for and replacing text</strong></p>
<table border="1">
<tbody>
<tr valign="top">
<th align="left"> Command</th>
<th align="left"> Description</th>
</tr>
<tr valign="top">
<td>:s/pear/peach/g</td>
<td>replace all occurrences of &#8220;pear&#8221; with &#8220;peach&#8221; on current line</td>
</tr>
<tr valign="top">
<td>:/orange/s//lemon/g</td>
<td>change all occurrences of &#8220;orange&#8221; into &#8220;lemon&#8221; on next line containing &#8220;orange&#8221;</td>
</tr>
<tr valign="top">
<td>:.,$/\&lt;file/directory/g</td>
<td>replace all words starting with &#8220;file&#8221; by &#8220;directory&#8221; on every line from current line onward, for example, &#8220;filename&#8221; becomes &#8220;directoryname&#8221;</td>
</tr>
<tr valign="top">
<td>:g/one/s//1/g</td>
<td>replace every occurrence of &#8220;one&#8221; with 1, for example, &#8220;oneself&#8221; becomes &#8220;1self&#8221;, &#8220;someone&#8221; becomes &#8220;some1&#8221;</td>
</tr>
</tbody>
</table>
<p><a name="0014"></a></p>
<p><strong>Matching patterns of text</strong></p>
<table border="1">
<tbody>
<tr valign="top">
<th align="left"> Expression</th>
<th align="left"> Matches</th>
</tr>
<tr valign="top">
<td>.</td>
<td>any single character</td>
</tr>
<tr valign="top">
<td><img src="http://osr600doc.sco.com/en/FD_create/graphics/lowast.gif" alt="*" /></td>
<td>zero or more of the previous expression</td>
</tr>
<tr valign="top">
<td>.<img src="http://osr600doc.sco.com/en/FD_create/graphics/lowast.gif" alt="*" /></td>
<td>zero or more arbitrary characters</td>
</tr>
<tr valign="top">
<td>\&lt;</td>
<td>beginning of a word</td>
</tr>
<tr valign="top">
<td>\&gt;</td>
<td>end of a word</td>
</tr>
<tr valign="top">
<td>\</td>
<td>quote a special character</td>
</tr>
<tr valign="top">
<td>\<img src="http://osr600doc.sco.com/en/FD_create/graphics/lowast.gif" alt="*" /></td>
<td>the character &#8220;<img src="http://osr600doc.sco.com/en/FD_create/graphics/lowast.gif" alt="*" />&#8221;</td>
</tr>
<tr valign="top">
<td>^</td>
<td>beginning of a line</td>
</tr>
<tr valign="top">
<td>$</td>
<td>end of a line</td>
</tr>
<tr valign="top">
<td>[<strong><em>set</em></strong>]</td>
<td>one character from a set of characters</td>
</tr>
<tr valign="top">
<td>[XYZ]</td>
<td>one of the characters &#8220;X&#8221;, &#8220;Y&#8221;, or &#8220;Z&#8221;</td>
</tr>
<tr valign="top">
<td>[[:upper:]][[:lower:]]*</td>
<td>one uppercase character followed by any number of lowercase characters</td>
</tr>
<tr valign="top">
<td>[^<strong><em>set</em></strong>]</td>
<td>one character not from a set of characters</td>
</tr>
<tr valign="top">
<td>[^XYZ[:digit:]]</td>
<td>any character except &#8220;X&#8221;, &#8220;Y&#8221;, &#8220;Z&#8221;, or a numeric digit</td>
</tr>
</tbody>
</table>
<p><strong>Options to the :set command</strong></p>
<table border="1">
<tbody>
<tr valign="top">
<th align="left"> Option</th>
<th align="left"> Effect</th>
</tr>
<tr valign="top">
<td>all</td>
<td>list settings of all options</td>
</tr>
<tr valign="top">
<td>ignorecase</td>
<td>ignore case in searches</td>
</tr>
<tr valign="top">
<td>list</td>
<td>display &lt;Tab&gt; and end-of-line characters</td>
</tr>
<tr valign="top">
<td>mesg</td>
<td>display messages sent to your terminal</td>
</tr>
<tr valign="top">
<td>nowrapscan</td>
<td>prevent searches from wrapping round the end or beginning of a file</td>
</tr>
<tr valign="top">
<td>number</td>
<td>display line numbers</td>
</tr>
<tr valign="top">
<td>report=5</td>
<td>warn if five or more lines are changed by command</td>
</tr>
<tr valign="top">
<td>term=ansi</td>
<td>set terminal type to &#8220;ansi&#8221;</td>
</tr>
<tr valign="top">
<td>terse</td>
<td>shorten error messages</td>
</tr>
<tr valign="top">
<td>warn</td>
<td>display &#8220;[No write since last change]&#8221; on shell escape if file has not been saved</td>
</tr>
</tbody>
</table>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dbamac.wordpress.com/85/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dbamac.wordpress.com/85/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dbamac.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dbamac.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dbamac.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dbamac.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dbamac.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dbamac.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dbamac.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dbamac.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dbamac.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dbamac.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dbamac.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dbamac.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dbamac.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dbamac.wordpress.com/85/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=85&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dbamac.wordpress.com/2008/08/08/vi-editor-quick-reference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5e75dbdf30b85ad9166dc9d1801193d7?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">macdba</media:title>
		</media:content>

		<media:content url="http://osr600doc.sco.com/en/FD_create/graphics/lowast.gif" medium="image">
			<media:title type="html">*</media:title>
		</media:content>

		<media:content url="http://osr600doc.sco.com/en/FD_create/graphics/lowast.gif" medium="image">
			<media:title type="html">*</media:title>
		</media:content>

		<media:content url="http://osr600doc.sco.com/en/FD_create/graphics/lowast.gif" medium="image">
			<media:title type="html">*</media:title>
		</media:content>

		<media:content url="http://osr600doc.sco.com/en/FD_create/graphics/lowast.gif" medium="image">
			<media:title type="html">*</media:title>
		</media:content>
	</item>
		<item>
		<title>How to check Database Availability automatically using a script</title>
		<link>http://dbamac.wordpress.com/2008/08/08/how-to-check-database-availability-automatically-using-a-script/</link>
		<comments>http://dbamac.wordpress.com/2008/08/08/how-to-check-database-availability-automatically-using-a-script/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 20:30:14 +0000</pubDate>
		<dc:creator>macdba</dc:creator>
				<category><![CDATA[ORACLE]]></category>
		<category><![CDATA[shell script]]></category>

		<guid isPermaLink="false">http://dbamac.wordpress.com/?p=75</guid>
		<description><![CDATA[The following script does the database checking automatically: check_database() { if [ `ps -fu oracle &#124; grep smon &#124; wc -l` -gt 0 ] ; then echo &#8220;Database is up and running &#8221; &#62; $status # Just store the status in a temp file else sleep 900 # just sleep for 15 min if [ [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=75&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The following script does the database checking automatically:</p>
<p>check_database()<br />
{<br />
if [ `ps -fu oracle | grep smon | wc -l` -gt 0 ] ; then<br />
echo &#8220;Database is up and running &#8221; &gt; $status # Just store the status<br />
in a temp file<br />
else<br />
sleep 900 # just sleep for 15 min<br />
if [ `ps -fu oracle | grep smon | wc -l` -eq 0 ] ;then<br />
echo&#8221; Database is unavailable for this moment &#8221; &gt;$status_not #<br />
Just store the status in a temp file<br />
fi<br />
fi<br />
}</p>
<p>Thanks to <span class="KBgroups_postInfo"><a class="small" href="http://www.ittoolbox.com/r/er.asp?i=1368719">sanjeeb mohapatra</a> for sharing this script.<br />
</span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dbamac.wordpress.com/75/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dbamac.wordpress.com/75/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dbamac.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dbamac.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dbamac.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dbamac.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dbamac.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dbamac.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dbamac.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dbamac.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dbamac.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dbamac.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dbamac.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dbamac.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dbamac.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dbamac.wordpress.com/75/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=75&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dbamac.wordpress.com/2008/08/08/how-to-check-database-availability-automatically-using-a-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5e75dbdf30b85ad9166dc9d1801193d7?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">macdba</media:title>
		</media:content>
	</item>
		<item>
		<title>Top DBA Shell Scripts for Monitoring the Database</title>
		<link>http://dbamac.wordpress.com/2008/08/08/top-dba-shell-scripts-for-monitoring-the-database/</link>
		<comments>http://dbamac.wordpress.com/2008/08/08/top-dba-shell-scripts-for-monitoring-the-database/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 20:14:47 +0000</pubDate>
		<dc:creator>macdba</dc:creator>
				<category><![CDATA[ORACLE]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://dbamac.wordpress.com/?p=70</guid>
		<description><![CDATA[As I was browsing the internet, I found this article and script collection of Daniel T. Liu http://www.dbazine.com/oracle/or-articles/liu2#instance Please feel free to test his scripts and hope it could help you too in your day to day database administrations. Introduction This article focuses on the DBA&#8217;s daily responsibilities for monitoring Oracle databases and provides tips [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=70&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As I was browsing the internet, I found this article and script collection of Daniel T. Liu http://www.dbazine.com/oracle/or-articles/liu2#instance</p>
<p>Please feel free to test his scripts and hope it could help you too in your day to day database administrations.<br />
<strong>Introduction</strong></p>
<p>This article focuses on the DBA&#8217;s daily responsibilities for monitoring Oracle databases and provides tips and techniques on how DBAs can turn their manual, reactive monitoring activities into a set of proactive shell scripts. The article first reviews some commonly used Unix commands by DBAs. It explains the Unix Cron jobs that are used as part of the scheduling mechanism to execute DBA scripts. The article covers eight important scripts for monitoring Oracle database:</p>
<p>+ Check instance availability<br />
+ Check listener availability<br />
+ Check alert log files for error messages<br />
+ Clean up old log files before log destination gets filled<br />
+ Analyze tables and indexes for better performance<br />
+ Check tablespace usage<br />
+ Find out invalid objects<br />
+ Monitor users and transactions</p>
<p><strong>UNIX Basics for the DBA</strong><br />
<em>Basic UNIX Command</em></p>
<p><strong>The following is a list of commonly used Unix command:</strong></p>
<p>+ ps &#8211; Show process<br />
+ grep &#8211; Search files for text patterns<br />
+ mailx &#8211; Read or send mail<br />
+ cat &#8211; Join files or display them<br />
+ cut &#8211; Select columns for display<br />
+ awk &#8211; Pattern-matching language<br />
+ df &#8211; Show free disk space</p>
<p>Here are some examples of how the DBA uses these commands:</p>
<p><strong>+ List available instances on a server:</strong></p>
<p>$ ps -ef | grep smon<br />
oracle 21832     1  0   Feb 24 ?       19:05 ora_smon_oradb1<br />
oracle   898     1  0   Feb 15 ?        0:00 ora_smon_oradb2<br />
dliu 25199 19038  0 10:48:57 pts/6    0:00 grep smon<br />
oracle 27798     1  0 05:43:54 ?        0:00 ora_smon_oradb3<br />
oracle 28781     1  0   Mar 03 ?        0:01 ora_smon_oradb4</p>
<p><strong>+ List available listeners on a server:</strong></p>
<p>$ ps -ef | grep listener | grep -v grep<br />
oracle 23879    1  0   Feb 24 ?  33:36 /8.1.7/bin/tnslsnr listener_db1 -inherit<br />
oracle 27939    1  0 05:44:02 ?  0:00  /8.1.7/bin/tnslsnr listener_db2 -inherit<br />
oracle 23536    1  0   Feb 12 ?  4:19  /8.1.7/bin/tnslsnr listener_db3 -inherit<br />
oracle 28891    1  0   Mar 03 ?  0:01  /8.1.7/bin/tnslsnr listener_db4 -inherit</p>
<p><strong> + Find out file system usage for Oracle archive destination:</strong></p>
<p>$ df -k | grep oraarch<br />
/dev/vx/dsk/proddg/oraarch 71123968 4754872 65850768  7%  /u09/oraarch</p>
<p>+ List number of lines in the alert.log file:</p>
<p>$ cat alert.log | wc -l<br />
2984</p>
<p><strong>+ List all Oracle error messages from the alert.log file:</strong></p>
<p>$ grep ORA- alert.log<br />
ORA-00600: internal error code, arguments: [kcrrrfswda.1], [], [], [], [], []<br />
ORA-00600: internal error code, arguments: [1881], [25860496], [25857716], []</p>
<p><strong>CRONTAB Basics</strong></p>
<p>A crontab file is comprised of six fields:<br />
Minute     0-59<br />
Hour     0-23<br />
Day of month     1-31<br />
Month     1 &#8211; 12<br />
Day of Week     0 &#8211; 6, with 0 = Sunday<br />
Unix Command or Shell Scripts</p>
<p>+ To edit a crontab file, type:</p>
<p>Crontab -e</p>
<p><strong>+ To view a crontab file, type:</strong></p>
<p>Crontab -l<br />
0  4 * * 5       /dba/admin/analyze_table.ksh<br />
30 3  * * 3,6    /dba/admin/hotbackup.ksh /dev/null 2&gt;&amp;1</p>
<p>In the example above, the first entry shows that a script to analyze a table runs every Friday at 4:00 a.m. The second entry shows that a script to perform a hot backup runs every Wednesday and Saturday at 3:00 a.m.<br />
Top DBA Shell Scripts for Monitoring the Database</p>
<p>The eight shell scripts provided below cover 90 percent of a DBA&#8217;s daily monitoring activities. You will need to modify the UNIX environment variables as appropriate.<br />
Check Oracle Instance Availability</p>
<p><strong>The oratab file lists all the databases on a server:</strong></p>
<p>$ cat /var/opt/oracle/oratab<br />
###################################################################<br />
## /var/opt/oracle/oratab                                        ##<br />
###################################################################<br />
oradb1:/u01/app/oracle/product/8.1.7:Y<br />
oradb2:/u01/app/oracle/product/8.1.7:Y<br />
oradb3:/u01/app/oracle/product/8.1.7:N<br />
oradb4:/u01/app/oracle/product/8.1.7:Y</p>
<p><strong>The following script checks all the databases listed in the oratab file, and finds out the status (up or down) of databases:</strong></p>
<p>###################################################################<br />
## ckinstance.ksh ##<br />
###################################################################<br />
ORATAB=/var/opt/oracle/oratab<br />
echo &#8220;`date`   &#8220;<br />
echo  &#8220;Oracle Database(s) Status `hostname` :\n&#8221;</p>
<p>db=`egrep -i &#8220;:Y|:N&#8221; $ORATAB | cut -d&#8221;:&#8221; -f1 | grep -v &#8220;\#&#8221; | grep -v &#8220;\*&#8221;`<br />
pslist=&#8221;`ps -ef | grep pmon`&#8221;<br />
for i in $db ; do<br />
echo  &#8220;$pslist&#8221; | grep  &#8220;ora_pmon_$i&#8221;  &gt; /dev/null 2&gt;$1<br />
if (( $? )); then<br />
echo &#8220;Oracle Instance &#8211; $i:       Down&#8221;<br />
else<br />
echo &#8220;Oracle Instance &#8211; $i:       Up&#8221;<br />
fi<br />
done</p>
<p><strong>Use the following to make sure the script is executable:</strong></p>
<p>$ chmod 744 ckinstance.ksh<br />
$ ls -l ckinstance.ksh<br />
-rwxr&#8211;r&#8211;   1 oracle     dba     657 Mar  5 22:59 ckinstance.ksh*</p>
<p><strong>Here is an instance availability report:</strong></p>
<p>$ ckinstance.ksh<br />
Mon Mar  4 10:44:12 PST 2002<br />
Oracle Database(s) Status for DBHOST server:<br />
Oracle Instance &#8211; oradb1:   Up<br />
Oracle Instance &#8211; oradb2:   Up<br />
Oracle Instance &#8211; oradb3:   Down<br />
Oracle Instance &#8211; oradb4:   Up</p>
<p><strong>Check Oracle Listener&#8217;s Availability</strong></p>
<p>A similar script checks for the Oracle listener. If the listener is down, the script will restart the listener:</p>
<p>#######################################################################<br />
## cklsnr.sh                                                         ##<br />
#######################################################################<br />
#!/bin/ksh<br />
DBALIST=&#8221;primary.dba@company.com,another.dba@company.com&#8221;;export DBALIST<br />
cd /var/opt/oracle<br />
rm -f lsnr.exist<br />
ps -ef | grep mylsnr | grep -v grep  &gt; lsnr.exist<br />
if [ -s lsnr.exist ]<br />
then<br />
echo<br />
else<br />
echo &#8220;Alert&#8221; | mailx -s &#8220;Listener &#8216;mylsnr&#8217; on `hostname` is down&#8221; $DBALIST<br />
TNS_ADMIN=/var/opt/oracle; export TNS_ADMIN<br />
ORACLE_SID=db1; export ORACLE_SID<br />
ORAENV_ASK=NO; export ORAENV_ASK<br />
PATH=$PATH:/bin:/usr/local/bin; export PATH<br />
. oraenv<br />
LD_LIBRARY_PATH=${ORACLE_HOME}/lib;export LD_LIBRARY_PATH<br />
lsnrctl start mylsnr<br />
fi</p>
<p><strong>Check Alert Logs (ORA-XXXXX)</strong></p>
<p>Some of the environment variables used by each script can be put into one profile:</p>
<p>#######################################################################<br />
## oracle.profile ##<br />
#######################################################################<br />
EDITOR=vi;export EDITOR ORACLE_BASE=/u01/app/oracle; export<br />
ORACLE_BASE ORACLE_HOME=$ORACLE_BASE/product/8.1.7; export<br />
ORACLE_HOME LD_LIBRARY_PATH=$ORACLE_HOME/lib; export<br />
LD_LIBRARY_PATH TNS_ADMIN=/var/opt/oracle;export<br />
TNS_ADMIN NLS_LANG=american; export<br />
NLS_LANG NLS_DATE_FORMAT=&#8217;Mon DD YYYY HH24:MI:SS&#8217;; export<br />
NLS_DATE_FORMAT ORATAB=/var/opt/oracle/oratab;export<br />
ORATAB PATH=$PATH:$ORACLE_HOME:$ORACLE_HOME/bin:/usr/ccs/bin:/bin:/usr/bin:/usr/sbin:/<br />
sbin:/usr/openwin/bin:/opt/bin:.; export<br />
PATH DBALIST=&#8221;primary.dba@company.com,another.dba@company.com&#8221;;export<br />
DBALIST</p>
<p><strong>The following script first calls oracle.profile to set up all the environment variables. The script also sends the DBA a warning e-mail if it finds any Oracle errors:</strong></p>
<p>####################################################################<br />
## ckalertlog.sh                                                  ##<br />
####################################################################<br />
#!/bin/ksh<br />
. /etc/oracle.profile<br />
for SID in `cat $ORACLE_HOME/sidlist`<br />
do<br />
cd $ORACLE_BASE/admin/$SID/bdump<br />
if [ -f alert_${SID}.log ]<br />
then<br />
mv alert_${SID}.log alert_work.log<br />
touch alert_${SID}.log<br />
cat alert_work.log &gt;&gt; alert_${SID}.hist<br />
grep ORA- alert_work.log &gt; alert.err<br />
fi<br />
if [ `cat alert.err|wc -l` -gt 0 ]<br />
then<br />
mailx -s &#8220;${SID} ORACLE ALERT ERRORS&#8221; $DBALIST &lt; alert.err<br />
fi<br />
rm -f alert.err<br />
rm -f alert_work.log<br />
done</p>
<p><strong>Clean Up Old Archived Logs</strong></p>
<p>The following script cleans up old archive logs if the log file system reaches 90-percent capacity:</p>
<p>$ df -k | grep arch<br />
Filesystem                kbytes   used     avail    capacity  Mounted on<br />
/dev/vx/dsk/proddg/archive 71123968 30210248 40594232   43%  /u08/archive</p>
<p>#######################################################################<br />
## clean_arch.ksh                                                    ##<br />
#######################################################################<br />
#!/bin/ksh<br />
df -k | grep arch &gt; dfk.result<br />
archive_filesystem=`awk  -F&#8221; &#8220;  &#8216;{ print $6 }&#8217; dfk.result`<br />
archive_capacity=`awk  -F&#8221; &#8220;  &#8216;{ print $5 }&#8217; dfk.result`</p>
<p>if [[ $archive_capacity &gt; 90% ] ]<br />
then<br />
echo &#8220;Filesystem ${archive_filesystem} is ${archive_capacity} filled&#8221;<br />
# try one of the following option depend on your need<br />
find $archive_filesystem -type f -mtime +2 -exec rm -r {} \;<br />
tar<br />
rman<br />
fi</p>
<p><strong>Analyze Tables and Indexes (for Better Performance)</strong></p>
<p>Below, I have shown an example on how to pass parameters to a script:</p>
<p>####################################################################<br />
## analyze_table.sh ##<br />
####################################################################<br />
#!/bin/ksh #<br />
input parameter: 1: password # 2: SID if (($#&lt;1)) then echo &#8220;Please enter<br />
&#8216;oracle&#8217;<br />
user password as the first parameter !&#8221; exit 0 fi if (($#&lt;2)) then echo<br />
&#8220;Please enter<br />
instance name as the second parameter!&#8221; exit 0 fi</p>
<p>To execute the script with parameters, type:</p>
<p>$ analyze_table.sh manager oradb1</p>
<p>The first part of script generates a file analyze.sql, which contains the syntax for analyzing table. The second part of script analyzes all the tables:</p>
<p>#####################################################################<br />
## analyze_table.sh ##<br />
#####################################################################<br />
sqlplus -s &lt;&lt;!<br />
oracle/$1@$2<br />
set heading off<br />
set feed off<br />
set pagesize 200<br />
set linesize 100<br />
spool analyze_table.sql<br />
select &#8216;ANALYZE TABLE &#8216; || owner || &#8216;.&#8217; || segment_name ||<br />
&#8216; ESTIMATE STATISTICS SAMPLE 10 PERCENT;&#8217;<br />
from dba_segments<br />
where segment_type = &#8216;TABLE&#8217;<br />
and owner not in (&#8216;SYS&#8217;, &#8216;SYSTEM&#8217;);<br />
spool off<br />
exit<br />
!<br />
sqlplus -s &lt;&lt;!<br />
oracle/$1@$2<br />
@./analyze_table.sql<br />
exit<br />
!</p>
<p><strong>Here is an example of analyze.sql:</strong></p>
<p>$ cat analyze.sql<br />
ANALYZE TABLE HIRWIN.JANUSAGE_SUMMARY ESTIMATE STATISTICS SAMPLE 10 PERCENT;<br />
ANALYZE TABLE HIRWIN.JANUSER_PROFILE ESTIMATE STATISTICS SAMPLE 10 PERCENT;<br />
ANALYZE TABLE APPSSYS.HIST_SYSTEM_ACTIVITY ESTIMATE STATISTICS SAMPLE 10 PERCENT;<br />
ANALYZE TABLE HTOMEH.QUEST_IM_VERSION ESTIMATE STATISTICS SAMPLE 10 PERCENT;<br />
ANALYZE TABLE JSTENZEL.HIST_SYS_ACT_0615 ESTIMATE STATISTICS SAMPLE 10 PERCENT;<br />
ANALYZE TABLE JSTENZEL.HISTORY_SYSTEM_0614 ESTIMATE STATISTICS SAMPLE 10 PERCENT;<br />
ANALYZE TABLE JSTENZEL.CALC_SUMMARY3 ESTIMATE STATISTICS SAMPLE 10 PERCENT;<br />
ANALYZE TABLE IMON.QUEST_IM_LOCK_TREE ESTIMATE STATISTICS SAMPLE 10 PERCENT;<br />
ANALYZE TABLE APPSSYS.HIST_USAGE_SUMMARY ESTIMATE STATISTICS SAMPLE 10 PERCENT;<br />
ANALYZE TABLE PATROL.P$LOCKCONFLICTTX ESTIMATE STATISTICS SAMPLE 10 PERCENT;</p>
<p><strong>Check Tablespace Usage</strong></p>
<p>This scripts checks for tablespace usage. If tablespace is 10 percent free, it will send an alert e-mail.</p>
<p>#####################################################################<br />
## ck_tbsp.sh ##<br />
#####################################################################<br />
#!/bin/ksh<br />
sqlplus -s &lt;&lt;!<br />
oracle/$1@$2<br />
set feed off<br />
set linesize 100<br />
set pagesize 200<br />
spool tablespace.alert<br />
SELECT F.TABLESPACE_NAME,<br />
TO_CHAR ((T.TOTAL_SPACE &#8211; F.FREE_SPACE),&#8217;999,999&#8242;) &#8220;USED (MB)&#8221;,<br />
TO_CHAR (F.FREE_SPACE, &#8217;999,999&#8242;) &#8220;FREE (MB)&#8221;,<br />
TO_CHAR (T.TOTAL_SPACE, &#8217;999,999&#8242;) &#8220;TOTAL (MB)&#8221;,<br />
TO_CHAR ((ROUND ((F.FREE_SPACE/T.TOTAL_SPACE)*100)),&#8217;999&#8242;)||&#8217; %&#8217; PER_FREE<br />
FROM   (<br />
SELECT       TABLESPACE_NAME,<br />
ROUND (SUM (BLOCKS*(SELECT VALUE/1024<br />
FROM V\$PARAMETER<br />
WHERE NAME = &#8216;db_block_size&#8217;)/1024)<br />
) FREE_SPACE<br />
FROM DBA_FREE_SPACE<br />
GROUP BY TABLESPACE_NAME<br />
) F,<br />
(<br />
SELECT TABLESPACE_NAME,<br />
ROUND (SUM (BYTES/1048576)) TOTAL_SPACE<br />
FROM DBA_DATA_FILES<br />
GROUP BY TABLESPACE_NAME<br />
) T<br />
WHERE F.TABLESPACE_NAME = T.TABLESPACE_NAME<br />
AND (ROUND ((F.FREE_SPACE/T.TOTAL_SPACE)*100)) &lt; 10;<br />
spool off<br />
exit<br />
!<br />
if [ `cat tablespace.alert|wc -l` -gt 0 ]<br />
then<br />
cat tablespace.alert -l tablespace.alert &gt; tablespace.tmp<br />
mailx -s &#8220;TABLESPACE ALERT for ${2}&#8221; $DBALIST &lt; tablespace.tmp<br />
fi</p>
<p>An example of the alert mail output is as follows:</p>
<p>TABLESPACE_NAME     USED (MB)   FREE (MB)         TOTAL (MB)            PER_FREE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
SYSTEM              2,047             203               2,250                9 %<br />
STBS01                302              25                327                 8 %<br />
STBS02                241              11                252                 4 %<br />
STBS03                233              19                252                 8 %</p>
<p><strong>Find Out Invalid Database Objects</strong></p>
<p>The following finds out invalid database objects:</p>
<p>#####################################################################<br />
## invalid_object_alert.sh ##<br />
#####################################################################<br />
#!/bin/ksh<br />
. /etc/oracle.profile<br />
sqlplus -s &lt;&lt;!<br />
oracle/$1@$2<br />
set          feed off<br />
set heading off<br />
column object_name format a30<br />
spool invalid_object.alert<br />
SELECT  OWNER, OBJECT_NAME, OBJECT_TYPE, STATUS<br />
FROM    DBA_OBJECTS<br />
WHERE   STATUS = &#8216;INVALID&#8217;<br />
ORDER BY OWNER, OBJECT_TYPE, OBJECT_NAME;<br />
spool off<br />
exit<br />
!<br />
if [ `cat invalid_object.alert|wc -l` -gt 0 ]<br />
then<br />
mailx -s &#8220;INVALID OBJECTS for ${2}&#8221; $DBALIST &lt; invalid_object.alert<br />
fi<br />
$ cat invalid_object.alert</p>
<p>OWNER        OBJECT_NAME           OBJECT_TYPE          STATUS<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
HTOMEH       DBMS_SHARED_POOL            PACKAGE BODY          INVALID<br />
HTOMEH       X_$KCBFWAIT                 VIEW                  INVALID<br />
IMON         IW_MON                      PACKAGE               INVALID<br />
IMON         IW_MON                      PACKAGE BODY          INVALID<br />
IMON         IW_ARCHIVED_LOG             VIEW                  INVALID<br />
IMON         IW_FILESTAT                 VIEW                  INVALID<br />
IMON         IW_SQL_FULL_TEXT            VIEW                  INVALID<br />
IMON         IW_SYSTEM_EVENT1            VIEW                  INVALID<br />
IMON         IW_SYSTEM_EVENT_CAT         VIEW                  INVALID<br />
LBAILEY      CHECK_TABLESPACE_USAGE      PROCEDURE             INVALID<br />
PATROL       P$AUTO_EXTEND_TBSP          VIEW                  INVALID<br />
SYS          DBMS_CRYPTO_TOOLKIT         PACKAGE               INVALID<br />
SYS          DBMS_CRYPTO_TOOLKIT         PACKAGE BODY          INVALID<br />
SYS          UPGRADE_SYSTEM_TYPES_TO_816 PROCEDURE             INVALID<br />
SYS          AQ$_DEQUEUE_HISTORY_T       TYPE                  INVALID<br />
SYS          HS_CLASS_CAPS               VIEW                  INVALID<br />
SYS          HS_CLASS_DD                 VIEW                  INVALID</p>
<p><strong>Monitor Users and Transactions (Dead Locks, et al)</strong></p>
<p>This script sends out an alert e-mail if dead lock occurs:</p>
<p>###################################################################<br />
## deadlock_alert.sh ##<br />
###################################################################<br />
#!/bin/ksh<br />
. /etc/oracle.profile<br />
sqlplus -s &lt;&lt;!<br />
oracle/$1@$2<br />
set feed off<br />
set heading off<br />
spool deadlock.alert<br />
SELECT   SID, DECODE(BLOCK, 0, &#8216;NO&#8217;, &#8216;YES&#8217; ) BLOCKER,<br />
DECODE(REQUEST, 0, &#8216;NO&#8217;,'YES&#8217; ) WAITER<br />
FROM     V$LOCK<br />
WHERE    REQUEST &gt; 0 OR BLOCK &gt; 0<br />
ORDER BY block DESC;<br />
spool off<br />
exit<br />
!<br />
if [ `cat deadlock.alert|wc -l` -gt 0 ]<br />
then<br />
mailx -s &#8220;DEADLOCK ALERT for ${2}&#8221; $DBALIST &lt; deadlock.alert<br />
fi</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dbamac.wordpress.com/70/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dbamac.wordpress.com/70/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dbamac.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dbamac.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dbamac.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dbamac.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dbamac.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dbamac.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dbamac.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dbamac.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dbamac.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dbamac.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dbamac.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dbamac.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dbamac.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dbamac.wordpress.com/70/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=70&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dbamac.wordpress.com/2008/08/08/top-dba-shell-scripts-for-monitoring-the-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5e75dbdf30b85ad9166dc9d1801193d7?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">macdba</media:title>
		</media:content>
	</item>
		<item>
		<title>How to Add Capacity in Existing Tablespace</title>
		<link>http://dbamac.wordpress.com/2008/08/07/how-to-add-capacity-in-existing-tablespace/</link>
		<comments>http://dbamac.wordpress.com/2008/08/07/how-to-add-capacity-in-existing-tablespace/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 14:33:38 +0000</pubDate>
		<dc:creator>macdba</dc:creator>
				<category><![CDATA[ORACLE]]></category>
		<category><![CDATA[datafile]]></category>
		<category><![CDATA[tablespace]]></category>

		<guid isPermaLink="false">http://dbamac.wordpress.com/?p=65</guid>
		<description><![CDATA[First of all, A tablespace is the logical storage unit in Oracle Database and may consist one or more datafiles. If you found your USR table capacity to be 99.7% (good Luck!) then you might want to increase the tablespace where the USR table resides. How do you do that? ALTER DATABASE DATAFILE '/directory/path/file_name.dbf' MAXSIZE [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=65&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>First of all, A tablespace is the logical storage unit in Oracle Database and may consist one or more datafiles. If you found your USR table capacity to be 99.7% (good Luck!) then you might want to increase the tablespace where the USR table resides. How do you do that?</p>
<pre>ALTER DATABASE
DATAFILE '/directory/path/file_name.dbf'
MAXSIZE 500M ;</pre>
<p>That command simply increased the existing tablespace that you have. But if you want to add another datafile to the tablespace in which your table resides you may issue this command:</p>
<pre>ALTER TABLESPACE your_ts_name
ADD DATAFILE '/directory_path/file_name.dbf'
SIZE 200M
AUTOEXTEND ON
MAXSIZE 500M;</pre>
<p>as simple as that&#8230;.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dbamac.wordpress.com/65/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dbamac.wordpress.com/65/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dbamac.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dbamac.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dbamac.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dbamac.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dbamac.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dbamac.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dbamac.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dbamac.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dbamac.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dbamac.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dbamac.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dbamac.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dbamac.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dbamac.wordpress.com/65/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=65&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dbamac.wordpress.com/2008/08/07/how-to-add-capacity-in-existing-tablespace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5e75dbdf30b85ad9166dc9d1801193d7?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">macdba</media:title>
		</media:content>
	</item>
		<item>
		<title>How to remove Agent/targets from Grid Control neatly</title>
		<link>http://dbamac.wordpress.com/2008/08/06/how-to-remove-agenttargets-from-grid-control-neatly/</link>
		<comments>http://dbamac.wordpress.com/2008/08/06/how-to-remove-agenttargets-from-grid-control-neatly/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 16:12:47 +0000</pubDate>
		<dc:creator>macdba</dc:creator>
				<category><![CDATA[ORACLE]]></category>
		<category><![CDATA[oem]]></category>

		<guid isPermaLink="false">http://dbamac.wordpress.com/?p=60</guid>
		<description><![CDATA[I was given the task to remove the target host/agents and other listed targets of Server1 from Oracle grid control. At first I thought it was very easy and I was definitely correct. Here&#8217;s what happened: From OEM Grid Control I clicked on targets and selected the Server1 from the list. Then from its homepage [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=60&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was given the task to remove the target host/agents and other listed targets of Server1 from Oracle grid control. At first I thought it was very easy and I was definitely correct. Here&#8217;s what happened:</p>
<p>From OEM Grid Control I clicked on targets and selected the Server1 from the list. Then from its homepage I clicked on the the targets and then I eventually select all the targets except of course from the agent. Note: (the management agent of server1 must be running to do this). The targets were successfully deleted and now the only thing left is the host and the agent of Server1.</p>
<p>To remove the agent and host form the list, I stop the management agent of server1 then I went back to my OEM Grid control to remove the host Server1. Now there comes the challenge, No matter how many times I tried to delete the host Server1 from oem grid control It seems like the page is just running and nothing happens. No matter how long I&#8217;ve waited the host Server1 still remains on the list.</p>
<p>Now to clean it manually, I connect to the OEM Grid Repository and perform the following:</p>
<p>SQL&gt; select target_name from mgmt_targets where target_type=&#8217;oracle_emd&#8217;;</p>
<p>This command show me the list of all the registered targets from my OEM and I can see that Server1 is still there. Then to manually remove Server1 from the list, I then execute:</p>
<p>SQL&gt; exec mgmt_admin.cleanup_agent(&#8216;Server1:3872&#8242;);</p>
<p>It will take a while at least 3 to 5 mins the most. Once it was completed  I quickly checked my OEM Grid Control Target List and voila!!! Server1 was successfully removed from the target list together with its agent.</p>
<address>Thanks to Metalink <span style="font-family:helvetica;"><strong>Note:454081.1</strong></span> and to Luis Cardenas post (http://www.lazydba.com/oracle/0__146127.html)  who gave me the idea to solve my problem. </address>
<address> </address>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dbamac.wordpress.com/60/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dbamac.wordpress.com/60/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dbamac.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dbamac.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dbamac.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dbamac.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dbamac.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dbamac.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dbamac.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dbamac.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dbamac.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dbamac.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dbamac.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dbamac.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dbamac.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dbamac.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=60&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dbamac.wordpress.com/2008/08/06/how-to-remove-agenttargets-from-grid-control-neatly/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5e75dbdf30b85ad9166dc9d1801193d7?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">macdba</media:title>
		</media:content>
	</item>
		<item>
		<title>How to remove a deleted agent from the GRID Control repository database?</title>
		<link>http://dbamac.wordpress.com/2008/08/05/how-to-remove-a-deleted-agent-from-the-grid-control-repository-database/</link>
		<comments>http://dbamac.wordpress.com/2008/08/05/how-to-remove-a-deleted-agent-from-the-grid-control-repository-database/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 20:50:28 +0000</pubDate>
		<dc:creator>macdba</dc:creator>
				<category><![CDATA[ORACLE]]></category>
		<category><![CDATA[oem]]></category>

		<guid isPermaLink="false">http://dbamac.wordpress.com/?p=57</guid>
		<description><![CDATA[Howto: How to remove a deleted agent from the GRID Control repository database? Doc ID: Note:454081.1 Type: HOWTO Last Revision Date: 24-OCT-2007 Status: PUBLISHED In this Document Goal Solution References Applies to: Enterprise Manager Grid Control &#8211; Version: 10.2.0.1 to 10.2.0.4 Information in this document applies to any platform. Goal The targets are removed from [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=57&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<table border="0" cellspacing="6" cellpadding="0" width="80%">
<tbody>
<tr>
<td colspan="4" align="left"><strong>Howto: How to remove a deleted agent from the GRID Control repository database?</strong></td>
</tr>
<tr>
<td></td>
<td align="right" valign="top"><a href="https://metalink.oracle.com/help/usaeng/Search/search.html#file">Doc ID</a>:</td>
<td align="left"><strong>Note:454081.1</strong></td>
<td align="right" valign="top">Type:</td>
<td align="left"><strong>HOWTO</strong></td>
</tr>
<tr>
<td></td>
<td align="right" valign="top">Last Revision Date:</td>
<td align="left"><strong>24-OCT-2007</strong></td>
<td align="right" valign="top">Status:</td>
<td align="left"><strong>PUBLISHED</strong></td>
</tr>
</tbody>
</table>
<table style="height:0;" border="0" cellspacing="0" cellpadding="0" width="98%">
<tbody>
<tr>
<td colspan="3" width="100%" valign="top" bgcolor="#ffffff"><strong>In this Document</strong><br />
<span> <a href="https://metalink.oracle.com/metalink/plsql/f?p=130:14:5525050408964753643::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,454081.1,1,1,1,helvetica#GOAL">Goal</a><br />
<a href="https://metalink.oracle.com/metalink/plsql/f?p=130:14:5525050408964753643::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,454081.1,1,1,1,helvetica#FIX">Solution</a><br />
<a href="https://metalink.oracle.com/metalink/plsql/f?p=130:14:5525050408964753643::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,454081.1,1,1,1,helvetica#REF">References</a><br />
</span></p>
<hr size="1" />
<h2 class="km">Applies to:</h2>
<p>Enterprise Manager Grid Control &#8211; Version: 10.2.0.1 to 10.2.0.4<br />
Information in this document applies to any platform.</p>
<h2 class="km"><a name="GOAL"></a>Goal</h2>
<p>The targets are removed from Grid Control UI.  However, it seems it was not completely removed.  The repository still has reference to the removed Agent. Agent was not totally removed from the repository.</p>
<p>How do you remove the deleted agent from the repository?</p>
<h2 class="km"><a name="FIX"></a>Solution</h2>
<p>1. Please ensure that the agent is stopped.</p>
<p>2. Logon with sqlplus against the repository database as user sysman<br />
and run following command:</p>
<div class="kmcodeblock" style="width:95%;"><code class="km">exec mgmt_admin.cleanup_agent('&lt;myserver&gt;:&lt;port&gt;');<br />
</code></div>
<p>3. If this program are deleting anything end with submit</p>
<p>4. If the procedure find something to delete you can now start the agent again.</p>
<p>5. If this procedure doesn&#8217;t find anything for delete</p>
<div class="kmcodeblock" style="width:95%;"><code class="km">5.1 Edit the agent agent side edit the $ORACLE_HOME/sysman/config/emd.properties<br />
Change the port number in:<br />
EMD_URL=https://server:port/emd/main/<br />
to the next free port at this node</code></p>
<p>5.2 Save the emd.properties</p>
<p>5.3 Confirm that the Agent home $ORACLE_HOME/sysman/emd/targets.xml file has the new port number defined for the emd agent.</p>
<p>5.4 Start the agent.</p></div>
<p>The agent will be now added with the new port number.</p>
<div class="kmnotebox">It is strongly suggest always to use the procedure<br />
exec mgmt_admin.cleanup_agent(&#8216;&lt;myserver&gt;:&lt;port&gt;&#8217;);<br />
to remove entire host targets from the Grid Control.<br />
This avoid that anything not deleted correctly</div>
</td>
</tr>
</tbody>
</table>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dbamac.wordpress.com/57/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dbamac.wordpress.com/57/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dbamac.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dbamac.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dbamac.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dbamac.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dbamac.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dbamac.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dbamac.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dbamac.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dbamac.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dbamac.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dbamac.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dbamac.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dbamac.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dbamac.wordpress.com/57/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=57&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dbamac.wordpress.com/2008/08/05/how-to-remove-a-deleted-agent-from-the-grid-control-repository-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5e75dbdf30b85ad9166dc9d1801193d7?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">macdba</media:title>
		</media:content>
	</item>
		<item>
		<title>How to Point an Agent to a different Grid Control OMS and Repository?</title>
		<link>http://dbamac.wordpress.com/2008/08/01/how-to-point-an-agent-to-a-different-grid-control-oms-and-repository/</link>
		<comments>http://dbamac.wordpress.com/2008/08/01/how-to-point-an-agent-to-a-different-grid-control-oms-and-repository/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 19:04:43 +0000</pubDate>
		<dc:creator>macdba</dc:creator>
				<category><![CDATA[ORACLE]]></category>
		<category><![CDATA[oem]]></category>

		<guid isPermaLink="false">http://dbamac.wordpress.com/?p=38</guid>
		<description><![CDATA[Subject: How to Point an Agent to a different Grid Control OMS and Repository? Doc ID: Note:413228.1 Type: HOWTO Last Revision Date: 25-FEB-2008 Status: PUBLISHED In this Document Goal Solution Applies to: Enterprise Manager Grid Control &#8211; Version: 10.2.0.0 Information in this document applies to any platform. Goal This Note intends to explain how to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=38&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<table border="0" cellspacing="6" cellpadding="0" width="80%">
<tbody>
<tr>
<td align="right" valign="top">Subject:</td>
<td colspan="4" align="left"><strong>How to Point an Agent to a different Grid Control OMS and Repository?</strong></td>
</tr>
<tr>
<td></td>
<td align="right" valign="top"><a href="https://metalink.oracle.com/help/usaeng/Search/search.html#file">Doc ID</a>:</td>
<td align="left"><strong>Note:413228.1</strong></td>
<td align="right" valign="top">Type:</td>
<td align="left"><strong>HOWTO</strong></td>
</tr>
<tr>
<td></td>
<td align="right" valign="top">Last Revision Date:</td>
<td align="left"><strong>25-FEB-2008</strong></td>
<td align="right" valign="top">Status:</td>
<td align="left"><strong>PUBLISHED</strong></td>
</tr>
</tbody>
</table>
<table style="height:0;" border="0" cellspacing="0" cellpadding="0" width="98%">
<tbody>
<tr>
<td colspan="3" width="100%" valign="top" bgcolor="#ffffff"><strong>In this Document</strong><br />
<span> <a href="https://metalink.oracle.com/metalink/plsql/f?p=130:14:10518755485291071173::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,413228.1,1,1,1,helvetica#GOAL">Goal</a><br />
<a href="https://metalink.oracle.com/metalink/plsql/f?p=130:14:10518755485291071173::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,413228.1,1,1,1,helvetica#FIX">Solution</a><br />
</span></p>
<hr size="1" />
<h2 class="km">Applies to:</h2>
<p>Enterprise Manager Grid Control &#8211; Version: 10.2.0.0<br />
Information in this document applies to any platform.</p>
<h2 class="km"><a name="GOAL"></a>Goal</h2>
<p>This Note intends to explain how to point an Oracle Management Agent to a different Grid Control OMS and Repository?</p>
<div class="kmnotebox">NOTE: These steps are NOT necessary if you are simply pointing the Oracle Management Agent to a new OMS that points to the SAME repository.  If simply moving from one OMS to another within the same Grid infrastructure, follow the instructions in the Documentation, Oracle® Enterprise Manager Advanced Configuration, Chapter 12 Reconfiguring the Management Agent and Management Service, <a href="http://download.oracle.com/docs/cd/B16240_01/doc/em.102/e10954/postinstall_config.htm#i1024275" target="new">12.1.1 Configuring the Management Agent to Use a New Management Service</a></div>
<h2 class="km"><a name="FIX"></a>Solution</h2>
<p><span style="text-decoration:underline;"><strong>A. Drop the Agent from the current OMS</strong></span></p>
<p><strong></strong></p>
<div class="kmnotebox">Note: this assumes that the Agent is still pointing to the old OMS. You will first drop the Agent from the old OMS, then add it to the new OMS. This can be ignored if the OMS doesn&#8217;t exist anymore.</div>
<p>1. Leave the monitoring agent up and running in order to delete all the targets, except the host and the agent itself).</p>
<p>2. From the old OMS, drop all the Targets on the host to be removed, except the Host and Agent.</p>
<p>Do not remove Host yet, but to confirm all targets are gone, choose Targets &gt; Hosts, highlight the host in the list and hit &#8220;Remove&#8221; button. Grid will not allow the Host to be dropped until all targets on the Host are gone, so this will list any remaining targets. Again: Do not remove Host yet.</p>
<p>All targets except the Host and Agent should now be gone from the OMS.</p>
<p>3. Confirm the targets (except Host and Agent) are removed successfully and completely from the OMS:</p>
<p>Click on &#8220;Setup&#8221; in upper right.<br />
Click on the &#8220;EM 10g Grid Control Management System&#8221; tab</p>
<blockquote><p>You will see this information on the page:</p>
<p>&#8211;&gt; Management Services and Repository<br />
&#8211;&gt; Overview page<br />
&#8211;&gt; General section<br />
&#8211;&gt; Deleted Targets: &lt; click on the digit listed here &gt;</p></blockquote>
<p>3a. Click on &#8220;Deleted Targets&#8221; (Note this only appears once a delete is attempted.)</p>
<p>3b. Confirm that the &#8220;Time Delete Completed&#8221; column is filled in; once that column is filled in then the delete is complete.</p>
<p>4. Stop the monitoring Agent</p>
<p>5. Drop the Host target from the old OMS.<br />
Targets &gt; Hosts, highlight the host in the list and hit &#8220;Remove&#8221; button.</p>
<p>Monitor for the &#8220;Time Delete Completed&#8221; column.<br />
Proceed once the column is updated.</p>
<p>6. Drop the Agent target from the old OMS.</p>
<p>Targets &gt; All Targets &gt; [pick Agent from list] &gt; &#8220;Remove&#8221; button.</p>
<p>Monitor for the &#8220;Time Delete Completed&#8221; column.<br />
Proceed once the column is updated.</p>
<p>&#8211;&gt; At this point the removal from the old OMS is completed.</p>
<p><span style="text-decoration:underline;"><strong>B. Point the Agent at the new OMS</strong></span></p>
<p>7. Follow the steps to reconfigure the Agent to point to the new OMS.</p>
<p>Here is the Documentation reference, which does explain several steps in a clear manner and will help clarify the process needed.</p>
<p>Oracle® Enterprise Manager Advanced Configuration, Chapter 12 Reconfiguring the Management Agent and Management Service, <a href="http://download.oracle.com/docs/cd/B16240_01/doc/em.102/e10954/postinstall_config.htm#i1024275" target="new">12.1.1 Configuring the Management Agent to Use a New Management Service</a></p>
<p><span style="text-decoration:underline;"><strong>Quick Summary of steps to point Agent at new OMS</strong></span></p>
<p>To associate the Management Agent with a new Management Service after you have installed the Management Agent:</p>
<p>#1 Stop the agent</p>
<p>#2 Edit the Agent&#8217;s $ORACLE_HOME/sysman/config/emd.properties file</p>
<p>#3 Search for REPOSITORY_URL<br />
Change this to point to the non-secure Grid Control hostname and port<br />
*also change HTTPS://&#8230;.. to HTTP (non-secure.)</p>
<p>#4 Search for EMD_URL<br />
This is your Agent&#8217;s address &#8211; if it has HTTPS, change it to HTTP</p>
<p>#5 Modify the value for the emdWalletSrcUrl and emdWalletDest properties. The emdWalletSrcUrl references the new Management Service. The emdWalletDest is the location where the agent saves the wallet received from the OMS, in its own file system. This is normally a directory on the agent node.</p>
<p>For example, if the new Management Service is on a host called mgmthost2.acme.com, modify the properties as follows:<br />
emdWalletSrcUrl=http://mgmthost2.acme.com:4889/em/wallets/emd<br />
emdWalletDest=&lt;AGENT_HOME&gt;/sysman/config/server</p>
<p>#6 Save and exit emd.properties.</p>
<div class="kmnotebox">Disclaimer: Clean starting the agent is only to be performed in this specific scenario and should only be used for all other issues under guidance from Oracle Support as this can damage the functionality of Grid Control and may require a re-installation.</div>
<p>#7 Clean up Agent: from the Agent $ORACLE_HOME</p>
<p>rm -r $ORACLE_HOME/sysman/emd/state/*<br />
rm -r $ORACLE_HOME/sysman/emd/collection/*<br />
rm -r $ORACLE_HOME/sysman/emd/upload/*<br />
rm $ORACLE_HOME/sysman/emd/lastupld.xml<br />
rm $ORACLE_HOME/sysman/emd/agntstmp.txt<br />
rm $ORACLE_HOME/sysman/emd/blackouts.xml<br />
rm $ORACLE_HOME/sysman/emd/protocol.ini</p>
<p>#8 Issue an agent clearstate from the Agent $ORACLE_HOME<br />
$ORACLE_HOME/bin/emctl clearstate agent</p>
<p>#9 Secure the agent<br />
$ORACLE_HOME/bin/emctl secure agent<br />
*if this fails, double-check OMS information and start from step #2 again</p>
<p>#10 Start the agent<br />
$ORACLE_HOME/bin/emctl start agent<br />
*wait about 30 seconds before going to step 11 &#8211; give agent time to &#8220;wake up&#8221;</p>
<p>#11 Force an upload to the OMS<br />
$ORACLE_HOME/bin/emctl upload agent</p>
<p>After 10-15 minutes the Agent and Host should show up in the new OMS.</td>
</tr>
</tbody>
</table>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dbamac.wordpress.com/38/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dbamac.wordpress.com/38/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dbamac.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dbamac.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dbamac.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dbamac.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dbamac.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dbamac.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dbamac.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dbamac.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dbamac.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dbamac.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dbamac.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dbamac.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dbamac.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dbamac.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=38&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dbamac.wordpress.com/2008/08/01/how-to-point-an-agent-to-a-different-grid-control-oms-and-repository/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5e75dbdf30b85ad9166dc9d1801193d7?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">macdba</media:title>
		</media:content>
	</item>
		<item>
		<title>WHY ARE MY JOBS NOT RUNNING</title>
		<link>http://dbamac.wordpress.com/2008/08/01/why-are-my-jobs-not-running/</link>
		<comments>http://dbamac.wordpress.com/2008/08/01/why-are-my-jobs-not-running/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 19:04:21 +0000</pubDate>
		<dc:creator>macdba</dc:creator>
				<category><![CDATA[ORACLE]]></category>
		<category><![CDATA[oracle jobs]]></category>
		<category><![CDATA[scheduler]]></category>

		<guid isPermaLink="false">http://dbamac.wordpress.com/?p=34</guid>
		<description><![CDATA[ANSWERS TO &#8220;WHY ARE MY JOBS NOT RUNNING ?&#8221; Thanks to : http://forums.oracle.com/forums/thread.jspa?threadID=646581&#38;tstart=0 This is one of the most common Scheduler questions asked. Here we list some of the common problems and their solutions. 1) job_queue_processes may be too low (this is the most common problem) The value of job_queue_processes limits the total number of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=34&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>ANSWERS TO &#8220;WHY ARE MY JOBS NOT RUNNING ?&#8221;</strong></p>
<p>Thanks to : http://forums.oracle.com/forums/thread.jspa?threadID=646581&amp;tstart=0</p>
<p>This is one of the most common Scheduler questions asked.<br />
Here we list some of the common problems and their solutions.</p>
<p><strong>1)</strong> job_queue_processes may be too low (this is the most common problem)<br />
The value of job_queue_processes limits the total number of dbms_scheduler<br />
and dbms_job jobs that can be running at a given time.<br />
To check whether this is the case check the current value of<br />
job_queue_processes with<br />
SQL&gt; select value from v$parameter where name=&#8217;job_queue_processes&#8217;;<br />
Then check the number of running jobs<br />
SQL&gt; select count(*) from dba_scheduler_running_jobs;<br />
SQL&gt; select count(*) from dba_jobs_running;</p>
<p>If this is the problem you can increase the parameter using<br />
SQL&gt; alter system set job_queue_processes=1000;</p>
<p><strong>2)</strong> max_job_slave_processes may be too low<br />
If this parameter is not NULL then it limits how many dbms_scheduler jobs can<br />
be running at a time. To check whether this is the problem, check the current<br />
value using<br />
SQL&gt; select value from dba_scheduler_global_attribute<br />
where attribute_name=&#8217;MAX_JOB_SLAVE_PROCESSES&#8217;;<br />
Then check the number of running jobs<br />
SQL&gt; select count(*) from dba_scheduler_running_jobs;</p>
<p>If this is the problem you can increase the number or just NULL it out using<br />
SQL&gt; exec dbms_scheduler.set_scheduler_attribute(&#8216;max_job_slave_processes&#8217;,null)</p>
<p><strong>3)</strong> sessions may be too low<br />
This parameter limits the number of sessions at any time. Every Scheduler job<br />
requires 2 sessions. To check whether this is the problem, check the current<br />
valule using<br />
SQL&gt; select value from v$parameter where name=&#8217;sessions&#8217;;<br />
Then check the current number of sessions using<br />
SQL&gt; select count(*) from v$session ;</p>
<p>If the numbers are too close you can increase the maximum using<br />
SQL&gt; alter system set job_queue_processes=200;</p>
<p><strong>4)</strong> Have you recently applied a timezone update patch or upgraded the database<br />
to a version with newer timezone information ? If you skipped any steps when<br />
updating the timezone information, jobs may not run. To check whether this<br />
is the case try doing<br />
SQL&gt; select * from sys.scheduler$_job;<br />
and make sure it finishes without errors.</p>
<p>If it throws a timezone warning, reapply the upgrade or<br />
timezone patch making sure to follow all the steps.</p>
<p><strong>5)</strong> Is the database running in restricted mode ?<br />
If the database is running in restricted mode then no jobs will run (unless<br />
you are using 11g and use the ALLOW_RUNS_IN_RESTRICTED_MODE attribute).<br />
To check this use<br />
SQL&gt; select logins from v$instance ;</p>
<p>If logins is restricted you can disable the restricted mode using<br />
SQL&gt; ALTER SYSTEM DISABLE RESTRICTED SESSION;</p>
<p><strong>6)</strong> Has the Scheduler been disabled ? This <strong>is not a supported action</strong><br />
but it is possible that someone has done it anyway. To check this do<br />
SQL&gt; select value from dba_scheduler_global_attribute where attribute_name=&#8217;SCHEDULER_DISABLED&#8217;</p>
<p>If this query returns TRUE then you can fix this using<br />
SQL&gt; exec dbms_scheduler.set_scheduler_attribute(&#8216;scheduler_disabled&#8217;,'false&#8217;);</p>
<p><strong>Reasons why jobs may run late</strong></p>
<p><strong>1)</strong> The first thing to check is the timezone that the job is scheduled with<br />
SQL&gt; select owner, job_name, next_run_date from dba_scheduler_jobs ;</p>
<p>If the jobs are in the wrong timezone they may not run at the expected<br />
time. If the next_run_date is using an absolute timezone offset (like<br />
+08:00) instead of a named timezone (like US/PACIFIC) then the jobs may not<br />
run as expected if daylight savings is in effect &#8211; they may run an hour<br />
early or late.</p>
<p><strong>2)</strong> It may be that at the time the job was scheduled to run, one of the several<br />
limits above may have been temporarily reached causing the job to be delayed.<br />
Check if the limits above are high enough and if possible check them during<br />
the time that the job is being delayed.</p>
<p><strong>3)</strong> One possible reason that one of the above limits may be hit is that a<br />
maintenance window may have come into effect. Maintenance windows are Oracle<br />
Scheduler windows that belong to the window group named<br />
MAINTENANCE_WINDOW_GROUP. During a scheduled maintenance window, several<br />
maintenance tasks are run using jobs. This may cause one of the limits listed<br />
above to be hit and user jobs to be delayed. See the admin guide for more info<br />
about this (chapter 24).</p>
<p>To get a list of maintenance windows use<br />
SQL&gt; select * from dba_scheduler_wingroup_members;</p>
<p>To see when the windows run use<br />
SQL&gt; select * from dba_scheduler_windows;</p>
<p>To fix this you can either increase the limits or reschedule the maintenance<br />
windows to run at more convenient times.</p>
<p><strong>Diagnosing other Problems</strong></p>
<p>If none of this works, here are some further steps you can take to try to<br />
figure out what is going on.</p>
<p><strong>1)</strong> Check whether there are any errors in the alert log. If the database is<br />
having trouble allocating memory or has run out of disk space or any other<br />
catastrophic errors have occurred, you should resolve those first. You can<br />
find the location of the alert log by using<br />
SQL&gt; select value from v$parameter where name = &#8216;background_dump_dest&#8217;;<br />
The alert log will be in this directory with a name starting with &#8220;alert&#8221;.</p>
<p><strong>2)</strong> Check whether if a job coordinator trace file and if it does, check if it<br />
contains any errors. If this exists, it will be located in the<br />
&#8216;background_dump_dest&#8217; directory which you can find as above and will look<br />
something like SID-cjq0_nnnn.trc . If there are any errors here they may<br />
hint at why jobs are not running.</p>
<p><strong>3)</strong> If either of the above indicates that the SYSAUX tablespace (where the scheduler stores its logging tables) is full, you can use the dbms_scheduler.purge_log procedure to clear out old log entries.</p>
<p><strong>4)</strong>try running a simple run-once job and see if it runs<br />
SQL&gt;begin<br />
dbms_scheduler.create_job (<br />
job_name =&gt; &#8216;test_job&#8217;,<br />
job_type =&gt; &#8216;plsql_block&#8217;,<br />
job_action =&gt; &#8216;null;&#8217;,<br />
enabled =&gt; true);<br />
end;<br />
/<br />
SQL&gt; &#8212; wait a while<br />
SQL&gt; select * from user_scheduler_job_run_details where job_name=&#8217;TEST_JOB&#8217;;</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dbamac.wordpress.com/34/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dbamac.wordpress.com/34/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dbamac.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dbamac.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dbamac.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dbamac.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dbamac.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dbamac.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dbamac.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dbamac.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dbamac.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dbamac.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dbamac.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dbamac.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dbamac.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dbamac.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbamac.wordpress.com&amp;blog=3892088&amp;post=34&amp;subd=dbamac&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dbamac.wordpress.com/2008/08/01/why-are-my-jobs-not-running/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5e75dbdf30b85ad9166dc9d1801193d7?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">macdba</media:title>
		</media:content>
	</item>
	</channel>
</rss>
