<?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:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>DBA VIEW</title>
	<atom:link href="http://naikh.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://naikh.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Fri, 17 Apr 2009 13:27:42 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='naikh.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/e88a706f26e71351c90022a595ad1577?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>DBA VIEW</title>
		<link>http://naikh.wordpress.com</link>
	</image>
			<item>
		<title>Applying RMAN Incremental Backup To Standby Database</title>
		<link>http://naikh.wordpress.com/2008/09/20/applying-rman-incremental-backup-to-standby-database/</link>
		<comments>http://naikh.wordpress.com/2008/09/20/applying-rman-incremental-backup-to-standby-database/#comments</comments>
		<pubDate>Sat, 20 Sep 2008 12:50:00 +0000</pubDate>
		<dc:creator>naikh</dc:creator>
				<category><![CDATA[Standby Database]]></category>

		<guid isPermaLink="false">http://naikh.wordpress.com/2008/09/20/applying-rman-incremental-backup-to-standby-database/</guid>
		<description><![CDATA[We can use RMAN incremental backup to roll forward the physical standby database in the following situations: 1. when an archive sequence is missing 2. when lots of archives needs to be applied
Steps:
1. Take the current SCN of the standby database
    SQL&#62; select to_char(current_scn)  scn from v$database;     [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=33&subd=naikh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>We can use RMAN incremental backup to roll forward the physical standby database in the following situations:<br /> 1. when an archive sequence is missing<br /> 2. when lots of archives needs to be applied</p>
<p>Steps:</p>
<p><span style="font-weight:bold;">1. Take the current SCN of the standby database</p>
<p></span><span style="font-size:85%;"><span style="font-family:courier new;">    SQL&gt; select to_char(current_scn)  scn from v$database;</span><br /><span style="font-family:courier new;">           SCN</span><br /><span style="font-family:courier new;">        &#8212;&#8212;&#8212;&#8212;&#8212;</span><br /><span style="font-family:courier new;">            23339995</span></span></p>
<p><span style="font-weight:bold;">2. Stop the redo apply on the standby database</p>
<p></span><span style="font-size:85%;"><span style="font-family:courier new;">    SQL&gt; alter database recover managed standby database cancel;</span></span></p>
<p><span style="font-weight:bold;">3. Take the incremental backup of the production database from the current SCN of the standby database</span><br /><span style="font-family:courier new;font-size:85%;"><br />RMAN&gt; run {<br />                     allocate channel c1 type disk format &#8216;/backup/%d_incr_s%s_p%p&#8217; maxpiecesize 2g;<br />                     allocate channel c2 type disk format &#8216;/backup/%d_incr_s%s_p%p&#8217; maxpiecesize 2g;<br />                     allocate channel c3 type disk format &#8216;/backup/%d_incr_s%s_p%p&#8217; maxpiecesize 2g;<br />                     allocate channel c4 type disk format &#8216;/backup/%d_incr_s%s_p%p&#8217; maxpiecesize 2g;<br />                     backup as compressed backupset incremental from scn 23339995 database;<br />         }</span></p>
<p><span style="font-weight:bold;">4. Transfer the incremental backup to the standby system</span><br /><span style="font-size:85%;"><span style="font-family:courier new;">  <br />$ scp /backup/*  usename@standbyhost:/tmp/</span></span></p>
<p><span style="font-weight:bold;">5. Catalog all the incremental backup pieces to the standby database</span><br /><span style="font-size:85%;"><span style="font-family:courier new;"><br />RMAN&gt; catalog start with &#8216;/tmp/&#8217; ;</span></span></p>
<p><span style="font-weight:bold;">6. Apply incremental backup to the standby database</span><br /><span style="font-size:85%;"><span style="font-family:courier new;"><br />RMAN&gt; recover database noredo;</span></span></p>
<p><span style="font-weight:bold;">7. Create new standby controlfile at the production database,  copy this to standby system and replace current standby controlfile with this new one.</p>
<p></span><span style="font-size:85%;"><span style="font-family:courier new;">    SQL&gt; alter database create standby controlfile as &#8216;/backup/standby_incr.ctl&#8217;;</span></span></p>
<p><span style="font-weight:bold;">8. Start redo apply on the physical standby  database</span><br /><span style="font-size:85%;"><span style="font-family:courier new;"><br />SQL&gt; alter database recover managed standby database disconnect;</span></span></p>
<p>Note:<br />If you have added new datafile to the production and if it is not at created at standby you have to  restore the datafile.<br /><span style="font-size:85%;"><span style="font-family:courier new;">    RAMN&gt; restore datafile 56,57,58;</span></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/naikh.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/naikh.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/naikh.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/naikh.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/naikh.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/naikh.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/naikh.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/naikh.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/naikh.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/naikh.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=33&subd=naikh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://naikh.wordpress.com/2008/09/20/applying-rman-incremental-backup-to-standby-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/025428d70b3b4930e3eef04e71023d1c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">naikh</media:title>
		</media:content>
	</item>
		<item>
		<title>Password Expiration Notification</title>
		<link>http://naikh.wordpress.com/2008/07/05/password-expiration-notification/</link>
		<comments>http://naikh.wordpress.com/2008/07/05/password-expiration-notification/#comments</comments>
		<pubDate>Sat, 05 Jul 2008 13:00:00 +0000</pubDate>
		<dc:creator>naikh</dc:creator>
				<category><![CDATA[Linux/Solaris]]></category>

		<guid isPermaLink="false">http://naikh.wordpress.com/2008/07/05/password-expiration-notification/</guid>
		<description><![CDATA[This is a simple script to notify about password expiration to users.
#!/bin/bash# Set the environment variablesexport ORACLE_HOME=/opt/oracle/product/102/DBexport ORALCE_SID=oradbexport PATH=$PATH:$ORACLE_HOME/bin# Declar the vaiableNOTIFY_LIST=user_name@abc.comDIFF_FILE=/tmp/pass_exp.log# Get expiry dateEXP_DATE=`chage -l oracle grep &#8220;Password Expires&#8221; awk &#8216;{print $4&#8243;-&#8221;$3&#8243;-&#8221;$5}&#8217;sed &#8217;s/,//&#8217;`
# Calculte in how many days password will expiresqlplus usr/pass@$ORACLE_SID&#60;&#8211;CREATE TABLE pwd_expire (expire_date date);INSERT INTO pwd_expire values (TO_DATE(&#8216;$EXP_DATE&#8217;,'DD-MON-YYYY&#8217;));COMMIT;SET ECHO OFF FEEDBACK OFFSPOOL [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=32&subd=naikh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This is a simple script to notify about password expiration to users.</p>
<p><span style="font-family:courier new;">#!/bin/bash</span><br /><span style="font-family:courier new;"></span><br /><span style="font-family:courier new;"># Set the environment variables</span><br /><span style="font-family:courier new;">export ORACLE_HOME=/opt/oracle/product/102/DB</span><br /><span style="font-family:courier new;">export ORALCE_SID=oradb</span><br /><span style="font-family:courier new;">export PATH=$PATH:$ORACLE_HOME/bin</span><br /><span style="font-family:courier new;"></span><br /><span style="font-family:courier new;"># Declar the vaiable</span><br /><a href="mailto:NOTIFY_LIST=user_name@abc.com"><span style="font-family:courier new;">NOTIFY_LIST=user_name@abc.com</span></a><br /><span style="font-family:courier new;">DIFF_FILE=/tmp/pass_exp.log</span><br /><span style="font-family:courier new;"></span><br /><span style="font-family:courier new;"># Get expiry date</span><br /><span style="font-family:courier new;">EXP_DATE=`chage -l oracle grep &#8220;Password Expires&#8221; awk &#8216;{print $4&#8243;-&#8221;$3&#8243;-&#8221;$5}&#8217;sed &#8217;s/,//&#8217;`</span></p>
<p><span style="font-family:courier new;"># Calculte in how many days password will expire</span><br /><span style="font-family:courier new;">sqlplus </span><a href="mailto:usr/pass@$ORACLE_SID"><span style="font-family:courier new;">usr/pass@$ORACLE_SID</span></a><span style="font-family:courier new;">&lt;<br /><span style="font-family:courier new;">&#8211;CREATE TABLE pwd_expire (expire_date date);</span><br /><span style="font-family:courier new;">INSERT INTO pwd_expire values (TO_DATE(&#8216;$EXP_DATE&#8217;,'DD-MON-YYYY&#8217;));</span><br /><span style="font-family:courier new;">COMMIT;</span><br /><span style="font-family:courier new;">SET ECHO OFF FEEDBACK OFF</span><br /><span style="font-family:courier new;">SPOOL $DIFF_FILE</span><br /><span style="font-family:courier new;">SELECT ROUND(expire_date-sysdate) diff FROM pwd_expire;</span><br /><span style="font-family:courier new;">SPOOL OFF</span><br /><span style="font-family:courier new;">&#8211;DROP TABLE pwd_expire;</span><br /><span style="font-family:courier new;">TRUNCATE TABLE pwd_expire;</span><br /><span style="font-family:courier new;">EXIT</span><br /><span style="font-family:courier new;"></span><br /><span style="font-family:courier new;">EOF</span><br /><span style="font-family:courier new;"></span><br /><span style="font-family:courier new;">DAYS=`tail -2 $DIFF_FILEhead -1awk &#8216;{print $1}&#8217;`</span><br /><span style="font-family:courier new;"></span></span><br /><span style="font-family:courier new;"><br /><span style="font-family:courier new;">if [ $DAYS -le 5 ]</span><br /><span style="font-family:courier new;">then</span><br /><span style="font-family:courier new;">mailx -s &#8220;Oracle Password will expires in $DAYS&#8221; $NOTIFY_LIST &lt; /dev/null</span></span><br /><span style="font-family:courier new;"><span style="font-family:courier new;"> <span style="font-family:courier new;">fi</span></p>
<p></span></span><span style="font-family:courier new;"><span style="font-family:courier new;"></span></span><span style="font-family:courier new;"><span style="font-family:courier new;"></span></span><span style="font-family:courier new;"><span style="font-family:courier new;"></span></span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/naikh.wordpress.com/32/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/naikh.wordpress.com/32/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/naikh.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/naikh.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/naikh.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/naikh.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/naikh.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/naikh.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/naikh.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/naikh.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/naikh.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/naikh.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=32&subd=naikh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://naikh.wordpress.com/2008/07/05/password-expiration-notification/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/025428d70b3b4930e3eef04e71023d1c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">naikh</media:title>
		</media:content>
	</item>
		<item>
		<title>AXEL: Download accelerator for Linux</title>
		<link>http://naikh.wordpress.com/2008/07/05/axel-download-accelerator-for-linux/</link>
		<comments>http://naikh.wordpress.com/2008/07/05/axel-download-accelerator-for-linux/#comments</comments>
		<pubDate>Sat, 05 Jul 2008 11:17:00 +0000</pubDate>
		<dc:creator>naikh</dc:creator>
				<category><![CDATA[Linux/Solaris]]></category>

		<guid isPermaLink="false">http://naikh.wordpress.com/2008/07/05/axel-download-accelerator-for-linux/</guid>
		<description><![CDATA[AXEL is a download accelerator for Linux. This utility also can be used to transfer files from one machine to another.Download:axel -n 16 -a http://download.com/download_file.gz
File Transfer:axel -n 16 -a ftp://username/password@remote_host//temp/expdp_naikh_01.dmp
axel -n 16 -a ftp://username/password@remote_host//temp/expdp_naikh*
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=31&subd=naikh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>AXEL is a download accelerator for Linux. This utility also can be used to transfer files from one machine to another.<br /><strong></strong><br /><strong>Download:</strong><br /><span style="font-family:courier new;font-size:85%;">axel -n 16 -a </span><a href="http://download.com/download_file.gz"><span style="font-family:courier new;font-size:85%;">http://download.com/download_file.gz</span></a></p>
<p><strong>File Transfer:</strong><br /><span style="font-family:courier new;font-size:85%;">axel -n 16 -a </span><span style="font-family:courier new;font-size:85%;"><a href="ftp://username/password@remote_host//temp/expdp_naikh_01.dmp">ftp://username/password@remote_host//temp/expdp_naikh_01.dmp</a></span></p>
<p><span style="font-family:courier new;font-size:85%;">axel -n 16 -a </span><a href="ftp://username/password@remote_host//temp/expdp_naikh"><span style="font-family:courier new;font-size:85%;">ftp://username/password@remote_host//temp/expdp_naikh</span></a><span style="font-family:courier new;font-size:85%;">*</span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/naikh.wordpress.com/31/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/naikh.wordpress.com/31/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/naikh.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/naikh.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/naikh.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/naikh.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/naikh.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/naikh.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/naikh.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/naikh.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/naikh.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/naikh.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=31&subd=naikh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://naikh.wordpress.com/2008/07/05/axel-download-accelerator-for-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/025428d70b3b4930e3eef04e71023d1c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">naikh</media:title>
		</media:content>
	</item>
		<item>
		<title>Applying Oracle Patchset</title>
		<link>http://naikh.wordpress.com/2008/07/05/applying-oracle-patchset/</link>
		<comments>http://naikh.wordpress.com/2008/07/05/applying-oracle-patchset/#comments</comments>
		<pubDate>Sat, 05 Jul 2008 10:57:00 +0000</pubDate>
		<dc:creator>naikh</dc:creator>
				<category><![CDATA[Installation]]></category>

		<guid isPermaLink="false">http://naikh.wordpress.com/2008/07/05/applying-oracle-patchset/</guid>
		<description><![CDATA[Aplying patchset p5337014_10203_LINUX.zip to upgrade from 10201 to 10203.1. Shut down the databaseSQL&#62; shut immediate2. Stop the listener$ lsnrctl stop 3. Unzip the patchset and run OUI$ ./runinstaller4. Start the listener$ lsnrctl start 5. Run the following commnadsSQL&#62; STARTUP UPGRADESQL&#62; SPOOL patch.logSQL&#62; @?/rdbms/admin/catupgrd.sqlSQL&#62; SPOOL OFF6. Restart the databaseSQL&#62; SHUT IMMEDIATESQL&#62; STARTUP7. Run the utlrp.sql script [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=30&subd=naikh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Aplying patchset p5337014_10203_LINUX.zip to upgrade from 10201 to 10203.<br /><strong></strong><br /><strong>1. Shut down the database</strong><br /><span style="font-family:courier new;">SQL&gt; shut immediate</span><br /><strong></strong><br /><strong>2. Stop the listener</strong><br /><span style="font-family:courier new;">$ lsnrctl stop </span><br /><strong></strong><br /><strong>3. Unzip the patchset and run OUI</strong><br /><span style="font-family:courier new;">$ ./runinstaller</span><br /><strong></strong><br /><strong>4. Start the listener</strong><br /><span style="font-family:courier new;">$ lsnrctl start </span><br /><strong></strong><br /><strong>5. Run the following commnads</strong><br /><span style="font-family:courier new;">SQL&gt; STARTUP UPGRADE</span><br /><span style="font-family:courier new;">SQL&gt; SPOOL patch.log</span><br /><span style="font-family:courier new;">SQL&gt; @?/rdbms/admin/catupgrd.sql</span><br /><span style="font-family:courier new;">SQL&gt; SPOOL OFF</span><br /><strong></strong><br /><strong>6. Restart the database</strong><br /><span style="font-family:courier new;">SQL&gt; SHUT IMMEDIATE</span><br /><span style="font-family:courier new;">SQL&gt; STARTUP</span><br /><strong></strong><br /><strong>7. Run the utlrp.sql script to recompile all invalid PL/SQL packages</strong><br /><span style="font-family:courier new;">SQL&gt; @?/rdbms/admin/utlrp.sql</span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/naikh.wordpress.com/30/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/naikh.wordpress.com/30/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/naikh.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/naikh.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/naikh.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/naikh.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/naikh.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/naikh.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/naikh.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/naikh.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/naikh.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/naikh.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=30&subd=naikh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://naikh.wordpress.com/2008/07/05/applying-oracle-patchset/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/025428d70b3b4930e3eef04e71023d1c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">naikh</media:title>
		</media:content>
	</item>
		<item>
		<title>Bash Shell Scripting Guide</title>
		<link>http://naikh.wordpress.com/2008/04/18/bash-shell-scripting-guide/</link>
		<comments>http://naikh.wordpress.com/2008/04/18/bash-shell-scripting-guide/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 21:53:19 +0000</pubDate>
		<dc:creator>naikh</dc:creator>
				<category><![CDATA[Shell Scripting]]></category>

		<guid isPermaLink="false">http://naikh.wordpress.com/?p=5</guid>
		<description><![CDATA[1. Some bash shell scripting rules
1) The first line in your script must be
#!/bin/bash 
That is a # (Hash) followed by a ! (ban) followed by the path of the shell. This line lets the environment know the file is a shell script and the location of the shell.
 
2) Before executing your script, you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=5&subd=naikh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><strong><span style="text-decoration:underline;"><span style="font-size:12pt;">1. Some bash shell scripting rules</span></span></strong><span style="font-size:10pt;"><br />
1) The first line in your script must be</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">#!/bin/bash </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:18pt;"><span style="font-size:10pt;">That is a # (Hash) followed by a ! (ban) followed by the path of the shell. This line lets the environment know the file is a <a href="http://linuxhelp.blogspot.com/2005/10/10-seconds-guide-to-bash-shell.html" target="_top"><span style="text-decoration:none;color:#000000;">shell script</span></a> and the location of the shell.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:18pt;"><span style="font-size:10pt;">2) Before executing your script, you should make the script executable. </span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">$ chmod ugo+x test.sh</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:18pt;"><span style="font-size:10pt;">3) The name of your shell script must end with a .sh . </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">Example 1.1: First shell script</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">a.</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">$ vi my_shell_script.sh</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">b.</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">#!/bin/bash<br />
echo “Hello World “</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">c.</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">$ chmod +x my_shell_script.sh</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">d.</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">$ ./ my_shell_script.sh</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><strong><span style="text-decoration:underline;"><span style="font-size:12pt;">2. Conditional statements</span></span></strong></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:18pt;"><span style="font-size:10pt;">The ‘if’ Statement &#8211; evaluates a condition which accompanies its command line. </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">Syntax 2.1:</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">if condition_is_true<br />
then<br />
execute commands<br />
fi</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">Syntax 2.2:</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">if condition_is_true<br />
then<br />
execute commands<br />
else<br />
execute commands<br />
fi</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:18pt;"><span style="font-size:10pt;">if condition also permits multiway branching. That is you can evaluate more conditions if the previous condition fails.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">Syntax 2.3:</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">if condition_is_true<br />
then<br />
execute commands<br />
elif another_condition_is_true<br />
then<br />
execute commands<br />
else<br />
execute commands<br />
fi</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><strong><span style="font-size:10pt;"> </span></strong></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><strong><span style="font-size:10pt;"> </span></strong></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><strong><span style="font-size:10pt;"> </span></strong></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><strong><span style="text-decoration:underline;"><span style="font-size:12pt;">3. if’s <a href="http://linuxhelp.blogspot.com/2005/10/10-seconds-guide-to-bash-shell.html" target="_top"><span style="color:#000000;">companion</span></a> &#8211; test</span></span></strong></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:18pt;"><span style="font-size:10pt;">test is an internal feature of the shell. test evaluates the condition placed on its right, and returns either a true or false exit status. For this purpose, test uses certain operators to evaluate the condition. They are as follows:</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"><br />
<strong>3.1 Relational operators</strong></span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">-eq  Equal to<br />
-lt  Less than<br />
-gt  Greater than<br />
-<a href="http://linuxhelp.blogspot.com/2005/10/10-seconds-guide-to-bash-shell.html" target="_top"><span style="text-decoration:none;color:#000000;">ge</span></a> Greater than or equal to<br />
-lt  Less than<br />
-le  Less than or equal to </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><strong><span style="font-size:10pt;">3.2 File related tests</span></strong></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">-f file   True if file exists and is a regular file<br />
-r file   True if file exists and is readable<br />
-w file   True if file exists and is writable<br />
-x file   True if file exists and is executable<br />
-d file   True if file exists and is a directory<br />
-s file   True if file exists and has a size greater than zero.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><strong><span style="font-size:10pt;">3.3 String tests</span></strong></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">-n str    True if string str is not a null string<br />
-z str    True if string str is a null string<br />
str1 == str2  True if both strings are equal<br />
str1 != str2  True if both strings are unequal<br />
str      True if string str is assigned a value and is not null.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><strong><span style="font-size:10pt;">3.4 Multiple conditions</span></strong></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">-a Performs the AND function<br />
-o Performs the OR function</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">Example 3.1: </span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">if [ $D -eq 25 ]<br />
then<br />
echo $D<br />
fi</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">Example 3.2:</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">if [ $STR1 == $STR2 ]<br />
then<br />
do something<br />
fi</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">Example 3.3:</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">if [ -n "$STR1" -a -n "$STR2" ]<br />
then<br />
echo ‘Both $STR1 and $STR2 are not null’<br />
fi</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">… above, I have checked if both strings are not null then execute the echo command.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="line-height:normal;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"><br />
Things to remember while using test</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:18pt;"><span style="font-size:10pt;">If you are using square brackets [] instead of test, then care should be taken to insert a space after the [ and before the ].</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">Note: test is confined to <a href="http://linuxhelp.blogspot.com/2005/10/10-seconds-guide-to-bash-shell.html" target="_top"><span style="text-decoration:none;color:#000000;">integer values</span></a> only. Decimal values are simply truncated.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><strong><span style="text-decoration:underline;"><span style="font-size:12pt;">4. Case statement</span></span></strong><span style="font-size:10pt;"><br />
Case statement is the second conditional offered by the shell.<br />
Syntax:</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">case expression in<br />
pattern1) execute commands ;;<br />
pattern2) execute commands ;;<br />
…<br />
esac</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:18pt;"><span style="font-size:10pt;">The keywords here are in, case and esac. The ‘;;’ is used as option <a href="http://linuxhelp.blogspot.com/2005/10/10-seconds-guide-to-bash-shell.html" target="_top"><span style="text-decoration:none;color:#000000;">terminators</span></a>. The construct also uses ‘)’ to delimit the pattern from the action.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"><br />
Example 4.1:</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">…<br />
echo “Enter your option : “<br />
read I;</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;">case $I in<br />
1) ls -l ;;<br />
2) ps -aux ;;<br />
3) date ;;<br />
4) who ;;<br />
5) exit<br />
esac</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">Note: The last case option need not have ;;</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">but you can provide them if you want.</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">Example 4.2:</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">case `date +%a` in<br />
Mon) commands ;;<br />
Tue) commands ;;<br />
Wed) commands ;;<br />
…<br />
esac</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><strong><span style="text-decoration:underline;"><span style="font-size:12pt;line-height:115%;">5. Looping<span> </span>Statements</span></span></strong></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;line-height:115%;">5.1 while loop</span></strong></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;line-height:115%;"><span> </span></span></strong><span style="font-size:10pt;line-height:115%;">Syntax:</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">while condition_is_true<br />
do<br />
execute commands<br />
done</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">Example 5.1.1:</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">while [ $NUM -gt 100 ]<br />
do<br />
sleep 5<br />
done</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">Example 5.1.2:</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">while :<br />
do<br />
execute some commands<br />
done</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">The above code implements a infinite loop. You could also write ‘while true’ instead of ‘while :’ .</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;line-height:115%;">5.2 until loop</span></strong></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">Until complements while construct in the sense that the loop body here is executed repeatedly as long as the condition remains false.</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">Syntax:</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">until false<br />
do<br />
execute commands<br />
done</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">Example 5.2:</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">…<br />
until [ -f myfile ]<br />
do<br />
sleep 5<br />
done</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">The above code is executed repeatedly until the file myfile is created(touch).</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;line-height:115%;">5.3 for loop</span></strong></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">Syntax :</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">for variable in list<br />
do<br />
execute commands<br />
done</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;line-height:115%;">Example 5.3.1:</span></strong></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">…<br />
for X in 1 2 3 4 5<br />
do<br />
echo “The value of X is $X”;<br />
done</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;line-height:115%;">Example 5.3.2:</span></strong></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">#!/bin/bash</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> LIMIT=10</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> for ((a=1; a &lt;= LIMIT ; a++))</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">do</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> echo -e “$a”</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">done</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><strong><span style="text-decoration:underline;"><span style="font-size:12pt;line-height:115%;">6. special symbols and their meanings w.r.t shell scripts</span></span></strong></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">$* &#8211; This denotes all the parameters passed to the script at the time of its execution. Which <span> </span></span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"><span> </span><span> </span>includes $1, $2 and so on.<br />
$0 &#8211; Name of the shell script being executed.<br />
$# &#8211; Number of arguments specified in the command line.<br />
$? &#8211; Exit status of the last command.</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;text-align:justify;line-height:18pt;"><span style="font-size:10pt;">$$ &#8211; contains the process ID of the current shell. </span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">The above symbols are known as positional parameters. Let me explain the positional parameters with the aid of an example. Suppose I have a shell script called my_script.sh . Now I execute this script in the command line as follows :</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">$ ./my_script.sh linux is a robust OS</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">… as you can see above, I have passed 5 parameters to the script. In this scenario, the values of the positional parameters are as follows:</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">$* &#8211; will contain the values ‘linux’,&#8217;is’,&#8217;a’,&#8217;robust’,&#8217;OS’.</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">$0 &#8211; will contain the value my_script.sh &#8211; the name of the script being</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">executed.</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">$# &#8211; contains the value 5 &#8211; the total number of parameters.</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">$$ &#8211; contains the process ID of the current shell. You can use this parameter while giving unique names to any temporary files that you create at the time of execution of the shell.</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">$1 &#8211; contains the value ‘linux’</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">$2</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">- contains the value ‘is’</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">… and so on.</span></p>
<p class="MsoNormal"><strong><span style="text-decoration:underline;"><span style="font-size:12pt;line-height:115%;">7. Read statement</span></span></strong></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">Make your shell script interactive. read will let the user enter values while the script is being executed. When a program encounters the read statement, the program pauses at that point. Input entered through the keyboard id read into the variables following read, and the program execution continues.</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">Example 7.1: Interactive</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">#!/bin/bash<br />
echo “Enter your name : “<br />
read NAME<br />
echo “Hello $NAME , Have a nice day.”</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">Exit status of the last command</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">Every command returns a value after execution. This value is called the exit status or return value of the command. A command is said to be true if it executes successfully, and false if it fails. This can be checked in the script using the $? positional parameter.</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">Example x: Multiplication Table</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">#!/bin/bash</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">Y=1</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">while [ $Y -le 12 ]; do</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> X=1</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> while [ $X -le 12 ]; do</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> printf “% 4d” $(( $X * $Y ))</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> let X++</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> done</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> echo “”</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> let Y++</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">done</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><strong><span style="text-decoration:underline;"><span style="font-size:12pt;line-height:115%;">8. Function</span></span></strong></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"><span> </span></span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">We can break our code into small chunks called functions, and call them by name in the main program. This approach helps in debugging, code re-usability, etc.</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"><span> </span></span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">Syntax:</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">&lt;name of function&gt; ()</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">{           # start of function</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> statements</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">}           # end of function</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">Functions are invoked by citing their names in the main program, optionally followed by arguments. </span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;">Example 8.1:</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">#!/bin/bash</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">#******************************************************</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"># This script uses function</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">#******************************************************</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">sumcalc ()</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">{</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> SUM=$[$1 + $2]</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">}</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">echo -e “Enter the first number:\c”</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">read  NUM1</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">echo -e “Enter the second number:\c”</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">read NUM2</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">sumcalc $NUM1 $NUM2</span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="background:#f0f4f5 none repeat scroll 0;margin-bottom:0.0001pt;line-height:18pt;"><span style="font-size:10pt;">echo “Output from function sumcalc: $SUM”</span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;"> </span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/naikh.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/naikh.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/naikh.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/naikh.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/naikh.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/naikh.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/naikh.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/naikh.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/naikh.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/naikh.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/naikh.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/naikh.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=5&subd=naikh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://naikh.wordpress.com/2008/04/18/bash-shell-scripting-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/025428d70b3b4930e3eef04e71023d1c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">naikh</media:title>
		</media:content>
	</item>
		<item>
		<title>Oracle 9i Funda1</title>
		<link>http://naikh.wordpress.com/2008/04/18/oracle-9i-funda1/</link>
		<comments>http://naikh.wordpress.com/2008/04/18/oracle-9i-funda1/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 21:46:57 +0000</pubDate>
		<dc:creator>naikh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://naikh.wordpress.com/?p=4</guid>
		<description><![CDATA[ 
 
Database Administration Tasks 

Plane and create database
Manage database availability
Manage physical and logical structures
Manage storage based on design
Manage security
Network administration
Backup and Recovery
Database tuning

 
 
Oracle Server = + Oracle Instance + Oracle database
Oracle Instance = Memory structures + Background process
Oracle Database = data files, control files, redo log files 
 
SGA – (System Global [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=4&subd=naikh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Database Administration Tasks </span></span></p>
<ul style="margin-top:0;" type="disc">
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Plane and create database</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Manage database availability</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Manage physical and logical structures</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Manage storage based on design</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Manage security</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Network administration</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Backup and Recovery</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Database tuning</span></span></li>
</ul>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Oracle Server = + Oracle Instance + Oracle database</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Oracle Instance = Memory structures + Background process</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Oracle Database = data files, control files, redo log files </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">SGA – (System Global Area), SGA_MAX_SIZE</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">-</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Shared pool,<span> </span>SHARED_POOL_SIZE</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 .75in;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">1.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Library cache</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 1in;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">- Execution plan </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 1in;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">- Parse Tree </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 1in;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">- Parsed and compiled program units and procedures<span> </span></span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 .75in;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">2.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Data Dictionary cache</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 .5in;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>- Information about user account data, data file names, segment <span> </span><span> </span><span> </span><span> </span>names, extent locations, table description and user privileges<span> </span></span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">-</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Database buffer cache,<span> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span><span> </span>- DB_CACHE_SIZE, DB_KEEP_CACHE_SIZE, DB_RECYCLE_CACHE_SIZE </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>- DB_CACHE_ADVICE values ON,OFF,READY, for predicting different cache <span> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>size behavior, information is stored in v$db_cache_advice<span> </span></span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">-</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Redo log buffer, LOG_BUFFER </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-family:Verdana;"><span style="font-weight:normal;font-size:10pt;"><span> </span></span><span style="font-weight:normal;font-size:10pt;">- Primary purpose is recovery</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>- records all changes made to the database block</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>- change records within are called redo entries<span> </span></span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">-</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Larger pool (optional), LARGE_POOL_SIZE</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">-</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Java pool<span> </span>(optional), JAVE_POOL_SIZE</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">PGA – (Program Global Area)</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>- is a memory region that contains data and control information for single <span> </span><span> </span><span> </span><span> </span>server process or a background process</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>- PGA includes following info</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span><span> </span>1. Sort area &#8211; </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span><span> </span>2. Session information &#8211; includes user privileges and performance statistics<span> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>for the session </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span><span> </span>3. Cursor state – </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span><span> </span>4. Stack space – contains other session variables <span> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><strong>DBWn writes when following events occurs:</strong></span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">1.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Checkpoint</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">2.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Dirty buffer threshold reached</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">3.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">No free buffer</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">4.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Timeout</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">5.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">RAC ping request</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">6.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Tablespace offline</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">7.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Tablespace read only</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">8.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Tablespace BEGIN BACKUP</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">9.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Table DROP or TRUNCATE</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><strong>LGWR writes under following situations</strong></span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">1.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">At commit</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">2.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">When one-third full</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">3.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">When there 1 MB of redo</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">4.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Every 3 seconds</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">5.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Before DBWn writes</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><strong>SMON: Responsibilities</strong></span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">1.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Instance recovery </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>- Rolls forward changes in the redo logs</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>- Open database for user access</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>- Rollback uncommitted transactions</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">2.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Coalescess free space every 3 seconds in the data files</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">3.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Deallocates temporary segments<span> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><strong>PMON: Cleans up after failed process by</strong></span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">1.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Rolling back the user’s current transaction</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">2.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Releasing the locks</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">3.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Release other resources</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">4.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Restarts dead dispatchers</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><strong>CKPT : Checkpoint occurs in the following situations</strong></span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">1.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">At every log switch</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">2.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">shut down normal, transactional, or immediate</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">3.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">when forced by setting the parameter FAST_START_MTTR_TARGET </span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">4.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">when manually requested by the DBA</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">5.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">ALTER TABLESPACE [OFFLINE NORMAL |READ ONLY|BEGIN BACKUP] cause checkpoint on specific data files </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><strong>Check points are implemented for the following reason:</strong></span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">1.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">it ensures that data blocks in memory that changes frequently are written to data files regularly</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">2.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">all changes up to the checkpoints have been recorded in the data files, redo log entries<span> </span>before the checkpoints no longer need to be applied to the data files if instance recovery is required</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><strong>At checkpoint following information is written:</strong></span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">1.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">checkpoint number into datafile headers</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">2.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">checkpoint number, log sequence number, archived log names, and system change numbers into the control file</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">If LOG_CHECKPOINTS_TO_ALERT parameter is set to TRUE checkpoint information is recorded in the altert_SID.log file</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Oracle Managed Files: </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">DB_CREATE_FILE_DEST – default location for data files</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">DB_CREATE_ONLINE_LOG_DEST_N – default location for online redo logs and control files, up to max 5 locations</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><strong>Startup nomount</strong></span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">-</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">only during database creation or control file re-creation </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Starting an instance includes following tasks</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">1.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Reading initialization file in the following order</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>- spfileSID.ora.<span> </span>if not found then</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>- spfile.ora</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>- initSID.ora</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">2.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">SGA is allocated</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">3.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Background processes are started</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">4.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">alert_SID.log and trace files opened</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><strong>mounting the database</strong></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Database in mount during the following tasks</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">-</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">renaming data files</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">-</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">enabling or disabling archiving </span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">-</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">performing full database recovery</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Mounting a database includes following tasks</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">1.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Associate a database with a previously started instance</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">2.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Locating and opening the control files specified in the parameter file</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">3.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Reads the control file to obtain the names and status or datafiles and online redo log files </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><strong>Opening the database</strong></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Opening the database includes the following tasks</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">1.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">opening the online data files</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">2.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">opening the redo log files</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">3.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">If necessary SMON initiates instance recovery</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><strong>Shutdown normal</strong></span></span></p>
<ol style="margin-top:0;" type="1">
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">no new connection can be made</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">waits for all users to disconnect</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">data and redo buffers are written to disk</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">background processes are terminated </span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">SGA is removed from the memory</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">closes and dismounts the database</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">next startup does not require a instance recovery</span></span></li>
</ol>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><strong>Shutdown Transactional</strong></span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">1.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">No new connection</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">2.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">waits until all the<span> </span>transaction ends</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">3.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">a shutdown immediate occurs</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><strong>shutdown immediate</strong></span></span></p>
<ol style="margin-top:0;" type="1">
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">does not wait for users to disconnect</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">rolls back all active transactions and disconnects all transactions</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">closes and dismounts the database, next startup instance reconvery not required</span></span></li>
</ol>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><strong>shutdown abort</strong></span></span></p>
<ol style="margin-top:0;" type="1">
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">all active sessions are terminated</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">database and redo buffers are not written to disk</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">uncommitted transactions are not rolled back</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">instance is terminated without closing the files</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">database is not closed or dismounted</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">next startup requires instance recovery</span></span></li>
</ol>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Alert log keeps a record of following information</span></span></p>
<ol style="margin-top:0;" type="1">
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">when the database was started and shutdown</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">a list of all non default initialization parameters</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">the start up of the background processes</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">the thread being used by the instance</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">the log sequence number LGWR is writing to</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Information about the log switch</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Creation of tablespaces and undo segments</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">alter statements that have been used</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">information regarding the error messages such as ora-600 etc</span></span></li>
</ol>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Base tables are create during database creation, sql.bsq</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Data Dictionary views are created using catalog.sql</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Dynamic performance views: information is accessed from </span></span></p>
<ol style="margin-top:0;" type="1">
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">memory</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">control file</span></span></li>
</ol>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Control files</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">-</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">can be multiplexed up to 8 times</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">-</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">size is influenced by the following keywords in create database or create ontolfile</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>commands</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>- MAXLOGFILES</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>- MAXLOGMEMBERS</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>- MAXLOGHISTORY</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>- MAXDATAFILES</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>- MAXINSTANCES</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">- Control file contains the following entries</span></span></p>
<ol style="margin-top:0;" type="1">
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Database name and identifier</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Time stamp of the database creation</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">tablespace names</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Names and locations of the data files and red log files</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Current redo log file sequence number</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Checkpoint information</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Begin and end of undo segments</span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Redo log archive information </span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Backup information</span></span></li>
</ol>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">-</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">The control file consists of two types of section</span></span></p>
<ol style="margin-top:0;" type="1">
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>Reusable – stores rman backup information, used in a circular manner. </span></span></li>
<li class="MsoNormal"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>Not reusable </span></span></li>
</ol>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Multiplexing control file using spfile</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">1. Alter spfile</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>Sql&gt; alter system set control_file=’/oradata1/control/control1.ctl’, <span> </span><span> </span>’/oradata2/control/control2.ctl’ scope=spfile;</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">2. shutdown normal</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>Sql&gt; shutdown</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">3. create addition control file</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-family:Verdana;"><span style="font-weight:normal;font-size:10pt;"><span> </span></span><span style="font-weight:normal;font-size:10pt;">$ cp /oradata1/control/control1.ctl’, ’/oradata2/control/control2.ctl’</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">4. start the databse</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>Sql&gt; startup </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Multiplexing control file using pfile</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">1. shutdown normal</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>Sql&gt; shutdown</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">2. create addition control file</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>$ cp /oradata1/control/control1.ctl’, ‘/oradata2/control/control2.ctl’</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">3. Add new control file name to init.ora<span> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>control_file=’/oradata1/control/control1.ctl’, <span> </span>’/oradata2/control/control2.ctl’ </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">4. start the databse</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>Sql&gt; startup </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Backup control file</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>Sql&gt; alter database backup controlfile to<span> </span>‘/backup/controlfile.bkp’;</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"><span> </span>Sql&gt; alter database backup controlfile to<span> </span>trace;</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Add redo group</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Alter database add logfile group 3 (‘/oradata/redolog/redo3a.log’, ‘/oradata/redolog/redo3b.log’) size 1m;</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Alter database add logfile member <span> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">‘/oradata/redolog/redo1c.log’, <span> </span>to group 1,</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">‘/oradata/redolog/redo2c.log’ <span> </span>to group 2,</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">‘/oradata/redolog/redo3c.log’ <span> </span>to group 2;</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Drop log file group</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Alter database drop logfile group 3;</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">&#8211; the os files are not deleted</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Drop log file member</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Alter database drop logfile member ‘/oradata/redolog/redo3c.log’ ;</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">&#8211; the os files are not deleted</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 3.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Status of the redo file</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">1.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">unused – log group never been used. When log file was just added</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">2.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">current – implies online redo group is active</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">3.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">active – indicates log group is active but not the current. It is needed for crash recovery</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span><span style="font-family:Verdana;">4.</span><span style="font:7pt;"> </span></span></span><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">inactive – log group is no longer needed for instance recovery. It may or may not be archived.</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;">
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Forcing Log switch</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">ALTER SYSTEM SWITH LOGFILE;</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;">
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">Clearing Log file</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">ALTER DATABASE CLEAR LOGFILE GROUP 5;</span></span></p>
<p class="MsoNormal" style="text-indent:-.25in;margin:0 0 0 21.75pt;"><span style="font-weight:normal;font-size:10pt;"><span style="font-family:Verdana;">ALTER DATABASE CLEAR UNARCHIVED LOGFILE GROUP 5<br />
</span></span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/naikh.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/naikh.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/naikh.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/naikh.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/naikh.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/naikh.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/naikh.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/naikh.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/naikh.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/naikh.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/naikh.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/naikh.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=4&subd=naikh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://naikh.wordpress.com/2008/04/18/oracle-9i-funda1/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/025428d70b3b4930e3eef04e71023d1c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">naikh</media:title>
		</media:content>
	</item>
		<item>
		<title>Useful SQL statements</title>
		<link>http://naikh.wordpress.com/2008/04/18/useful-sql-statements/</link>
		<comments>http://naikh.wordpress.com/2008/04/18/useful-sql-statements/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 21:20:02 +0000</pubDate>
		<dc:creator>naikh</dc:creator>
				<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://naikh.wordpress.com/?p=3</guid>
		<description><![CDATA[1. datafiles 
SELECT &#8216;cp &#8216;&#124;&#124;NAME &#124;&#124;&#8216;   /localdisk/oradb/&#8217;&#124;&#124;SUBSTR(NAME,INSTR(NAME,&#8216;/&#8217;,-1,1)+1 )&#124;&#124;&#8216; &#38;&#8217; 
from (
       select name from v$datafile
       union all
       select name from v$controlfile
       union all 
       select member from v$logfile
)
 
2. Rename Datafiles 
SELECT &#8216;ALTER DATABASE RENAME FILE &#8221;&#8217;&#124;&#124;NAME &#124;&#124;&#8221;&#8217;   TO  &#8221;/localdisk/oradb/&#8217;&#124;&#124;SUBSTR(NAME,INSTR(NAME,&#8216;/&#8217;,-1,1)+1 )&#124;&#124;&#8221;&#8217;;&#8217; 
FROM (
       SELECT NAME FROM V$DATAFILE
       UNION ALL
       SELECT MEMBER FROM V$LOGFILE
)
 
 
3.    datafiles 
SELECT &#8216;cp &#8216;&#124;&#124;NAME &#124;&#124;&#8216;   [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=3&subd=naikh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">1. datafiles </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">SELECT</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;cp &#8216;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||NAME ||</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;<span>   </span>/localdisk/oradb/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||SUBSTR</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">NAME</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">INSTR</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">NAME</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,-</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)+</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216; &amp;&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">from</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"><span>      </span><span> </span></span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">select</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> name </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">from</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> v$datafile</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"><span>      </span><span> </span></span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">union</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">all</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"><span>      </span><span> </span></span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">select</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> name </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">from</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> v$controlfile</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"><span>      </span><span> </span></span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">union</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">all</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"><span>      </span><span> </span></span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">select</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">member</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">from</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> v$logfile</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">2. Rename Datafiles </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">SELECT</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;ALTER DATABASE RENAME FILE &#8221;&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||NAME ||</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8221;&#8217;<span>   </span>TO<span>  </span>&#8221;/localdisk/oradb/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||SUBSTR</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">NAME</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">INSTR</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">NAME</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,-</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)+</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8221;&#8217;;&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">FROM</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"><span>      </span><span> </span></span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">SELECT</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> NAME </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">FROM</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> V$DATAFILE</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"><span>      </span><span> </span></span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">UNION</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">ALL</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"><span>      </span><span> </span></span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">SELECT</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">MEMBER</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">FROM</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> V$LOGFILE</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">3.    datafiles </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">SELECT</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;cp &#8216;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||NAME ||</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;<span>   </span>/localdisk/oradb/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||SUBSTR</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">NAME</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">INSTR</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">NAME</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,-</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)+</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216; &amp;&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">FROM</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> V$DATAFILE;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">4. controlfiles</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">SELECT</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;cp &#8216;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||NAME ||</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;<span>   </span>/localdisk/oradb/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||SUBSTR</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">NAME</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">INSTR</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">NAME</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,-</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)+</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216; &amp;&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">FROM</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> V$CONTROLFILE;</span></p>
<p class="MsoNormal" style="margin:0;"> </p>
<p class="MsoNormal" style="margin:0;"> </p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">5. Redo files</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">SELECT</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;cp &#8216;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">MEMBER</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> ||</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;<span>   </span>/localdisk/oradb/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||SUBSTR</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(MEMBER,</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">INSTR</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(MEMBER,</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,-</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)+</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216; &amp;&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">FROM</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> V$LOGFILE;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">SELECT</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;ALTER DATABASE RENAME FILE &#8221;&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||name||</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8221;&#8217; TO &#8221;/localdisk/oradb/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||substr</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">name</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">instr</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">name</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,-</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)+</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8221;&#8217;;&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"><span>  </span></span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">FROM</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> V$DATAFILE</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">SELECT</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;ALTER DATABASE RENAME FILE &#8221;&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">member</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8221;&#8217; TO &#8221;/localdisk/oradb/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||substr</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(member,</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">instr</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(member,</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,-</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)+</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8221;&#8217;;&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"><span>  </span></span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">FROM</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> V$LOGFILE</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">;</span></p>
<p class="MsoNormal" style="margin:0;">
<div class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;"> </span></span></div>
<div></div>
<p><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;"></p>
<p class="MsoNormal" style="margin:0;"> </p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">select</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> </span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216; Alter database rename file &#8221;&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||name ||</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8221;&#8217; to &#8221;&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">decode</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">substr</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">name</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">instr</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">name</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,-</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)),</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;/u01/oradb/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;/localdisk/oradb/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;/u02/oradb/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;/localdisk/oradb/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span></p>
<p class="MsoNormal" style="margin:0;"><span style="color:#ff0000;"><span style="font-weight:normal;font-size:10pt;font-family:Courier;">&#8216;/u03/oradb/&#8217;</span><span style="font-weight:normal;font-size:10pt;font-family:Courier;">/localdisk/oradb/</span><span style="font-weight:normal;font-size:10pt;font-family:Courier;">&#8216;</span></span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;/u04/oradb/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;/localdisk/oradb/&#8217;</span></p>
<p class="MsoNormal" style="margin:0;"> </p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">||substr</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">name</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">instr</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">(</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;">name</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8216;/&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,-</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">,</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)+</span><span style="font-weight:normal;font-size:10pt;color:#800000;font-family:Courier;">1</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">)</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> ||</span><span style="font-weight:normal;font-size:10pt;color:#ff0000;font-family:Courier;">&#8221;&#8217; ;&#8217;</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> name</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">from</span><span style="font-weight:normal;font-size:10pt;color:#000000;font-family:Courier;"> v$datafile</span><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;">;</span></p>
<p class="MsoNormal" style="margin:0;"> </p>
<div><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;"> </span></span></div>
<div><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;"> </span></span></div>
<p><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;"><span style="font-weight:normal;font-size:10pt;color:#0000f0;font-family:Courier;"> </p>
<p></span></span> </p>
<p> </p>
<p></span> </p>
<p> </p>
<p class="MsoNormal" style="margin:0;"> </p>
<p> </p>
<p class="MsoNormal" style="margin:0;"> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/naikh.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/naikh.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/naikh.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/naikh.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/naikh.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/naikh.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/naikh.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/naikh.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/naikh.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/naikh.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/naikh.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/naikh.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=3&subd=naikh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://naikh.wordpress.com/2008/04/18/useful-sql-statements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/025428d70b3b4930e3eef04e71023d1c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">naikh</media:title>
		</media:content>
	</item>
		<item>
		<title>Standby Database Creation</title>
		<link>http://naikh.wordpress.com/2008/03/21/standby-database-creation/</link>
		<comments>http://naikh.wordpress.com/2008/03/21/standby-database-creation/#comments</comments>
		<pubDate>Fri, 21 Mar 2008 13:14:00 +0000</pubDate>
		<dc:creator>naikh</dc:creator>
				<category><![CDATA[Standby Database]]></category>

		<guid isPermaLink="false">http://naikh.wordpress.com/2008/03/21/standby-database-creation/</guid>
		<description><![CDATA[Steps to create the physical standby database:1. Take the backup of production database2. Create standby controlfile3. Copy the backup, standy controfile and init.ora files to standby box4. Create necessary directories5. Edit the init.ora file6. Mount the database7. Restore the database8. Start the recovery
1. Take the backup of production databaserman&#62; run {allocate channel c1 type disk [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=28&subd=naikh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Steps to create the physical standby database:<br />1. Take the backup of production database<br />2. Create standby controlfile<br />3. Copy the backup, standy controfile and init.ora files to standby box<br />4. Create necessary directories<br />5. Edit the init.ora file<br />6. Mount the database<br />7. Restore the database<br />8. Start the recovery</p>
<p><strong><u>1. Take the backup of production database</u></strong><br />rman&gt; run {<br />allocate channel c1 type disk format &#8216;/backup/%d_rman_bkp_%T_p%p_s%s&#8217; maxpiecesize 1800M;<br />allocate channel c2 type disk format &#8216;/backup/%d_rman_bkp_%T_p%p_s%s&#8217; maxpiecesize 1800M;<br />allocate channel c3 type disk format &#8216;/backup/%d_rman_bkp_%T_p%p_s%s&#8217; maxpiecesize 1800M;<br />allocate channel c4 type disk format &#8216;/backup/%d_rman_bkp_%T_p%p_s%s&#8217; maxpiecesize 1800M;<br />backup as compressed backupset databse plus archivelog;<br />}</p>
<p><strong><u>2. Create standby controlfile</u></strong><br />sql&gt; alter database create controlfile as &#8216;/backup/standby_controlfile.ctl&#8217;;</p>
<p><strong><u>3. Copy the backup, controfile and init.ora files to standby box</u></strong><br />use ftp or scp to copy the files</p>
<p><strong><u>4. Create necessary directories<br /></u></strong>$ mkdir adump bdump cdump udump datafiles controlfiles redofiles archive</p>
<p><strong><u>5. Edit the init.ora file</u></strong><br />a. Change controfile path<br />b. Change the paths of all dump_dest parametes<br />c. Change the LOG_ARCHIVE_DEST path<br />d. Add below 3 parametes<br />DB_FILE_NAME_CONVERT=&#8217;/old_path1/&#8217;,'/new_path1/&#8217; ,&#8217;/old_path2/&#8217;,'/new_path2/&#8217;<br />LOG_FILE_NAME_CONVERT=&#8217;/old_path/&#8217;,'/new_path/&#8217;<br />STANDBY_FILE_MANAGEMENT=&#8217;AUTO&#8217;</p>
<p><strong><u>6. Mount the database</u></strong><br />sql&gt; startup mount pfile=&#8217;init.ora&#8217;</p>
<p><strong><u>7. Restore the database</u></strong><br />rman&gt; run {<br />allocate channel c1 type disk;<br />allocate channel c2 type disk;<br />allocate channel c3 type disk;<br />allocate channel c4 type disk;<br />restore database;<br />}</p>
<p><strong><u>8. Start the recovery</u></strong><br />sql&gt; alter database recover manged standby database disconnect;</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/naikh.wordpress.com/28/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/naikh.wordpress.com/28/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/naikh.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/naikh.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/naikh.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/naikh.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/naikh.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/naikh.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/naikh.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/naikh.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/naikh.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/naikh.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=28&subd=naikh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://naikh.wordpress.com/2008/03/21/standby-database-creation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/025428d70b3b4930e3eef04e71023d1c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">naikh</media:title>
		</media:content>
	</item>
		<item>
		<title>Restore Spfile and Controlfile</title>
		<link>http://naikh.wordpress.com/2008/02/06/restore-spfile-and-controlfile/</link>
		<comments>http://naikh.wordpress.com/2008/02/06/restore-spfile-and-controlfile/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 05:35:00 +0000</pubDate>
		<dc:creator>naikh</dc:creator>
				<category><![CDATA[RMAN]]></category>

		<guid isPermaLink="false">http://naikh.wordpress.com/2008/02/06/restore-spfile-and-controlfile/</guid>
		<description><![CDATA[Different ways of restoring spfile and controlfile
1. Restore SPFILE
restore spfile to &#8216;/bkp/spfile.ora&#8217;; 
restore spfile to &#8216;/bkp/spfile.ora&#8217; from autobackup;
restore spfile to &#8216;/bkp/spfile.ora&#8217; from tag=man_bkp;
restore spfile to &#8216;/bkp/spfile.ora&#8217; from /home/oracle/bkp/c-543432-24342-01 ;
restore spfile to &#8216;/bkp/spfile.ora&#8217; until time &#8217;sysdate-31;2. Restore Controlfile
restore controlfile to &#8216;/bkp/controlfile.ctl&#8217;;
restore controlfile to &#8216;/bkp/controlfile.ctl&#8217; from autobackup;
restore controlfile to &#8216;/bkp/controlfile.ctl&#8217; from tag=man_bkp;
restore controlfile to &#8216;/bkp/controlfile.ctl&#8217; from /bkp/c-543432-24342-01 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=27&subd=naikh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Different ways of restoring spfile and controlfile</p>
<p><span style="font-size:130%;"><span style="font-weight:bold;">1. Restore SPFILE</span></span></p>
<p><span style="font-size:100%;"><span style="font-family:courier new;"><span>restore spfile to &#8216;<span style="font-weight:bold;">/bkp/spfile.ora&#8217;;</span> </span></p>
<p>restore spfile to &#8216;/bkp/spfile.ora&#8217; <span style="font-weight:bold;">from autobackup;</span></p>
<p>restore spfile to &#8216;/bkp/spfile.ora&#8217; <span style="font-weight:bold;">from tag=man_bkp;</span></p>
<p>restore spfile to &#8216;/bkp/spfile.ora&#8217; <span style="font-weight:bold;">from /home/oracle/bkp/c-543432-24342-01 ;</span></p>
<p>restore spfile to &#8216;/bkp/spfile.ora&#8217; <span style="font-weight:bold;">until time &#8217;sysdate-31;</span></span><br /></span><br /><span style="font-size:130%;"><span style="font-weight:bold;">2. Restore Controlfile</span></span></p>
<p><span style="font-size:100%;"><span style="font-family:courier new;">restore controlfile to <span style="font-weight:bold;">&#8216;/bkp/controlfile.ctl&#8217;;</span></p>
<p>restore controlfile to &#8216;/bkp/controlfile.ctl&#8217; <span style="font-weight:bold;">from autobackup;</span></p>
<p>restore controlfile to &#8216;/bkp/controlfile.ctl&#8217; <span style="font-weight:bold;">from tag=man_bkp;</span></p>
<p>restore controlfile to &#8216;/bkp/controlfile.ctl&#8217; <span style="font-weight:bold;">from /bkp/c-543432-24342-01 ;</span></p>
<p>restore controlfile to &#8216;/bkp/controlfile.ctl&#8217; <span style="font-weight:bold;">until time &#8217;sysdate-31;</span></span><span style="font-weight:bold;"> </span></span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/naikh.wordpress.com/27/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/naikh.wordpress.com/27/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/naikh.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/naikh.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/naikh.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/naikh.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/naikh.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/naikh.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/naikh.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/naikh.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/naikh.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/naikh.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=27&subd=naikh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://naikh.wordpress.com/2008/02/06/restore-spfile-and-controlfile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/025428d70b3b4930e3eef04e71023d1c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">naikh</media:title>
		</media:content>
	</item>
		<item>
		<title>Transportable TBS &#8211; Part 3</title>
		<link>http://naikh.wordpress.com/2008/02/04/transportable-tbs-part-3/</link>
		<comments>http://naikh.wordpress.com/2008/02/04/transportable-tbs-part-3/#comments</comments>
		<pubDate>Mon, 04 Feb 2008 05:34:00 +0000</pubDate>
		<dc:creator>naikh</dc:creator>
				<category><![CDATA[Transportable TBS]]></category>

		<guid isPermaLink="false">http://naikh.wordpress.com/2008/02/04/transportable-tbs-part-3/</guid>
		<description><![CDATA[Transportable Tablespace from RMAN backup.
Assumptions* Tablespace name=TTBS* Same platform (source and target)* We have RMAN backup of the database
RMAN&#62; transport tablespace TTBStablespace destination &#8216;/opt/oracle/ttbs_dir&#8217;auxiliary destination &#8216;/opt/oracle/aux_ttbs&#8217;datapump directory DATA_PUMP_DIRdump file &#8216;expdp_ttbs_01.dmp&#8217;import script &#8216;impdp_ttbs_01.sql&#8217;export log &#8216;expdp_ttbs.log&#8217;;Explanation:tablespace destination &#8211; in this location RMAN stores datafiles of the TTBSauxiliary destination &#8211; in this location RMAN creates temporary database and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=26&subd=naikh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Transportable Tablespace from RMAN backup.</p>
<p>Assumptions<br />* Tablespace name=TTBS<br />* Same platform (source and target)<br />* We have RMAN backup of the database</p>
<p><span style="font-family:courier new;">RMAN&gt; <strong>transport tablespace</strong> TTBS</span><br /><span style="font-family:courier new;"><strong>tablespace destination</strong> &#8216;/opt/oracle/ttbs_dir&#8217;</span><br /><span style="font-family:courier new;"><strong>auxiliary destination</strong> &#8216;/opt/oracle/aux_ttbs&#8217;</span><br /><span style="font-family:courier new;"><strong>datapump directory</strong> DATA_PUMP_DIR</span><br /><span style="font-family:courier new;"><strong>dump file</strong> &#8216;expdp_ttbs_01.dmp&#8217;</span><br /><span style="font-family:courier new;"><strong>import script</strong> &#8216;impdp_ttbs_01.sql&#8217;</span><br /><span style="font-family:courier new;"><strong>export log</strong> &#8216;expdp_ttbs.log&#8217;;</span><br /><span style="font-family:Courier New;"></span><br /><span style="font-family:Courier New;"></span><br /><strong>Explanation:</strong><br /><strong>tablespace destination</strong> &#8211; in this location RMAN stores datafiles of the TTBS<br /><strong>auxiliary destination</strong> &#8211; in this location RMAN creates temporary database and later deletes it.<br /><strong>datapump directory</strong> &#8211; in this export dump of metadata of TTBS is stored<br /><strong>dump file</strong> &#8211; Name of the datapump dump file<br /><strong>import script</strong> &#8211; RMAN creates import file which can be used to import the metadata</p>
<p><strong>Possible Error:</strong><br />While importing i got the below error. i just created the <strong>user_name</strong> in the database.</p>
<p>ORA-29342: user <strong>user_name</strong> does not exist in the database</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/naikh.wordpress.com/26/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/naikh.wordpress.com/26/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/naikh.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/naikh.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/naikh.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/naikh.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/naikh.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/naikh.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/naikh.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/naikh.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/naikh.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/naikh.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=naikh.wordpress.com&blog=551302&post=26&subd=naikh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://naikh.wordpress.com/2008/02/04/transportable-tbs-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/025428d70b3b4930e3eef04e71023d1c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">naikh</media:title>
		</media:content>
	</item>
	</channel>
</rss>