<?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>FlimaTech Blog</title>
	<atom:link href="http://blog.flimatech.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flimatech.com</link>
	<description>Sharing Our Database Experience</description>
	<lastBuildDate>Sun, 13 May 2012 23:43:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Example of using sql profile to use switch to a different execution plan</title>
		<link>http://blog.flimatech.com/2012/05/13/example-of-using-sql-profile-to-use-switch-to-a-different-execution-plan/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=example-of-using-sql-profile-to-use-switch-to-a-different-execution-plan</link>
		<comments>http://blog.flimatech.com/2012/05/13/example-of-using-sql-profile-to-use-switch-to-a-different-execution-plan/#comments</comments>
		<pubDate>Sun, 13 May 2012 23:40:48 +0000</pubDate>
		<dc:creator>Amin Jaffer</dc:creator>
				<category><![CDATA[General DBA]]></category>
		<category><![CDATA[Tuning]]></category>
		<category><![CDATA[dbms_sqltune]]></category>
		<category><![CDATA[execution plan]]></category>
		<category><![CDATA[profile]]></category>
		<category><![CDATA[sql_profile]]></category>
		<category><![CDATA[tuning]]></category>

		<guid isPermaLink="false">http://blog.flimatech.com/?p=2018</guid>
		<description><![CDATA[Below are the 2 SQL statements, the first one uses the index AAA_IDX and then second one does a full table scan and in this case we want to make the first one that uses the index use the same execution plan as the 2nd one. SQL statement: select * from aaa e where ename [...]]]></description>
			<content:encoded><![CDATA[<p><b>Below are the 2 SQL statements, the first one uses the index AAA_IDX and then second one does a full table scan and in this case we want to make the first one that uses the index use the same execution plan as the 2nd one.</b></p>
<p><b>SQL statement:</b><br />
select * from aaa e where ename = &#39;aaa&#39;;<br />
select /*+ FULL(e) */ * from aaa e where ename = &#39;aaa&#39;</p>
<p><b>By query v$sql we found the sql_id, child_number and plan_hash_value also checked there isn&#39;t a sql_profile attached to the SQL.</b></p>
<p>SQL> select sql_id, child_number, sql_profile, plan_hash_value, sql_text from v$sql where sql_id IN (&#39;63cg18v928540&#39;, &#39;0tjtg6yqqbbxk&#39;);</p>
<p>SQL_ID        CHILD_NUMBER SQL_PROFILE                                       PLAN_HASH_VALUE<br />
&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;<br />
SQL_TEXT<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
63cg18v928540            0                                                    2022030255<br />
select * from aaa e where ename = &#39;aaa&#39;</p>
<p>0tjtg6yqqbbxk            0                                                    864433273<br />
select /*+ FULL(e) */ * from aaa e where ename = &#39;aaa&#39;</p>
<p><b>Displaying the execution plan of the 2nd SQL with the outline option</b><br />
SQL> SELECT * FROM TABLE(dbms_xplan.display_cursor(&#39;0tjtg6yqqbbxk&#39;, 0, &#39;outline&#39;));<br />
PLAN_TABLE_OUTPUT<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>SQL_ID  0tjtg6yqqbbxk, child number 0<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
select /*+ FULL(e) */ * from aaa e where ename = &#39;aaa&#39;</p>
<p>Plan hash value: 864433273</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
|   0 | SELECT STATEMENT  |      |       |       |     2 (100)|          |<br />
|*  1 |  TABLE ACCESS FULL| AAA  |     1 |     5 |     2   (0)| 00:00:01 |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Outline Data<br />
&#8212;&#8212;&#8212;&#8212;-</p>
<p>  /*+<br />
      BEGIN_OUTLINE_DATA<br />
      IGNORE_OPTIM_EMBEDDED_HINTS<br />
      OPTIMIZER_FEATURES_ENABLE(&#39;11.2.0.1&#39;)<br />
      DB_VERSION(&#39;11.2.0.1&#39;)<br />
      ALL_ROWS<br />
      OUTLINE_LEAF(@&#8221;SEL$1&#8243;)<br />
      FULL(@&#8221;SEL$1&#8243; &#8220;E&#8221;@&#8221;SEL$1&#8243;)<br />
      END_OUTLINE_DATA<br />
  */</p>
<p>Predicate Information (identified by operation id):<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>   1 &#8211; filter(&#8220;ENAME&#8221;=&#39;aaa&#39;)</p>
<p><b>From the outline generated used the hint to add to first SQL to change its execution plan i.e. full table scan</b>.<br />
define SQL_ID = &#39;63cg18v928540&#39;;</p>
<p>DECLARE<br />
   clsql_text CLOB;<br />
BEGIN<br />
   SELECT sql_fulltext INTO clsql_text FROM V$sqlarea where sql_id = &#39;&#038;SQL_ID&#39;;<br />
   dbms_sqltune.import_sql_profile(sql_text => clsql_text,<br />
            profile=> sqlprof_attr(&#39;FULL(@SEL$1 E@SEL$1)&#39;),<br />
            name=>&#39;PROFILE_&#038;SQL_ID&#39;,<br />
            force_match=>true);<br />
end;<br />
/</p>
<p><b>Shows now when we execute the SQL it uses the same execution plan as the 2nd one i.e. full table scan</b><br />
SQL> select * from aaa e where ename = &#39;aaa&#39;;<br />
Execution Plan<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Plan hash value: 864433273</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
|   0 | SELECT STATEMENT  |      |     1 |     5 |     2   (0)| 00:00:01 |<br />
|*  1 |  TABLE ACCESS FULL| AAA  |     1 |     5 |     2   (0)| 00:00:01 |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Predicate Information (identified by operation id):<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>   1 &#8211; filter(&#8220;ENAME&#8221;=&#39;aaa&#39;)</p>
<p>Note<br />
&#8212;&#8211;<br />
   &#8211; SQL profile &#8220;PROFILE_63cg18v928540&#8243; used for this statement</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flimatech.com/2012/05/13/example-of-using-sql-profile-to-use-switch-to-a-different-execution-plan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Example shows how &#8220;DISABLE TABLE LOCK&#8221; works</title>
		<link>http://blog.flimatech.com/2012/05/13/example-shows-how-disable-table-lock-works/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=example-shows-how-disable-table-lock-works</link>
		<comments>http://blog.flimatech.com/2012/05/13/example-shows-how-disable-table-lock-works/#comments</comments>
		<pubDate>Sun, 13 May 2012 19:24:36 +0000</pubDate>
		<dc:creator>Amin Jaffer</dc:creator>
				<category><![CDATA[General DBA]]></category>
		<category><![CDATA[disable]]></category>
		<category><![CDATA[disable table lock]]></category>
		<category><![CDATA[enable]]></category>
		<category><![CDATA[lock]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://blog.flimatech.com/?p=2016</guid>
		<description><![CDATA[Following example shows what happens when locks are disabled on the TABLE. &#045;&#045; disable lock on a table SQL&#62; alter table t disable table lock; Table altered. &#045;&#045; shows one can&#8217;t drop table as table locks are disable SQL&#62; drop table t; drop table t * ERROR at line 1: ORA-00069: cannot acquire lock &#8212; [...]]]></description>
			<content:encoded><![CDATA[<p>Following example shows what happens when locks are disabled on the TABLE.</p>
<p>&#045;&#045; disable lock on a table<br />
SQL&gt; alter table t disable table lock;<br />
Table altered.</p>
<p>&#045;&#045; shows one can&#8217;t drop table as table locks are disable<br />
SQL&gt; drop table t;<br />
drop table t<br />
           *<br />
ERROR at line 1:<br />
ORA-00069: cannot acquire lock &#8212; table locks disabled for T</p>
<p>&#045;&#045; shows one can&#8217;t truncate table as table locks are disable<br />
SQL&gt; truncate table t;<br />
truncate table t<br />
               *<br />
ERROR at line 1:<br />
ORA-00069: cannot acquire lock &#8212; table locks disabled for T</p>
<p>&#045;&#045; DML is okay to run<br />
SQL&gt; delete from t;<br />
1 row deleted.</p>
<p>&#045;&#045; new columns can be added<br />
SQL&gt; alter table t add tt varchar2(1);<br />
Table altered.</p>
<p>&#045;&#045; columns can&#8217;t be modified<br />
SQL&gt; alter table t modify tt varchar2(10);<br />
alter table t modify tt varchar2(10)<br />
*<br />
ERROR at line 1:<br />
ORA-00069: cannot acquire lock &#8212; table locks disabled for T</p>
<p>&#045;&#045; columns can&#8217;t be dropped<br />
SQL&gt; alter table t drop column tt;<br />
alter table t drop column tt<br />
*<br />
ERROR at line 1:<br />
ORA-00069: cannot acquire lock &#8212; table locks disabled for T</p>
<p>&#045;&#045; enable locking on the table<br />
SQL&gt; alter table t enable table lock;<br />
Table altered.</p>
<p>&#045;&#045; table now can be dropped<br />
SQL&gt; drop table t;<br />
Table dropped.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flimatech.com/2012/05/13/example-shows-how-disable-table-lock-works/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to trace a running process?</title>
		<link>http://blog.flimatech.com/2012/05/13/how-to-trace-a-running-process/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-trace-a-running-process</link>
		<comments>http://blog.flimatech.com/2012/05/13/how-to-trace-a-running-process/#comments</comments>
		<pubDate>Sun, 13 May 2012 16:38:31 +0000</pubDate>
		<dc:creator>Amin Jaffer</dc:creator>
				<category><![CDATA[trace]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[attach]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[running]]></category>
		<category><![CDATA[strace]]></category>

		<guid isPermaLink="false">http://blog.flimatech.com/?p=2014</guid>
		<description><![CDATA[Using strace one can trace the system calls being executed by a running process. To stop the strace press control-C To display the system calls being executed $ strace -p &#60;pid&#62; or To display a summary of system calls being executed $ strace -cfo &#60;logfile&#62; -p &#60;pid&#62; Example: In this example smon process was being [...]]]></description>
			<content:encoded><![CDATA[<p>Using strace one can trace the system calls being executed by a running process.  To stop the strace press control-C</p>
<p>To display the system calls being executed<br />
$ strace -p &lt;pid&gt;</p>
<p>or </p>
<p>To display a summary of system calls being executed<br />
$ strace -cfo &lt;logfile&gt; -p &lt;pid&gt;</p>
<p>Example: In this example smon process was being traced<br />
$ strace -p 1234<br />
Process 1234 attached &#8211; interrupt to quit<br />
getrusage(RUSAGE_SELF, (ru&#8230;.<br />
getrusage(RUSAGE_SELF, (ru&#8230;.<br />
Pressed &lt;control-C&gt;</p>
<p>$ strace -cfo smon_strace.log -p 1234<br />
Process 1234 attached &#8211; interrupt to quit<br />
Process 1234 detached<br />
Pressed &lt;control-C&gt; to detach.</p>
<p>$ cat smon_strace.log<br />
% time     seconds  usecs/call     calls    errors syscall<br />
&#8212;&#8212; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212; &#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;-<br />
   nan    0.000000           0        22           getrusage<br />
&#8212;&#8212; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212; &#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;-<br />
100.00    0.000000                    22           total</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flimatech.com/2012/05/13/how-to-trace-a-running-process/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to see the oldest flashback available?</title>
		<link>http://blog.flimatech.com/2012/05/12/how-to-see-the-oldest-flashback-available/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-see-the-oldest-flashback-available</link>
		<comments>http://blog.flimatech.com/2012/05/12/how-to-see-the-oldest-flashback-available/#comments</comments>
		<pubDate>Sun, 13 May 2012 06:08:39 +0000</pubDate>
		<dc:creator>Amin Jaffer</dc:creator>
				<category><![CDATA[Backup & Recovery]]></category>
		<category><![CDATA[Flashback]]></category>
		<category><![CDATA[available]]></category>
		<category><![CDATA[V$FLASHBACK_DATABASE_LOG]]></category>

		<guid isPermaLink="false">http://blog.flimatech.com/?p=2012</guid>
		<description><![CDATA[Using the following query one can see the flashback data available. SELECT to_char(sysdate,&#039;YYYY-MM-DD HH24:MI&#039;) current_time, to_char(f.oldest_flashback_time, &#039;YYYY-MM-DD HH24:MI&#039;) OLDEST_FLASHBACK_TIME, (sysdate &#8211; f.oldest_flashback_time)*24*60 HIST_MIN FROM v$database d, V$FLASHBACK_DATABASE_LOG f; CURRENT_TIME OLDEST_FLASHBACK HIST_MIN &#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- 2012-04-25 07:34 2012-04-25 05:48 106.066667]]></description>
			<content:encoded><![CDATA[<p>Using the following query one can see the flashback data available.</p>
<p>SELECT to_char(sysdate,&#039;YYYY-MM-DD HH24:MI&#039;) current_time, to_char(f.oldest_flashback_time, &#039;YYYY-MM-DD HH24:MI&#039;) OLDEST_FLASHBACK_TIME,<br />
  (sysdate &#8211; f.oldest_flashback_time)*24*60 HIST_MIN FROM v$database d, V$FLASHBACK_DATABASE_LOG f;</p>
<p>CURRENT_TIME     OLDEST_FLASHBACK   HIST_MIN<br />
&#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-<br />
2012-04-25 07:34 2012-04-25 05:48 106.066667</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flimatech.com/2012/05/12/how-to-see-the-oldest-flashback-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to stop a job scheduled in DBMS_SCHEDULER?</title>
		<link>http://blog.flimatech.com/2012/05/12/how-to-stop-a-job-scheduled-in-dbms_scheduler/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-stop-a-job-scheduled-in-dbms_scheduler</link>
		<comments>http://blog.flimatech.com/2012/05/12/how-to-stop-a-job-scheduled-in-dbms_scheduler/#comments</comments>
		<pubDate>Sun, 13 May 2012 06:07:32 +0000</pubDate>
		<dc:creator>Amin Jaffer</dc:creator>
				<category><![CDATA[General DBA]]></category>
		<category><![CDATA[Scheduler]]></category>
		<category><![CDATA[DBMS_SCHEDULER]]></category>
		<category><![CDATA[stop]]></category>
		<category><![CDATA[stop_job]]></category>
		<category><![CDATA[terminate]]></category>

		<guid isPermaLink="false">http://blog.flimatech.com/?p=2010</guid>
		<description><![CDATA[Using sys.dbms_scheduler.STOP_JOB one can stop scheduled job. SQL&#62; exec sys.dbms_scheduler.STOP_JOB(job_name=&#62;&#039;SYS.ORA$AT_OS_OPT_SY_12856&#039;, force=&#62;true); Output: PL/SQL procedure successfully completed. If it can&#8217;t find the job then you may see the following error, in the example below I hadn&#8217;t specified the user to it was looking for the job as the current user. ORA-27475: &#8220;DBAUSER.ORA$AT_OS_OPT_SY_12856&#8243; must be a job [...]]]></description>
			<content:encoded><![CDATA[<p>Using sys.dbms_scheduler.STOP_JOB one can stop scheduled job.</p>
<p>SQL&gt; exec sys.dbms_scheduler.STOP_JOB(job_name=&gt;&#039;SYS.ORA$AT_OS_OPT_SY_12856&#039;, force=&gt;true);</p>
<p>Output:<br />
PL/SQL procedure successfully completed.</p>
<p>If it can&#8217;t find the job then you may see the following error, in the example below I hadn&#8217;t specified the user to it was looking for the job as the current user.<br />
ORA-27475: &#8220;DBAUSER.ORA$AT_OS_OPT_SY_12856&#8243; must be a job<br />
ORA-06512: at &#8220;SYS.DBMS_ISCHED&#8221;, line 199<br />
ORA-06512: at &#8220;SYS.DBMS_SCHEDULER&#8221;, line 557<br />
ORA-06512: at line 1</p>
<p>To see jobs running <a href='http://oraclespin.wordpress.com/2010/05/08/dba_scheduler_running_jobs/' target='_blank'>http://oraclespin.wordpress.com/2010/05/08/dba_scheduler_running_jobs/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flimatech.com/2012/05/12/how-to-stop-a-job-scheduled-in-dbms_scheduler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>dba_jobs and interval</title>
		<link>http://blog.flimatech.com/2012/05/12/dba_jobs-and-interval/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dba_jobs-and-interval</link>
		<comments>http://blog.flimatech.com/2012/05/12/dba_jobs-and-interval/#comments</comments>
		<pubDate>Sun, 13 May 2012 06:03:52 +0000</pubDate>
		<dc:creator>Amin Jaffer</dc:creator>
				<category><![CDATA[General DBA]]></category>
		<category><![CDATA[Scheduler]]></category>
		<category><![CDATA[dba_jobs]]></category>
		<category><![CDATA[dbms_jobs.manage.schedule]]></category>
		<category><![CDATA[Internal]]></category>

		<guid isPermaLink="false">http://blog.flimatech.com/?p=2008</guid>
		<description><![CDATA[Few examples of some scenarios of setting intervals for dba_jobs. Note: Updating the interval will not update the NEXT_DATE run of the job until the job runs. Setting a job to run every monday at 10:00 am SQL&#62; exec dbms_job.interval(5, &#039;TRUNC(NEXT_DAY(SYSDATE, &#039;&#039;MONDAY&#039;&#039;))+(10/24)&#039;); SQL&#62; commit; &#8211; assume job was run and this SQL was run after [...]]]></description>
			<content:encoded><![CDATA[<p>Few examples of some scenarios of setting intervals for dba_jobs. Note: Updating the interval will not update the NEXT_DATE run of the job until the job runs.</p>
<p><b>Setting a job to run every monday at 10:00 am</b><br />
SQL&gt; exec dbms_job.interval(5, &#039;TRUNC(NEXT_DAY(SYSDATE, &#039;&#039;MONDAY&#039;&#039;))+(10/24)&#039;);<br />
SQL&gt; commit;</p>
<p>&#8211; assume job was run and this SQL was run after it was run<br />
SQL&gt; SELECT job, interval, next_date FROM dba_jobs where job = 5;<br />
       JOB NEXT_DATE<br />
&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
        5 19-MAR-2012 10:00:00</p>
<p><b>Setting a job to run every hour on the 1/2 hour</b><br />
SQL&gt; exec dbms_job.interval(5, &#039;TRUNC(SYSDATE, &#039;&#039;HH&#039;&#039;)+(1.5/24)&#039;);<br />
SQL&gt; commit;</p>
<p><b>Setting a job to run every hour after the last time the job was started</b><br />
SQL&gt; exec dbms_job.interval(5, &#039;SYSDATE+(1/24)&#039;);<br />
SQL commit;<br />
&#8211; assume job was run and this SQL was run after it was run, the time NEXT_DATE would be a hour after the job was last started.<br />
SQL&gt; SELECT job, interval, next_date FROM dba_jobs where job = 5;<br />
       JOB NEXT_DATE<br />
&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
        5 15-MAR-2012 22:45:00</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flimatech.com/2012/05/12/dba_jobs-and-interval/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using sys.dbms_iob one can manage jobs in dba_jobs.</title>
		<link>http://blog.flimatech.com/2012/05/12/using-sys-dbms_iob-one-can-manage-jobs-in-dba_jobs/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-sys-dbms_iob-one-can-manage-jobs-in-dba_jobs</link>
		<comments>http://blog.flimatech.com/2012/05/12/using-sys-dbms_iob-one-can-manage-jobs-in-dba_jobs/#comments</comments>
		<pubDate>Sun, 13 May 2012 06:02:31 +0000</pubDate>
		<dc:creator>Amin Jaffer</dc:creator>
				<category><![CDATA[General DBA]]></category>
		<category><![CDATA[Scheduler]]></category>
		<category><![CDATA[dbms_ijob]]></category>
		<category><![CDATA[execute]]></category>
		<category><![CDATA[interval]]></category>
		<category><![CDATA[modify]]></category>
		<category><![CDATA[next_date]]></category>

		<guid isPermaLink="false">http://blog.flimatech.com/?p=2006</guid>
		<description><![CDATA[DBMS_JOB allows one to create/manage jobs under user who has logged but using sys.dbms_ijob one can manage jobs all jobs scheduled in DBA_JOBS. Here are some of the functions available in sys.dbms_ijob. To execute/run job: You don&#8217;t have to be an owner of the job SQL&#62; exec sys.dbms_ijob.run(5); If one tried executing the job not [...]]]></description>
			<content:encoded><![CDATA[<p>DBMS_JOB allows one to create/manage jobs under user who has logged but using sys.dbms_ijob one can manage jobs all jobs scheduled in DBA_JOBS.</p>
<p>Here are some of the functions available in sys.dbms_ijob.<br />
<b>To execute/run job:  You don&#8217;t have to be an owner of the job</b><br />
SQL&gt; exec sys.dbms_ijob.run(5);</p>
<p>If one tried executing the job not owned by the user using DBMS_JOB, one can&#8217;t run it and you will get the following error &#8220;ORA-23421: job number 21 is not a job in the job queue&#8221;</p>
<p><b>To enable/disable job:</b><br />
&#045;&#045; to disable a job. Note one should set this when the job is not running by checking DBA_JOBS_RUNNING, because if the job is running you will have to wait till it finishes before disabling it and it has to be followed by a commit.<br />
SQL&gt; exec sys.dbms_ijob.broken(5, true);<br />
SQL&gt; commit;</p>
<p>&#045;&#045;  Note the next_date value it initialized when the job is broken.<br />
SQL&gt; select broken, next_date from dba_jobs where job = 5;</p>
<p>B TO_CHAR(NEXT_DATE,&#8217;D<br />
- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Y 01-JAN-4000 00:00:00</p>
<p>&#045;&#045; to enable a job, note it has to be followed by a commit and after the job is enabled the NEXT_DATE is updated based on the value of interval.<br />
SQL&gt; exec sys.dbms_ijob.broken(5, false);<br />
SQL&gt; commit;</p>
<p>SQL&gt; select  broken, next_date from dba_jobs where job in ( 5 );</p>
<p>B TO_CHAR(NEXT_DATE,&#8217;D<br />
- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
N 11-MAR-2012 19:31:45</p>
<p><b>To change the next date the job runs, again note if the job is running when one modifies this, it will get reset to the next interval instead of the value specified.</b><br />
SQL&gt; exec sys.dbms_ijob.next_date(5, sysdate + 1);<br />
SQL commit;</p>
<p>SQL&gt; select next_date from dba_jobs where job in ( 5 );</p>
<p>B TO_CHAR(NEXT_DATE,&#8217;D<br />
- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
N 12-MAR-2012 19:41:27</p>
<p><b>To change the interval</b><br />
Example below changes the interval to run every Monday at midnight<br />
SQL&gt; exec sys.dbms_ijob.interval(5, &#039;TRUNC(NEXT_DAY(sysdate, &#039;&#039;MONDAY&#039;&#039;))&#039;);<br />
PL/SQL procedure successfully completed.<br />
SQL&gt; commit;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flimatech.com/2012/05/12/using-sys-dbms_iob-one-can-manage-jobs-in-dba_jobs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to tell/find if the instance is Primary/Standby?</title>
		<link>http://blog.flimatech.com/2012/05/12/how-to-tellfind-if-the-instance-is-primarystandby/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-tellfind-if-the-instance-is-primarystandby</link>
		<comments>http://blog.flimatech.com/2012/05/12/how-to-tellfind-if-the-instance-is-primarystandby/#comments</comments>
		<pubDate>Sun, 13 May 2012 06:01:05 +0000</pubDate>
		<dc:creator>Amin Jaffer</dc:creator>
				<category><![CDATA[Dataguard]]></category>
		<category><![CDATA[General DBA]]></category>
		<category><![CDATA[database_mode]]></category>
		<category><![CDATA[PHYSICAL STANDBY]]></category>
		<category><![CDATA[primary]]></category>
		<category><![CDATA[standby]]></category>

		<guid isPermaLink="false">http://blog.flimatech.com/?p=2004</guid>
		<description><![CDATA[By querying v$database one can tell if the host is primary or standby For primary testdb&#62; select database_role from v$database; DATABASE_ROLE &#8212;&#8212;&#8212;&#8212;&#8212;- PRIMARY For Standby &#8211; Note you may need to connect to as sys as sysdba if the instance is in mount state testd&#62; select database_role from v$database; DATABASE_ROLE &#8212;&#8212;&#8212;&#8212;&#8212;- PHYSICAL STANDBY OR On [...]]]></description>
			<content:encoded><![CDATA[<p>By querying v$database one can tell if the host is primary or standby</p>
<p><b>For primary</b><br />
testdb&gt; select database_role from v$database;</p>
<p>DATABASE_ROLE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
PRIMARY</p>
<p><b>For Standby &#8211; Note you may need to connect to as sys as sysdba if the instance is in mount state</b><br />
testd&gt; select database_role from v$database;</p>
<p>DATABASE_ROLE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
PHYSICAL STANDBY</p>
<p><b>OR</b><br />
On Primary database the value of controlfile_type in V$database is &#8220;CURRENT&#8221; and standby is &#8220;STANDBY&#8221;</p>
<p>Value on Primary:<br />
SQL&gt; SELECT controlfile_type FROM V$database;</p>
<p>CONTROL<br />
&#8212;&#8212;&#8211;<br />
CURRENT</p>
<p>Value on Standby:<br />
SQL&gt; SELECT controlfile_type FROM V$database;</p>
<p>CONTROL<br />
&#8212;&#8212;&#8211;<br />
STANDBY</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flimatech.com/2012/05/12/how-to-tellfind-if-the-instance-is-primarystandby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dataguard ORA-16817</title>
		<link>http://blog.flimatech.com/2012/05/12/dataguard-ora-16817/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dataguard-ora-16817</link>
		<comments>http://blog.flimatech.com/2012/05/12/dataguard-ora-16817/#comments</comments>
		<pubDate>Sun, 13 May 2012 05:53:02 +0000</pubDate>
		<dc:creator>Amin Jaffer</dc:creator>
				<category><![CDATA[Dataguard]]></category>
		<category><![CDATA[General DBA]]></category>
		<category><![CDATA[dataguard]]></category>
		<category><![CDATA[log_archive_max_processes]]></category>
		<category><![CDATA[ORA-16817]]></category>
		<category><![CDATA[SYNCHRONIZED]]></category>
		<category><![CDATA[unsynchronized]]></category>

		<guid isPermaLink="false">http://blog.flimatech.com/?p=2002</guid>
		<description><![CDATA[If you have an issue where the server where standby resides had to be restarted and when you try to enable Fast Start Failover, it wouldn&#8217;t enable due to ORA-16608 and when checking the primary database in dataguard it would return ORA-16817 &#8220;unsynchronized fast-start failover configuration&#8221; Example: $ dgmgrl / DGMGRL&#62; enable configuration Enabled. DGMGRL&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>If you have an issue where the server where standby resides had to be restarted and when you try to enable Fast Start Failover, it wouldn&#8217;t enable due to ORA-16608 and when checking the primary database in dataguard it would return ORA-16817 &#8220;unsynchronized fast-start failover configuration&#8221;</p>
<p>Example:<br />
$ dgmgrl /<br />
DGMGRL&gt; enable configuration<br />
Enabled.<br />
DGMGRL&gt; show configuration verbose<br />
Configuration<br />
  Name:                FSF<br />
  Enabled:             YES<br />
  Protection Mode:     MaxAvailability<br />
  Databases:<br />
    testdb_a &#8211; Primary database<br />
    testdb_b &#8211; Physical standby database</p>
<p>Fast-Start Failover: DISABLED<br />
Current status for &#8220;FSF&#8221;:<br />
Warning: ORA-16608: one or more databases have warnings</p>
<p>So upon checking both the databases, the primary would report the following warning ORA-16817 and Standby was fine.<br />
DGMGRL&gt; SHOW DATABASE VERBOSE testdb_a<br />
..<br />
Current status for &#8220;testdb_a&#8221;:<br />
Warning: ORA-16817: unsynchronized fast-start failover configuration.</p>
<p>Also then checking the primary it returned the following:<br />
On Primary:<br />
SQL&gt; select PROTECTION_LEVEL, FS_FAILOVER_STATUS from v$database;<br />
PROTECTION_LEVEL     FS_FAILOVER_STATUS<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
RESYNCHRONIZATION    UNSYNCHRONIZED</p>
<p>And checking V$archived_log</p>
<p>select * from (<br />
   select sequence#,dest_id,first_time,archived,applied,completion_time, name<br />
      from v$archived_log<br />
     where applied = &#8216;YES&#8217;<br />
    order by first_time desc<br />
);</p>
<p>SEQUENCE#    DEST_ID FIRST_TIM ARC APPLIED   COMPLETIO  NAME<br />
&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212; &#8212; &#8212;&#8212;&#8212; &#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
&#8230;<br />
     15321          2 03-MAR-12 YES NO        03-MAR-12 testdb_b.amazon<br />
     15321          1 03-MAR-12 YES NO        03-MAR-12 /arch/testdb/redolog-15321-1.arc<br />
     15320          1 03-MAR-12 YES NO        03-MAR-12 /arch/testdb/redolog-15320-1.arc<br />
     15319          2 03-MAR-12 YES NO        03-MAR-12 testdb_b.amazon<br />
     15319          1 03-MAR-12 YES NO        03-MAR-12 /arch/testdb/redolog-15319-1.arc<br />
     15318          2 03-MAR-12 YES YES       03-MAR-12 avm1na_b.amazon<br />
     15318          1 03-MAR-12 YES NO        03-MAR-12 /arch/testdb/redolog-15318-1.arc<br />
..</p>
<p>If you see above there is a gap for redo log sequence# 15320 and due to which primary is in the Resynchronization state and when one does a logfile switch on primary, it transmits the redo log to standby and standby applies the archive log (by monitoring the alert log of standby).</p>
<p>So fix this issue, resetting the value of log_archive_max_processes would fix the synchronize issue i.e. update FS_FAILOVER_STATUS to SYNCHRONIZED and update the protection_level in v$database.</p>
<p>SQL&gt; show parameters log_archive_max_processes;<br />
log_archive_max_processes   integer     4</p>
<p>SQL&gt; alter system set log_archive_max_processes=1;<br />
System altered.</p>
<p>SQL&gt; alter system set log_archive_max_processes=4;<br />
System altered.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flimatech.com/2012/05/12/dataguard-ora-16817/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to suspend all jobs from executing in dba_jobs?</title>
		<link>http://blog.flimatech.com/2012/05/12/how-to-suspend-all-jobs-from-executing-in-dba_jobs/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-suspend-all-jobs-from-executing-in-dba_jobs</link>
		<comments>http://blog.flimatech.com/2012/05/12/how-to-suspend-all-jobs-from-executing-in-dba_jobs/#comments</comments>
		<pubDate>Sun, 13 May 2012 05:50:05 +0000</pubDate>
		<dc:creator>Amin Jaffer</dc:creator>
				<category><![CDATA[General DBA]]></category>
		<category><![CDATA[Scheduler]]></category>
		<category><![CDATA[dba_jobs]]></category>
		<category><![CDATA[job_queue_processes]]></category>
		<category><![CDATA[pause]]></category>
		<category><![CDATA[suspend]]></category>

		<guid isPermaLink="false">http://blog.flimatech.com/?p=2000</guid>
		<description><![CDATA[By setting the value of 0 to the parameter &#8220;job_queue_processes&#8221; one can suspend all jobs from executing in DBA_JOBS. The value of this parameter can be changed without instance restart. &#045;&#045; see current value of the parameter SQL&#62; show parameter job_queue_processes; NAME TYPE VALUE &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211; job_queue_processes integer 1000 &#045;&#045; Set the value of [...]]]></description>
			<content:encoded><![CDATA[<p>By setting the value of 0 to the parameter &#8220;job_queue_processes&#8221; one can suspend all jobs from executing in DBA_JOBS.  The value of this parameter can be changed without instance restart.</p>
<p>&#045;&#045; see current value of the parameter<br />
SQL&gt; show parameter job_queue_processes;</p>
<p>NAME                                 TYPE        VALUE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211;<br />
job_queue_processes                  integer     1000</p>
<p>&#045;&#045; Set the value of the parameter in memory, which will suspend jobs from starting<br />
SQL&gt; alter system set job_queue_processes=0 scope=memory;</p>
<p>System altered.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flimatech.com/2012/05/12/how-to-suspend-all-jobs-from-executing-in-dba_jobs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

