<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Andrew Fraser DBA &#187; Linux</title>
	<atom:link href="http://andrewfraserdba.com/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://andrewfraserdba.com</link>
	<description>Oracle DBA (plus SQL Server)</description>
	<lastBuildDate>Fri, 06 Apr 2012 09:24:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>sed change entire line</title>
		<link>http://andrewfraserdba.com/2011/06/08/sed-change-entire-line/</link>
		<comments>http://andrewfraserdba.com/2011/06/08/sed-change-entire-line/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 11:08:22 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=715</guid>
		<description><![CDATA[Here I use sed to replace the entire 2nd line in a lot of files with a new 2nd line. The shell script: for fle in `ls *.msg` do # copy file first so as can keep permissions and ownership &#8230; <a href="http://andrewfraserdba.com/2011/06/08/sed-change-entire-line/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here I use sed to replace the entire 2nd line in a lot of files with a new 2nd line.</p>
<p>The shell script:</p>
<pre class="brush:bash, shell">for fle in `ls *.msg`
do
    # copy file first so as can keep permissions and ownership identical
    cp -p $fle test_$fle
    # replace entire 2nd line with a new 2nd line
    sed -f t.sed $fle > test_$fle
done</pre>
<p>Which calls this sed command file, named t.sed:</p>
<pre class="brush:bash, shell">2c\
\To: dummy.email@me.com</pre>
<p>The result is that the 2nd line in each file reads:
<pre class="brush:bash, shell">To: dummy.email@me.com</pre>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2011/06/08/sed-change-entire-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RAID internal hard disks linux</title>
		<link>http://andrewfraserdba.com/2011/06/06/raid-internal-hard-disks-linux/</link>
		<comments>http://andrewfraserdba.com/2011/06/06/raid-internal-hard-disks-linux/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 16:18:37 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=711</guid>
		<description><![CDATA[Useful commands to show RAID level of internal hard disks. On HP blade servers: /usr/sbin/hpacucli controller all show status /usr/sbin/hpacucli controller slot=0 logicaldrive all show On other servers: cat /proc/mdstat]]></description>
			<content:encoded><![CDATA[<p>Useful commands to show RAID level of internal hard disks.</p>
<p>On HP blade servers:</p>
<pre class="brush:bash, shell">/usr/sbin/hpacucli controller all show status
/usr/sbin/hpacucli controller slot=0 logicaldrive all show</pre>
<p>On other servers:</p>
<pre class="brush:bash, shell">cat /proc/mdstat</pre>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2011/06/06/raid-internal-hard-disks-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cron during British Summer Time / Daylight Saving Time</title>
		<link>http://andrewfraserdba.com/2011/04/06/cron-during-british-summer-time-daylight-saving-time/</link>
		<comments>http://andrewfraserdba.com/2011/04/06/cron-during-british-summer-time-daylight-saving-time/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 09:58:26 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=664</guid>
		<description><![CDATA[For older versions of unix/linux, crons running at 01.* (anything from 01:00 to 01:59) do not run during the Spring Sunday time change. Those sames crons will run twice during the Autumn time change. So it is important to not &#8230; <a href="http://andrewfraserdba.com/2011/04/06/cron-during-british-summer-time-daylight-saving-time/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For older versions of unix/linux, crons running at 01.* (anything from 01:00 to 01:59) do not run during the Spring Sunday time change. Those sames crons will run twice during the Autumn time change.</p>
<p>So it is important to not use <strong>01.*</strong> times in your cron entries, for anything which runs on a Sunday.</p>
<p>Newer versions of unix try to deal intelligently with the time change. They attempt to run the Spring 01.* crons at a suitable time after 2am, and make sure not to run Autumn 01.* crons twice.</p>
<p>You can see what the behaviour of your version of unix is by looking at &#8216;man cron&#8217; and &#8216;man crontab&#8217;. If they contain information like the below, then they attempt to deal intelligently with time changes, if not, not.  The below is from &#8216;man cron&#8217; in current HP-UX:</p>
<blockquote><p><strong>Spring and Autumn Time Transitions</strong></p>
<p>On the days of daylight savings (summer) time transition (in time zones and countries where daylight savings time applies), cron schedules commands differently from normal.</p>
<p>In the following description, an ambiguous time refers to an hour and minute that occurs twice in the same day because of a daylight savings time transition (usually on a day during the Autumn season).  A nonexistent time refers to an hour and minute that does not occur because of a daylight savings time transition (usually on a day during the Spring season).  DST-shift refers to the offset that is applied to standard time to result in daylight savings time.  This is normally one hour, but can be any combination of hours and minutes up to 23 hours and 59 minutes (see tztab(4)).</p>
<p>When a command is specified to run at an ambiguous time, the command is executed only once at the first occurrence of the ambiguous time.</p>
<p>When a command is specified to run at a nonexistent time, the command is executed after the specified time by an amount of time equal to the DST-shift.  When such an adjustment would conflict with another time specified to run the command, the command is run only once rather than running the command twice at the same time.</p>
<p>Commands that are scheduled to run during all hours (there is a * is in the hour field of the crontab entry) are scheduled without any adjustment.</p></blockquote>
<p>Britain, and the rest of Europe, always switch 1-2am, but other countries, including parts of the US, can switch at different times, so you may need to watch a different time range there.</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2011/04/06/cron-during-british-summer-time-daylight-saving-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check if you work on a virtual/physical machine in Linux</title>
		<link>http://andrewfraserdba.com/2011/02/14/check-if-you-work-on-a-virtualphysical-machine-in-linux/</link>
		<comments>http://andrewfraserdba.com/2011/02/14/check-if-you-work-on-a-virtualphysical-machine-in-linux/#comments</comments>
		<pubDate>Mon, 14 Feb 2011 11:31:01 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=513</guid>
		<description><![CDATA[http://www.spotht.com/2010/11/check-if-you-work-on-virtualphysical.html]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.spotht.com/2010/11/check-if-you-work-on-virtualphysical.html">http://www.spotht.com/2010/11/check-if-you-work-on-virtualphysical.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2011/02/14/check-if-you-work-on-a-virtualphysical-machine-in-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FTP 421 service not available tcp wrapper hosts.allow</title>
		<link>http://andrewfraserdba.com/2011/01/06/ftp-421-service-not-available-tcp-wrapper-hosts-allow/</link>
		<comments>http://andrewfraserdba.com/2011/01/06/ftp-421-service-not-available-tcp-wrapper-hosts-allow/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 09:49:36 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=509</guid>
		<description><![CDATA[Files /etc/hosts.allow and /etc/hosts.deny control tcp wrapper permissions for incoming requests to linux servers. Ftp access is normally controlled by the &#8216;vsftpd&#8217; line, e.g.: vsftpd: 138.134.116. 138.134.117. That would allow ftp connections from IP addresses like 138.134.116.x and 138.134.117.x. If &#8230; <a href="http://andrewfraserdba.com/2011/01/06/ftp-421-service-not-available-tcp-wrapper-hosts-allow/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Files /etc/hosts.allow and /etc/hosts.deny control tcp wrapper permissions for incoming requests to linux servers.</p>
<p>Ftp access is normally controlled by the &#8216;vsftpd&#8217; line, e.g.:</p>
<pre class="brush:bash, shell">vsftpd: 138.134.116. 138.134.117.</pre>
<p>That would allow ftp connections from IP addresses like 138.134.116.x and 138.134.117.x.</p>
<p>If your IP address is not in the allow list, ftp attempts will fail with an error like this:</p>
<pre class="brush:bash, shell">421 service not available.
Connection closed by remote host.</pre>
<p>Domain names can also be specified in these files as well as IP addresses.</p>
<p>Changes take effect immediately, there is no need to restart any services.</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2011/01/06/ftp-421-service-not-available-tcp-wrapper-hosts-allow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IBM Tivoli restores using dsmc</title>
		<link>http://andrewfraserdba.com/2010/12/23/ibm-tivoli-restores-using-dsmc/</link>
		<comments>http://andrewfraserdba.com/2010/12/23/ibm-tivoli-restores-using-dsmc/#comments</comments>
		<pubDate>Thu, 23 Dec 2010 16:11:20 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Rman]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=497</guid>
		<description><![CDATA[As root dsmc or, for more complex configurations, specify an optfile: dsmc -optfile=/opt/tivoli/tsm/client/ba/bin/dsm-ora.opt List backup files: tsm&#62; q backup "/oracle/*" -subdir=yes -inactive Restore: tsm&#62; restore "/oracle/mydb/*" /oracle/ -subdir=yes -pick Note how the second mention of directory path ommits the lowest &#8230; <a href="http://andrewfraserdba.com/2010/12/23/ibm-tivoli-restores-using-dsmc/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As root</p>
<pre class="brush:bash, shell">dsmc</pre>
<p>or, for more complex configurations, specify an optfile:</p>
<pre class="brush:bash, shell">dsmc -optfile=/opt/tivoli/tsm/client/ba/bin/dsm-ora.opt</pre>
<p>List backup files:</p>
<pre class="brush:bash, shell">tsm&gt; q backup "/oracle/*" -subdir=yes -inactive</pre>
<p>Restore:</p>
<pre class="brush:bash, shell">tsm&gt; restore "/oracle/mydb/*" /oracle/ -subdir=yes -pick</pre>
<p>Note how the second mention of directory path <strong>ommits</strong> the lowest directory.</p>
<pre class="brush:bash, shell">tsm&gt; +   # to select all
tsm&gt; o   # ok, start restore</pre>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2010/12/23/ibm-tivoli-restores-using-dsmc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Server age with dmidecode&#124;grep Date</title>
		<link>http://andrewfraserdba.com/2010/11/08/server-age-with-dmidecodegrep-date/</link>
		<comments>http://andrewfraserdba.com/2010/11/08/server-age-with-dmidecodegrep-date/#comments</comments>
		<pubDate>Mon, 08 Nov 2010 10:43:45 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=462</guid>
		<description><![CDATA[BIOS build date should correspond to approximate manufacture date for a server, is given with (as root): dmidecode &#124; egrep -i 'date&#124;product']]></description>
			<content:encoded><![CDATA[<p>BIOS build date should correspond to approximate manufacture date for a server, is given with (as root):<br />
<code>dmidecode | egrep -i 'date|product'</code></p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2010/11/08/server-age-with-dmidecodegrep-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find delete old files</title>
		<link>http://andrewfraserdba.com/2010/10/29/find-delete-old-files/</link>
		<comments>http://andrewfraserdba.com/2010/10/29/find-delete-old-files/#comments</comments>
		<pubDate>Fri, 29 Oct 2010 08:27:21 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Rman]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=449</guid>
		<description><![CDATA[# Delete files older than 15 minutes find /ORA_DISK/redoarch/ -name 'arch_*.dbf' -mmin +15 -delete #Delete files older than 2 days 50 8 * * * find /ORA_DISK/redoarch/ -name 'arch_*.dbf' -mtime +2 -delete Old versions of unix find do not have &#8230; <a href="http://andrewfraserdba.com/2010/10/29/find-delete-old-files/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<pre class="brush:bash, shell">#  Delete files older than 15 minutes
find /ORA_DISK/redoarch/ -name 'arch_*.dbf' -mmin +15 -delete

#Delete files older than 2 days
50 8 * * * find /ORA_DISK/redoarch/ -name 'arch_*.dbf' -mtime +2 -delete</pre>
<p>Old versions of unix find do not have the -delete option, so instead:</p>
<pre class="brush:bash, shell">#  Delete files older than 15 minutes
find /ORA_DISK/redoarch/ -name 'arch_*.dbf' -mmin +15 -exec rm {} \;

#Delete files older than 2 days
50 8 * * * find /ORA_DISK/redoarch/ -name 'arch_*.dbf' -mtime +2 -exec rm {} \;</pre>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2010/10/29/find-delete-old-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tivoli Storage Manager simple restore</title>
		<link>http://andrewfraserdba.com/2010/10/28/tivole-storage-manager-simple-restore/</link>
		<comments>http://andrewfraserdba.com/2010/10/28/tivole-storage-manager-simple-restore/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 13:52:11 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Rman]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=436</guid>
		<description><![CDATA[Sample restore from command line Tivoli Storage Manager. Run as root. ps -ef &#124; grep dsm #here look to see if 'optfile' is set cd /mydir dsmc -optfile=/opt/tivoli/tsm/client/ba/bin/dsm-ora.opt tsm> restore /mydir/*.dbf -inactive -pick tsm> 1 #here choose which file number &#8230; <a href="http://andrewfraserdba.com/2010/10/28/tivole-storage-manager-simple-restore/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sample restore from command line Tivoli Storage Manager. Run as root. </p>
<pre class="brush:bash, shell">ps -ef | grep dsm  #here look to see if 'optfile' is set
cd /mydir
dsmc -optfile=/opt/tivoli/tsm/client/ba/bin/dsm-ora.opt
tsm> restore /mydir/*.dbf -inactive -pick
tsm> 1   #here choose which file number you want
tsm> 2   #choose another file if needed
tsm> o   #o='ok'
tsm> quit</pre>
<p>You should specify an &#8216;optfile&#8217; at line 3 only if you saw it in the output of line 1.<br />
<span id="more-436"></span><br />
Other useful options:</p>
<p>List backup files:</p>
<pre class="brush:bash, shell">tsm>q backup "/opt/fc-lun1/*" -inactive -subdir=yes</pre>
<p>Restore (note how second mention directory name is shorter):</p>
<pre class="brush:bash, shell">tsm> restore "/opt/fc-lun1/MYDB/mydb/*" /ORA_DISK/MYDB/infprod/ -subdir=yes –pick</pre>
<p>Select all files:</p>
<pre class="brush:bash, shell">tsm> +   # to select all files</pre>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2010/10/28/tivole-storage-manager-simple-restore/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>du -sk to identify space usage unix</title>
		<link>http://andrewfraserdba.com/2010/04/08/du-sk-to-identify-space-usage-unix/</link>
		<comments>http://andrewfraserdba.com/2010/04/08/du-sk-to-identify-space-usage-unix/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 08:25:26 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Space]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=239</guid>
		<description><![CDATA[Find out what directories are using up disk space in unix with this command: du -sk * &#124; sort -n I often put it into a function so I can call it quickly: g () { du -sk * &#124; &#8230; <a href="http://andrewfraserdba.com/2010/04/08/du-sk-to-identify-space-usage-unix/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Find out what directories are using up disk space in unix with this command:</p>
<pre class="brush:bash, shell">du -sk * | sort -n</pre>
<p>I often put it into a function so I can call it quickly:</p>
<pre class="brush:bash, shell">g () {
  du -sk * | sort -n
}</pre>
<p><code>df -h</code> (<code>df -k</code> on old machines) shows the filesystem disk utilisation.</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2010/04/08/du-sk-to-identify-space-usage-unix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

