Showing posts with label oracle. Show all posts
Showing posts with label oracle. Show all posts

Wednesday, March 28, 2012

Empty an Oracle schema, leave an empty schema

What it says on the tin. Sufficient code analysis will reveal that some bizarre schema dependencies may not be destroyed by this; but experience will show that's not actually a problem :-)

The code lives as a gist over on github. A snapshot is below, for simplicity:



set echo off
set verify off
set serveroutput on size 100000

-- Hosted at http://lastinfinitetentacle.blogspot.com/2012/03/empty-oracle-schema-leave-empty-schema.html

-- Disable all contraints
BEGIN
  FOR c IN
  (SELECT c.owner, c.table_name, c.constraint_name
   FROM user_constraints c, user_tables t
   WHERE c.table_name = t.table_name
   AND c.status = 'ENABLED'
   ORDER BY c.constraint_type DESC)
  LOOP
    dbms_utility.exec_ddl_statement('alter table ' || c.owner || '.' || c.table_name || ' disable constraint ' || c.constraint_name);
  END LOOP;
END;
/

-- remove all objects
declare

cursor dropObjectsCusor is
select 'drop ' || object_type || ' ' || object_name as sqlDropStmt
from user_objects
where object_type <> 'TABLE' and object_type <> 'INDEX'
order by object_type;

cursor dropTablesCusor is
select 'truncate table ' || object_name as sqlTruncTbl,
'drop table ' || object_name || ' cascade constraints' as sqlDropTbl
from user_objects
where object_type = 'TABLE'
order by object_type;

begin

for ob in dropTablesCusor
loop
begin
  execute immediate ob.sqlTruncTbl;
exception when others then dbms_output.put_line('Could not truncate a table.');
end;
begin
  execute immediate ob.sqlDropTbl;
exception when others then dbms_output.put_line('Could not drop a table.');
end;
end loop;

for ob in dropObjectsCusor
loop
begin
  execute immediate ob.sqlDropStmt;
exception when others then dbms_output.put_line('Could not drop some object.');
end;
end loop;


end;
/
purge recyclebin;

Thursday, February 03, 2011

TIBCO fiddles

In brief:
  1. When fiddling with TIBCO Software, use an OpenSUSE virtual machine, it hurts less.
  2. Oracle XE is very handy for fiddling with TIBCO software - Here's a great web page explaining how to set it up on OpenSUSE - http://forums.opensuse.org/install-boot-login/414654-how-install-oraclexe-opensuse-11-1-a.html
  3. Give your VM about 2GB RAM, or more.
  4. Create a different Unix user for each 'build' (ActiveMatrix v2 suite, ActiveMatrix v3 suite, BusinessWorks/Administrator suite, etc.). Don't let them read/write to each other's files, ever.
  5. Do not install gcj, OpenJDK, or anything remotely like Java and not made by Sun and/or Oracle.

Wednesday, October 15, 2008

Gold!

A readable, recent blog on big JVM heaps... They're bad, naughty, offer rubbish performance, but they're hard to dodge.

http://andrigoss.blogspot.com/2008/02/jvm-performance-tuning.html

Certainly, it's better than this effort from Tangosol/Coherence/Oracle ("Use our product!"). As it happens, I need to sort this for a badly built product based on Coherence... Oh! The pain!