Tuesday, June 4, 2013

Takes too long to restart the Weblogic Managed Servers

If your Weblogic server startup takes too long, then you might be running into entropy bug that can be fixed in one of the 3 ways:

  1. Patch /jre/lib/security/java.security by replacing the line "securerandom.source=file:/dev/urandom" with "securerandom.source=file:/dev/./urandom"
  2. Add JVM argument -Djava.security.egd=file:/dev/./urandom to the startup scripts
  3. Create a symlink for /dev/urandom to point to /dev/./urandom

Monday, June 3, 2013

Updating a large table in batches

In order to update million of record using the UPDATE statement can be time-consuming and may lead to timeout errors and other issues. A better approach would be to commit the updates in batches and here is the PL/SQL recipe for doing it:

declare
   cursor c is select rowid id from <TABLE> order by rowid;
   counter NUMBER(10) := 0;
   rowids dbms_sql.urowid_table;  

begin
   dbms_output.enable;
   open c;
   loop  
      fetch c bulk collect into rowids limit 1000;
      forall i in 1..rowids.count
         update <TABLE> set date=SYSDATE
              where rowid = rowids(i);
      commit;
      counter := counter + 1;
      dbms_output.put_line('Updated batch ' || counter );
      exit when c%notfound;
   end loop;
   close c;
end;
/

The above PL/SQL would update the DATE column of the table <TABLE> in batches of 1000 and will be much faster than the traditional UPDATE statement.

Search This Blog