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

<channel>
	<title>Oracle DBA in KSA</title>
	<atom:link href="http://ksadba.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ksadba.wordpress.com</link>
	<description>Living &#38; Wokring in Kingdom of Saudi Arabia</description>
	<lastBuildDate>Wed, 24 Jun 2009 06:02:19 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='ksadba.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/4643d962d4a772772f1e9a4335e7db87?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Oracle DBA in KSA</title>
		<link>http://ksadba.wordpress.com</link>
	</image>
			<item>
		<title>Tuning PL/SQL with Multithreading &amp; DBMS_SCHEDULER</title>
		<link>http://ksadba.wordpress.com/2009/05/26/tuning-plsql-with-multithreading-dbms_scheduler/</link>
		<comments>http://ksadba.wordpress.com/2009/05/26/tuning-plsql-with-multithreading-dbms_scheduler/#comments</comments>
		<pubDate>Tue, 26 May 2009 07:17:37 +0000</pubDate>
		<dc:creator>ksadba</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[dbms_scheduler]]></category>
		<category><![CDATA[Multithreading]]></category>
		<category><![CDATA[PL/SQL]]></category>

		<guid isPermaLink="false">http://ksadba.wordpress.com/?p=209</guid>
		<description><![CDATA[We had a piece of PL/SQL code that copies data from remote view to a local table. This code executes once a day and took about 4 hours. As if this is not bad enough, we received a request to run this piece of code 3-4 times daily which will total up to about 16 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=209&subd=ksadba&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>We had a piece of PL/SQL code that copies data from remote view to a local table. This code executes once a day and took about 4 hours. As if this is not bad enough, we received a request to run this piece of code 3-4 times daily which will total up to about 16 hours per day.</p>
<p>The original code to copy data from a remote view consists of 3 steps:</p>
<ol>
<li>Copy over employee numbers (one column only) from remote view to local temp table. This step takes few seconds only.</li>
<li>Use employee numbers copied locally to do a lookup serially (lookup row by row) from remote view. This step takes about 4 hours to copy 20,000 rows. The reason it takes that long is one column from the view is an actual function. Most of the time is spent executing this function and for so many reasons (not all are technical) we can’t get to function to tune it.</li>
<li>Commit one time at the end.</li>
</ol>
<p>Here how the original code looks like:</p>
<p><span style="color:#008000;">&#8211; Step 1:<br />
&#8211; truncate local temp table so we can copy employee numbers<br />
&#8211; copy over employees numbers to local temp table from the remote view </span></p>
<pre class="brush: css;">
execute immediate 'truncate table temp_emp_no';
execute immediate 'truncate table employees';

insert into temp_emp_no select distinct EMPLOYEE_NUMBER from remote_employee_view@remote_link;
commit;
</pre>
</p>
<p><span style="color:#008000;">&#8211; Step 2:<br />
&#8211; Loop through copied over employee numbers and do a remote lookup 1 row at a time</span></p>
<pre class="brush: css;">
cursor c1 is
   select emp_no from temp_emp_no;

for i in c1 loop
   exit when c1%notfound;
   insert into employees
   select EMPLOYEE_NUMBER, first_name, last_name, RATE, PERIOD, total_rate
     from remote_employee_view@remote_link;
   where EMPLOYEE_NUMBER = i.emp_no;
end loop;

commit;
</pre>
<p>At this point we were left with one option only which is run the PL/SQL code in parallel (multithreading), but as you might now, PL/SQL doesn’t support multithreading natively,</p>
<p>To simulate multithreading we need to accomplish 2 steps:</p>
<ol>
<li>Break the job in multiple pieces (threads).</li>
<li>Schedule every thread to run concurrently.</li>
</ol>
<p>Remember first step which is coping employee numbers only from remote view to local table. We hash-partitioned this local table into 4 partitions. Each of these partitions will translate into a thread as you will see.</p>
<pre class="brush: css;">
CREATE TABLE vb_emp_no
   (emp_no  VARCHAR2(30))
    PARTITION BY HASH (EMP_NO)
     PARTITIONS 4
/
</pre>
<p>This is the thread code (stored procedure) which takes in a partition name as a parameter and copies employee data from remote view for that partition only.</p>
<pre class="brush: css;">
CREATE procedure refresh_employee_data_part (p_name in varchar2 )
  authid definer
is
  TYPE EmpCurTyp  IS REF CURSOR;
  v_emp_cursor    EmpCurTyp;
  sql_stmt varchar2(2048);
  v_emp_no varchar2(30);

begin
  sql_stmt := 'select emp_no from vb_emp_no partition(' || p_name || ')';
  open v_emp_cursor for sql_stmt ;

loop
  fetch v_emp_cursor into v_emp_no;
  EXIT WHEN v_emp_cursor%NOTFOUND;
  insert into employees
          (EMPLOYEE_NUMBER,
           VACATION_BALANCE,
           RATE, PERIOD, TOTAL_RATE)
  select distinct employee_number, vacation_balance, rate, period, total_rate
    from   remote_employee_view@remote_link;
  where  EMPLOYEE_NUMBER = v_emp_no;
end loop;

commit;
close v_emp_cursor;
end;
/
</pre>
<p>This procedure glues all parts together. We schedule the previous procedure 4 times and achieve concurrency.</p>
<pre class="brush: css;">
CREATE procedure refresh_employees
  authid definer
is
begin
  execute immediate 'truncate table vb_emp_no';
  insert into vb_emp_no
  select distinct employee_number from remote_view@db_link;
  commit;
  execute immediate 'truncate table employees';

dbms_scheduler.create_job(job_name =&gt; dbms_scheduler.generate_job_name('VB_P1_'),
   job_type =&gt; 'PLSQL_BLOCK',
   job_action =&gt; 'begin refresh_employee_data_part(''VB_EMP_NO_P1''); end;',
   comments =&gt; 'Thread 1 to refresh employees',
   enabled =&gt; true,
   auto_drop =&gt; true);

dbms_scheduler.create_job(job_name =&gt; dbms_scheduler.generate_job_name('VB_P2_'),
   job_type =&gt; 'PLSQL_BLOCK',
   job_action =&gt; 'begin refresh_employee_data_part(''VB_EMP_NO_P2''); end;',
   comments =&gt; 'Thread 2 to refresh employees',
   enabled =&gt; true,
   auto_drop =&gt; true);

dbms_scheduler.create_job(job_name =&gt; dbms_scheduler.generate_job_name('VB_P3_'),
   job_type =&gt; 'PLSQL_BLOCK',
   job_action =&gt; 'begin refresh_employee_data_part(''VB_EMP_NO_P3''); end;',
   comments =&gt; 'Thread 3 to refresh employees',
   enabled =&gt; true,
   auto_drop = true);

dbms_scheduler.create_job(job_name =&gt; dbms_scheduler.generate_job_name('VB_P4_'),
   job_type =&gt; 'PLSQL_BLOCK',
   job_action =&gt; 'begin refresh_employee_data_part(''VB_EMP_NO_P4''); end;',
   comments =&gt; 'Thread 4 to refresh employees,
   enabled =&gt; true,
   auto_drop =&gt; true);

end;
/
</pre>
<p>The procedure would finish immediately even if there are errors. To check the execution status look under DBA_SCHEDULER_JOB_RUN_DETAILS to look for errors and running time.</p>
<h2 style="text-align:center;"><span style="color:#000080;">End Result the job finished in 50 minutes more than 4x faster.</span></h2>
<p><em>Hazem Ameen<br />
Senior Oracle DBA</em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ksadba.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ksadba.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ksadba.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ksadba.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ksadba.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ksadba.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ksadba.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ksadba.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ksadba.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ksadba.wordpress.com/209/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=209&subd=ksadba&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ksadba.wordpress.com/2009/05/26/tuning-plsql-with-multithreading-dbms_scheduler/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eda39a036b3ab7f1ff7462687db4c6f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ksadba</media:title>
		</media:content>
	</item>
		<item>
		<title>Virtual Private Database (VPD) Column Masking Simple Example</title>
		<link>http://ksadba.wordpress.com/2009/04/22/virtual-private-database-vpd-column-masking-simple-example/</link>
		<comments>http://ksadba.wordpress.com/2009/04/22/virtual-private-database-vpd-column-masking-simple-example/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 06:23:04 +0000</pubDate>
		<dc:creator>ksadba</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[column masking]]></category>
		<category><![CDATA[dbms_rls]]></category>
		<category><![CDATA[Virtual private database]]></category>
		<category><![CDATA[vpd]]></category>

		<guid isPermaLink="false">http://ksadba.wordpress.com/?p=200</guid>
		<description><![CDATA[Column masking is a simple way to hide you valuable data from certain users without having to apply encrypt/decrypt techniques and increase the column width to accommodate the new string like the old times. Through some simple configuration you can create policies to show your important columns as null without rewriting a single line of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=200&subd=ksadba&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Column masking is a simple way to hide you valuable data from certain users without having to apply encrypt/decrypt techniques and increase the column width to accommodate the new string like the old times. Through some simple configuration you can create policies to show your important columns as null without rewriting a single line of code on your application side.</p>
<p>There are 3 steps for accomplish column masking:</p>
<ol>
<li> A function to be used by the policy (function policy) created in next step.</li>
<li> Use dbms_rls package to create the policy.</li>
<li> Assign “exempt access policy” to users to be excluded from the policy. These users can see all data with no masking.</li>
</ol>
<h2><span style="color:#000000;">Step 1: Create Function Policy</span></h2>
<p>This function will be called be the policy to create the column masking. Function name can be any name you select. In my case I called vpd_function. If predicate evaluated to true, then data will to show to all users. In my case I made sure that function will always evaluate to false by looking for (rowid = 0) which will never be true. I suggest creating the function under system account.</p>
<pre class="brush: css;">
CREATE OR REPLACE
FUNCTION vpd_function (obj_owner IN VARCHAR2, obj_name IN VARCHAR2)
RETURN VARCHAR2
AS
BEGIN
RETURN 'rowid = ''0''';
END vpd_function;
/
</pre>
<h2><span style="color:#000000;">Step 2: Create Policy</span></h2>
<pre class="brush: css;">
BEGIN
DBMS_RLS.ADD_POLICY(object_schema=&gt; 'SCOTT',
object_name=&gt; 'EMP',
policy_name=&gt; 'scott_emp_policy',
function_schema=&gt; 'SYSTEM',
policy_function=&gt; 'vpd_function',
sec_relevant_cols=&gt; 'JOB',
policy_type =&gt; DBMS_RLS.SHARED_STATIC,
sec_relevant_cols_opt=&gt; dbms_rls.ALL_ROWS);

END;
/
</pre>
<h2><span style="color:#000000;">Step 3: Exclude Some Users from Policy</span></h2>
<p>Users who need to see all the data without any masking need to be granted  “exempt access policy”</p>
<h2><span style="color:#000000;">Notes:</span></h2>
<ul>
<li>Dropping a table that has a policy will drop the policy but not the function policy.</li>
<li>Renaming the table will NOT drop the policy or disable it. The policy will remain active.</li>
<li>Export/Import will also export/import the policy along with the table, but will not export/import the function policy.</li>
<li>When exporting a table under a policy, make sure the user exporting the table has “exempt access policy” grant, otherwise, the column under the policy will always be null and column data will be lost.</li>
</ul>
<h2><span style="color:#000000;">Some Important Views</span></h2>
<p>dba_policies<br />
v$vpd_policy</p>
<p><em>Hazem Ameen<br />
Senior Oracle DBA</em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ksadba.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ksadba.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ksadba.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ksadba.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ksadba.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ksadba.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ksadba.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ksadba.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ksadba.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ksadba.wordpress.com/200/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=200&subd=ksadba&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ksadba.wordpress.com/2009/04/22/virtual-private-database-vpd-column-masking-simple-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eda39a036b3ab7f1ff7462687db4c6f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ksadba</media:title>
		</media:content>
	</item>
		<item>
		<title>SPFILE Backup &amp; Restore Recommendations</title>
		<link>http://ksadba.wordpress.com/2009/03/14/spfile-backup-and-recovery/</link>
		<comments>http://ksadba.wordpress.com/2009/03/14/spfile-backup-and-recovery/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 13:00:44 +0000</pubDate>
		<dc:creator>ksadba</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[backup spfile]]></category>
		<category><![CDATA[controlfile autobackup]]></category>
		<category><![CDATA[restore spfile]]></category>
		<category><![CDATA[rman]]></category>
		<category><![CDATA[RMAN-06564]]></category>
		<category><![CDATA[Spfile autobackup]]></category>

		<guid isPermaLink="false">http://ksadba.wordpress.com/?p=185</guid>
		<description><![CDATA[I&#8217;m always amazed as how a little file as the SPFILE can complicate situations &#8220;when you can really use a break&#8221;. For example, you shutdown your database gracefully just to find out that you can&#8217;t bring it up again due to the fact that you have bad parameters in your SPFILE or the file somehow [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=185&subd=ksadba&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m always amazed as how a little file as the SPFILE can complicate situations &#8220;when you can really use a break&#8221;. For example, you shutdown your database gracefully just to find out that you can&#8217;t bring it up again due to the fact that you have bad parameters in your SPFILE or the file somehow got deleted and you just came to find out. So you want to recover a backup copy of SPFILE, that&#8217;s when you discover that you don&#8217;t really know how Oracle is backing up your SPFILE, where the file is (disk, tape or both) and how to recover it.</p>
<p>I hope this post will answer all these questions.</p>
<p><strong>SPFILE Backup</strong></p>
<p>Our design goal is to have 2 backups of SPFILE: 1 on disk and the other backup on tape. This way you can first attempt to recover from disk which is faster, if you can&#8217;t then try the tape.</p>
<p>Here are the steps to accomplish our design (<em>Tested in 10.2.0.4 Linux 64-bit)</em>:</p>
<p><strong>1) </strong><strong>Enable control file auto backup to disk. </strong></p>
<p>Every time a change is made to control file, an auto backup will take place of both control file and SPFILE. Unfortunately SPFILE changes by itself don&#8217;t constitute an auto backup. In addition to auto backups when control file changes, every time you have a backup statement in your RMAN script (ex. backup database plus archive), an auto backup will be generated.</p>
<p>To enable control file auto backup:</p>
<p>rman&gt; CONFIGURE CONTROLFILE AUTOBACKUP ON;</p>
<p>You can send your auto backups to anywhere on disk. The default is $ORACLE_HOME/dbs. I prefer sending auto backups to FRA (especially in a RAC environment). You can read about how to set up FRA and send auto backups to it <a title="here" href="http://ksadba.wordpress.com/2008/10/19/database-flashback-configuration-and-tips-for-rac/">here</a>.</p>
<p>Here is an example of sending auto backups to a specific location on disk:</p>
<p>CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO &#8216;/u04/backups/auto/%F&#8217;;</p>
<p>Now you accomplished first design goal which is backup SPFILE to disk.</p>
<p><strong>2) </strong><strong>Include SPFILE in your RMAN backup sets to tape. </strong></p>
<p>The default behavior when you enable auto backup is NOT to backup SPFILE in RMAN backup pieces. To overwrite this behavior, this RMAN statement will create backup piece for SPFILE and implicitly create an auto backup on disk as configured in previous step.</p>
<p>backup<br />
incremental level 0<br />
spfile format &#8217;spfile_%d_%s_%T.bak&#8217;  tag &#8217;spfile backup&#8217;<br />
database include current controlfile format &#8216;data_%d_%s_%T.bak&#8217;  tag &#8216;data backup&#8217;<br />
archivelog all format &#8216;arc_%d_%s_%T.bak&#8217;  tag &#8216;archive backup&#8217; delete input;</p>
<p>Now we accomplished second step which is backing up SPFILE to tape with your daily rman backup.</p>
<p><strong>Recovery Scenarios</strong></p>
<p>Here are the most common recovery scenarios I came across, remember Oracle will not recover an SPFILE file to its original location while the database is up even if SPFILE is deleted. You will get <em>&#8220;RMAN-06564 must use the TO clause when the instance is started with SPFILE&#8221;</em>, error message is a little confusing. So simply recover to a different location and do &#8220;cp&#8221;.</p>
<p><strong>A) </strong><strong>Recover latest SPFILE while database down</strong></p>
<p>set dbid <em>&lt;your DBID&gt;</em></p>
<p>startup nomount;</p>
<p>restore spfile from autobackup;</p>
<p>shutdown immediate</p>
<p>startup</p>
<p><strong>B) </strong><strong>Recover from auto backup in Flashback Recovery Area, database up</strong></p>
<p>This is RAC/ASM with FRA placed in ASM</p>
<p>RMAN&gt; restore spfile to &#8216;<em>&lt;path with filename&gt;</em>&#8216; from autobackup;<br />
Starting restore at 11-MAR-09<br />
allocated channel: ORA_DISK_1<br />
channel ORA_DISK_1: sid=128 instance=raca1 devtype=DISK<br />
recovery area destination: +ARCDG<br />
database name (or database unique name) used for search: RACA<br />
channel ORA_DISK_1: autobackup found in the recovery area<br />
channel ORA_DISK_1: autobackup found: +arcdg/RACA/AUTOBACKUP/2009_03_11/s_681250817.257.681250819</p>
<p>channel ORA_DISK_1: SPFILE restore from autobackup complete<br />
Finished restore at 11-MAR-09</p>
<p>Another syntax is to accomplish the same thing:</p>
<p>restore spfile to pfile &#8216;&lt;path and filename&gt;&#8217; from autobackup db_recovery_file_dest=&#8217;+ARCDG&#8217; db_name=&#8217;&lt;your db name&gt;&#8217;;</p>
<p><strong>C) </strong><strong>Recover a specific backup of SPFILE</strong></p>
<p>This is useful if you have bad parameters in your SPFILE and want to recover an older cleaner copy (SPFILE point in time recovery, now how about that )</p>
<p>list backup of spfile;</p>
<p># select proper backup piece</p>
<p>restore spfile to &#8216;&lt;path and filename except original location when DB started&gt; from &#8216;&lt;backup piece or auto backup&gt;&#8217;;</p>
<p><strong>D) </strong><strong>Recover an SPFILE to PFILE</strong></p>
<p><strong> </strong></p>
<p>Always useful if you want to read content of your parameter file.</p>
<p>restore spfile to pfile &#8216;<em>&lt;your path and filename&gt;</em>&#8216;  from autobackup;</p>
<p><em></em><br />
<em>Hazem Ameen</em><br />
<em>Senior Oracle DBA</em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ksadba.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ksadba.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ksadba.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ksadba.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ksadba.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ksadba.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ksadba.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ksadba.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ksadba.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ksadba.wordpress.com/185/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=185&subd=ksadba&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ksadba.wordpress.com/2009/03/14/spfile-backup-and-recovery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eda39a036b3ab7f1ff7462687db4c6f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ksadba</media:title>
		</media:content>
	</item>
		<item>
		<title>Oracle Streams: SET_TAG and Capture Rules (Skip DDL &amp; DML)</title>
		<link>http://ksadba.wordpress.com/2009/01/23/oracle-streams-set_tag-and-capture-rules-skip-ddl-dml/</link>
		<comments>http://ksadba.wordpress.com/2009/01/23/oracle-streams-set_tag-and-capture-rules-skip-ddl-dml/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 11:53:59 +0000</pubDate>
		<dc:creator>ksadba</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Capture Rules]]></category>
		<category><![CDATA[dbms_streams.set_tag]]></category>
		<category><![CDATA[Oracle Streams]]></category>

		<guid isPermaLink="false">http://ksadba.wordpress.com/?p=178</guid>
		<description><![CDATA[If you ever tried to use dbms_streams.set_tag function to avoid replicating DDL or DML in your Streams environment, we’ll you unpleasantly surprised that it doesn’t work (I hope you didn’t try it on production right way ).
This post deals with steps you have to implement to get it working.
First, every entry in the redo log [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=178&subd=ksadba&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you ever tried to use dbms_streams.set_tag function to avoid replicating DDL or DML in your Streams environment, we’ll you unpleasantly surprised that it doesn’t work (I hope you didn’t try it on production right way ).</p>
<p>This post deals with steps you have to implement to get it working.</p>
<p>First, every entry in the redo log files has a tag associated with it. The default value for this tag is null. The capture process default behavior is not to check for tags at all, in other words, it will read and process every entry in the redo log regardless of it&#8217;s tag value. But what we want is for the capture process to read and process null tags only and ignore non-null tags (these are the DML or DDL that will be skipped).</p>
<p>So the question, how to change the capture process behavior so it will ignore non-null tags?<br />
The answer is by adjusting the capture rules for DML &amp; DDL (depends on whether you need to ignore both operations).</p>
<p>The following scripts assume you have the default Streams configuration without adding any additional custom rules.</p>
<p>Get Capture Rule name and rule condition.<br />
select rule_name, rule_condition<br />
from dba_streams_rules<br />
where rule_set_owner = &#8216;STRMADMIN&#8217;<br />
and streams_type = &#8216;CAPTURE&#8217;;</p>
<p>It should return 2 rows, 1 rule for DML and the other for DDL.</p>
<p>Here how the DDL capture rule looks like before changing:</p>
<p>((((:ddl.get_object_owner() = &#8217;schema name&#8217; or :ddl.get_base_table_owner() = ‘schema name&#8217;) and :ddl.get_source_database_name() = &#8216;database name&#8217; )) and (:ddl.get_compatible() &lt;= dbms_streams.compatible_10_2))</p>
<p>Now add condition to capture null tags only</p>
<p>BEGIN<br />
DBMS_RULE_ADM.ALTER_RULE (<br />
rule_name =&gt; &#8216;CWSAPP66&#8242;,<br />
condition =&gt; &#8216;((((:ddl.get_object_owner() = &#8221;CWSAPP&#8221; or :ddl.get_base_table_owner() = &#8221;CWSAPP&#8221;) and :ddl.get_source_database_name() = &#8221;CWSRD&#8221; ))<br />
and (:ddl.get_compatible() &lt;= dbms_streams.compatible_10_2) and <span style="color:#ff0000;">(:ddl.is_null_tag() = &#8221;Y&#8221;)</span>)&#8217;,<br />
evaluation_context =&gt; NULL);<br />
END;<br />
/</p>
<p>Now from a new session</p>
<p>dbms_streams.set_tag(‘01’);</p>
<p>DDL or DML changes will not get replicated</p>
<p>dbms_streams.set_tag(null); &#8212; go back to replicating everything</p>
<p>Remember if using bi-directional replication, you have to adjust capture rules in every site.</p>
<p><em>Hazem Ameen<br />
Senior Oracle DBA</em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ksadba.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ksadba.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ksadba.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ksadba.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ksadba.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ksadba.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ksadba.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ksadba.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ksadba.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ksadba.wordpress.com/178/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=178&subd=ksadba&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ksadba.wordpress.com/2009/01/23/oracle-streams-set_tag-and-capture-rules-skip-ddl-dml/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eda39a036b3ab7f1ff7462687db4c6f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ksadba</media:title>
		</media:content>
	</item>
		<item>
		<title>Would you Let Women Drive in Saudi Arabia</title>
		<link>http://ksadba.wordpress.com/2009/01/20/would-you-let-women-drive-in-saudi-arabia/</link>
		<comments>http://ksadba.wordpress.com/2009/01/20/would-you-let-women-drive-in-saudi-arabia/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 03:12:30 +0000</pubDate>
		<dc:creator>ksadba</dc:creator>
				<category><![CDATA[Life in Saudi Arabia]]></category>
		<category><![CDATA[Saudi Arabia]]></category>
		<category><![CDATA[Saudian Culture]]></category>

		<guid isPermaLink="false">http://ksadba.wordpress.com/?p=173</guid>
		<description><![CDATA[Not so long ago, I was driving my van and sitting right next to me one of the mildest tempered people I knew in my life, my wife.  However, this time, she was yelling at me saying, FOLLOW HIM, GET HIM.
 The person that made my wife yell was not a thief or an [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=173&subd=ksadba&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Not so long ago, I was driving my van and sitting right next to me one of the mildest tempered people I knew in my life, my wife.  However, this time, she was yelling at me saying, FOLLOW HIM, GET HIM.</p>
<p> The person that made my wife yell was not a thief or an attacker, but your common average driver in KSA.  The driving in Saudi is a combination of rude, aggressive, and in some cases flat out suicidal.  It definitely gets under your skin and you respond rather erratically like.</p>
<p>Back in USA people are scared of drunk drivers, but in Saudi, we are fearsome of most drivers and especially of teen drivers. There are young teens that barely can see over the wheel and driving an 8-15 passenger 4&#215;4 SUV.  It came no surprise that KSA has one of the highest car accident death rates in the world. </p>
<p>Knowing all risks involved, would you let your wife or daughter drive (if it is ever allowed)?  Even though is none of my business, but I don’t think so, not unless KSA fixes this domestic problem. Why would anybody want to take a risk on his wife’s or daughter’s life!</p>
<p>If you ever in KSA, here are some tips to help you cope with this issue:</p>
<p>Few expatriates elect not to own a car but rather relying on company’s transportation and taxis.</p>
<p>Some co-workers take longer and easier routes just to elude traffic and come to the job calmer.</p>
<p>Know the problematic routes and times of traffic congestion to avoid them.</p>
<p>Remind yourself to always remain calm. This is one fight you can’t really win.</p>
<p>Most expatriates buy 4&#215;4 SUVs; they are safer in case car accidents (God forbid).</p>
<p>Drive defensively, can’t stress this point enough.</p>
<p><em>Hazem Ameen</em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ksadba.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ksadba.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ksadba.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ksadba.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ksadba.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ksadba.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ksadba.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ksadba.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ksadba.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ksadba.wordpress.com/173/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=173&subd=ksadba&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ksadba.wordpress.com/2009/01/20/would-you-let-women-drive-in-saudi-arabia/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eda39a036b3ab7f1ff7462687db4c6f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ksadba</media:title>
		</media:content>
	</item>
		<item>
		<title>How to use Fine Grained Auditing (FGA) to Identify Unused Tables in Oracle 10g</title>
		<link>http://ksadba.wordpress.com/2009/01/15/how-to-use-fine-grained-auditing-fga-to-identify-unused-tables-in-oracle-10g/</link>
		<comments>http://ksadba.wordpress.com/2009/01/15/how-to-use-fine-grained-auditing-fga-to-identify-unused-tables-in-oracle-10g/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 03:58:46 +0000</pubDate>
		<dc:creator>ksadba</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Audit]]></category>
		<category><![CDATA[DBA_FGA_AUDIT_TRAIL]]></category>
		<category><![CDATA[dbms_fga]]></category>
		<category><![CDATA[FGA]]></category>

		<guid isPermaLink="false">http://ksadba.wordpress.com/?p=161</guid>
		<description><![CDATA[After years of changes made to an in-house system, it became very hard for our developers to identify which tables are no longer used. Going through hundreds of thousands of line of code and cross referencing hundreds of tables manually is not a simple task. So, and like usual, send it over to the DBA [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=161&subd=ksadba&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>After years of changes made to an in-house system, it became very hard for our developers to identify which tables are no longer used. Going through hundreds of thousands of line of code and cross referencing hundreds of tables manually is not a simple task. So, and like usual, send it over to the DBA team.</p>
<p>I&#8217;m must admit it wasn&#8217;t a stimulating task in the beginning, but once we figured we can use fine grained auditing (FGA), it became more exciting.</p>
<p>Here is the procedure we used, we have only 1 main schema:</p>
<p>1)      Identify tables with DML. This is easily done by checking user_tab_modifications.</p>
<p>2)      Create a table unused_tables containing all tables not in user_tab_modifications. With this step, you would eliminate some of the tables currently being used (hopefully most of them):</p>
<p>create table unused_tables as<br />
Select table_name from user_tables<br />
Minus<br />
Select table_name from user_tab_modifications</p>
<p>3)      Enable FGA for &#8220;selects&#8221; only on the tables in previous step. FGA puts overhead on your system so don&#8217;t enable it on all your tables at once if you have thousands of tables. Enable few say 50 or use you best judgment at a time.</p>
<p># generate script to enable auditing</p>
<p>&#8216;exec dbms_fga.add_policy(object_schema =&gt; &#8221;your_schema&#8221;, object_name =&gt; &#8221;&#8217; || table_name || &#8221;&#8217;, policy_name =&gt; &#8221;&#8217; ||<br />
table_name || &#8216;_P&#8221;);&#8217;<br />
from unused_tables;</p>
<p>4)  Look under DBA_FGA_AUDIT_TRAIL and disable policies for tables that have a trail. Here is script we use to disable policies, we run about once a day:</p>
<p># generate script to disable auditing</p>
<p>select &#8216;exec dbms_fga.disable_policy(object_schema =&gt; &#8221;&#8217; || object_schema || &#8221;&#8217; , object_name =&gt; &#8221;&#8217; || object_name ||<br />
&#8221;&#8217;, policy_name =&gt; &#8221;&#8217; || policy_name || &#8221;&#8217;);&#8217;<br />
from<br />
(<br />
select distinct a.object_schema, a.object_name, a.policy_name<br />
from DBA_FGA_AUDIT_TRAIL a, DBA_AUDIT_POLICIES b<br />
where a.object_schema = b.object_schema<br />
and a.object_name = b.object_name<br />
and a.policy_name = b.policy_name<br />
and b.enabled = &#8216;YES&#8217;<br />
)</p>
<p>5)  Repeat steps 3 &amp; 4 until you enable auditing for all tables</p>
<p>6)  Tables with enabled policies and no audit trail are these tables you can safely drop. Off course you have to wait an X amount of time (weeks most probably) to confirm.</p>
<p>7)  Be aware that if you do a nightly dump (export), it will show in the audit trail. We normally delete these entries from the audit trail. Our export is done with a different user then the schema owner:</p>
<p>delete from sys.fga_log$ where dbuid = &#8216;export user&#8217;;</p>
<p>commit;</p>
<p><em>Hazem Ameen</em><br />
<em>Senior Oracle DBA</em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ksadba.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ksadba.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ksadba.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ksadba.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ksadba.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ksadba.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ksadba.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ksadba.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ksadba.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ksadba.wordpress.com/161/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=161&subd=ksadba&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ksadba.wordpress.com/2009/01/15/how-to-use-fine-grained-auditing-fga-to-identify-unused-tables-in-oracle-10g/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eda39a036b3ab7f1ff7462687db4c6f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ksadba</media:title>
		</media:content>
	</item>
		<item>
		<title>ASM Grave Errors: ORA-15042 &amp; ORA-15063</title>
		<link>http://ksadba.wordpress.com/2008/12/23/asm-grave-errors-ora-15042-ora-15063/</link>
		<comments>http://ksadba.wordpress.com/2008/12/23/asm-grave-errors-ora-15042-ora-15063/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 12:31:18 +0000</pubDate>
		<dc:creator>ksadba</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[ASM]]></category>
		<category><![CDATA[ORA-15042]]></category>
		<category><![CDATA[ORA-15063]]></category>

		<guid isPermaLink="false">http://ksadba.wordpress.com/?p=150</guid>
		<description><![CDATA[ORA-15042:  ASM disk &#8220;n&#8221; is missing
ORA-15063: ASM discovered an insufficient number of disks for diskgroup &#8220;diskgroup name&#8221;
These 2 errors are related to missing disk(s) from ASM disk group. After you go through the initial inspection which is basically checking if the disk does exist and correct permissions assigned to Oracle user, if you are not [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=150&subd=ksadba&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>ORA-15042:  ASM disk &#8220;n&#8221; is missing<br />
ORA-15063: ASM discovered an insufficient number of disks for diskgroup &#8220;diskgroup name&#8221;</p>
<p>These 2 errors are related to missing disk(s) from ASM disk group. After you go through the initial inspection which is basically checking if the disk does exist and correct permissions assigned to Oracle user, if you are not using ASM disk mirroring, then what to do?</p>
<p>In my case, the system administrator took 7 ASM disks belonging to 2 different disk groups. One of these groups was the archive destination while the other was data. I also came to find out that this happened 2 other times in other production systems in addition to 1 time in a development system. All happened by different system administrators on HP and Solaris. Goes to show you how difficult to fit new Oracle system tools in big organizations.</p>
<p>If you have a disk group with 100 disks and you lose 1 disk, then the entire disk group will be dismounted.  Attempts to mount the disk group will render the following error:</p>
<p>ORA-15032: not all alterations performed<br />
ORA-15040: diskgroup is incomplete<br />
ORA-15042: ASM disk &#8220;n&#8221; is missing</p>
<p>What I find out &#8211; the hard way unfortunately &#8211; taking a disk from ASM is the mother of all mistakes. The only solution at this point is to use dd command to wipe the headers of all of the disks participating in this disk group, recreate the disk group with same name, and then restore from backup. In my case we had to do point-in-time recovery because we also lost the archive files. Data loss was imminent.</p>
<p>In a nutshell, losing 1 disk from a disk group = losing entire disk group, but why is this?</p>
<p>It is because ASM is designed to take a file and spread (stripe) it across multiple disks in your disk group for performance benefits.  You can find out the stripe size or allocation unit (AU) from asmcmd -&gt; lsdg. So if you lose 1 disk, you lost parts or units of every file in this disk group.</p>
<p>This got me thinking about a recommendation I read a while back which said create 2 disk groups only to simply maintenance; 1 for archive destination and the other for data. But if you come across a scenario like this and you have a large database, you would lose all you control files and also you would have a prolonged downtime to recover your entire database.</p>
<p>If you feel you need to design your environment to handle such a scenario, then here are some recommendations:</p>
<ol>
<li>Disk group total size should be recovered within the time limit allowed for recovery. That means you will have more disk groups, not just 1 or 2.</li>
<li>Multiplex your control files in different disk group. In my case, I lost all control files.</li>
<li>If possible, multiplex your archive destination to a file system (not ASM); 1 destination is ASM while the other is file system outside ASM. This will allow you to recover to point of failure even if you loss your entire ASM disks.</li>
</ol>
<p><em>Hazem Ameen<br />
Senior Oracle DBA</em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ksadba.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ksadba.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ksadba.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ksadba.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ksadba.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ksadba.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ksadba.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ksadba.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ksadba.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ksadba.wordpress.com/150/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=150&subd=ksadba&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ksadba.wordpress.com/2008/12/23/asm-grave-errors-ora-15042-ora-15063/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eda39a036b3ab7f1ff7462687db4c6f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ksadba</media:title>
		</media:content>
	</item>
		<item>
		<title>How to Remove Oracle Streams from Your 10g Environment</title>
		<link>http://ksadba.wordpress.com/2008/11/22/how-to-remove-oracle-streams-from-your-10g-environment/</link>
		<comments>http://ksadba.wordpress.com/2008/11/22/how-to-remove-oracle-streams-from-your-10g-environment/#comments</comments>
		<pubDate>Sat, 22 Nov 2008 12:46:47 +0000</pubDate>
		<dc:creator>ksadba</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[dba_log_groups]]></category>
		<category><![CDATA[dbms_streams_adm]]></category>
		<category><![CDATA[Oracle Streams]]></category>
		<category><![CDATA[Supplemental Logging]]></category>

		<guid isPermaLink="false">http://ksadba.wordpress.com/?p=136</guid>
		<description><![CDATA[When I first started experimenting with Oracle Streams, I found that removing Streams from our environment was challenging. Oracle documentation just says use dbms_streams_adm.remove_streams_configurations, which didn&#8217;t clean the Streams completely, and as such, trying to reconfigure Streams again was unsuccessful.
Here are 2 ways I use to remove bi-directional schema replication from our environment. Both have [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=136&subd=ksadba&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>When I first started experimenting with Oracle Streams, I found that removing Streams from our environment was challenging. Oracle documentation just says use dbms_streams_adm.remove_streams_configurations, which didn&#8217;t clean the Streams completely, and as such, trying to reconfigure Streams again was unsuccessful.</p>
<p>Here are 2 ways I use to remove bi-directional schema replication from our environment. Both have its pros and cons.</p>
<p>These steps have been tested in 10.2.0.4 environment.</p>
<p>1)      Use dbms_streams_adm package<br />
2)      Drop strmadmin user</p>
<p><strong><span style="text-decoration:underline;"> </span></strong></p>
<p><strong><span style="text-decoration:underline;">Using dbms_streams_adm</span></strong></p>
<p>Here are the steps, execute on every replication site:</p>
<p>A)  Disable propagation schedule</p>
<p>exec dbms_aqadm.disable_propagation_schedule(<br />
                             queue_name =&gt; &#8216;capture name&#8217;,<br />
                             destination =&gt; &#8216;destination&#8217;,<br />
                             destination_queue =&gt; &#8216;apply name&#8217;);</p>
<p>B) Drop propagation</p>
<p>exec dbms_propagation_adm.drop_propagation(<br />
                                propagation_name =&gt; &#8216;propagation name&#8217;,<br />
                                drop_unused_rule_sets =&gt; true);</p>
<p>C) Remove Streams</p>
<p> exec  dbms_streams_adm.remove_streams_configuration;</p>
<p>D) Drop Queues for capture and apply</p>
<p>&#8211; drop capture queue<br />
exec  DBMS_STREAMS_ADM.REMOVE_QUEUE(&#8216;&lt;capture queue name&gt;&#8217;,TRUE);</p>
<p>&#8211; drop apply queue<br />
Exec DBMS_STREAMS_ADM.REMOVE_QUEUE(&#8216;&lt;apply queue name&gt;&#8217;,TRUE);</p>
<p>When finished executing these steps, you should see only be left with 1 object only (database link) under strmadmin.</p>
<p>Again remember to execute on every site.</p>
<p><strong>Pros</strong></p>
<p>1)   It drops the replication configuration without dropping strmadmin or database link which makes it simpler to rebuild your Streams environment.</p>
<p><strong>Cons</strong></p>
<p>1)      Too many steps.<br />
2)      It has been my experience if your replication is hung with &#8220;Pause for flow control&#8221; these steps might not work.</p>
<p>
</p>
<p><strong><span style="text-decoration:underline;">Dropping strmadmin</span></strong></p>
<p>Just drop Streams admin user  (strmadmin) on every site.</p>
<p>drop user strmadmin cascade;</p>
<p><strong>Pros</strong></p>
<p>1)      Just 1 step.<br />
2)      It has been my experience when replication is hung that is the only way to clean it up.</p>
<p><strong>Cons</strong></p>
<p>1)      User strmadmin must be disconnected. You might have to kill few sessions before dropping the user.<br />
2)      If your intention is to rebuild the Streams environment, then you must recreate the user on every site and grant proper privileges.</p>
<p>
<strong>Caution</strong></p>
<p>If you are completely removing replication from your environment, then remember to disable supplemental logging. Supplemental log does use some CPU and additional disk space. Both of methods mentioned in this post don&#8217;t disable the supplemental logging.</p>
<p>alter table &lt;schema.object_name&gt; drop supplemental log group &lt;group name&gt;;</p>
<p>You can get object name and group name from dba_log_groups.</p>
<p><em>Hazem Ameen<br />
Senior Oracle DBA</em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ksadba.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ksadba.wordpress.com/136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ksadba.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ksadba.wordpress.com/136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ksadba.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ksadba.wordpress.com/136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ksadba.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ksadba.wordpress.com/136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ksadba.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ksadba.wordpress.com/136/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=136&subd=ksadba&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ksadba.wordpress.com/2008/11/22/how-to-remove-oracle-streams-from-your-10g-environment/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eda39a036b3ab7f1ff7462687db4c6f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ksadba</media:title>
		</media:content>
	</item>
		<item>
		<title>Oracle CRS Reboot Bloopers</title>
		<link>http://ksadba.wordpress.com/2008/11/12/oracle-crs-reboot-bloopers/</link>
		<comments>http://ksadba.wordpress.com/2008/11/12/oracle-crs-reboot-bloopers/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 13:42:47 +0000</pubDate>
		<dc:creator>ksadba</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[10g]]></category>
		<category><![CDATA[CRS]]></category>
		<category><![CDATA[RAC]]></category>

		<guid isPermaLink="false">http://ksadba.wordpress.com/?p=131</guid>
		<description><![CDATA[This post is just a delightful recap of “not so bright” actions I’ve seen done unintentionally that wind up causing a reboot of a node or more in CRS. Some were done by DBAs while others were done by system administrators.
Environment HP &#38; Solaris 10gR2
Kill ocssd.bin Process
This instantly crashed the node.
Delete Content under /tmp/.oracle 
This [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=131&subd=ksadba&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This post is just a delightful recap of “not so bright” actions I’ve seen done unintentionally that wind up causing a reboot of a node or more in CRS. Some were done by DBAs while others were done by system administrators.</p>
<p>Environment HP &amp; Solaris 10gR2</p>
<p><strong>Kill ocssd.bin Process</strong><br />
This instantly crashed the node.</p>
<p><strong>Delete Content under /tmp/.oracle </strong><br />
This hanged CRS. Commands such as crsctl check crs won’t even come back. You have to reboot the node to recreate the socket file under tmp.</p>
<p><strong>Change System Date</strong><br />
This rebooted CRS flaging a “Cluster Integrity” issue. Poor system administrator almost had a heart attack.</p>
<p><strong>Change Physical Hostname</strong><br />
System administrator accidentally changed the physical hostname then changed it back. The host file was changed as well. This hung CRS. A reboot took care of it.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ksadba.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ksadba.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ksadba.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ksadba.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ksadba.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ksadba.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ksadba.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ksadba.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ksadba.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ksadba.wordpress.com/131/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=131&subd=ksadba&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ksadba.wordpress.com/2008/11/12/oracle-crs-reboot-bloopers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eda39a036b3ab7f1ff7462687db4c6f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ksadba</media:title>
		</media:content>
	</item>
		<item>
		<title>Two Practical Tips for DBConsole</title>
		<link>http://ksadba.wordpress.com/2008/10/28/two-practical-tips-for-db-control/</link>
		<comments>http://ksadba.wordpress.com/2008/10/28/two-practical-tips-for-db-control/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 12:38:20 +0000</pubDate>
		<dc:creator>ksadba</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[DB Control]]></category>
		<category><![CDATA[DBConsole]]></category>
		<category><![CDATA[Enterprise Manager]]></category>

		<guid isPermaLink="false">http://ksadba.wordpress.com/?p=89</guid>
		<description><![CDATA[These 2 tips for Enterprise Manager database control have been tested in 10.2.0.4
 
Adjusting Collection Interval for Alert Log
 
The default collection interval for scanning alert logs is every 15 minutes which might me too long for some sites.
Here are the steps to adjust the time down to 5 minutes:
 

cd      $ORACLE_HOME/&#60;hostname_instancename&#62;/sysman/emd/collection
vi [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=89&subd=ksadba&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><em>These 2 tips for Enterprise Manager database control have been tested in 10.2.0.4</em><br />
<strong> </strong></p>
<p><strong>Adjusting Collection Interval for Alert Log</strong><br />
<strong> </strong><br />
The default collection interval for scanning alert logs is every 15 minutes which might me too long for some sites.</p>
<p>Here are the steps to adjust the time down to 5 minutes:<br />
<strong> </strong></p>
<ol type="1">
<li>cd      $ORACLE_HOME/&lt;hostname_instancename&gt;/sysman/emd/collection</li>
<li>vi      oracle_database_&lt;sid&gt;.xml</li>
<li>Look      for &#8220;alert_log_rollup&#8221;</li>
<li>Adjust      &#8220;ScheduleInterval=5&#8243;</li>
<li>Restart      your DB Control.</li>
<li>If      RAC, then do the same on rest of the nodes.</li>
</ol>
<p>
<strong> </strong><br />
<strong>Adjusting Logout Time  Interval</strong></p>
<p><strong> </strong></p>
<p>If your session remains idle for more than 45 minutes, then DB Control will log you out</p>
<p><strong> </strong></p>
<p>Here are the steps to increase the logout time:</p>
<p><strong> </strong></p>
<ol type="1">
<li>cd $ORACLE_HOME/&lt;hostname_instancename&gt;/sysman/config/emoms.properties</li>
<li>vi      emoms.properties</li>
<li>add      this line to bottom: oracle.sysman.eml.maxInactiveTime=&lt;time in      minutes&gt; #1440 for 24 hours</li>
<li>Restart      your DB Control.</li>
</ol>
<p><em> </em></p>
<p><strong></strong><br />
<em>Hazem Ameen<br />
Senior Oracle DBA</em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ksadba.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ksadba.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ksadba.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ksadba.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ksadba.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ksadba.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ksadba.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ksadba.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ksadba.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ksadba.wordpress.com/89/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ksadba.wordpress.com&blog=3930725&post=89&subd=ksadba&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ksadba.wordpress.com/2008/10/28/two-practical-tips-for-db-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eda39a036b3ab7f1ff7462687db4c6f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ksadba</media:title>
		</media:content>
	</item>
	</channel>
</rss>