<?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</title>
	<atom:link href="http://andrewfraserdba.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://andrewfraserdba.com</link>
	<description>Oracle DBA (plus SQL Server)</description>
	<lastBuildDate>Thu, 18 Mar 2010 15:20:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PL/SQL to count from all tables in a schema</title>
		<link>http://andrewfraserdba.com/2010/03/12/plsql-to-count-from-all-tables-in-a-schema/</link>
		<comments>http://andrewfraserdba.com/2010/03/12/plsql-to-count-from-all-tables-in-a-schema/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 16:51:03 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=218</guid>
		<description><![CDATA[Replace SYSTEM with the name of the schema you are interested in:
set serverout on size 999999
declare
cnt number ;
begin
for c1 in (select owner, table_name from all_tables where owner = 'SYSTEM')
loop
execute immediate 'select count(1) from '&#124;&#124;c1.owner&#124;&#124;'.'&#124;&#124;c1.table_name into cnt ;
dbms_output.put_line(c1.table_name&#124;&#124;','&#124;&#124;cnt) ;
end loop ;
end ;
/
]]></description>
			<content:encoded><![CDATA[<p>Replace SYSTEM with the name of the schema you are interested in:</p>
<p><code>set serverout on size 999999<br />
declare<br />
cnt number ;<br />
begin<br />
for c1 in (select owner, table_name from all_tables where owner = 'SYSTEM')<br />
loop<br />
execute immediate 'select count(1) from '||c1.owner||'.'||c1.table_name into cnt ;<br />
dbms_output.put_line(c1.table_name||','||cnt) ;<br />
end loop ;<br />
end ;<br />
/</code></p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2010/03/12/plsql-to-count-from-all-tables-in-a-schema/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix for Oracle XE 1608: unable to create InstallDriver instance, return code -2147221164</title>
		<link>http://andrewfraserdba.com/2010/03/08/fix-for-oracle-xe-1608-unable-to-create-installdriver-instance-return-code-2147221164/</link>
		<comments>http://andrewfraserdba.com/2010/03/08/fix-for-oracle-xe-1608-unable-to-create-installdriver-instance-return-code-2147221164/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 12:49:49 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[installs]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=215</guid>
		<description><![CDATA[I got this annoying error when attempting to install Oracle XE:
1608: unable to create InstallDriver instance, return code -2147221164
The fix for this on my PC was:

Identify your TEMP folder &#8211; choose start -&#62; run -&#62; type &#8220;cmd&#8221;, then type &#8220;set temp&#8221; in the command window.
Navigate to this folder in windows. It may well be a [...]]]></description>
			<content:encoded><![CDATA[<p>I got this annoying error when attempting to install Oracle XE:</p>
<blockquote><p>1608: unable to create InstallDriver instance, return code -2147221164</p></blockquote>
<p>The fix for this on my PC was:</p>
<ul>
<li>Identify your TEMP folder &#8211; choose start -&gt; run -&gt; type &#8220;cmd&#8221;, then type &#8220;set temp&#8221; in the command window.</li>
<li>Navigate to this folder in windows. It may well be a hidden folder , so  select tools  -&gt;  folder options -&gt; view -&gt; show hidden files and folders.</li>
<li>Attempt to install OracleXE again &#8211; but this time leave the &#8220;<em>1608: unable to create InstallDriver instance, return code -2147221164</em>&#8221; error dialog box visible, do <strong>not</strong> close it by clicking ok. Closing the dialog box will delete the TEMP files which we need for the next step.</li>
<li>A new folder will have been created under the TEMP folder (press F5 to refresh if necessary). Copy this new folder and all its files to a new location.</li>
<li>Now it is safe to close the &#8220;<em>1608: unable to create InstallDriver instance, return code -2147221164</em>&#8221; error dialog box by clicking ok.</li>
<li>Locate file ISScript11.Msi in the newly copied folder.</li>
<li>Right click on file ISScript11.Msi and select &#8220;Uninstall&#8221;</li>
<li>Right click on file ISScript11.Msi and select &#8220;Install&#8221;</li>
<li>Now attempt to install OracleXE again &#8211; for me it now ran through to completion.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2010/03/08/fix-for-oracle-xe-1608-unable-to-create-installdriver-instance-return-code-2147221164/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic gather stats job</title>
		<link>http://andrewfraserdba.com/2010/03/05/automatic-gather-stats-job/</link>
		<comments>http://andrewfraserdba.com/2010/03/05/automatic-gather-stats-job/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 10:48:45 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=213</guid>
		<description><![CDATA[check it is on with:
SQL> select state, last_start_date from dba_scheduler_jobs where job_name = 'GATHER_STATS_JOB' ;
Switch it on and off with:
SQL> exec dbms_scheduler.disable(’GATHER_STATS_JOB’)
SQL> exec dbms_scheduler.enable(’GATHER_STATS_JOB’)
]]></description>
			<content:encoded><![CDATA[<p>check it is on with:</p>
<p><code>SQL> select state, last_start_date from dba_scheduler_jobs where job_name = 'GATHER_STATS_JOB' ;</code></p>
<p>Switch it on and off with:</p>
<p><code>SQL> exec dbms_scheduler.disable(’GATHER_STATS_JOB’)<br />
SQL> exec dbms_scheduler.enable(’GATHER_STATS_JOB’)</code></p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2010/03/05/automatic-gather-stats-job/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>shell script to clean old oracle trace and log files</title>
		<link>http://andrewfraserdba.com/2010/02/26/shell-script-to-clean-old-oracle-trace-and-log-files/</link>
		<comments>http://andrewfraserdba.com/2010/02/26/shell-script-to-clean-old-oracle-trace-and-log-files/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 09:25:00 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=211</guid>
		<description><![CDATA[This code cleans up old trace files, log files, core dumps, etc. It is designed to be run from cron. It takes a somewhat brutal approach by deleting files after just 7 days &#8211; good for e.g. dev/test servers, but in production you would probably want to modify this to keep files for longer.
For this [...]]]></description>
			<content:encoded><![CDATA[<p>This code cleans up old trace files, log files, core dumps, etc. It is designed to be run from cron. It takes a somewhat brutal approach by deleting files after just 7 days &#8211; good for e.g. dev/test servers, but in production you would probably want to modify this to keep files for longer.</p>
<p>For this example all oracle files of interest were under directory &#8220;/ora&#8221; &#8211; that would need to be changed to suit other sites.</p>
<p><code># 1) Remove old oracle-owned aud, trc, trw, core files<br />
#    Also remove old recv error files (these have format ".err_[0-9]")<br />
#    Also remove access_log.<number>, error_log.<number>, emoms.log.<number> files - which are generated in large numbers<br />
#    Only core files named "core.<number>" are removed: because many other files with "core" in their name are not core dumps, are used by oracle.</p>
<p>echo "*** REMOVE OLD ORACLE AUDIT FILES and OLD RECV Error Files and OLD TRACE FILES ***"<br />
find /ora -mtime +7 -user oracle \( \<br />
  -name '*.aud' -o \<br />
  -name '*.trc*' -o \<br />
  -name '*.trw' -o \<br />
  -name 'core.[0-9]*' -o \<br />
  -name '*.err_[0-9]*' -o \<br />
  -name 'access_log.[0-9]*' -o \<br />
  -name 'error_log.[0-9]*' -o \<br />
  -name 'emoms.log.[0-9]*' \) -exec rm {} \;</p>
<p># 2) Cut down alert logs and listener logs, and also access_log and event_log (webcache/portal/etc.)<br />
#    Old log files are ignored - only log files modified in the last 7 days are worked on.<br />
#    Small log files are ignored - only files bigger than 3mb (=6144*512 byte blocks) are worked on. 3mb is approximately 30,000 lines of text.</p>
<p>echo "*** CUT DOWN THE ALERT LOGS and ORACLE LISTENER.LOG FILE ***"<br />
for FILE in `find /ora -mtime -7 -size +6144 -user oracle \( \<br />
  -name 'alert_*.log' -o \<br />
  -name 'listener*.log' -o \<br />
  -name 'access_log' -o \<br />
  -name 'event_log' -o \<br />
  -name 'http-web-access.log' -o \<br />
  -name 'server.log' \)`<br />
do<br />
  echo "*** cutting $FILE ***"<br />
  cp $FILE $FILE.tmp<br />
  tail -10000 $FILE.tmp > $FILE<br />
  rm $FILE.tmp<br />
done</p>
<p>echo "*** CUT DOWN MESSAGES and WARN FILES  ***"<br />
for FILE in `find /var/log/ -mtime -7 -size +6144 \( \<br />
  -name 'messages' -o \<br />
  -name 'warn'  \)`<br />
do<br />
  echo "*** cutting $FILE ***"<br />
  cp $FILE $FILE.tmp<br />
  tail -10000 $FILE.tmp > $FILE<br />
  rm $FILE.tmp<br />
done</p>
<p># End of file.</code></p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2010/02/26/shell-script-to-clean-old-oracle-trace-and-log-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>/etc/cron.d not working fails</title>
		<link>http://andrewfraserdba.com/2010/02/25/etccron-d-not-working-fails/</link>
		<comments>http://andrewfraserdba.com/2010/02/25/etccron-d-not-working-fails/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 16:27:17 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=209</guid>
		<description><![CDATA[Files in /etc/cron.d only work if they are not executable files (at least that is the case on newer version of unix/linux).
]]></description>
			<content:encoded><![CDATA[<p>Files in /etc/cron.d only work if they are <strong>not</strong> executable files (at least that is the case on newer version of unix/linux).</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2010/02/25/etccron-d-not-working-fails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle Performance Tuning Notes</title>
		<link>http://andrewfraserdba.com/2009/04/17/oracle-performance-tuning-notes/</link>
		<comments>http://andrewfraserdba.com/2009/04/17/oracle-performance-tuning-notes/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 14:59:00 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=206</guid>
		<description><![CDATA[Click for the Course notes with scripts for a 3 day performance tuning course I did recently.
]]></description>
			<content:encoded><![CDATA[<p>Click for the <a href="http://andrewfraserdba.com/training/">Course notes with scripts for a 3 day performance tuning course</a> I did recently.</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2009/04/17/oracle-performance-tuning-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>schema moves by the magic of partition exchange</title>
		<link>http://andrewfraserdba.com/2009/04/17/schema-moves-by-the-magic-of-partition-exchange/</link>
		<comments>http://andrewfraserdba.com/2009/04/17/schema-moves-by-the-magic-of-partition-exchange/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 11:54:49 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=200</guid>
		<description><![CDATA[Here’s an example of how to use partition exchange to move partitions or even entire unpartitioned tables from one schema to another. Is mean to be very fast and generate very little redo. Even more so if the partitions and tables are kept in the same tablespace.
Process for doing partition exchange is like this:
&#8211; first [...]]]></description>
			<content:encoded><![CDATA[<p>Here’s an example of how to use partition exchange to move partitions or even entire unpartitioned tables from one schema to another. Is mean to be very fast and generate very little redo. Even more so if the partitions and tables are kept in the same tablespace.</p>
<p>Process for doing partition exchange is like this:</p>
<p>&#8211; first create the archive table, empty initially:<br />
<code>create table arch_owner.mytable .... [full create table spec goes in here, including partition clauses, but leave out the primary key/index ]</code></p>
<p>&#8211; give arch_owner (or alternatively whichever user runs this job) the required privileges<code><br />
grant select, alter on live_owner.mytable to arch_owner ;</code></p>
<p>&#8211; create an empty temporary table, used later in the partition exchange<br />
<code>create table arch_owner.temp_table as select * from live_owner.mytable where 1=2 ;</code></p>
<p>&#8211; exchange the live partition with the temporary table<br />
<code>alter table live_owner.mytable exchange partition year2001 with table arch_owner.temp_table ;</code></p>
<p>&#8211; exchange that onwards to the archived table<br />
<code>alter table arch_owner.mytable exchange partition year2001 with table arch_owner.temp_table ;</code></p>
<p>&#8211; at the very end of the process, clean up the temporary table, add in any required primary keys or other indexes, and gather optimizer stats (=analyze)<br />
<code>drop table arch_owner.temp_table ;<br />
alter table arch_owner.mytable add primary key (aud_id) using index tablespace ts_index1 ;<br />
exec dbms_stats.gather_schema_stats('ARCH_OWNER', estimate_percent=&gt;99.99, cascade =&gt; TRUE, method_opt=&gt; 'FOR ALL INDEXED COLUMNS SIZE 1')</code></p>
<p><strong>&gt; </strong><em>On a similar vein, is there an elegant way of copying the current data from the live_owner.mytable table to the arch_owner.mytable table? About 15Gb of data would normally go across via our scripts, but unfortunately the tables aren’t partitioned to let us do something along the lines of your last suggestion …</em></p>
<p><strong>1) Yes, can do it in essentially the same way as before</strong> (h/t <a href="http://www.pythian.com/news/218/oracle-how-to-move-a-table-to-another-schema">Pythian Blog</a>):</p>
<p>&#8211; give arch_owner the required privileges on the live table:<br />
<code>grant select, alter on live_owner.mytable to arch_owner ;</code></p>
<p>&#8211; create an empty table and index in arch_owner<br />
<code>create table df_arch_owner.mytable .. [full create table spec here]<br />
create index arch_owner.mytable_index1 on arch_owner.mytable (to_date(plan_date,'YYYY-MM-DD') ) tablespace ts_index1 ;</code></p>
<p>&#8211; also create a temporary table with a single dummy partition<br />
<code>create table arch_owner.temp_table<br />
partition by range ( userid )<br />
( partition dummy values less than ( maxvalue ) )<br />
as select * from arch_owner.mytable where 1=2 ;</code></p>
<p>&#8211; again with an index (locally):<br />
<code>create index arch_owner.temp_index1 on arch_owner.temp_table (to_date(plan_date,'YYYY-MM-DD') ) tablespace ts_index1 local ;</code></p>
<p>&#8211; swap the live table and the temporary table with each other:<br />
<code>alter table arch_owner.temp_table exchange partition dummy with table live_owner.mytable<br />
including indexes without validation ;</code></p>
<p>&#8211; then swap the temporary table and the arch_owner table with each other:<br />
<code>alter table arch_owner.temp_table exchange partition dummy with table arch_owner.mytable<br />
including indexes without validation ;</code></p>
<p>&#8211; optimizer stats for both schemas should be re-gathered at the overall completion of the archiving work, and temporary tables dropped.</p>
<p><strong>2) Or alternative method – but probably not so good</strong> because it doesn’t strictly move from one schema to the other, just renames:</p>
<p>&#8211; login as live_owner<br />
<code>conn live_owner/password</code></p>
<p>&#8211; rename the old table to have arch_ in front of its name<br />
<code>rename mytable to arch_mytable ;</code></p>
<p>&#8211; rename the old index to have arch_ in front of its name<br />
<code>alter index mytable_index1 rename to arch_mytable_index1 ;</code></p>
<p>&#8211; create a synonym in arch_owner that points to the arch_ table.<br />
<code>create synonym arch_owner.arch_mytable for live_owner.arch_mytable ;</code></p>
<p>&#8211; and also grant arch_owner privileges on the arch_ table<br />
<code>grant select on live_owner.arch_mytable to arch_owner ;</code></p>
<p>&#8211; create a new empty table in live_owner, complete with indexes, <code>triggers, grants, and so on:<br />
create table live_owner.mytable ....<br />
create index mytable_index1 on live_owner.mytable ....<br />
create trigger live_owner.del_mytable ....<br />
grant select, insert, ....</code></p>
<p>&#8211; optionally can move the arch tables from one tablespace to the other (although I don’t see how that could be worth the substantial time and effort that it takes):<br />
<code>alter table arch_mytable move tablespace ts_arch_data ;<br />
alter index arch_mytable_index1 rebuild tablespace ts_arch_index ;</code></p>
<p>&#8211; optimizer stats for both schemas should be re-gathered at the overall completion of the archiving work.</p>
<p><strong>Changing Tablespaces in Partition Exchange</strong></p>
<p>If you need objects to be in specific tablespaces, you should explicitly state that tablespace name, otherwise you can expect the users default tablespace will be used instead. That applies to all operations that alter indexes and tables – including exchange partition, enable constraint, create constraint, create index, alter index rebuild, create table, alter table add partition, and so on.</p>
<p>For partition exchanges, it is a bit more complex than that, because exchanged partitions take their tablespace with them during the exchange.</p>
<p>So imagine an initial setup where the live year2001 partition is in ts_data1, and the other two objects to be used are in tablespaces “X” and “Z”:</p>
<p> </p>
<table class="wptable rowstyle-alt" id="wptable-3"  cellspacing="1" cellpadding="1">
	<thead>
	<tr>
		<th class="sortable" style="width:80px" align="left">Object</th>
		<th class="sortable" style="width:80px" align="left">Tablespace</th>
	</tr>
	</thead>
	<tr>
		<td style="width:80px" align="left">live_year2001</td>
		<td style="width:80px" align="left">ts_data1</td>
	</tr>
	<tr class="alt">
		<td style="width:80px" align="left">temp table</td>
		<td style="width:80px" align="left">X</td>
	</tr>
	<tr>
		<td style="width:80px" align="left">archive_year2001</td>
		<td style="width:80px" align="left">Z</td>
	</tr>
</table><p>
</p>
<p>After we exchange &#8220;live year 2001&#8243; with &#8220;temp table&#8221; their tablespaces swap:</p>
<p> </p>
<table class="wptable rowstyle-alt" id="wptable-5"  cellspacing="1" cellpadding="1">
	<thead>
	<tr>
		<th class="sortable" style="width:80px" align="left">Object</th>
		<th class="sortable" style="width:80px" align="left">Tablespace</th>
	</tr>
	</thead>
	<tr>
		<td style="width:80px" align="left">live_year2001</td>
		<td style="width:80px" align="left">X</td>
	</tr>
	<tr class="alt">
		<td style="width:80px" align="left">temp table</td>
		<td style="width:80px" align="left">ts_data1</td>
	</tr>
	<tr>
		<td style="width:80px" align="left">archive_year2001</td>
		<td style="width:80px" align="left">Z</td>
	</tr>
</table><p>
</p>
<p>Then exchange &#8220;archive year 2001&#8243; with &#8220;temp table&#8221;, same thing happens:</p>
<p> </p>
<table class="wptable rowstyle-alt" id="wptable-6"  cellspacing="1" cellpadding="1">
	<thead>
	<tr>
		<th class="sortable" style="width:80px" align="left">Object</th>
		<th class="sortable" style="width:80px" align="left">Tablespace</th>
	</tr>
	</thead>
	<tr>
		<td style="width:80px" align="left">live_year2001</td>
		<td style="width:80px" align="left">X</td>
	</tr>
	<tr class="alt">
		<td style="width:80px" align="left">temp table</td>
		<td style="width:80px" align="left">Z</td>
	</tr>
	<tr>
		<td style="width:80px" align="left">archive_year2001</td>
		<td style="width:80px" align="left">ts_data1</td>
	</tr>
</table><p>
</p>
<p>Then we drop the “temp table”:</p>
<p> </p>
<table class="wptable rowstyle-alt" id="wptable-7"  cellspacing="1" cellpadding="1">
	<thead>
	<tr>
		<th class="sortable" style="width:80px" align="left">Object</th>
		<th class="sortable" style="width:80px" align="left">Tablespace</th>
	</tr>
	</thead>
	<tr>
		<td style="width:80px" align="left">live_year2001</td>
		<td style="width:80px" align="left">X</td>
	</tr>
	<tr class="alt">
		<td style="width:80px" align="left">archive_year2001</td>
		<td style="width:80px" align="left">ts_data1</td>
	</tr>
</table><p>
</p>
<p>Now, assuming we want tablespace “X” to be ts_data1, checking back to the initial setup shows that that tablespace was the one defined by the temp table. So it is important to explicitly specify that tablespace, using code like:</p>
<p>&#8211; create an empty temporary table, used later in the partition exchange<br />
<code>create table arch_owner.temp_table tablespace ts_data1<br />
as select * from live_owner.mytable where 1=2 ;</code></p>
<p>Also, assuming we want the “archive year2001” partition to be in ts_arch_data, we have a problem – it has ended up in ts_data1. There is no way to prevent that at the time, instead it has to be moved at the end, using:</p>
<p><code>alter table arch_owner.owner.mytable move tablespace ts_arch_data ;</code></p>
<p>That table move is unfortunately slow and generates redo.</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2009/04/17/schema-moves-by-the-magic-of-partition-exchange/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use ftp in shell scripts with password in .netrc</title>
		<link>http://andrewfraserdba.com/2009/04/17/use-ftp-in-shell-scripts-with-password-in-netrc/</link>
		<comments>http://andrewfraserdba.com/2009/04/17/use-ftp-in-shell-scripts-with-password-in-netrc/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 11:38:17 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=198</guid>
		<description><![CDATA[ftp can be used in shell scripts by specifying the ftp password in a .netrc file.
On the source server create/edit this file:
$ vi $HOME/.netrc
Add in a line with the username password details:
machine targetservername login targetusername password targetpassword
Make that file secure (the ftp actually fails if you don&#8217;t):
$ chmod 600 $HOME/.netrc
]]></description>
			<content:encoded><![CDATA[<p>ftp can be used in shell scripts by specifying the ftp password in a .netrc file.</p>
<p>On the source server create/edit this file:<br />
<code>$ vi $HOME/.netrc</code></p>
<p>Add in a line with the username password details:<br />
<code>machine <em>targetservername</em> login <em>targetusername</em> password <em>targetpassword</em></code></p>
<p>Make that file secure (the ftp actually fails if you don&#8217;t):<br />
<code>$ chmod 600 $HOME/.netrc</code></p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2009/04/17/use-ftp-in-shell-scripts-with-password-in-netrc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle Application Server sets NLS_LANG by default</title>
		<link>http://andrewfraserdba.com/2009/03/27/oracle-application-server-sets-nls_lang-by-default/</link>
		<comments>http://andrewfraserdba.com/2009/03/27/oracle-application-server-sets-nls_lang-by-default/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 15:17:17 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=194</guid>
		<description><![CDATA[If you don&#8217;t specify NLS_LANG in your shell when starting OAS, OAS goes and sets it for you.
Fix is to specify NLS_LANG in any OAS startup scripts you use, or edit these files:
$ grep -i NLS_LANG $ORACLE_HOME/Apache/Apache/bin/apachectl
NLS_LANG=${NLS_LANG="ENGLISH_UNITED KINGDOM.WE8ISO8859P1"}; export NLS_LANG
$ grep -i NLS_LANG $ORACLE_HOME/opmn/bin/opmnctl
NLS_LANG=${NLS_LANG="ENGLISH_UNITED KINGDOM.WE8ISO8859P1"}; export NLS_LANG
$
Reference 10gR2 Oracle Application Server Globalization Support Guide, Chapter [...]]]></description>
			<content:encoded><![CDATA[<p>If you don&#8217;t specify NLS_LANG in your shell when starting OAS, OAS goes and sets it for you.</p>
<p>Fix is to specify NLS_LANG in any OAS startup scripts you use, or edit these files:</p>
<pre>$ grep -i NLS_LANG $ORACLE_HOME/Apache/Apache/bin/apachectl
NLS_LANG=${NLS_LANG="ENGLISH_UNITED KINGDOM.WE8ISO8859P1"}; export NLS_LANG
$ grep -i NLS_LANG $ORACLE_HOME/opmn/bin/opmnctl
NLS_LANG=${NLS_LANG="ENGLISH_UNITED KINGDOM.WE8ISO8859P1"}; export NLS_LANG
$</pre>
<p>Reference <a href="http://download.oracle.com/docs/cd/B15904_01/core.1012/b14004/iasconfig.htm#sthref306">10gR2 Oracle Application Server Globalization Support Guide, Chapter 5</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2009/03/27/oracle-application-server-sets-nls_lang-by-default/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Logon Trigger to Capture Session NLS_Territory</title>
		<link>http://andrewfraserdba.com/2009/03/27/logon-trigger-to-capture-session-nls_territory/</link>
		<comments>http://andrewfraserdba.com/2009/03/27/logon-trigger-to-capture-session-nls_territory/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 14:33:47 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=187</guid>
		<description><![CDATA[You can see your own sessions nls settings
SQL&#62; select * from nls_session_parameters ;
But for other users&#8217; sessions, that information is stored in their own UGA, not accessible outside their session.
So if you need to know what their nls settings are, a logon trigger is needed to record that. Like this:
conn / as sysdba
drop table af_nls
/
create [...]]]></description>
			<content:encoded><![CDATA[<p>You can see your own sessions nls settings</p>
<blockquote><p>SQL&gt; select * from nls_session_parameters ;</p></blockquote>
<p>But for other users&#8217; sessions, that information is stored in their own UGA, not accessible outside their session.</p>
<p>So if you need to know what their nls settings are, a logon trigger is needed to record that. Like this:</p>
<pre>conn / as sysdba
drop table af_nls
/
create table af_nls (
  af_sid number ,
  af_program varchar2(48) ,
  af_nls_territory varchar2(40) )
tablespace users
/
create or replace trigger sys.logon_af_nls
after logon on database
when ( user != 'SYS' )
declare
  v_sid number ;
  v_program varchar2(48) ;
  v_nls_territory varchar2(40) ;
begin
  select m.sid, s.program into v_sid, v_program
    from v$session s , v$mystat m
    where m.sid = s.sid and rownum &lt; 2 ;
  select value into v_nls_territory from nls_session_parameters
    where parameter = 'NLS_TERRITORY' ;
  insert into af_nls values
    ( v_sid , v_program , v_nls_territory  ) ;
  commit ;
end logon_af_nls ;
/
sho err</pre>
<p>Handy if you&#8217;ve got <a href="http://andrewfraserdba.com/2007/04/25/and-on-the-seventh-day-god-fiddled-with-his-nls-settings/">this problem</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2009/03/27/logon-trigger-to-capture-session-nls_territory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
