Jun 19, 2013

Write XMLType Column to File using dbms_xslprocessor [Oracle] [Solved]

Posted Jun 19, 2013
Declare your desired directory:

create or replace DIRECTORY XMLDIR AS 'C:\tmp';

Use dbms_xslprocessor to write XMLType column to file:

BEGIN
  for cur in (select XML_COLUMN from YOUR_TABLE) loop
    dbms_xslprocessor.clob2file(cur.XML_COLUMN.getClobVal(), 'XMLDIR', 'NAME.xml');
  end loop;
END;
/

Clear Oracle DB Cache [Solved]

I used these 2 commands to clear cache in between queries in Oracle DB especially when testing for performance:

ALTER SYSTEM FLUSH BUFFER_CACHE;

ALTER SYSTEM FLUSH SHARED_POOL;

Jun 14, 2013

[Solved] NoClassDefFoundError, cannot find VirtualMachine when using HotThread

Posted Jun 14, 2013
I got a NoClassDefFoundError when trying to execute HotThread.jar in Cent OS Linux using java -jar command, seems it cannot find com/sun/tools/attach/VirtualMachine which is part of tools.jar.


[root@ALFSYSTEST4-VM bin]# ./java -jar /home/samba/HotThread.jar 3223
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/attach/VirtualMachine
        at hotthread.Main.main(Main.java:52)
Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.VirtualMachine
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
        ... 1 more


The solution is to just use the java -classpath approach and load the two libraries then execute the HotThread program:

java -classpath "/opt/jdk1.6/lib/tools.jar:/home/samba/HotThread.jar" hotthread.Main 3223