<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1636561596040407909</id><updated>2011-07-28T15:15:03.451-07:00</updated><title type='text'>Rodrigo Rodrigues</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://rodrigorodriguessp.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://rodrigorodriguessp.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>rodrigo.rodriguessp</name><uri>http://www.blogger.com/profile/03319446857597123225</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_emDa0wGyac4/S6yq2tSBzOI/AAAAAAAACLk/cvSfvkftTkU/S220/OgAAADnt0ftcHcrbF_x6o6x07LEtfEpJnxbggBY8sXNk4Krfe8YGDejhvSrdQvdSa-LPE76vN_tqTdZq8XwIeMXVLyUAm1T1ULqq4DSYQjmWxROq_iWDhHWHNWcJ.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>9</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1636561596040407909.post-6442185318594989052</id><published>2010-03-26T06:30:00.000-07:00</published><updated>2010-03-26T06:48:24.219-07:00</updated><title type='text'>Installing Oracle on Windows 7 x64</title><content type='html'>São Paulo, 26-May-2010,&lt;br /&gt;&lt;br /&gt;This complex procedure was tested and you'll be able to accomplish the steps in 2 hours approximately. LOL.&lt;br /&gt;&lt;br /&gt;- Step one&lt;br /&gt;&lt;br /&gt;Before start the installation edit the following file&lt;br /&gt;&lt;br /&gt;"WhereUveExtractedDaOraFiles"\database\install\oraparam.ini&lt;br /&gt;&lt;br /&gt;And find this&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;[Certified Versions]&lt;br /&gt;#You can customise error message shown for failure, provide value for CERTIFIED_VERSION_FAILURE_MESSAGE&lt;br /&gt;Windows=5.0,5.1,5.2,6.0&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;Append 6.1 to the end of the line.&lt;br /&gt;That works for 10g and 11g, I havent tried for 9i but Im pretty sure It should be the same.&lt;br /&gt;&lt;br /&gt;- Step two&lt;br /&gt;&lt;br /&gt;Get back to that gossip, soccer, torrent, gaga or whatever website you were.&lt;br /&gt;&lt;br /&gt;Enjoy, Rod.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1636561596040407909-6442185318594989052?l=rodrigorodriguessp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rodrigorodriguessp.blogspot.com/feeds/6442185318594989052/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2010/03/installing-oracle-on-windows-7-x64.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/6442185318594989052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/6442185318594989052'/><link rel='alternate' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2010/03/installing-oracle-on-windows-7-x64.html' title='Installing Oracle on Windows 7 x64'/><author><name>rodrigo.rodriguessp</name><uri>http://www.blogger.com/profile/03319446857597123225</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_emDa0wGyac4/S6yq2tSBzOI/AAAAAAAACLk/cvSfvkftTkU/S220/OgAAADnt0ftcHcrbF_x6o6x07LEtfEpJnxbggBY8sXNk4Krfe8YGDejhvSrdQvdSa-LPE76vN_tqTdZq8XwIeMXVLyUAm1T1ULqq4DSYQjmWxROq_iWDhHWHNWcJ.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1636561596040407909.post-3389075575394079989</id><published>2010-03-26T05:41:00.000-07:00</published><updated>2010-03-26T06:18:56.541-07:00</updated><title type='text'>Outer Join using case</title><content type='html'>São Paulo, 26-May-2010,&lt;br /&gt;&lt;br /&gt;I was workin on table integrity issues, u know, when data from different systems have to be consolidaded in a sort of bi report and they dont have a relationship between them.&lt;br /&gt;The report was supposed to retreive customer information from those systems, cross it n present the results.&lt;br /&gt;But what if one system tells u the customer did something and the other dont.&lt;br /&gt;Well, lets have a look at this piece of code (if I can call sql as a real code :P):&lt;br /&gt;&lt;br /&gt;create table system1(&lt;br /&gt;key char(1), --dont ask me why char, ok?&lt;br /&gt;status char(8),&lt;br /&gt;descrpt char(6),&lt;br /&gt;avail char(1));&lt;br /&gt;&lt;br /&gt;create table system2(key char(1),&lt;br /&gt;status char(8),&lt;br /&gt;descrpt char(6),&lt;br /&gt;avail char(1),&lt;br /&gt;surrogate number); --have u watched that movie? crap.&lt;br /&gt;&lt;br /&gt;insert into system1 values ('A', 'ACTIVE', 'PROD A', 'Y');&lt;br /&gt;insert into system1 values ('B', 'ACTIVE', 'PROD B', 'N');&lt;br /&gt;insert into system1 values ('C', 'INACTIVE', 'PROD C', 'Y');&lt;br /&gt;&lt;br /&gt;insert into system2 values ('A','INACTIVE','PROD A','Y',1001);&lt;br /&gt;insert into system2 values ('A','ACTIVE', 'PROD A','Y',1002);&lt;br /&gt;insert into system2 values ('B','INACTIVE','PROD B','Y',2001);&lt;br /&gt;insert into system2 values ('D','ACTIVE', 'PROD D','Y',4001);&lt;br /&gt;&lt;br /&gt;select t2.surrogate, t1.key, t1.status, t1.key T1KEYNULL, t2.key T2KEYNULL, t1.key ' ' t2.key T1KEYT2KEYDIFF from t1 full outer join t2 on t1.key=t2.key&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;SELECT *&lt;br /&gt;FROM (SELECT t2.surrogate,&lt;br /&gt;t1.key,&lt;br /&gt;t1.status,&lt;br /&gt;CASE WHEN t1.key IS NULL THEN 1 ELSE 0 END AS t1keynull,&lt;br /&gt;CASE WHEN t2.key IS NULL THEN 1 ELSE 0 END AS t2keynull,&lt;br /&gt;CASE WHEN t1.key IS NOT NULL AND t2.key IS NOT NULL AND (t1.status &lt;&gt; t2.status) /* Status is mandatory */ THEN 1 ELSE 0 END AS t1keyt2keydiff&lt;br /&gt;FROM t2&lt;br /&gt;FULL OUTER JOIN t1 ON t1.key = t2.key)&lt;br /&gt;WHERE t1keynull + t2keynull + t1keyt2keydiff &gt; 0&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;I wont post the results from the selects above, Its up to you give it a try.&lt;br /&gt;I tried to predict all possibilites using the case statement.&lt;br /&gt;Hope it helps.&lt;br /&gt;&lt;br /&gt;Rod.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1636561596040407909-3389075575394079989?l=rodrigorodriguessp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rodrigorodriguessp.blogspot.com/feeds/3389075575394079989/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2010/03/outer-join-using-case.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/3389075575394079989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/3389075575394079989'/><link rel='alternate' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2010/03/outer-join-using-case.html' title='Outer Join using case'/><author><name>rodrigo.rodriguessp</name><uri>http://www.blogger.com/profile/03319446857597123225</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_emDa0wGyac4/S6yq2tSBzOI/AAAAAAAACLk/cvSfvkftTkU/S220/OgAAADnt0ftcHcrbF_x6o6x07LEtfEpJnxbggBY8sXNk4Krfe8YGDejhvSrdQvdSa-LPE76vN_tqTdZq8XwIeMXVLyUAm1T1ULqq4DSYQjmWxROq_iWDhHWHNWcJ.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1636561596040407909.post-3475034735683789970</id><published>2009-07-06T05:26:00.000-07:00</published><updated>2009-07-06T05:27:18.010-07:00</updated><title type='text'>procedure para pegar locks (imcompleta) :(</title><content type='html'>CREATE OR REPLACE procedure UNIMED.pr_monitora_locks as&lt;br /&gt;&lt;br /&gt;v_conta number(10):=0;&lt;br /&gt;v_guarda_sql varchar2(4000);&lt;br /&gt;v_data date;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;cursor clock is&lt;br /&gt;select  lpad(' ',3*(level-1))  waiting_session waiting_session,&lt;br /&gt;    lock_type,&lt;br /&gt;    mode_requested,&lt;br /&gt;    mode_held,&lt;br /&gt;    lock_id1,&lt;br /&gt;    lock_id2&lt;br /&gt; from tmp_lock_holders&lt;br /&gt;connect by  prior waiting_session = holding_session&lt;br /&gt;  start with holding_session is null;&lt;br /&gt;&lt;br /&gt;rlock clock%rowtype;&lt;br /&gt;&lt;br /&gt;cursor csess is&lt;br /&gt; select PROCESS,username USERNAME,&lt;br /&gt;        sid,&lt;br /&gt;        serial#,&lt;br /&gt;        MACHINE  MACHINE,&lt;br /&gt;        TERMINAL TERMINAL,&lt;br /&gt;        osuser   OSUSER,&lt;br /&gt;        LOCKWAIT,&lt;br /&gt;        status,&lt;br /&gt;        program,&lt;br /&gt;        lpad(to_char(sql_hash_value),20,'0') SQL_HASH_VALUE,&lt;br /&gt;        sql_address,&lt;br /&gt;    module,action,client_info&lt;br /&gt; from v$session&lt;br /&gt; where username is not null&lt;br /&gt;   and username &lt;&gt; 'SYS'&lt;br /&gt;   and sid = to_number(rtrim(ltrim(rlock.waiting_session)));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;rsess csess%rowtype;&lt;br /&gt;&lt;br /&gt;cursor ctextosql is&lt;br /&gt;select sql_text&lt;br /&gt;from v$sqltext&lt;br /&gt;where address = rsess.sql_address&lt;br /&gt;order by piece;&lt;br /&gt;&lt;br /&gt;rtextosql ctextosql%rowtype;&lt;br /&gt;&lt;br /&gt;v_erro varchar2(200);&lt;br /&gt;v_code number;&lt;br /&gt;&lt;br /&gt;begin&lt;br /&gt;&lt;br /&gt;insert into tmp_dba_locks_temp&lt;br /&gt;select * from dba_locks;&lt;br /&gt;&lt;br /&gt;commit;&lt;br /&gt;&lt;br /&gt;insert into tmp_lock_holders&lt;br /&gt;  select w.session_id,&lt;br /&gt;        h.session_id,&lt;br /&gt;        w.lock_type,&lt;br /&gt;        h.mode_held,&lt;br /&gt;        w.mode_requested,&lt;br /&gt;        w.lock_id1,&lt;br /&gt;        w.lock_id2&lt;br /&gt;  from tmp_dba_locks_temp w, tmp_dba_locks_temp h&lt;br /&gt; where h.blocking_others =  'Blocking'&lt;br /&gt;  and  h.mode_held      !=  'None'&lt;br /&gt;  and  h.mode_held      !=  'Null'&lt;br /&gt;  and  w.mode_requested !=  'None'&lt;br /&gt;  and  w.lock_type       =  h.lock_type&lt;br /&gt;  and  w.lock_id1        =  h.lock_id1&lt;br /&gt;  and  w.lock_id2        =  h.lock_id2;&lt;br /&gt;&lt;br /&gt;commit;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;insert into tmp_lock_holders&lt;br /&gt;  select holding_session, null, 'None', null, null, null, null&lt;br /&gt;    from tmp_lock_holders&lt;br /&gt; minus&lt;br /&gt;  select waiting_session, null, 'None', null, null, null, null&lt;br /&gt;    from tmp_lock_holders;&lt;br /&gt;commit;&lt;br /&gt;&lt;br /&gt;v_data:=sysdate;&lt;br /&gt;&lt;br /&gt;open clock;&lt;br /&gt;loop&lt;br /&gt;fetch clock into rlock;&lt;br /&gt;exit when clock%notfound;&lt;br /&gt;&lt;br /&gt;v_conta:=v_conta+1;&lt;br /&gt;&lt;br /&gt;if v_conta = 6 then exit;&lt;br /&gt;end if;&lt;br /&gt;&lt;br /&gt;open csess;&lt;br /&gt;fetch csess into rsess;&lt;br /&gt;&lt;br /&gt;    v_guarda_sql:=' ';&lt;br /&gt;    open ctextosql;&lt;br /&gt;    loop&lt;br /&gt;    fetch ctextosql into rtextosql;&lt;br /&gt;    exit when ctextosql%notfound;&lt;br /&gt;        if length(v_guarda_sql) &gt;= 4000 then&lt;br /&gt;            null;&lt;br /&gt;        else&lt;br /&gt;            v_guarda_sql:=substr(v_guarda_sqlrtextosql.sql_text,1,4000);&lt;br /&gt;        end if;&lt;br /&gt;    end loop;&lt;br /&gt;    close ctextosql;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;if csess%found then&lt;br /&gt;   insert into tmp_guarda_lock_holders&lt;br /&gt;   (data_registro,sequencia,&lt;br /&gt;    waiting_session,&lt;br /&gt;    --holding_session,&lt;br /&gt;    lock_type      ,mode_held      ,&lt;br /&gt;    mode_requested ,lock_id1       ,&lt;br /&gt;    lock_id2       ,sess_process   ,&lt;br /&gt;    sess_username  ,sess_sid       ,&lt;br /&gt;    sess_serial#   ,sess_machine   ,&lt;br /&gt;    sess_terminal  ,sess_osuser    ,&lt;br /&gt;    sess_lockwait  ,sess_status    ,&lt;br /&gt;    sess_program   ,sess_sqladdress,&lt;br /&gt;    sess_module    ,sess_action    ,&lt;br /&gt;    sess_client_info,sql_texto)&lt;br /&gt;    values(v_data,v_conta,&lt;br /&gt;        rlock.waiting_session,&lt;br /&gt;        --rlock.holding_session,&lt;br /&gt;        rlock.lock_type      ,rlock.mode_held      ,&lt;br /&gt;        rlock.mode_requested ,rlock.lock_id1       ,&lt;br /&gt;        rlock.lock_id2       ,&lt;br /&gt;        rsess.process   ,&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1636561596040407909-3475034735683789970?l=rodrigorodriguessp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rodrigorodriguessp.blogspot.com/feeds/3475034735683789970/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2009/07/procedure-para-pegar-locks-imcompleta.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/3475034735683789970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/3475034735683789970'/><link rel='alternate' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2009/07/procedure-para-pegar-locks-imcompleta.html' title='procedure para pegar locks (imcompleta) :('/><author><name>rodrigo.rodriguessp</name><uri>http://www.blogger.com/profile/03319446857597123225</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_emDa0wGyac4/S6yq2tSBzOI/AAAAAAAACLk/cvSfvkftTkU/S220/OgAAADnt0ftcHcrbF_x6o6x07LEtfEpJnxbggBY8sXNk4Krfe8YGDejhvSrdQvdSa-LPE76vN_tqTdZq8XwIeMXVLyUAm1T1ULqq4DSYQjmWxROq_iWDhHWHNWcJ.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1636561596040407909.post-4568011987300552151</id><published>2009-06-23T06:49:00.001-07:00</published><updated>2009-06-23T06:49:24.962-07:00</updated><title type='text'></title><content type='html'># tip: Use utllockt.sql to find the offending user# locksql.sql&lt;br /&gt;select ses.username'('ses.sid')' users, acc.owner owner,acc.object object, ses.lockwait, txt.sql_text sqltextfrom v$sqltext txt, v$access acc, v$session seswhere txt.address = ses.sql_addressand txt.hash_value = ses.sql_hash_valueand ses.sid = acc.sidand ses.lockwait is not null;&lt;br /&gt;# If your database has many users logging on to the database using# the same user ID, you can obtain the operating system process ID # using the following script&lt;br /&gt;# lockproc.sql&lt;br /&gt;select ses.username'('ses.sid')' users, acc.owner owner,acc.object object, ses.lockwait, ses.osuser os_processfrom v$process prc, v$access acc, v$session seswhere prc.addr = ses.paddrand ses.sid = acc.sidand ses.lockwait is not null;&lt;br /&gt;# To observe the blocking user sessions and the waiting user# sessions all in a single statement, you can run the following# script&lt;br /&gt;# lockhldr.sql or blocker.sql&lt;br /&gt;TTITLE 'User Blocking and Waiting for Other Users'Select distinct o.object_name, sh.username'('sh.sid')' 'Holder', sw.username'('sw.sid')' 'Waiter',decode(lh.lmode, 1, 'NULL', 2,'row share', 3, 'row exclusive', 4, 'share', 5, 'share row exclusive', 6, 'exclusive') 'Lock Type'from all_objects o, v$session sw, v$lock lw, v$session sh, v$lock lhwhere lh.id1 = o.object_idand lh.id1 = lw.id1and sh.sid= lh.sidand sw.sid= lw.sidand sh.lockwait is nulland sw.lockwait is not nulland lh.type = 'TM'and lw.type = 'TM'/&lt;br /&gt;# To obtain more information on the type of lock being held, you can # run the following script. The id1 column in the v$lock table is the# OBJECT_ID of the object being locked. The OBJECT_ID can be used to# search the DBA_OBJECTS table to determine the object and object´s# owner&lt;br /&gt;# tranlock.sql or alllocks.sql&lt;br /&gt;TTITLE 'Transactions Experiencing Lock Contention'Select decode(lmode, 2, 'Row-S(SS)',3, 'Row-X(SX)',4, 'Share',5, 'S/Row-X(SSX)',6, 'Exclusive','Other') Lock_Requested,id1, id2from v$lock where type='TX' and (id1, id2) in (select id1, id2 from v$lock l where id1=l.id1 and id2 = l.id2 and l.request &gt; 0);&lt;br /&gt;# To obtain all locks held by al users...&lt;br /&gt;select s.username, l.type, o.object_name,decode(l1.lmode, 2, 'Row-S(SS)',3, 'Row-X(SX)',4, 'Share',5, 'S/Row-X(SSX)',6, 'Exclusive','Other') Mode_Heldfrom dba_objects o, v$session s, v$lock lwhere s.sid = l.sidand o.object_id= l.id1;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1636561596040407909-4568011987300552151?l=rodrigorodriguessp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rodrigorodriguessp.blogspot.com/feeds/4568011987300552151/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2009/06/tip-use-utllockt.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/4568011987300552151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/4568011987300552151'/><link rel='alternate' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2009/06/tip-use-utllockt.html' title=''/><author><name>rodrigo.rodriguessp</name><uri>http://www.blogger.com/profile/03319446857597123225</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_emDa0wGyac4/S6yq2tSBzOI/AAAAAAAACLk/cvSfvkftTkU/S220/OgAAADnt0ftcHcrbF_x6o6x07LEtfEpJnxbggBY8sXNk4Krfe8YGDejhvSrdQvdSa-LPE76vN_tqTdZq8XwIeMXVLyUAm1T1ULqq4DSYQjmWxROq_iWDhHWHNWcJ.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1636561596040407909.post-6730547805133415672</id><published>2009-06-23T06:14:00.000-07:00</published><updated>2009-06-23T06:15:06.132-07:00</updated><title type='text'></title><content type='html'>&lt;a title="Permanent Link to How did we solve our “log file sync” ?" href="http://practicalappsdba.wordpress.com/2008/04/24/how-did-we-solve-our-log-file-sync/"&gt;How did we solve our “log file sync” ?&lt;/a&gt;&lt;br /&gt;Posted by &lt;a href="http://practicalappsdba.wordpress.com/"&gt;Navdeep Saini&lt;/a&gt; on April 24, 2008&lt;br /&gt;It was one of those intriguing days when for almost 2-3 days users/developers/managers has been bugging me for “possible” slowness in our EPR instance. Ofcourse I checked everything: no long running queries eating up resources, no sudden spurt of sessions, nothing in AWR report to show off, nothing to show that there is slowness in the database !!!&lt;br /&gt;I do not normaly loose sleep over performance issues, but it was irritating when apps support guys woke me up in middle of night for two consecutive nights. One batch job (conc. request) very critical to business, was running 5 hours behind schedule. Obvious place to look for was dbconsole “top activity” and tracing the conc. request. The trace file showed that request was just running crazy (tail -f of trace) and dbconsole did not show any particular activity which might be causing the slowness in the database. I tkprofed (sys=no, sort=exeela,prsela,fchela) the trace and found nothing wrong with the sqls that were reported. No wait events like “db file sequential/scattered read”, apart from few occurances of “log file sync” event. Looking more carefuly in the “top sessions” in dbconsole it occured to me that indeed “log file sync” was reported occasionally but only for few seconds.&lt;br /&gt;Observing more keenly I also found that trace of the sessions (tail -f of trace) was freezing occasionaly for few second and showing “log file sync” after it freezes. So it seems “log file sync” is my area of concern, albeit it was very miniscule in the overall database scenario.&lt;br /&gt;As per metalink standard Note:34592.1 on “log file sync”:&lt;br /&gt;The log file sync wait may be broken down into the following components:&lt;br /&gt;1. Wakeup LGWR if idle2. LGWR gathers the redo to be written and issue the I/O3. Time for the log write I/O to complete4. LGWR I/O post processing5. LGWR posting the foreground/user session that the write has completed6. Foreground/user session wakeup&lt;br /&gt;Tuning advice based on log file sync component breakdown above:&lt;br /&gt;Steps 2 and 3 are accumulated in the “redo write time” statistic. (i.e. as found under STATISICS section of Statspack and AWR)Step 3 is the “log file parallel write” wait event. (Note 34583.1:”log file parallel write” Reference Note )Steps 5 and 6 may become very significant as the system load increases. This is because even after the foreground has been posted it may take a some time for the OS to schedule it to run. May require monitoring from O/S level.&lt;br /&gt;As mentioned earlier, my AWR report was not showing “redo write time” and “log file parallel write” to be that significant. As such Load on the machine was “normal” and there was nothing that could point me to a direction in which I could proceed.&lt;br /&gt;The situation was becoming worse and batch job finally finished at 7:30 AM in the morning, 5:30 hours behind schedule. Blood hounds (business/apps support) were out after me and they were smelling blood. But I was not letting it go and turned to my internals knowledge. During my oracle days one of the thing I learned was that we can 10046 (sql trace) trace background sessions also. They will only show wait events in trace files as they normally do not fire any sqls. LGWR was my guy this time and I turned on the trace. VOILA !!! it was showing “log file parallel write” !!&lt;br /&gt;However my hopes were dashed immiediately as it was normal for LGWR to post this event as it writes (IO) to redo logs. Again I was in dark and could not fathom what could be the reason for “log file sync”. One wild idea that was floating in my mind was that it could be that there are suddenly more commits in the sytem. Apps support guys purged almot 800 millions rows in workflow tables, as they fixed some issue with workflow becuase of which they were not able to purge WF tables for almost a year !!!. Could it be that there are now 1/2 the number of rows in WF tables which might have “oiled” the system and now it was “churing” out more !!! There is suddenly more commits in the database and causing the LGWR to lag behind…..&lt;br /&gt;Keen observation is one common concept that many try to overlook and I was the one who was the victim of it that day. Looking at LGWR trace files again, I saw that elapsed time for “log file parallel write” was sometimes spiking. Simple unix sort on it showed that “elapsed time” was sometimes in secs where-as, as per oracle for 20k of redo it should not take more than 15 milliseconds. It was “log file parallel write” , a simple sutpid IO request on redo log files causing this delay. And since LGWR has to write to redo at every commit it was stalling the whole system !!!&lt;br /&gt;Here is portion of lgwr trace showing “log file parallel write” spiking to sometime to 39 secs !!&lt;br /&gt;WAIT #0: nam=’log file parallel write’ ela= 22324424 files=2 blocks=2 requests=2 obj#=-1 tim=13758521131245WAIT #0: nam=’rdbms ipc message’ ela= 6595 timeout=294 p2=0 p3=0 obj#=-1 tim=13758521138897WAIT #0: nam=’log file parallel write’ ela= 2343353 files=2 blocks=64 requests=4 obj#=-1 tim=13758521143128WAIT #0: nam=’rdbms ipc message’ ela= 97448 timeout=290 p2=0 p3=0 obj#=-1 tim=13758521262712WAIT #0: nam=’log file parallel write’ ela= 1294 files=2 blocks=80 requests=2 obj#=-1 tim=13758521264788WAIT #0: nam=’rdbms ipc message’ ela= 9538 timeout=280 p2=0 p3=0 obj#=-1 tim=13758521275843WAIT #0: nam=’log file parallel write’ ela= 909835 files=2 blocks=8 requests=2 obj#=-1 tim=13758521278533&lt;br /&gt;Mount points for redo logs was targeted and I contacted my SAs for DMX system. They immiediately found that out of four fiber adaptors on database machine , which connects to storage array via SAN switch, one was performing little slower. They asked for some more time to investigate. I waited for almost 1 excrutiating hour and finally heard back from them. It was indeed the IO sub-system. One of the port on SAN switch was “dying” causing frequent IO queues. They swapped the port with another one and it fixed it !!!. So it was just one simple bad port on SAN switch which was giving frequent “heart burns” to the database.&lt;br /&gt;Leason learned…on a very very busy system, esp. an OLTP like Oracle APPS, it is absolutely critical that write throughput on redo logs is maintained at every time. No RAID-5, just simple RAID-1, on faster fiber channels, san switches etc..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1636561596040407909-6730547805133415672?l=rodrigorodriguessp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rodrigorodriguessp.blogspot.com/feeds/6730547805133415672/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2009/06/how-did-we-solve-our-log-file-sync.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/6730547805133415672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/6730547805133415672'/><link rel='alternate' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2009/06/how-did-we-solve-our-log-file-sync.html' title=''/><author><name>rodrigo.rodriguessp</name><uri>http://www.blogger.com/profile/03319446857597123225</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_emDa0wGyac4/S6yq2tSBzOI/AAAAAAAACLk/cvSfvkftTkU/S220/OgAAADnt0ftcHcrbF_x6o6x07LEtfEpJnxbggBY8sXNk4Krfe8YGDejhvSrdQvdSa-LPE76vN_tqTdZq8XwIeMXVLyUAm1T1ULqq4DSYQjmWxROq_iWDhHWHNWcJ.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1636561596040407909.post-6152946631105806150</id><published>2009-06-04T07:30:00.000-07:00</published><updated>2009-06-04T07:32:07.098-07:00</updated><title type='text'>Procedure para tentar pegar os locks</title><content type='html'>&lt;div&gt;procedure get_lock_log is&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;--create table lock_log_holder (&lt;/div&gt;&lt;div&gt;--pk          number,&lt;/div&gt;&lt;div&gt;--sid         number,&lt;/div&gt;&lt;div&gt;--sql_address raw(8),&lt;/div&gt;&lt;div&gt;--username    varchar2(30),&lt;/div&gt;&lt;div&gt;--osuser      varchar2(30),&lt;/div&gt;&lt;div&gt;--estacao     varchar2(30),&lt;/div&gt;&lt;div&gt;--program     varchar2(50),&lt;/div&gt;&lt;div&gt;--horario     date,&lt;/div&gt;&lt;div&gt;--comando     varchar2(4000)&lt;/div&gt;&lt;div&gt;--ds_usu      VARCHAR2(30));&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;--create table lock_log_waiter (&lt;/div&gt;&lt;div&gt;--pk          number,&lt;/div&gt;&lt;div&gt;--sid         number,&lt;/div&gt;&lt;div&gt;--sid_holder  number,&lt;/div&gt;&lt;div&gt;--sql_address raw(8),&lt;/div&gt;&lt;div&gt;--username    varchar2(30),&lt;/div&gt;&lt;div&gt;--osuser      varchar2(30),&lt;/div&gt;&lt;div&gt;--estacao     varchar2(30),&lt;/div&gt;&lt;div&gt;--program     varchar2(50),&lt;/div&gt;&lt;div&gt;--horario     date,&lt;/div&gt;&lt;div&gt;--comando     varchar2(4000)&lt;/div&gt;&lt;div&gt;--ds_usu      VARCHAR2(30));&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;-- create sequence seq_lock_log_holder increment by 1;&lt;/div&gt;&lt;div&gt;-- create sequence seq_lock_log_waiter increment by 1;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;v_sql_address varchar2(16);&lt;/div&gt;&lt;div&gt;v_username    varchar2(30);&lt;/div&gt;&lt;div&gt;v_osuser      varchar2(30);&lt;/div&gt;&lt;div&gt;v_estacao     varchar2(30);&lt;/div&gt;&lt;div&gt;v_program     varchar2(50);&lt;/div&gt;&lt;div&gt;v_sysdate     varchar2(16);&lt;/div&gt;&lt;div&gt;v_sql_text    varchar2(64);&lt;/div&gt;&lt;div&gt;v_ds_usu      varchar2(30);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;v_pk_holder   number;&lt;/div&gt;&lt;div&gt;v_pk_waiter   number;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;begin&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        -- Who are the Lock Holders?&lt;/div&gt;&lt;div&gt;        for holder in (select sid, id1, id2 from sys.v$lock where block = 1) loop&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;                select to_char(sysdate, 'DD-MON-YY hh24:mi') into v_sysdate from dual;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;                -- Get the Holder´s SQL_ADDRESS&lt;/div&gt;&lt;div&gt;                select a.sql_address, a.username, a.osuser, decode(substr(a.terminal,1,24),'Window',a.machine,a.machine), a.program, b.ds_usu&lt;/div&gt;&lt;div&gt;                into   v_sql_address, v_username, v_osuser, v_estacao, v_program, v_ds_usu&lt;/div&gt;&lt;div&gt;                from   sys.v$session a, vld.usuarios b&lt;/div&gt;&lt;div&gt;                where  a.sid=holder.sid&lt;/div&gt;&lt;div&gt;                and    a.username=b.nome_usu;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;                -- Record the Holder&lt;/div&gt;&lt;div&gt;                insert into lock_log_holder&lt;/div&gt;&lt;div&gt;                values(seq_lock_log_holder.nextval,&lt;/div&gt;&lt;div&gt;                       holder.sid,&lt;/div&gt;&lt;div&gt;                       v_sql_address,&lt;/div&gt;&lt;div&gt;                       v_username,&lt;/div&gt;&lt;div&gt;                       v_osuser,&lt;/div&gt;&lt;div&gt;                       v_estacao,&lt;/div&gt;&lt;div&gt;                       v_program,&lt;/div&gt;&lt;div&gt;                       to_date(v_sysdate,'DD-MON-YY hh:mi'),&lt;/div&gt;&lt;div&gt;                       ' ',&lt;/div&gt;&lt;div&gt;                       v_ds_usu)&lt;/div&gt;&lt;div&gt;                returning pk into v_pk_holder;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;                -- Then record the Holder´s SQL_TEXT&lt;/div&gt;&lt;div&gt;                for text in (select sql_text from sys.v_$sqltext where address = v_sql_address order by piece) loop&lt;/div&gt;&lt;div&gt;                        update lock_log_holder set comando = comando || ' ' || text.sql_text where pk=v_pk_holder;&lt;/div&gt;&lt;div&gt;                        commit;&lt;/div&gt;&lt;div&gt;                end loop;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;                commit;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;                v_sql_address := '';&lt;/div&gt;&lt;div&gt;                v_username    := '';&lt;/div&gt;&lt;div&gt;                v_osuser      := '';&lt;/div&gt;&lt;div&gt;                v_estacao     := '';&lt;/div&gt;&lt;div&gt;                v_program     := '';&lt;/div&gt;&lt;div&gt;                v_sql_text    := '';&lt;/div&gt;&lt;div&gt;                v_ds_usu      := '';&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;                -- Get the Waiter´s SID and SQL_ADDRESS&lt;/div&gt;&lt;div&gt;                for waiter in (select sid from sys.v$lock where id1=holder.id1 and id2=holder.id2 and block=0) loop&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;                        -- Get the Waiter´s SQL_ADDRESS&lt;/div&gt;&lt;div&gt;                        select a.sql_address, a.username, a.osuser, decode(substr(a.terminal,1,24),'Window',a.machine,a.machine), a.program, b.ds_usu&lt;/div&gt;&lt;div&gt;                        into   v_sql_address, v_username, v_osuser, v_estacao, v_program, v_ds_usu&lt;/div&gt;&lt;div&gt;                        from   sys.v$session a, vld.usuarios b&lt;/div&gt;&lt;div&gt;                        where  a.sid=waiter.sid&lt;/div&gt;&lt;div&gt;                        and    a.username=b.nome_usu;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;                        -- Record the Waiter&lt;/div&gt;&lt;div&gt;                        insert into lock_log_waiter&lt;/div&gt;&lt;div&gt;                        values(seq_lock_log_waiter.nextval,&lt;/div&gt;&lt;div&gt;                               waiter.sid,&lt;/div&gt;&lt;div&gt;                               holder.sid,&lt;/div&gt;&lt;div&gt;                               v_sql_address,&lt;/div&gt;&lt;div&gt;                               v_username,&lt;/div&gt;&lt;div&gt;                               v_osuser,&lt;/div&gt;&lt;div&gt;                               v_estacao,&lt;/div&gt;&lt;div&gt;                               v_program,&lt;/div&gt;&lt;div&gt;                               to_date(v_sysdate,'DD-MON-YY hh:mi'),&lt;/div&gt;&lt;div&gt;                               ' ',&lt;/div&gt;&lt;div&gt;                               v_ds_usu)&lt;/div&gt;&lt;div&gt;                        returning pk into v_pk_waiter;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;                        --Then get the Waiter´s SQL_TEXT&lt;/div&gt;&lt;div&gt;                        for text in (select sql_text from sys.v_$sqltext where address = v_sql_address order by piece) loop&lt;/div&gt;&lt;div&gt;                                update lock_log_waiter set comando = comando || ' ' || text.sql_text where pk=v_pk_waiter;&lt;/div&gt;&lt;div&gt;                                commit;&lt;/div&gt;&lt;div&gt;                        end loop;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;                        commit;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;                end loop;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;                v_sql_address := '';&lt;/div&gt;&lt;div&gt;                v_username    := '';&lt;/div&gt;&lt;div&gt;                v_osuser      := '';&lt;/div&gt;&lt;div&gt;                v_estacao     := '';&lt;/div&gt;&lt;div&gt;                v_program     := '';&lt;/div&gt;&lt;div&gt;                v_sql_text    := '';&lt;/div&gt;&lt;div&gt;                v_ds_usu      := '';&lt;/div&gt;&lt;div&gt;                v_sysdate     := '';&lt;/div&gt;&lt;div&gt;                v_pk_holder   := '';&lt;/div&gt;&lt;div&gt;                v_pk_waiter   := '';&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        end loop;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        commit;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;exception&lt;/div&gt;&lt;div&gt;        when others then dbms_output.put_line(sqlerrm);&lt;/div&gt;&lt;div&gt;end;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;na Cron&lt;/div&gt;&lt;div&gt;&lt;div&gt;# Investigacao Locks Decat (NTUX)&lt;/div&gt;&lt;div&gt;0-59 8-17 * * 1-5 /ora817/ntux/get_lock_log_decat.sh&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1636561596040407909-6152946631105806150?l=rodrigorodriguessp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rodrigorodriguessp.blogspot.com/feeds/6152946631105806150/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2009/06/procedure-para-tentar-pegar-os-locks.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/6152946631105806150'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/6152946631105806150'/><link rel='alternate' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2009/06/procedure-para-tentar-pegar-os-locks.html' title='Procedure para tentar pegar os locks'/><author><name>rodrigo.rodriguessp</name><uri>http://www.blogger.com/profile/03319446857597123225</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_emDa0wGyac4/S6yq2tSBzOI/AAAAAAAACLk/cvSfvkftTkU/S220/OgAAADnt0ftcHcrbF_x6o6x07LEtfEpJnxbggBY8sXNk4Krfe8YGDejhvSrdQvdSa-LPE76vN_tqTdZq8XwIeMXVLyUAm1T1ULqq4DSYQjmWxROq_iWDhHWHNWcJ.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1636561596040407909.post-6962197004735206465</id><published>2009-06-04T07:18:00.000-07:00</published><updated>2009-06-04T07:28:34.052-07:00</updated><title type='text'>.sqls</title><content type='html'>&lt;div&gt;/ora817/ntux&gt;more sql.sql&lt;/div&gt;&lt;div&gt;set linesize 200&lt;/div&gt;&lt;div&gt;select optimizer_mode,first_load_time,executions,buffer_gets,disk_reads,sql_text from v$sqlarea where address='&amp;amp;addr'&lt;/div&gt;&lt;div&gt;/&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;/ora817/ntux&gt;more sql.sql&lt;/div&gt;&lt;div&gt;set linesize 200&lt;/div&gt;&lt;div&gt;select optimizer_mode,first_load_time,executions,buffer_gets,disk_reads,sql_text from v$sqlarea where address='&amp;amp;addr'&lt;/div&gt;&lt;div&gt;/&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;/ora817/ntux&gt;more allsql.sql&lt;/div&gt;&lt;div&gt;column sid format 999&lt;/div&gt;&lt;div&gt;set linesize 200&lt;/div&gt;&lt;div&gt;set pagesize 1000&lt;/div&gt;&lt;div&gt;column user_ora format a8&lt;/div&gt;&lt;div&gt;column conexao format a13&lt;/div&gt;&lt;div&gt;col program for a21 trunc&lt;/div&gt;&lt;div&gt;col sql_text for a70&lt;/div&gt;&lt;div&gt;select s.sid SID,&lt;/div&gt;&lt;div&gt;       s.sql_address,&lt;/div&gt;&lt;div&gt;       s.username USER_ORA,&lt;/div&gt;&lt;div&gt;       s.program  PROGRAM,&lt;/div&gt;&lt;div&gt;       --s.status,&lt;/div&gt;&lt;div&gt;       to_char(s.logon_time,'ddMonyy hh24:mi') CONEXAO,&lt;/div&gt;&lt;div&gt;       executions,&lt;/div&gt;&lt;div&gt;       sql_text&lt;/div&gt;&lt;div&gt;  from V$SESSION s,&lt;/div&gt;&lt;div&gt;       V$SQLAREA a&lt;/div&gt;&lt;div&gt; where a.hash_value = s.sql_hash_value&lt;/div&gt;&lt;div&gt;   and a.address    = s.sql_address&lt;/div&gt;&lt;div&gt;   --and upper(a.sql_text) like '%COMMIT%'&lt;/div&gt;&lt;div&gt;   and username is not null&lt;/div&gt;&lt;div&gt;   and s.status = 'ACTIVE'&lt;/div&gt;&lt;div&gt; order by 5 desc;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;/ora817/ntux&gt;more lock2.sql&lt;/div&gt;&lt;div&gt;SELECT sid, DECODE( block, 0, 'NO', 'YES' ) BLOCKER,&lt;/div&gt;&lt;div&gt;DECODE( request, 0, 'NO', 'YES' ) WAITER&lt;/div&gt;&lt;div&gt;FROM v$lock&lt;/div&gt;&lt;div&gt;WHERE request &gt; 0 OR block &gt; 0 ORDER BY block DESC&lt;/div&gt;&lt;div&gt;/&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;/ora817/ntux&gt;more prcs.sql&lt;/div&gt;&lt;div&gt;select s.sid, s.osuser, a.optimizer_mode,a.first_load_time,a.executions,a.buffer_gets,a.disk_reads,a.sql_text&lt;/div&gt;&lt;div&gt;from v$sqlarea a, v$session s, v$process p where a.ADDRESS=s.sql_address and s.paddr=p.addr and p.spid='&amp;amp;prcs';&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;/ora817/ntux&gt;more sqltext.sql&lt;/div&gt;&lt;div&gt;SET LINESIZE 500&lt;/div&gt;&lt;div&gt;SET PAGESIZE 1000&lt;/div&gt;&lt;div&gt;SET FEEDBACK OFF&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;SELECT --s.sid,&lt;/div&gt;&lt;div&gt;       s.status "Status",&lt;/div&gt;&lt;div&gt;       --p.spid "Process",&lt;/div&gt;&lt;div&gt;       --s.schemaname "Schema Name",&lt;/div&gt;&lt;div&gt;       --s.osuser "OS User",&lt;/div&gt;&lt;div&gt;       --Substr(a.sql_text,1,120) "SQL Text",&lt;/div&gt;&lt;div&gt;       s.program "Program",&lt;/div&gt;&lt;div&gt;       a.sql_text&lt;/div&gt;&lt;div&gt;FROM   v$session s,&lt;/div&gt;&lt;div&gt;       --v$sqlarea a,&lt;/div&gt;&lt;div&gt;       v$sqltext a,&lt;/div&gt;&lt;div&gt;       v$process p&lt;/div&gt;&lt;div&gt;WHERE  s.sql_hash_value = a.hash_value (+)&lt;/div&gt;&lt;div&gt;AND    s.sql_address    = a.address (+)&lt;/div&gt;&lt;div&gt;AND    s.paddr          = p.addr&lt;/div&gt;&lt;div&gt;--AND    s.status         = 'ACTIVE'&lt;/div&gt;&lt;div&gt;AND    s.sid            = '&amp;amp;sid'&lt;/div&gt;&lt;div&gt;order by s.sid, a.piece;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;SET PAGESIZE 14&lt;/div&gt;&lt;div&gt;SET FEEDBACK ON&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;/ora817/ntux&gt;more cpu.sql&lt;/div&gt;&lt;div&gt;set pages 200&lt;/div&gt;&lt;div&gt;set lines 132&lt;/div&gt;&lt;div&gt;col username for a16&lt;/div&gt;&lt;div&gt;col program for a32&lt;/div&gt;&lt;div&gt;col pid for a5&lt;/div&gt;&lt;div&gt;col sid for 99999&lt;/div&gt;&lt;div&gt;select p.spid          PID,&lt;/div&gt;&lt;div&gt;       s.sid,&lt;/div&gt;&lt;div&gt;       s.username,&lt;/div&gt;&lt;div&gt;       decode(nvl(p.background,0),1,bg.description,s.program) program,&lt;/div&gt;&lt;div&gt;       ss.value/100    "CPU (segs)",&lt;/div&gt;&lt;div&gt;       physical_reads  "disk_io (Blks)"&lt;/div&gt;&lt;div&gt;  from v$process p,&lt;/div&gt;&lt;div&gt;       v$session s,&lt;/div&gt;&lt;div&gt;       v$sesstat ss,&lt;/div&gt;&lt;div&gt;       v$sess_io si,&lt;/div&gt;&lt;div&gt;       v$bgprocess bg&lt;/div&gt;&lt;div&gt; where s.paddr=p.addr&lt;/div&gt;&lt;div&gt;   and ss.sid=s.sid&lt;/div&gt;&lt;div&gt;   and ss.statistic#=12&lt;/div&gt;&lt;div&gt;   and si.sid=s.sid&lt;/div&gt;&lt;div&gt;   and bg.paddr(+)=p.addr&lt;/div&gt;&lt;div&gt; order by 5 desc;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;/ora817/ntux&gt;more reads.sql&lt;/div&gt;&lt;div&gt;set lines 200&lt;/div&gt;&lt;div&gt;set pages 999&lt;/div&gt;&lt;div&gt;col sql_text         for a75 word_wrapped&lt;/div&gt;&lt;div&gt;col username         for a10&lt;/div&gt;&lt;div&gt;col executions       for 99999999999&lt;/div&gt;&lt;div&gt;col loads            for 99999999999&lt;/div&gt;&lt;div&gt;col DISK_READS       for 99999999999&lt;/div&gt;&lt;div&gt;col ROWS_PROCESSED   for 99999999999&lt;/div&gt;&lt;div&gt;col BUFFER_GETS      for 99999999999&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;select c.sql_text,&lt;/div&gt;&lt;div&gt;       username,&lt;/div&gt;&lt;div&gt;       executions,&lt;/div&gt;&lt;div&gt;       loads,&lt;/div&gt;&lt;div&gt;       disk_reads,&lt;/div&gt;&lt;div&gt;       buffer_gets,&lt;/div&gt;&lt;div&gt;       rows_processed&lt;/div&gt;&lt;div&gt;from   v$sqlarea  a,&lt;/div&gt;&lt;div&gt;       dba_users  b,&lt;/div&gt;&lt;div&gt;       v$sqltext c&lt;/div&gt;&lt;div&gt;where  a.PARSING_USER_ID = b.user_id&lt;/div&gt;&lt;div&gt;and    DISK_READS &gt;  5000000&lt;/div&gt;&lt;div&gt;and    b.username &lt;&gt; 'SYS'&lt;/div&gt;&lt;div&gt;and    a.hash_value=c.hash_value&lt;/div&gt;&lt;div&gt;order by c.piece&lt;/div&gt;&lt;div&gt;/&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;/ora817/ntux&gt;more sql_text.sql&lt;/div&gt;&lt;div&gt;select piece, sql_text from sys.v_$sqltext where address = upper('&amp;amp;address') order by piece;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;/ora817/ntux&gt;more sid.sql&lt;/div&gt;&lt;div&gt;select s.sid, p.spid, s.osuser, a.optimizer_mode,a.first_load_time,a.executions,a.buffer_gets,a.disk_reads,a.sql_text&lt;/div&gt;&lt;div&gt;from v$sqlarea a, v$session s, v$process p where a.ADDRESS=s.sql_address and s.paddr=p.addr and s.sid='&amp;amp;sid';&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1636561596040407909-6962197004735206465?l=rodrigorodriguessp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rodrigorodriguessp.blogspot.com/feeds/6962197004735206465/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2009/06/sqls.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/6962197004735206465'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/6962197004735206465'/><link rel='alternate' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2009/06/sqls.html' title='.sqls'/><author><name>rodrigo.rodriguessp</name><uri>http://www.blogger.com/profile/03319446857597123225</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_emDa0wGyac4/S6yq2tSBzOI/AAAAAAAACLk/cvSfvkftTkU/S220/OgAAADnt0ftcHcrbF_x6o6x07LEtfEpJnxbggBY8sXNk4Krfe8YGDejhvSrdQvdSa-LPE76vN_tqTdZq8XwIeMXVLyUAm1T1ULqq4DSYQjmWxROq_iWDhHWHNWcJ.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1636561596040407909.post-3160467946575478635</id><published>2009-06-04T07:17:00.000-07:00</published><updated>2009-06-04T07:18:12.567-07:00</updated><title type='text'>Active Users .sql</title><content type='html'>&lt;div&gt;column sid format 9999&lt;/div&gt;&lt;div&gt;--column serial# format 999999&lt;/div&gt;&lt;div&gt;column user_ora format a11&lt;/div&gt;&lt;div&gt;column conexao format a13&lt;/div&gt;&lt;div&gt;column status format a8&lt;/div&gt;&lt;div&gt;column user_unix format a20&lt;/div&gt;&lt;div&gt;column estacao format a24&lt;/div&gt;&lt;div&gt;column prcs format a5&lt;/div&gt;&lt;div&gt;column comando format a10&lt;/div&gt;&lt;div&gt;column l format a1&lt;/div&gt;&lt;div&gt;column cpu format 9999&lt;/div&gt;&lt;div&gt;col ip format a15&lt;/div&gt;&lt;div&gt;col program for a41&lt;/div&gt;&lt;div&gt;set linesize 200&lt;/div&gt;&lt;div&gt;set pause off&lt;/div&gt;&lt;div&gt;set echo off&lt;/div&gt;&lt;div&gt;set feed off&lt;/div&gt;&lt;div&gt;set pagesize 1000&lt;/div&gt;&lt;div&gt;select a.sid SID,&lt;/div&gt;&lt;div&gt;--       a.serial# serial#,&lt;/div&gt;&lt;div&gt;       a.sql_address,&lt;/div&gt;&lt;div&gt;       a.username USER_ORA,&lt;/div&gt;&lt;div&gt;       decode (substr(a.osuser,1,20),'OraUser','C/S',&lt;/div&gt;&lt;div&gt;              substr(a.osuser,1,20)) USER_UNIX,&lt;/div&gt;&lt;div&gt;       to_char(logon_time,'ddMonyy hh24:mi') CONEXAO,&lt;/div&gt;&lt;div&gt;       --client_info IP,&lt;/div&gt;&lt;div&gt;       b.spid PRCS,&lt;/div&gt;&lt;div&gt;       d.CONSISTENT_GETS GETS,&lt;/div&gt;&lt;div&gt;       d.BLOCK_CHANGES CHANGES,&lt;/div&gt;&lt;div&gt;       substr(c.name,1,10) COMANDO,&lt;/div&gt;&lt;div&gt;       decode(a.lockwait,'','n','y') L,&lt;/div&gt;&lt;div&gt;       decode (substr(a.terminal,1,24),'Window',machine,machine) ESTACAO,&lt;/div&gt;&lt;div&gt;       --substr(a.program,1,40) PROGRAM&lt;/div&gt;&lt;div&gt;       a.program PROGRAM&lt;/div&gt;&lt;div&gt;from v$session  a,v$process b,audit_actions c,v$sess_io d,v$sesstat e,v$statname f&lt;/div&gt;&lt;div&gt;where a.paddr=b.addr&lt;/div&gt;&lt;div&gt;and   a.username!=' '&lt;/div&gt;&lt;div&gt;--and   a.username &lt;&gt; 'SYS'&lt;/div&gt;&lt;div&gt;and   a.status='ACTIVE'&lt;/div&gt;&lt;div&gt;and a.command=c.action&lt;/div&gt;&lt;div&gt;and a.sid=d.sid&lt;/div&gt;&lt;div&gt;and a.sid=e.sid&lt;/div&gt;&lt;div&gt;and e.STATISTIC#=f.STATISTIC#&lt;/div&gt;&lt;div&gt;and e.STATISTIC#=12&lt;/div&gt;&lt;div&gt;and f.STATISTIC#=12&lt;/div&gt;&lt;div&gt;order by GETS&lt;/div&gt;&lt;div&gt;/&lt;/div&gt;&lt;div&gt;set feed on&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1636561596040407909-3160467946575478635?l=rodrigorodriguessp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rodrigorodriguessp.blogspot.com/feeds/3160467946575478635/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2009/06/active-users-sql.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/3160467946575478635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/3160467946575478635'/><link rel='alternate' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2009/06/active-users-sql.html' title='Active Users .sql'/><author><name>rodrigo.rodriguessp</name><uri>http://www.blogger.com/profile/03319446857597123225</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_emDa0wGyac4/S6yq2tSBzOI/AAAAAAAACLk/cvSfvkftTkU/S220/OgAAADnt0ftcHcrbF_x6o6x07LEtfEpJnxbggBY8sXNk4Krfe8YGDejhvSrdQvdSa-LPE76vN_tqTdZq8XwIeMXVLyUAm1T1ULqq4DSYQjmWxROq_iWDhHWHNWcJ.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1636561596040407909.post-4796525553865289952</id><published>2009-06-04T07:15:00.000-07:00</published><updated>2009-06-04T07:16:15.023-07:00</updated><title type='text'>Create Database 10g</title><content type='html'>&lt;div&gt;Create database 10g:&lt;/div&gt;&lt;div&gt;- profile&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;- init (basicão):&lt;/div&gt;&lt;div&gt;db_name = db10g&lt;/div&gt;&lt;div&gt;db_block_size = 8192&lt;/div&gt;&lt;div&gt;control_files = (/u01/oradata/BCOTESTE/control01.ora,/u01/oradata/BCOTESTE/control02.ora)&lt;/div&gt;&lt;div&gt;background_dump_dest = /u01/app/oracle/admin/BCOTESTE/bdump&lt;/div&gt;&lt;div&gt;core_dump_dest = /u01/app/oracle/admin/BCOTESTE/cdump&lt;/div&gt;&lt;div&gt;user_dump_dest = /u01/app/oracle/admin/BCOTESTE/udump&lt;/div&gt;&lt;div&gt;sga_target = 200m&lt;/div&gt;&lt;div&gt;db_file_multiblock_read_count = 16&lt;/div&gt;&lt;div&gt;undo_management = auto&lt;/div&gt;&lt;div&gt;undo_tablespace = undo&lt;/div&gt;&lt;div&gt;pga_aggregate_target = 50m&lt;/div&gt;&lt;div&gt;workarea_size_policy = AUTO&lt;/div&gt;&lt;div&gt;remote_login_passwordfile = exclusive&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;- orapwd&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;- create database:&lt;/div&gt;&lt;div&gt;create database db10g &lt;/div&gt;&lt;div&gt;logfile group 1 ('/oradata/db10g/redo/redo1a.log','/oradata/db10g/redo/redo1b.log') size 100m,&lt;/div&gt;&lt;div&gt;        group 2 ('/oradata/db10g/redo/redo2a.log','/oradata/db10g/redo/redo2b.log') size 100m,&lt;/div&gt;&lt;div&gt;        group 3 ('/oradata/db10g/redo/redo3a.log','/oradata/db10g/redo/redo3b.log') size 100m&lt;/div&gt;&lt;div&gt;character set WE8ISO8859P1&lt;/div&gt;&lt;div&gt;datafile '/oradata/db10g/data/system01.dbf' size 200M autoextend on next 10M maxsize unlimited&lt;/div&gt;&lt;div&gt;sysaux datafile '/oradata/db10g/data/sysaux01.dbf' size 200M autoextend on next 10M maxsize unlimited&lt;/div&gt;&lt;div&gt;undo tablespace undotbs datafile '/oradata/db10g/data/undotbs01.dbf' size 100M&lt;/div&gt;&lt;div&gt;default temporary tablespace temp tempfile '/oradata/db10g/temp/temp01.dbf' size 100M;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;@$ORACLE_HOME/rdbms/admin/catalog.sql&lt;/div&gt;&lt;div&gt;@$ORACLE_HOME/rdbms/admin/catproc.sql&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;conn system/manager&lt;/div&gt;&lt;div&gt;@$ORACLE_HOME/sqlplus/admin/pupbld.sql&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1636561596040407909-4796525553865289952?l=rodrigorodriguessp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rodrigorodriguessp.blogspot.com/feeds/4796525553865289952/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2009/06/create-database-10g.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/4796525553865289952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1636561596040407909/posts/default/4796525553865289952'/><link rel='alternate' type='text/html' href='http://rodrigorodriguessp.blogspot.com/2009/06/create-database-10g.html' title='Create Database 10g'/><author><name>rodrigo.rodriguessp</name><uri>http://www.blogger.com/profile/03319446857597123225</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_emDa0wGyac4/S6yq2tSBzOI/AAAAAAAACLk/cvSfvkftTkU/S220/OgAAADnt0ftcHcrbF_x6o6x07LEtfEpJnxbggBY8sXNk4Krfe8YGDejhvSrdQvdSa-LPE76vN_tqTdZq8XwIeMXVLyUAm1T1ULqq4DSYQjmWxROq_iWDhHWHNWcJ.jpg'/></author><thr:total>0</thr:total></entry></feed>
