Shell environment
for Oracle
written in perl

 Project Summary

Senora is targeted to be a drop-in replacement for sqlplus. It provides a plethora of new commands, which accept Unix-style options. It is enhanceable via plug-ins, and provides most of sqlplus' functionality.

Senora intends to be your primary Oracle shell. While there are may nifty Oracle tools around (e.g. TORA or TOAD), these do not attempt to replace sqlplus, so chances are you'll need to run sqlplus additionally. Also these tools are hard (TORA) or impossible (TOAD, sqlplus) to extend. Senora attempts to give you much of the browsing and anayzing capabilities of these tools without the need to run any other tool. 

You can extend Senora easily by providing you own plugins. In fact most of Senora's core functionality is written as plugins. A plugin provides additional commands to Senora and integrates these with Senora's help system. Senora's extensions are thus self-documenting as we know it from emacs.

This is just one benefit of plugins over stand-alone sql-scripts. Another one is the ability to provide unix-style options. The lack of options in sqlplus was in fact the main reason I started to write senora. Options allows you to group similar commands under one common hood, even when the undelying SQL differs significantly depending on the currently set options. The good thing about this is: you need to remeber less, and if things do slip your memory, the help system will guide you - much faster than any menu driven system ever will. 

Some Plugins have grown into extremely useful tools. I am getting a reputation for being an oracle wizard, just becuase I fire up the Senora's profiler (from the Tuning plugin) whenver someone ask the question "why is this so slow ?"

Senora attempts to provide a friendlier output formatting than sqlplus. Columns tend to be only as wide a really needed, and when linebreaks are needed, these are placed at "good" positions, i.e. after blanks or undescores. This is of course an incompatibility to sqlplus, and programs that rely on sqlplus-style fromatting may not work with Senora. Still Senora understands some of sqlpluses columns formatting commands.

Senora can run legacy sqlplus scripts as long as these do non use any unsupported commands. The most important sqlplus commands however do work, including starting scripts from within a script (@ and @@), using defines (see ampersand replacing) and bind variables.


again <pattern>

alias: !
rerun latest matching entry

history <pattern>

alias: hi
show history items matchin pattern (or all)

rerun <nr>

alias: !!
run history item nr


recompile <type/name>

alias: rec
recompile objects
-a Do all objects, even with a dollar
-i Do invalid objects only

refs <table>

print referential integrity

find <pattern>

find a line in user_source
-i search case insensitive

deps <name>

object dependencies
-U Print uses insted of dependencies
-r List dependecies recursively

pull <type/name>

pull code of procedures etc.
-a Pull all objects, even with a dollar
-f file Save result in file
-F Save each object in individual file
-e edit code in _editor
-q Don't print to the screen

ls <type/name>

list all objects matching pattern
-a List all objects, even with a dollar
-l List validity of objects too
-C List constraints etc too
-I List indexes etc too
-i List invalid objects only

set ddView <''|user|all>

switch between user and all views in DataDictionary


print <name>

alias: p
print a bind variables
-a list all variables

variable <name type>

alias: var
declare a bind variable
-s value set value right away


show parameter <pattern>

alias: sp
show init.ora parameter

ps <>

print session information
-l print long format
-s s1,s2.. only show given sids
-p pattern only "matching" sessions

waits <>

show what sessions are waiting for
-s s1,s2.. restrict to SIDs

validate <index>

alias: vi
validate structure an index

analyzeObject <pattern>

alias: ana
analyze a table or an index

-c compute instead of estimate
-t days only if not analyzed days ago
-n only show objects, don't analyze
-d delete statistics

rollSegs <>

print rollback info
-u print currently used segments with SIDs

kill <sid>

kill a session

space <>

show space
-t show tablespace stats
-d show datafile stats
-D show resizable datafiles
-b blksz assume blocksize for -D
-e n show top n extent consumers
-s n show top n space consumers

hwm <table>

get high watermark info on analyzed tables (experimental)

xplain <>

explain plan for statement
-f file take statement from file
-v echo statement
-c only create plan table

jobs <>

print job information
-l Print long format
-p pattern Print only jobs with matching "what"
-r Print only hanging, running or broken jobs

profile <> (cool !)

estimate current execution times
-s sids restrict to sids
-c create required table senora_profile
-i iterationsset sample size (100)
-t msecs set sampling time (50)

resize <>

resize datafiles
-m Mbytes limit to at least Mbytes space reclaimes (50)
-f force: dont ask

kept <>

show kept (pinned) code
-p pattern restrict by pattern
-n show non pinned

xqueries <>

alias: xq
show most expensive quieries
-n rows show top n rows
-i check increase agains copy of v$sqlarea
-s create a snapshot of v$sqlarea for -i
-p pattern print only statements matching pattern
-R order by reads
-X order by reads/xl
-N order by execs + loads

cstatement <>

alias: cs
show the current statements of sessions
-u user limit to a given user
-s s1,s2.. limit to a given SIDs
-p show previous statement

stat <>

print session statistics
-s sid The sid to stat
-p pattern pattern to match the statname
-a also show values=0
-l limit only show values > limit

locks <>

show sessions and the objects the are waiting for


set pluginCode <OFF|ON>

always show SQL code of plugin before executing

unregister <plugin>

unregister a plugin

help <pattern>

alias: he
provide help for a command
-v print more help

register <plugin>

register a plugin (will always reload file)


disconnect <sessionNr>

alias: dis
disconnect session nr

connect <connectString>

alias: senora|conn|c
create a new session
-a create additional session, don't disconnect
-l list connections
-s sessNo switch to sessNo (as reported by -l)

quit <>

alias: exit|q
exit Senora.


show user <>

alias: id
show the current username

describe <object>

alias: desc|d
describe a table or command

prompt <args>

echo arguments

purge <table where ...>

delete from (large) table in chunks
-n 1000 chunk size
-i 1000 max iterations
-q be quiet

exec <psql>

run a single line PL/SQL

cd <cmd> (yeah)

change directory

count <pattern>

count rows of tables

pwd <>

alias: cwd|dirs
show current directory

define <name=value>

define a value for later reference
-l list defines

spool <file>

alias: spo
write to file

column <name format ann>

set column format
-l list formats

grep <pattern table [extra clause]>

show rows that match pattern
-v show rows that don't match pattern
-i ignore case

head <table>

show first rows of table
-n rows set number or rows to show

set serveroutput <on|off>

alias: so
get dbms_output messages
-b bufsz set the buffer size

cat <table [extra clause]>

synonym for select * from
-a don't stop after 3000 rows

list <>

alias: l
list last sql/plsql statement

show errors <>

show compilation errors

host <cmd>

execute os cmd

dir <pattern>

list directory


startRel <args>

alias: @@
run an sql script relative to a running script

set verify <OFF|ON>

print ampersand replacing

start <args>

alias: @
run an sql script

Available Plugins