<?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; Uncategorized</title>
	<atom:link href="http://andrewfraserdba.com/category/uncategorized/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>Documentation and Comments</title>
		<link>http://andrewfraserdba.com/2012/03/06/documentation-and-comments/</link>
		<comments>http://andrewfraserdba.com/2012/03/06/documentation-and-comments/#comments</comments>
		<pubDate>Tue, 06 Mar 2012 16:24:54 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=870</guid>
		<description><![CDATA[Steve Feuerstein here: There are two forms of code documentation: external and internal. External documentation is descriptive information about a program which is written and stored separately from the program itself. Internal documentation, also known as inline documentation or comments, &#8230; <a href="http://andrewfraserdba.com/2012/03/06/documentation-and-comments/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Steve Feuerstein <a href="http://soft.buaa.edu.cn/oracle/bookshelf/Oreilly/prog2/ch03_06.htm">here</a>: </p>
<blockquote><p>There are two forms of code documentation: external and internal. External documentation is descriptive information about a program which is written and stored separately from the program itself. Internal documentation, also known as inline documentation or comments, is placed within the program itself, either at the program level or the statement level.<span id="more-870"></span><br />
The best kind of internal documentation derives from your programming style. If you apply [my] guidelines, you will be able to write code which is, to a great extent, self-documenting.</p></blockquote>
<p>Best practice for documentation is:</p>
<ol>
<li>Write code in a style that is self-documenting.</li>
<li>To the extent that is not possible, then keep the documentation internal to the program itself, in the form of comments.</li>
<li>Only if that is also not possible, should you resort to external documentation. In that case keep the external documentation easily accessible by URL and state that URL inside the program comments (and/or display in the application front end).
</ol>
<p>Ideally, the only external documentation needed is the high level overview containing just:</p>
<ol>
<li>Server name(s)</li>
<li>Database name(s)</li>
<li>Owner username(s)</li>
<li>Details of where to find password(s) &#8211; e.g. full path details of a <a href="http://keepass.info/">KeePass</a> encrypted file.
<li>Any helpful visio-style diagrams
</ol>
<p>The most important set of comments is this initial set &#8211; and this should appear in every piece of code you write:
<pre>CREATE OR REPLACE PROCEDURE myowner.myprocedure AS
/***************************
|| Name :
|| Author :
|| Date :
|| Purpose :
|| Change History :
||     date author refno description
***************************/</pre>
<p>Of those fields, author is the most important.</p>
<p>Counter-intuitively, simple short programs actually need that header  info more than long programs &#8211; because you can more often work out the purpose of long programs by reading through their code.</p>
<p>Focus on the <em>why</em>, not the what.</p>
<p>Packages should have these comments in the package body, not the package header, because the body is more often modified and contains the most code.</p>
<p>Views need commented just as much as pl/sql. But their comments need to go after the select keyword:
<pre>create or replace [materialized] view myowner.myview as select
/***************************
|| Name :
|| Author :
|| Date :
|| Purpose :
|| Change History :
***************************/</pre>
<p>Triggers and functions also should be commented with the some format. As should any SQL script files and shell script files.</p>
<p>For SQL script files, set doc off first to avoid having the comments echoed out to screen every time the script is run:
<pre>set doc off
/***************************
|| Name :</pre>
<p>Shell scripts should follow the same comment format as sql, except for &#8216;#&#8217; symbols:
<pre>##############################
# Name :
# Author :
# Date :
# Purpose :
# Change History :
##############################</pre>
<p>PHP files also should have the same initial comment block, except marking lines with * is more standard for php:
<pre>/***************************
* Name :
* Author :
* Date :
* Purpose :
* Change History :
***************************/</pre>
<p>Functions and subroutines, whether in php, shell, or pl/sql package bodies, should each get their own introductory comment block &#8211; although <em>without</em> the change history, because that is best maintained in the overall initial comment block.</p>
<p>Oracle Forms screens should all have that same initial comment block placed in their <em>when-new-form-instance </em>trigger. If necessary, add the <em>when-new-form-instance</em> trigger purely to contain that comment block. And again each program unit within the form would also get its own introductory comment block.</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2012/03/06/documentation-and-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle range limit AD BC dates</title>
		<link>http://andrewfraserdba.com/2011/08/11/oracle-range-limit-ad-bc-dates/</link>
		<comments>http://andrewfraserdba.com/2011/08/11/oracle-range-limit-ad-bc-dates/#comments</comments>
		<pubDate>Thu, 11 Aug 2011 16:12:46 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=798</guid>
		<description><![CDATA[This is the extreme limit for oracle dates: alter session set nls_date_format = 'Dy DD-Mon-YYYY AD' ; select sysdate, to_date('01-JAN-4712 BC','DD-MON-YYYY AD'), to_date('30-DEC-9999 AD','DD-MON-YYYY AD') from dual ; Without encountering this error: ORA-01841: (full) year must be between -4713 and &#8230; <a href="http://andrewfraserdba.com/2011/08/11/oracle-range-limit-ad-bc-dates/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is the extreme limit for oracle dates:</p>
<pre class="brush:sql">alter session set nls_date_format = 'Dy DD-Mon-YYYY AD' ;
select sysdate, to_date('01-JAN-4712 BC','DD-MON-YYYY AD'), to_date('30-DEC-9999 AD','DD-MON-YYYY AD') from dual ;</pre>
<p>Without encountering this error:</p>
<p>ORA-01841: (full) year must be between -4713 and +9999, and not be 0<br />
01841. 00000 &#8211;  &#8220;(full) year must be between -4713 and +9999, and not be 0&#8243;<br />
*Cause:    Illegal year entered<br />
*Action:   Input year in the specified range</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2011/08/11/oracle-range-limit-ad-bc-dates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle Developer Suite 10g 9.0.4.0.1 windows software download media</title>
		<link>http://andrewfraserdba.com/2011/07/15/oracle-developer-suite-10g-9-0-4-0-1-windows-software-download-media/</link>
		<comments>http://andrewfraserdba.com/2011/07/15/oracle-developer-suite-10g-9-0-4-0-1-windows-software-download-media/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 13:57:54 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=734</guid>
		<description><![CDATA[Oracle Developer Suite 10g 9.0.4.0.1 for Windows (forms developer) is not easy to obtain now, out of support by Oracle for a long time, but that version is still in use out there. So I have zipped both installation CDs &#8230; <a href="http://andrewfraserdba.com/2011/07/15/oracle-developer-suite-10g-9-0-4-0-1-windows-software-download-media/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Oracle Developer Suite 10g 9.0.4.0.1 for Windows (forms developer) is not easy to obtain now, out of support by Oracle for a long time, but that version is still in use out there. So I have <a href="http://andrewfraserdba.com/Oracle Developer Suite 10g 9.0.4.0.1.zip">zipped both installation CDs here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2011/07/15/oracle-developer-suite-10g-9-0-4-0-1-windows-software-download-media/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Cron fix for ulimit: max user processes: cannot modify limit:operation not permitted</title>
		<link>http://andrewfraserdba.com/2011/07/14/cron-fix-for-ulimit-max-user-processes-cannot-modify-limitoperation-not-permitted/</link>
		<comments>http://andrewfraserdba.com/2011/07/14/cron-fix-for-ulimit-max-user-processes-cannot-modify-limitoperation-not-permitted/#comments</comments>
		<pubDate>Thu, 14 Jul 2011 16:15:41 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=726</guid>
		<description><![CDATA[Werner Puschitz has details of how to use ulimit and limits.conf to change maximum processes and open file descriptors. But for processes running from cron, I found I had to additionally make the below changes (this is on old version: &#8230; <a href="http://andrewfraserdba.com/2011/07/14/cron-fix-for-ulimit-max-user-processes-cannot-modify-limitoperation-not-permitted/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.puschitz.com/TuningLinuxForOracle.shtml#LimitingMaximumNumberOfProcessesForTheOracleUser">Werner Puschitz has details of how to use ulimit and limits.conf</a> to change maximum processes and open file descriptors.</p>
<p>But for processes running from cron, I found I had to additionally make the below changes (this is on old version: <em>32 bit Linux 2.4.21-27.ELsmp Red Hat Enterprise Linux AS release 3 (Taroon Update 4)</em> &#8211; maybe not needed for newer versions).</p>
<pre class="brush:bash, shell">vi /etc/init.d/crond</pre>
<p>Add lines like:</p>
<pre class="brush:bash, shell">ulimit -Hu 131072  # new line Jul 2011
ulimit -Su 131072  # new line Jul 2011
ulimit -Hn 262144  # new line Jul 2011
ulimit -Sn 262144  # new line Jul 2011</pre>
<p>These should be the first commands in that file.</p>
<p>Restart cron with:</p>
<pre class="brush:bash, shell">/etc/init.d/crond restart</pre>
<p>Not relevant for cron, but file /etc/profile is loaded at login and may have been edited to contain ulimit settings &#8211; if so those lines would need changed or removed for normal (non cron) logins.</p>
<p>Thanks to <a href="http://linux.derkeiler.com/Newsgroups/comp.os.linux.setup/2004-07/0596.html">Michael Heiming</a> for this.</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2011/07/14/cron-fix-for-ulimit-max-user-processes-cannot-modify-limitoperation-not-permitted/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Change oracle password temporarily</title>
		<link>http://andrewfraserdba.com/2010/06/03/change-oracle-password-temporarily/</link>
		<comments>http://andrewfraserdba.com/2010/06/03/change-oracle-password-temporarily/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 10:48:25 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=263</guid>
		<description><![CDATA[Want to connect as a particular user but don&#8217;t know their password? You can temporarily change it and then reset it back, if you have DBA/alter any user privilege: SQL> select password from dba_users where username = 'MYUSER'; PASSWORD ------------------------------ &#8230; <a href="http://andrewfraserdba.com/2010/06/03/change-oracle-password-temporarily/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Want to connect as a particular user but don&#8217;t know their password? You can temporarily change it and then reset it back, if you have DBA/alter any user privilege:</p>
<pre  class="brush:sql">SQL> select password from dba_users where username = 'MYUSER';

PASSWORD
------------------------------
086FAA387C794B46

SQL> alter user MYUSER identified by mypassword ;

User altered.

SQL> conn MYUSER/mypassword
Connected.
SQL> alter user MYUSER identified by values '086FAA387C794B46';

User altered.

SQL> sho user
USER is "MYUSER"</pre>
<p>The above works for versions up to 10g. For 11g, instead use:</p>
<pre  class="brush:sql">SQL> set long 9999
SQL> select dbms_metadata.get_ddl ('USER', 'MYUSER') from dual ;
</pre>
<p>Source: <a href="http://laurentschneider.com/wordpress/2007/08/the-password-is-not-longer-displayed-in-dba_userspassword.html">Laurent Schneider</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2010/06/03/change-oracle-password-temporarily/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comments in spfile alter system</title>
		<link>http://andrewfraserdba.com/2010/05/13/comments-in-spfile-alter-system/</link>
		<comments>http://andrewfraserdba.com/2010/05/13/comments-in-spfile-alter-system/#comments</comments>
		<pubDate>Thu, 13 May 2010 10:42:52 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=250</guid>
		<description><![CDATA[Comments are used much less often in spfile than they were in old init.ora&#8217;s. Syntax for them is like: SQL> alter system set pga_aggregate_target=1g comment='Andrew Fraser 13-May-2010 was 390m' scope=spfile sid='*' ;]]></description>
			<content:encoded><![CDATA[<p>Comments are used much less often in spfile than they were in old init.ora&#8217;s. Syntax for them is like:</p>
<pre class="brush:sql">SQL> alter system set pga_aggregate_target=1g comment='Andrew Fraser 13-May-2010 was 390m'  scope=spfile sid='*' ;</pre>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2010/05/13/comments-in-spfile-alter-system/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Show date time tables were created</title>
		<link>http://andrewfraserdba.com/2010/03/30/show-date-time-tables-were-created/</link>
		<comments>http://andrewfraserdba.com/2010/03/30/show-date-time-tables-were-created/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 09:40:35 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andrewfraserdba.com/?p=223</guid>
		<description><![CDATA[To see when tables (or other objects) were created, first change your date format to display time: alter session set nls_date_format='Dy DD-Mon-YYYY HH24:MI:SS'; Then in Oracle SQL Developer, right click on the table or object in question, select &#8216;open&#8216;, and &#8230; <a href="http://andrewfraserdba.com/2010/03/30/show-date-time-tables-were-created/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>To see when tables (or other objects) were created, first change your date format to display time:</p>
<pre class="brush:sql">alter session set nls_date_format='Dy DD-Mon-YYYY HH24:MI:SS';</pre>
<p>Then in Oracle SQL Developer, right click on the table or object in question, select &#8216;<em>open</em>&#8216;, and look at the &#8216;<em>details</em>&#8216; tab.</p>
<p><a href="http://andrewfraserdba.com/wp-content/uploads/2010/03/sqldev11.jpeg"><img class="alignnone size-full wp-image-226" title="sqldev1" src="http://andrewfraserdba.com/wp-content/uploads/2010/03/sqldev11.jpeg" alt="" width="577" height="288" /></a></p>
<p>Or alternatively still in SQL, look at the created column:</p>
<pre class="brush:sql">select object_name, created from user_objects order by 2;</pre>
<p>That is for objects owned by you. For objects owned by others:</p>
<pre class="brush:sql">select object_name, created from all_objects order by 2;</pre>
<p>Note that the column &#8216;last_ddl_time&#8217; is not as useful as it sounds, since even operations like GRANTs on the table update the &#8216;last_ddl_time&#8217;.</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2010/03/30/show-date-time-tables-were-created/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

