<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Shell script for delteing rows in oracle DB table in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-for-delteing-rows-in-oracle-db-table/m-p/4315172#M670458</link>
    <description>hi Andy,&lt;BR /&gt;&lt;BR /&gt;Question: why use shell script when you can do the same thing using a scheduled job? (DBMS_JOB or DBMS_SCHEDULER)&lt;BR /&gt;&lt;BR /&gt;You can simply write a procedure and schedule it to run at specific interval and do the purge operation accordingly.&lt;BR /&gt;&lt;BR /&gt;if you need any assistance on this, please do let us know&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
    <pubDate>Tue, 02 Dec 2008 05:47:22 GMT</pubDate>
    <dc:creator>Yogeeraj_1</dc:creator>
    <dc:date>2008-12-02T05:47:22Z</dc:date>
    <item>
      <title>Shell script for delteing rows in oracle DB table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-for-delteing-rows-in-oracle-db-table/m-p/4315169#M670455</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I am trying to create shell script to do the followings, but I am not good in shell scriting yet.&lt;BR /&gt;&lt;BR /&gt;1. Connect to an oracle DB&lt;BR /&gt;2. Delete every 5000 rows and commit table TBL_TEMP_TAKS, based on TASK_ID column.&lt;BR /&gt;&lt;BR /&gt;It should find the MIN number on TAKS_ID columns and MAX number.&lt;BR /&gt;Then should delete MIN+5000 till MIN = MAX&lt;BR /&gt;&lt;BR /&gt;I apprecitae your help.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Andy&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 28 Nov 2008 21:05:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-for-delteing-rows-in-oracle-db-table/m-p/4315169#M670455</guid>
      <dc:creator>Inter_1</dc:creator>
      <dc:date>2008-11-28T21:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script for delteing rows in oracle DB table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-for-delteing-rows-in-oracle-db-table/m-p/4315170#M670456</link>
      <description>why?&lt;BR /&gt;&lt;BR /&gt;If you need to delete all rows from a table, then you should use "TRUNCATE TABLE".&lt;BR /&gt;&lt;BR /&gt;To delete multiple records from a table your best bet is probably still to find a way to express all records to be deleted and execute and commit that 1 statement.&lt;BR /&gt;&lt;BR /&gt;While commiting 5000 deletes is faster than 5000 times commiting one record, commiting all deletes is faster still and should be used until you can explain why that is not good enough.&lt;BR /&gt;&lt;BR /&gt;SQLplus does not like / do 'counting'.&lt;BR /&gt;You pretty much need PL/SQL for that.&lt;BR /&gt;Things like "rownum &amp;lt; 5000" only SUGGEST it is counting... it is still finding all candidates first.&lt;BR /&gt;&lt;BR /&gt;You may want to check out the new (10.2) &lt;BR /&gt;COMMIT options like WRITE BATCH and NOWAIT.&lt;BR /&gt;&lt;A href="http://oratips-ddf.blogspot.com/2008/02/dreaded-ora-01555.html" target="_blank"&gt;http://oratips-ddf.blogspot.com/2008/02/dreaded-ora-01555.html&lt;/A&gt;&lt;BR /&gt;commit work write batch nowait&lt;BR /&gt;&lt;BR /&gt;And for PL/SQL there is "BULK COLLECT "&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.oracle.com/technology/oramag/oracle/03-sep/o53asktom.html" target="_blank"&gt;http://www.oracle.com/technology/oramag/oracle/03-sep/o53asktom.html&lt;/A&gt;&lt;BR /&gt;Bulk Up Your Processing &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/tuning.htm#i48876" target="_blank"&gt;http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/tuning.htm#i48876&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Sat, 29 Nov 2008 16:07:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-for-delteing-rows-in-oracle-db-table/m-p/4315170#M670456</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-11-29T16:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script for delteing rows in oracle DB table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-for-delteing-rows-in-oracle-db-table/m-p/4315171#M670457</link>
      <description>&lt;!--!*#--&gt;&lt;BR /&gt;Now, If I _had_ to chop this up in X-row sub queries, then I would use a temporary table to get a predictable, stable, result.&lt;BR /&gt;&lt;BR /&gt;First do something like:&lt;BR /&gt;&lt;BR /&gt;select TAKS_ID from &lt;BR /&gt; (select rownum x, TAKS_ID from &lt;BR /&gt;  (select TAKS_ID from TBL_TEMP_TAKS order by TAKS_ID)&lt;BR /&gt; )&lt;BR /&gt; where mod(x,5000)=0;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Next, use your shell or perl script to select an entry and the next from the temp table to execute and commit:&lt;BR /&gt; DELETE TBL_TEMP_TAKS WHERE TAKS_ID BETWEEN ... AND ...;&lt;BR /&gt;&lt;BR /&gt;You may want to add the first and/or last values through SQL or hardcoded in the script.&lt;BR /&gt;&lt;BR /&gt;Using SQL you could use a 'nice':&lt;BR /&gt;&lt;BR /&gt;select MIN(TAKS_ID) from TBL_TEMP_TAKS &lt;BR /&gt; union all&lt;BR /&gt;select TAKS_ID from &lt;BR /&gt; (select rownum x, TAKS_ID from &lt;BR /&gt;  (select TAKS_ID from TBL_TEMP_TAKS order by TAKS_ID)&lt;BR /&gt; )&lt;BR /&gt; where mod(x,5000)=0;&lt;BR /&gt; union all&lt;BR /&gt;select MAX(TAKS_ID) from TBL_TEMP_TAKS &lt;BR /&gt;&lt;BR /&gt;Or a brute-force:&lt;BR /&gt;&lt;BR /&gt;select 0 "TAKS_ID" from dual;&lt;BR /&gt; union all&lt;BR /&gt;select TAKS_ID from &lt;BR /&gt; (select rownum x, TAKS_ID from &lt;BR /&gt;  (select TAKS_ID from TBL_TEMP_TAKS order by TAKS_ID)&lt;BR /&gt; )&lt;BR /&gt; where mod(x,5000)=0;&lt;BR /&gt; union all&lt;BR /&gt;select 99999999 "TAKS_ID" from dual;&lt;BR /&gt;&lt;BR /&gt;Good luck,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 29 Nov 2008 20:50:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-for-delteing-rows-in-oracle-db-table/m-p/4315171#M670457</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-11-29T20:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script for delteing rows in oracle DB table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-for-delteing-rows-in-oracle-db-table/m-p/4315172#M670458</link>
      <description>hi Andy,&lt;BR /&gt;&lt;BR /&gt;Question: why use shell script when you can do the same thing using a scheduled job? (DBMS_JOB or DBMS_SCHEDULER)&lt;BR /&gt;&lt;BR /&gt;You can simply write a procedure and schedule it to run at specific interval and do the purge operation accordingly.&lt;BR /&gt;&lt;BR /&gt;if you need any assistance on this, please do let us know&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
      <pubDate>Tue, 02 Dec 2008 05:47:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-for-delteing-rows-in-oracle-db-table/m-p/4315172#M670458</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2008-12-02T05:47:22Z</dc:date>
    </item>
  </channel>
</rss>

