Thursday, April 16, 2015

Repeating another SQLCL EA release

It's been a month and a lot of bugs have been fixed in that time and new features added. That adds up to time for another EA for our new sqlcl. The third sqlcl EA is out now and can be found here on the SQL Developer 4.1 download page.

LOAD: Making CSV loading to the db very easy

Here's a very quick example of the possibilities. Here

-- drop it to be sure
drop table emp2;
-- create an empty table
create table emp2 as select * from emp where rownum=0;
-- don't need to see it
set term off
-- set the format to CSV
set sqlformat csv
-- spool
spool emp.csv
-- spooling....
select * from emp;
-- spooled
spool off
-- need to see again
set term on
-- load into the new table
load EMP2 emp.csv

The output from running the script makes it very easy to see what happened.

REPEAT : Build your own monitor

This is another very simple yet useful command. The idea is to basically build your own sql that your may want to run to see what's going on. This example is a simple select against v$session with a decode on the command to see what the sessions are doing. Running this is easy, running it again and again mean hitting / and return a lot.

Enter the repeat. Just specify how many times and what the sleep interval is and sqlcl takes care of running it.

In the header, there's a status to who what iteration it is what the time is ( and yes I know a bug in the number format ) and what the delay is to running it again.

The Report being used

The SQL I'm using here is the same sql in the SQL Developer Sessions report. It can be found off the Tools->Sessions menu. Additionally in the Reports section under DBA reports.