<?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>remidian.com &#187; oracle</title>
	<atom:link href="http://remidian.com/category/oracle/feed" rel="self" type="application/rss+xml" />
	<link>http://remidian.com</link>
	<description>Braindumps of Remi Visser, freelance Oracle DBA.</description>
	<lastBuildDate>Thu, 29 Dec 2011 11:56:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PL/SQL quickie; generate RMAN set newname script to different mountpoints</title>
		<link>http://remidian.com/oracle/plsql-quickie-evnly-spread-datafiles-over-number-of-mountpoints.html</link>
		<comments>http://remidian.com/oracle/plsql-quickie-evnly-spread-datafiles-over-number-of-mountpoints.html#comments</comments>
		<pubDate>Fri, 16 Sep 2011 13:49:38 +0000</pubDate>
		<dc:creator>remivisser</dc:creator>
				<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://remidian.com/?p=566</guid>
		<description><![CDATA[Script below generates RMAN newname file where database A is copied to database B AND database B has &#8216;conflicting&#8217; mountpoints set up. Mountpoints setup on database A is like /m001/, /m002/, /m003/, /m004/ but mountpoints on database B side is just /m001/ and /m002. /m001 has only 800 G free space so I place everything [...]]]></description>
			<content:encoded><![CDATA[<p>Script below generates RMAN newname file where database A is copied to database B AND database B has &#8216;conflicting&#8217; mountpoints set up.<br />
Mountpoints setup on database A is like /m001/, /m002/, /m003/, /m004/ but mountpoints on database B side is just /m001/ and /m002. /m001 has only 800 G free space so I place everything in /m001 until i_num_bytes reaches 800G then all the reset goes to /m002.</p>
<p><code>declare<br />
&nbsp;&nbsp;&nbsp;&nbsp;i_num_bytes number := 0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;v_mount&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;varchar2(100);<br />
&nbsp;&nbsp;&nbsp;&nbsp;v_file&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;varchar2(100);<br />
begin<br />
&nbsp;<br />
&nbsp;&nbsp;for i in (select file_id, file_name, bytes from dba_data_files order by file_id) <br />
&nbsp;&nbsp;loop<br />
&nbsp;&nbsp;&nbsp;&nbsp;i_num_bytes := i_num_bytes + i.bytes ;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&#45;- 800g<br />
&nbsp;&nbsp;&nbsp;&nbsp;if i_num_bytes &lt; 858993459200 then <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v_mount := &#039;/m001/oradata/********/&#039; ;<br />
&nbsp;&nbsp;&nbsp;&nbsp;else <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v_mount := &#039;/m002/oradata/********/&#039; ;<br />
&nbsp;&nbsp;&nbsp;&nbsp;end if;<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&#45;- get base name of the file<br />
&nbsp;&nbsp;&nbsp;&nbsp;v_file := SUBSTR( i.file_name, INSTR( i.file_name ,&#039;/&#039;, -1) +1);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&#45;- replace oracle_sid<br />
&nbsp;&nbsp;&nbsp;&nbsp;v_file := REPLACE( v_file, &#039;********&#039;, &#039;********&#039;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;dbms_output.put_line ( &#039;set newname for datafile &#039; || i.file_id || &#039; to &#039;&#039;&#039;|| v_mount || v_file || &#039;&#039;&#039;;&#039;);<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;end loop;<br />
&nbsp;<br />
end;<br />
/<br />
&nbsp;<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://remidian.com/oracle/plsql-quickie-evnly-spread-datafiles-over-number-of-mountpoints.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generate scp datafiles script with regular expression</title>
		<link>http://remidian.com/oracle/generate-scp-datafiles-script-with-regular-expression.html</link>
		<comments>http://remidian.com/oracle/generate-scp-datafiles-script-with-regular-expression.html#comments</comments>
		<pubDate>Tue, 24 May 2011 08:56:55 +0000</pubDate>
		<dc:creator>remivisser</dc:creator>
				<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://remidian.com/?p=513</guid>
		<description><![CDATA[Need to transfer a bunch of databases with pattern {a&#8230;9} to {t&#8230;8}. Please copy databases below; adummy19 to tdummy18 &#8211; server070 (*) adummy29 to tdummy28 &#8211; server526 adummy39 to tdummy38 &#8211; server526 adummy49 to tdummy48 &#8211; server526 adummy59 to tdummy58 &#8211; server526 adummy69 to tdummy68 &#8211; server526 adummy79 to tdummy78 &#8211; server526 adummy89 to tdummy88 [...]]]></description>
			<content:encoded><![CDATA[<p>Need to transfer a bunch of databases with pattern {a&#8230;9} to {t&#8230;8}.<span id="more-513"></span></p>
<p>Please copy databases below;</p>
<p>adummy19 to tdummy18 &#8211; server070 (*)<br />
adummy29 to tdummy28 &#8211; server526<br />
adummy39 to tdummy38 &#8211; server526<br />
adummy49 to tdummy48 &#8211; server526<br />
adummy59 to tdummy58 &#8211; server526<br />
adummy69 to tdummy68 &#8211; server526<br />
adummy79 to tdummy78 &#8211; server526<br />
adummy89 to tdummy88 &#8211; server526</p>
<p>Created PL/SQL script below to get me the scp commands;</p>
<pre>
declare
 function replace_sid ( piv_string in varchar2)
&nbsp;&nbsp;return varchar2
 as
&nbsp;&nbsp;db_name_cur varchar2(64);
&nbsp;&nbsp;db_name_new varchar2(64);
 begin
&nbsp;&nbsp;&#45;- current db_name
&nbsp;&nbsp;select value into db_name_cur from v$parameter where name = &#039;db_name&#039;;
&nbsp;&nbsp;
&nbsp;&nbsp;&#45;- new db_name 
&nbsp;&nbsp;db_name_new := regexp_replace( db_name_cur, &#039;(^a)&#039;, &#039;t&#039;);
&nbsp;&nbsp;db_name_new := regexp_replace( db_name_new, &#039;(9$)&#039;, &#039;8&#039;);
&nbsp;&nbsp; 
&nbsp;&nbsp;&#45;- return replacement
&nbsp;&nbsp;return replace( piv_string, db_name_cur, db_name_new);
 end;
&nbsp;
begin
 for i in ( select file_name from dba_data_files ) 
 loop
&nbsp;&nbsp;dbms_output.put_line ( &#039;scp &#039; || i.file_name || &#039; ahc526:&#039; || replace_sid( i.file_name));
 end loop;

end;
/
</pre>
]]></content:encoded>
			<wfw:commentRss>http://remidian.com/oracle/generate-scp-datafiles-script-with-regular-expression.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Segment Advisor dump (R 10.1)</title>
		<link>http://remidian.com/oracle/segment-advisor-dump-r-10-1.html</link>
		<comments>http://remidian.com/oracle/segment-advisor-dump-r-10-1.html#comments</comments>
		<pubDate>Tue, 17 May 2011 15:09:47 +0000</pubDate>
		<dc:creator>remivisser</dc:creator>
				<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://remidian.com/?p=506</guid>
		<description><![CDATA[Dump of running segment advisor in Oracle 10.1 @See: http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10802/d_advis.htm http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2049277600346543592 http://www.oracle-base.com/articles/10g/SpaceObjectTransactionManagement10g.php / For tablespace create or replace procedure sa_tablespace ( &#160;&#160;piv_tablespace in varchar2, &#160;&#160;piv_task&#160;&#160;&#160;&#160;&#160;&#160; in varchar2 default null ) &#160;&#160;authid current_user &#160; as &#160; &#160;&#160;obj_id number; &#160;&#160;task&#160;&#160; varchar2(100); &#160; begin &#160; &#160;&#160; if piv_task is null then &#160;&#160;&#160;&#160; task := &#039;SA TABLESPACE &#039; &#124;&#124; [...]]]></description>
			<content:encoded><![CDATA[<p>
Dump of running segment advisor in Oracle 10.1<span id="more-506"></span></p>
<p>
@See:<br />
<a target="_blank" class="link-dest-external" href="http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10802/d_advis.htm">http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10802/d_advis.htm</a><br />
<a target="_blank" class="link-dest-external" href="http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2049277600346543592">http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2049277600346543592</a><br />
<a target="_blank" class="link-dest-external" href="http://www.oracle-base.com/articles/10g/SpaceObjectTransactionManagement10g.php">http://www.oracle-base.com/articles/10g/SpaceObjectTransactionManagement10g.php</a> / </p>
<p>For tablespace</p>
<pre>
create or replace procedure sa_tablespace
(
&nbsp;&nbsp;piv_tablespace in varchar2,
&nbsp;&nbsp;piv_task&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in varchar2 default null
)
&nbsp;&nbsp;authid current_user
&nbsp;
as
&nbsp;
&nbsp;&nbsp;obj_id number;
&nbsp;&nbsp;task&nbsp;&nbsp; varchar2(100);
&nbsp;
begin
&nbsp;
&nbsp;&nbsp; if piv_task is null then
&nbsp;&nbsp;&nbsp;&nbsp; task := &#039;SA TABLESPACE &#039; || piv_tablespace ;
&nbsp;&nbsp; else
&nbsp;&nbsp;&nbsp;&nbsp; task := piv_task;
&nbsp;&nbsp; end if;
&nbsp;
&nbsp;&nbsp;&#45;- remove task
&nbsp;&nbsp;begin
&nbsp;&nbsp;&nbsp;&nbsp;dbms_advisor.delete_task ( task_name&nbsp;&nbsp;&nbsp;&nbsp; =&gt; task);
&nbsp;&nbsp;exception
&nbsp;&nbsp;&nbsp;&nbsp;when others then null ;
&nbsp;&nbsp;end;
&nbsp;
&nbsp;&nbsp;&#45;- create task
&nbsp;&nbsp;dbms_advisor.create_task (
&nbsp;&nbsp;&nbsp;&nbsp;advisor_name&nbsp;&nbsp;&nbsp;&nbsp; =&gt; &#039;Segment Advisor&#039;,
&nbsp;&nbsp;&nbsp;&nbsp;task_name&nbsp;&nbsp;&nbsp;&nbsp; =&gt; task);
&nbsp;
&nbsp;&nbsp;dbms_advisor.create_object (
&nbsp;&nbsp;&nbsp;&nbsp;task_name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; task,
&nbsp;&nbsp;&nbsp;&nbsp;object_type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; &#039;TABLESPACE&#039;,
&nbsp;&nbsp;&nbsp;&nbsp;attr1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; piv_tablespace,
&nbsp;&nbsp;&nbsp;&nbsp;attr2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; NULL,
&nbsp;&nbsp;&nbsp;&nbsp;attr3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; NULL,
&nbsp;&nbsp;&nbsp;&nbsp;attr4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; NULL,
&nbsp;&nbsp;&nbsp;&nbsp;attr5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; NULL,
&nbsp;&nbsp;&nbsp;&nbsp;object_id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; obj_id);
&nbsp;
&nbsp;&nbsp;dbms_advisor.set_task_parameter(
&nbsp;&nbsp;&nbsp;&nbsp;task_name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; task,
&nbsp;&nbsp;&nbsp;&nbsp;parameter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; &#039;recommend_all&#039;,
&nbsp;&nbsp;&nbsp;&nbsp;value&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; &#039;TRUE&#039;);
&nbsp;
&nbsp;&nbsp;dbms_advisor.execute_task(task);
&nbsp;
end;
/
&nbsp;
</pre>
<pre>
exec sa_tablespace( &#039;P1TS001&#039;);
exec sa_tablespace( &#039;P1TS002&#039;);
</pre>
<p>For user object</p>
<pre>
create or replace procedure sa_object
(
&nbsp;&nbsp;piv_object_owner&nbsp;&nbsp;&nbsp;&nbsp;in varchar2,
&nbsp;&nbsp;piv_object_name&nbsp;&nbsp;in varchar2,
&nbsp;&nbsp;piv_object_type&nbsp;&nbsp;&nbsp;&nbsp;in varchar2,
&nbsp;&nbsp;piv_task&nbsp;&nbsp;&nbsp;&nbsp;in varchar2 default null
)
&nbsp;&nbsp;authid current_user
as
&nbsp;&nbsp;obj_id number;
&nbsp;&nbsp;task&nbsp;&nbsp; varchar2(100);
begin
&nbsp;
&nbsp;&nbsp; if piv_task is null then
&nbsp;&nbsp;&nbsp;&nbsp; task := &#039;SA OBJECT &#039; || piv_object_type || &#039;-&#039; || piv_object_owner || &#039;-&#039; || piv_object_name;
&nbsp;&nbsp; else
&nbsp;&nbsp;&nbsp;&nbsp; task := piv_task;
&nbsp;&nbsp; end if;
&nbsp;
&nbsp;&nbsp;dbms_advisor.create_task (
&nbsp;&nbsp;&nbsp;&nbsp;advisor_name&nbsp;&nbsp;&nbsp;&nbsp; =&gt; &#039;Segment Advisor&#039;,
&nbsp;&nbsp;&nbsp;&nbsp;task_name&nbsp;&nbsp;&nbsp;&nbsp; =&gt; task);
&nbsp;
&nbsp;&nbsp;dbms_advisor.create_object (
&nbsp;&nbsp;&nbsp;&nbsp;task_name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; task,
&nbsp;&nbsp;&nbsp;&nbsp;object_type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; piv_object_type,
&nbsp;&nbsp;&nbsp;&nbsp;attr1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; piv_object_owner,
&nbsp;&nbsp;&nbsp;&nbsp;attr2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; piv_object_name,
&nbsp;&nbsp;&nbsp;&nbsp;attr3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; NULL,
&nbsp;&nbsp;&nbsp;&nbsp;attr4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; NULL,
&nbsp;&nbsp;&nbsp;&nbsp;attr5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; NULL,
&nbsp;&nbsp;&nbsp;&nbsp;object_id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; obj_id);
&nbsp;
&nbsp;&nbsp;dbms_advisor.set_task_parameter(
&nbsp;&nbsp;&nbsp;&nbsp;task_name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; task,
&nbsp;&nbsp;&nbsp;&nbsp;parameter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; &#039;recommend_all&#039;,
&nbsp;&nbsp;&nbsp;&nbsp;value&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; &#039;TRUE&#039;);
&nbsp;
&nbsp;&nbsp; dbms_advisor.execute_task(task);
end;
/
&nbsp;
</pre>
<pre>
exec sa_object( &#039;P1BRID&#039;, &#039;DEMO&#039;, &#039;TABLE&#039;, &#039;SA_1&#039;);
exec sa_object( &#039;P1BRID&#039;, &#039;DEMO&#039;, &#039;TABLE&#039;, &#039;SA 1&#039;);
&nbsp;
&#45;- Display the findings.
SET LINESIZE 250
COLUMN task_name FORMAT A20
COLUMN object_type FORMAT A20
COLUMN schema FORMAT A20
COLUMN object_name FORMAT A30
COLUMN object_name FORMAT A30
COLUMN message FORMAT A40
COLUMN more_info FORMAT A40
&nbsp;
SELECT f.task_name,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f.impact,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o.type AS object_type,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o.attr1 AS schema,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o.attr2 AS object_name,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f.message,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f.more_info
FROM&nbsp;&nbsp; dba_advisor_findings f
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JOIN dba_advisor_objects o ON f.object_id = o.object_id AND f.task_name = o.task_name
WHERE&nbsp;&nbsp;f.task_name IN (&#039;SA_1&#039;, &#039;SA 1&#039;) or f.task_name like &#039;SA T%&#039;
ORDER BY f.task_name, f.impact DESC;
&nbsp;
&#45;-select * from DBA_ADVISOR_FINDINGS where task_name=&#039;SA_1&#039;&nbsp;&nbsp;;
&#45;-select * from DBA_ADVISOR_FINDINGS where task_name=&#039;SA 1&#039;&nbsp;&nbsp;;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://remidian.com/oracle/segment-advisor-dump-r-10-1.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>expdp / impdp</title>
		<link>http://remidian.com/oracle/expdp-impdp.html</link>
		<comments>http://remidian.com/oracle/expdp-impdp.html#comments</comments>
		<pubDate>Tue, 01 Mar 2011 17:30:25 +0000</pubDate>
		<dc:creator>remivisser</dc:creator>
				<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://remidian.com/?p=462</guid>
		<description><![CDATA[Some expdp impdp commands. Quotes in &#8216;/as sysdba&#8217; needs escape slashes /m001/oradata/EXPORT&#62;expdp \&#039;/ as sysdba\&#039; schemas=owner1,owner2,owner3 directory=EXP_DIR2 dumpfile=&#60;filename&#62; logfile=&#60;filename&#62;]]></description>
			<content:encoded><![CDATA[<p>Some expdp impdp commands.<span id="more-462"></span><br />
Quotes in &#8216;/as sysdba&#8217; needs escape slashes</p>
<pre>
/m001/oradata/EXPORT&gt;expdp \&#039;/ as sysdba\&#039; schemas=owner1,owner2,owner3 directory=EXP_DIR2 dumpfile=&lt;filename&gt; logfile=&lt;filename&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://remidian.com/oracle/expdp-impdp.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ORAENV_ASK</title>
		<link>http://remidian.com/oracle/oraenv_ask.html</link>
		<comments>http://remidian.com/oracle/oraenv_ask.html#comments</comments>
		<pubDate>Mon, 18 Oct 2010 12:33:43 +0000</pubDate>
		<dc:creator>remivisser</dc:creator>
				<category><![CDATA[DBA util]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://remidian.com/?p=369</guid>
		<description><![CDATA[ORAENV_ASK=no export ORAENV_ASK=NO;export ORACLE_SID=********;. /usr/local/bin/oraenv;sqlplus &#039;/ as sysdba&#039; @batch.sql export ORAENV_ASK=NO;export ORACLE_SID=********;. /usr/local/bin/oraenv;sqlplus &#039;/ as sysdba&#039; @batch.sql export ORAENV_ASK=NO;export ORACLE_SID=********;. /usr/local/bin/oraenv;sqlplus &#039;/ as sysdba&#039; @batch.sql export ORAENV_ASK=NO;export ORACLE_SID=********;. /usr/local/bin/oraenv;sqlplus &#039;/ as sysdba&#039; @batch.sql export ORAENV_ASK=NO;export ORACLE_SID=********;. /usr/local/bin/oraenv;sqlplus &#039;/ as sysdba&#039; @batch.sql export ORAENV_ASK=NO;export ORACLE_SID=********;. /usr/local/bin/oraenv;sqlplus &#039;/ as sysdba&#039; @batch.sql export ORAENV_ASK=NO;export ORACLE_SID=********;. /usr/local/bin/oraenv;sqlplus &#039;/ as [...]]]></description>
			<content:encoded><![CDATA[<p>
ORAENV_ASK=no <span id="more-369"></span>
</p>
<pre>
export ORAENV_ASK=NO;export ORACLE_SID=********;. /usr/local/bin/oraenv;sqlplus &#039;/ as sysdba&#039; @batch.sql
export ORAENV_ASK=NO;export ORACLE_SID=********;. /usr/local/bin/oraenv;sqlplus &#039;/ as sysdba&#039; @batch.sql 
export ORAENV_ASK=NO;export ORACLE_SID=********;. /usr/local/bin/oraenv;sqlplus &#039;/ as sysdba&#039; @batch.sql 
export ORAENV_ASK=NO;export ORACLE_SID=********;. /usr/local/bin/oraenv;sqlplus &#039;/ as sysdba&#039; @batch.sql 
export ORAENV_ASK=NO;export ORACLE_SID=********;. /usr/local/bin/oraenv;sqlplus &#039;/ as sysdba&#039; @batch.sql 
export ORAENV_ASK=NO;export ORACLE_SID=********;. /usr/local/bin/oraenv;sqlplus &#039;/ as sysdba&#039; @batch.sql 
export ORAENV_ASK=NO;export ORACLE_SID=********;. /usr/local/bin/oraenv;sqlplus &#039;/ as sysdba&#039; @batch.sql 
</pre>
]]></content:encoded>
			<wfw:commentRss>http://remidian.com/oracle/oraenv_ask.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>monitor progress of long running job with dbms_application_info.set_session_longops</title>
		<link>http://remidian.com/oracle/monitor-progress-with-dbms_application_info-set_session_longops.html</link>
		<comments>http://remidian.com/oracle/monitor-progress-with-dbms_application_info-set_session_longops.html#comments</comments>
		<pubDate>Sat, 16 Oct 2010 13:47:13 +0000</pubDate>
		<dc:creator>remivisser</dc:creator>
				<category><![CDATA[DBA util]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://remidian.com/?p=353</guid>
		<description><![CDATA[Investigating a major performance issue with a PL/SQL loop running for more then 12 hours. Added dbms_application_info.set_session_longops to have entry in v$session_longnops. DECLARE &#160; &#160;&#160;&#45;- @what: display elapsed msecs &#160;&#160;&#45;- @link: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2389164927483 &#160;&#160;n_starttime NUMBER; &#160;&#160;n_endtime&#160;&#160; NUMBER; &#160;&#160;n_elapsed&#160;&#160; NUMBER; &#160;&#160; &#160;&#160;d_date&#160;&#160;&#160;&#160;&#160;&#160;DATE&#160;&#160; := SYSDATE; &#160; &#160;&#160;&#45;- @what: dbms_application_info.set_session_longops &#160;&#160;&#45;- @link: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1099233454171#18173358903352 &#160;&#160;l_nohint&#160;&#160;&#160;&#160; NUMBER DEFAULT dbms_application_info.set_session_longops_nohint; &#160;&#160;l_rindex&#160;&#160;&#160;&#160; NUMBER [...]]]></description>
			<content:encoded><![CDATA[<p>
Investigating a major performance issue with a PL/SQL loop running for more then 12 hours. Added dbms_application_info.set_session_longops to have entry in v$session_longnops.<span id="more-353"></span>
</p>
<pre>
DECLARE
&nbsp;
&nbsp;&nbsp;&#45;- @what: display elapsed msecs
&nbsp;&nbsp;&#45;- @link: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2389164927483
&nbsp;&nbsp;n_starttime NUMBER;
&nbsp;&nbsp;n_endtime&nbsp;&nbsp; NUMBER;
&nbsp;&nbsp;n_elapsed&nbsp;&nbsp; NUMBER;
&nbsp;&nbsp;
&nbsp;&nbsp;d_date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DATE&nbsp;&nbsp; := SYSDATE;
&nbsp;
&nbsp;&nbsp;&#45;- @what: dbms_application_info.set_session_longops
&nbsp;&nbsp;&#45;- @link: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1099233454171#18173358903352
&nbsp;&nbsp;l_nohint&nbsp;&nbsp;&nbsp;&nbsp; NUMBER DEFAULT dbms_application_info.set_session_longops_nohint;
&nbsp;&nbsp;l_rindex&nbsp;&nbsp;&nbsp;&nbsp; NUMBER DEFAULT l_nohint;
&nbsp;
&nbsp;&nbsp;n_slno&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NUMBER;
&nbsp;&nbsp;n_totalwork NUMBER := 847; &#45;- init total work, number of records in loop recordset is 847
&nbsp;&nbsp;n_sofar&nbsp;&nbsp;&nbsp;&nbsp; NUMBER := 0;
&nbsp;
BEGIN
&nbsp;
&nbsp;&nbsp;FOR i IN
&nbsp;&nbsp;(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SELECT&nbsp;&nbsp;*********.DBKey&nbsp;&nbsp;FloorDBKey,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*********.Value3 StoreVersionID
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FROM&nbsp;&nbsp;&nbsp;&nbsp;*********,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*********,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*********
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WHERE&nbsp;&nbsp; *********.DBParentStoreKey = *********.DBKey
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AND&nbsp;&nbsp;&nbsp;&nbsp; *********.DBKey = *********.DBParentFloorplanKey
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AND&nbsp;&nbsp;&nbsp;&nbsp; *********.DBStatus = 1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AND&nbsp;&nbsp;&nbsp;&nbsp; *********.DBStatus = 1
&nbsp;&nbsp;&#45;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *********.DBKey = 121281
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ORDER BY *********.DBKey
&nbsp;&nbsp;)
&nbsp;&nbsp;LOOP
&nbsp;&nbsp;&nbsp;&nbsp;n_sofar := n_sofar + 1;
&nbsp;&nbsp;&nbsp;&nbsp;sys.dbms_application_info.set_session_longops (
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rindex&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; l_rindex,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;slno&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; n_slno,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;op_name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; &#039;csg_Store_Fixture_OneStore&#039;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;target&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; 123,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;context&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 123,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sofar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; n_sofar,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;totalwork&nbsp;&nbsp;&nbsp;&nbsp; =&gt; n_totalwork,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;target_desc&nbsp;&nbsp; =&gt; &#039;********* loop&#039;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;units&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; &#039;PL/SQL Loop iterations&#039;
&nbsp;&nbsp;&nbsp;&nbsp;);
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;n_starttime := dbms_utility.get_time+power(2,32);
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;ems_ikb.csg_Store_Fixture_OneStore( d_date, i.FloorDBKey, i.StoreVersionID);
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;n_endtime := dbms_utility.get_time+power(2,32);
&nbsp;&nbsp;&nbsp;&nbsp;n_elapsed := n_endtime - n_starttime;
&nbsp;&nbsp;&nbsp;&nbsp;dbms_output.put_line( &#039;Store &#039; || i.FloorDBKey || &#039; took &#039; || n_elapsed || &#039; msecs&#039;);
&nbsp;
&nbsp;&nbsp;END LOOP;
END;
/
&nbsp;
select to_char(sysdate, &#039;DD-MON-YY hh:mi:ss AM&#039;) sdate from dual
/
</pre>
<p>
Monitor progress in v$session_longops. (Output was from a testrun after I added an index and reducing runtime from over twelve hours to under 15 minutes.)
</p>
<pre>
SQL&gt; /
&nbsp;&nbsp;SID OP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SOFAR TOTALWORK&nbsp;&nbsp;PERC UNITS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;START_TIME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ELAPSED_SECONDS
&#45;&#45;&#45;-- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;- &#45;&#45;-&#45;&#45;&#45;- &#45;&#45;-&#45;&#45;-&#45;&#45;- &#45;&#45;&#45;-- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;&#45;- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-
&nbsp;&nbsp;107 csg_Store_Fixture_OneSto&nbsp;&nbsp;&nbsp;&nbsp; 301&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 847&nbsp;&nbsp;&nbsp;&nbsp;36 PL/SQL Loop iterations 16-OCT 12:30:20&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 243
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
SQL&gt; /&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;SID OP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SOFAR TOTALWORK&nbsp;&nbsp;PERC UNITS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;START_TIME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ELAPSED_SECONDS
&#45;&#45;&#45;-- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;- &#45;&#45;-&#45;&#45;&#45;- &#45;&#45;-&#45;&#45;-&#45;&#45;- &#45;&#45;&#45;-- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;&#45;- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-
&nbsp;&nbsp;107 csg_Store_Fixture_OneSto&nbsp;&nbsp;&nbsp;&nbsp; 422&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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-- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;- &#45;&#45;-&#45;&#45;&#45;- &#45;&#45;-&#45;&#45;-&#45;&#45;- &#45;&#45;&#45;-- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;&#45;- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-
&nbsp;&nbsp;107 csg_Store_Fixture_OneSto&nbsp;&nbsp;&nbsp;&nbsp; 740&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 847&nbsp;&nbsp;&nbsp;&nbsp;87 PL/SQL Loop iterations 16-OCT 12:30:20&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 574
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
SQL&gt; /&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;SID OP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SOFAR TOTALWORK&nbsp;&nbsp;PERC UNITS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;START_TIME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ELAPSED_SECONDS
&#45;&#45;&#45;-- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;- &#45;&#45;-&#45;&#45;&#45;- &#45;&#45;-&#45;&#45;-&#45;&#45;- &#45;&#45;&#45;-- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;&#45;- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-
&nbsp;&nbsp;107 csg_Store_Fixture_OneSto&nbsp;&nbsp;&nbsp;&nbsp; 845&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 847&nbsp;&nbsp; 100 PL/SQL Loop iterations 16-OCT 12:30:20&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 663
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</pre>
<p>
Links:
</p>
<ul>
<li><a target="_blank" class="link-dest-external" href="http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16760/d_appinf.htm#i996999">PL/SQL Packages and Types Reference &#8211; 20 DBMS_APPLICATION_INFO / http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16760/d_appinf.htm#i996999</a></li>
<li><a target="_blank" class="link-dest-external" href="http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2389164927483">Tom Kyte &#8211; Display elpased time (milliseconds) using dbms_utility.get_time / http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2389164927483</a></li>
<li><a target="_blank" class="link-dest-external" href="http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1099233454171#18173358903352">Tom Kyte &#8211; Working example of dbms_application_info.set_session_longops / http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1099233454171#18173358903352</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://remidian.com/oracle/monitor-progress-with-dbms_application_info-set_session_longops.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>change database id of database</title>
		<link>http://remidian.com/oracle/change-database-id-of-database.html</link>
		<comments>http://remidian.com/oracle/change-database-id-of-database.html#comments</comments>
		<pubDate>Tue, 05 Oct 2010 07:51:42 +0000</pubDate>
		<dc:creator>remivisser</dc:creator>
				<category><![CDATA[DBA util]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://remidian.com/?p=348</guid>
		<description><![CDATA[SQL script to change database id of database. shutdown immediate startup mount host nid target=/ disconnect connect / as sysdba startup mount alter database open resetlogs; &#160;]]></description>
			<content:encoded><![CDATA[<p>
SQL script to change database id of database.<span id="more-348"></span>
</p>
<pre>
shutdown immediate
startup mount
host nid target=/
disconnect
connect / as sysdba
startup mount
alter database open resetlogs;
&nbsp;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://remidian.com/oracle/change-database-id-of-database.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>a winner, flashback query; AS OF TIMESTAMP</title>
		<link>http://remidian.com/oracle/a-winner-flashback-query-as-of-timestamp.html</link>
		<comments>http://remidian.com/oracle/a-winner-flashback-query-as-of-timestamp.html#comments</comments>
		<pubDate>Mon, 27 Sep 2010 08:13:57 +0000</pubDate>
		<dc:creator>remivisser</dc:creator>
				<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://remidian.com/?p=335</guid>
		<description><![CDATA[Recovering data from a malicious SQL update carried out on a production database. Instead of restoring the whole database to recover some lost data I gave flashback query a try and even thougg the &#8216;undo_retention&#8217; parameter was set to only 5 minutes oracle recovered the data from the table from about 18 hours before. SQL [...]]]></description>
			<content:encoded><![CDATA[<p>Recovering data from a malicious SQL update carried out on a production database. Instead of restoring the whole database to recover some lost data I gave flashback query a try and even thougg the &#8216;undo_retention&#8217; parameter was set to only 5 minutes oracle recovered the data from the table from about 18 hours before.<span id="more-335"></span></p>
<p>SQL Statements below recover the data from a timestamp just before the offending SQL update was carried out. I saved the data to a _BAK table. </p>
<p>From: Visser, Remi<br />
Sent: Wednesday, September 22, 2010 3:37 PM<br />
To: ********<br />
Subject: recoverd *********** table using oracle flashback query</p>
<p>Importance: High</p>
<p>Hi ****</p>
<p>I was able to recover the table using flashback query. See below.</p>
<p>Please check the data in the table ********_BAK it contains the data in ******** as of  2010-09-22 09:00:00. The offensing update was carried out at 9:10 hours.</p>
<p>When the data is OK I can merge the data from the _BAK table to the original production table.</p>
<pre>
SQL&gt; create table ********_BAK
&nbsp;&nbsp;2&nbsp;&nbsp;as
&nbsp;&nbsp;3&nbsp;&nbsp;SELECT * FROM BAGR.********&nbsp;&nbsp;&nbsp;&nbsp;AS OF TIMESTAMP 
&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp; TO_TIMESTAMP(&#039;2010-09-22 09:00:00&#039;, &#039;YYYY-MM-DD HH:MI:SS&#039;)
&nbsp;&nbsp;5&nbsp;&nbsp;;

Table created.

&nbsp;
SQL&gt; create public synonym ********_BAK for ********.********_BAK;

Synonym created.

&nbsp;
SQL&gt; grant select on ********.********_BAK to public;

Grant succeeded.
</pre>
<p>
Dutch people, notice the schema owner name &#8216;BAGR.********&#8217;, Hello my name is &#8216;BAGR&#8217;, how nice&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://remidian.com/oracle/a-winner-flashback-query-as-of-timestamp.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Purging SYSAUX tablespace (Purging AWR reports)</title>
		<link>http://remidian.com/oracle/purging-sysaux-tablespace-purging-awr-reports.html</link>
		<comments>http://remidian.com/oracle/purging-sysaux-tablespace-purging-awr-reports.html#comments</comments>
		<pubDate>Tue, 18 Aug 2009 10:52:10 +0000</pubDate>
		<dc:creator>remivisser</dc:creator>
				<category><![CDATA[Grid]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://remidian.com/?p=265</guid>
		<description><![CDATA[Dump below is of a session clearing the sysaux tablespace. It turned out that something went wrong with the automatic AWR gathering/purging and the sysaux tablespace became very large. Thanks to this blog I found script below wich displays the various sysaux components and their sizes. SQL&#62; col &#34;Space (M)&#34; for 999,999.99&#160;&#160; SQL&#62; SQL&#62; SELECT [...]]]></description>
			<content:encoded><![CDATA[<p>
Dump below is of a session clearing the sysaux tablespace. <span id="more-265"></span>It turned out that something went wrong with the automatic AWR gathering/purging and the sysaux tablespace became very large.
</p>
<p>
Thanks to <a target="_blank" class="link-dest-external" href="http://jhdba.wordpress.com/2009/05/19/purging-statistics-from-the-sysaux-tablespace/">this blog</a> I found script below wich displays the various sysaux components and their sizes.
</p>
<pre>
SQL&gt; col &quot;Space (M)&quot; for 999,999.99&nbsp;&nbsp;
SQL&gt; 
SQL&gt; SELECT 
&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;occupant_name,&nbsp;&nbsp;
&nbsp;&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;round( space_usage_kbytes/1024) &quot;Space (M)&quot;,&nbsp;&nbsp;
&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;schema_name, 
&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;move_procedure
&nbsp;&nbsp;6&nbsp;&nbsp;FROM 
&nbsp;&nbsp;7&nbsp;&nbsp;&nbsp;&nbsp;v$sysaux_occupants&nbsp;&nbsp;
&nbsp;&nbsp;8&nbsp;&nbsp;ORDER BY 
&nbsp;&nbsp;9&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;
 10&nbsp;&nbsp;/
OCCUPANT_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Space (M) SCHEMA_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOVE_PROCEDURE
&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;&#45;-- &#45;&#45;-&#45;&#45;-&#45;&#45;&#45;-- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;&#45;-- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;&#45;-
AO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.00 SYS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DBMS_AW.MOVE_AWMETA
EM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DBMS_XSOQ.OlapiMoveProc
&nbsp;
22 rows selected.
&nbsp;
SQL&gt;&nbsp;&nbsp; 
SQL&gt; 
</pre>
<p>
Next thing I retrieve the oldest and latest AWR snapshot, turns out to be 2007&#8230;
</p>
<pre>
SQL&gt; SELECT 
&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;snap_id, begin_interval_time, end_interval_time 
&nbsp;&nbsp;3&nbsp;&nbsp;FROM 
&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;SYS.WRM$_SNAPSHOT 
&nbsp;&nbsp;5&nbsp;&nbsp;WHERE 
&nbsp;&nbsp;6&nbsp;&nbsp;&nbsp;&nbsp;snap_id = ( SELECT MIN (snap_id) FROM SYS.WRM$_SNAPSHOT)
&nbsp;&nbsp;7&nbsp;&nbsp;UNION 
&nbsp;&nbsp;8&nbsp;&nbsp;SELECT 
&nbsp;&nbsp;9&nbsp;&nbsp;&nbsp;&nbsp;snap_id, begin_interval_time, end_interval_time 
 10&nbsp;&nbsp;FROM 
 11&nbsp;&nbsp;&nbsp;&nbsp;SYS.WRM$_SNAPSHOT 
 12&nbsp;&nbsp;WHERE 
 13&nbsp;&nbsp;&nbsp;&nbsp;snap_id = ( SELECT MAX (snap_id) FROM SYS.WRM$_SNAPSHOT)
 14&nbsp;&nbsp;/
&nbsp;&nbsp; SNAP_ID BEGIN_INTERVAL_TIME&nbsp;&nbsp; END_INTERVAL_TIME
&#45;&#45;-&#45;&#45;-&#45;&#45;&#45;- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;- &#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;7556 <strong>15-09-07 08:44:42,810</strong> 15-09-07 11:01:11,950
&nbsp;&nbsp;&nbsp;&nbsp; 23698 18-08-09 11:00:41,612 18-08-09 12:00:53,074
&nbsp;
</pre>
<p>
<em><br />
I prefer SYS.WRM$_SNAPSHOT instead of DBA_HIST_SNAPSHOT because I saw strange results in (Release 10.1.0.5).<br />
</em><br />
Now use the dbms_workload_repository package to remove the AWR snapshots.
</p>
<pre>
BEGIN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;dbms_workload_repository.drop_snapshot_range(low_snap_id =&gt; 7556, high_snap_id=&gt;15000);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
END;
/
</pre>
<h3>Speed up &#8216;removal&#8217; of old AWR reports</h3>
<p>
@#$%^&#038;*()_ removing the entries takes ages and fails on undo errors &#8230; Metalink note Doc ID: 852028.1 states that I can safely remove the AWR metadata tables and recreate them.
</p>
<blockquote><p>
If none of the above suits as everything is set proper then consider clean up and rebuild AWR repository to clear all the space.
</p></blockquote>
<pre>
SQL&gt; connect / as sysdba 
SQL&gt; @?/rdbms/admin/catnoawr.sql 
SQL&gt; @?/rdbms/admin/catawrtb.sql 
</pre>
]]></content:encoded>
			<wfw:commentRss>http://remidian.com/oracle/purging-sysaux-tablespace-purging-awr-reports.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Manually triggering Metric Collection (clearing -tablespace- Alerts)</title>
		<link>http://remidian.com/oracle/grid/manually-triggering-metric-collection-clearing-alerts.html</link>
		<comments>http://remidian.com/oracle/grid/manually-triggering-metric-collection-clearing-alerts.html#comments</comments>
		<pubDate>Tue, 19 Feb 2008 09:28:50 +0000</pubDate>
		<dc:creator>remivisser</dc:creator>
				<category><![CDATA[Grid]]></category>

		<guid isPermaLink="false">http://remidian.com/oracle/grid/manually-triggering-metric-collection-clearing-alerts.html</guid>
		<description><![CDATA[Manually triggering metric collection in Oracle Enterprise Manager (GRID control) Here&#8217;s the scenario: You have an Alert that your tablespace is &#8216;full&#8217;, You enlarge the tablespace, The &#8216;Tablespace Full Alert&#8217; is still in your dashbord for the next 24 (x) hours since you&#8217;ve configured this metric to be collected once every 24 (x) hours, You [...]]]></description>
			<content:encoded><![CDATA[<p>Manually triggering metric collection in Oracle Enterprise Manager (GRID control)</p>
<p><span id="more-72"></span></p>
<p>
Here&#8217;s the scenario:
</p>
<ol>
<li>You have an Alert that your tablespace is &#8216;full&#8217;,</li>
<li>You enlarge the tablespace,</li>
<li>The &#8216;Tablespace Full Alert&#8217; is still in your dashbord for the next 24 (x) hours since you&#8217;ve configured this metric to be collected once every 24 (x) hours,</li>
<li>You <strong>want</strong> however to &#8216;remove&#8217; (clear) this Alert. In order to achive this you will have to to re-evaluate this metric collection &#8230;</li>
</ol>
<p>
Here is how you do it (for anything storage related on your database server):
</p>
<pre>
$ emctl control agent runCollection &lt;hostname&gt;:host host_storage
</pre>
<p>
See the Oracle docs, <a target="_blank" class="link-dest-external" href="http://download.oracle.com/docs/cd/B19306_01/em.102/b40002/emctl.htm#sthref202<br />
">2.7.6 Reevaluating Metric Collections</a>. It shows you how to retrieve the correct <em>collection</em> name for any <em>metric</em>.
</p>
<p>
You will find yourself <code>grep</code>-ing through &#8216;$ORACLE_HOME/sysman/admin/metadata/*xml&#8217; and &#8216;$ORACLE_HOME/sysman/admin/default_collection/*xml&#8217; &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://remidian.com/oracle/grid/manually-triggering-metric-collection-clearing-alerts.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

