Saturday 27 December 2008

Top SQLs by Disk Read via V$SQLAREA

with base_data as
  (
  select
  v.HASH_VALUE,
  disk_reads,
  executions,
  v.CPU_TIME,
  sql_text,
  v.FIRST_LOAD_TIME
 from v$sqlarea v
 order by 2 desc, 3 desc
 )
 select
 sysdate snaptime,
 null hash_value,
 sum(disk_reads) disk_reads,
 sum(executions) executions,
 sum(cpu_time)   cpu_time,
 '!ALL SQL SUMMARY' SQL_TEXT,
 NULL first_load_time
 from base_data
 union all
 select  
 sysdate,
 HASH_VALUE,
 disk_reads,
 executions,
 CPU_TIME,
 sql_text,
 FIRST_LOAD_TIME
from base_data
 where rownum <=20

Thursday 18 December 2008

Clear log file via inline edit

Trim off first 1000000 lines

# No backup
perl -i -ne 'print unless 1 ..1000000' server.log

# With backup

perl -i.bkp -ne 'print unless 1 ..1000000' server.log


du : Sort by size and display in human

Not terribly economic but functional

du -sk * | sort -nr | cut -f2 | xargs du -sh

Tuesday 9 December 2008

Wednesday 3 December 2008

Using Xming (against solaris)

Needed a portable x-server to run oracle installers etc on a solaris box without vnc installed

So dragged down xming from http://www.straightrunning.com/XmingNotes/

Installed into a temp directory - the app is portable
Included the local version of plink when prompted,  declined integration with the desktop (portable!)
Needed the optional font package - installed on top of the xming install but stripped it down to the TTF font directory to save space

Create a session by using the xlaunch.exe program - which is a wizard to create a .xlaunch file to store parameters to feed to xming.exe
xlaunch.exe
  • Chose
  • one window,
  • display 0,
  • start a program,
  • program = /usr/bin/gnome-session - note the path ! - other options /usr/openwin/bin/xterm, /usr/openwin/bin/twm (solaris default windows manager)
  • using putty
  • connect to <servername>
  • login as <username>
  • password <password and to hell with security though the password does seem to blank out when the wizard is re-run>
  • Clipboard
  • TURN OFF THE ACCESS CONTROL if NOT relying on plink
  • No other params
  • Save everything to a .xlaunch file
To run without the wizard - xlaunch.exe -run config.xlaunch
To re-edit - xlaunch.exe -run config.xlaunch


Even the clipboard worked