otmfaqForumsBlogsRegister
FAQMembers ListCalendarToday's PostsSearch


 Subscribe Blogs:RSS
 Subscribe Forums:RSS
OTMFAQ Home
OTMFAQ Blogs
OTMFAQ Forums
OTMFAQ Tutorials

OTM SIG
MavenWire

Go Back   Oracle OTM / G-Log GC3 Community Support > OTM / G-Log - Technical Topics > Database Administration
Reload this Page

[SOLVED] Helpful DBA SQL Queries - Current Processes, Pig SQL


Database Administration Database installation, creation, administration and related topics.

Tags: , , ,

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old October 26th, 2007, 00:51
chrisplough's Avatar
Site Moderator
 
Join Date: Jun 2006
Location: West Chester, PA
Posts: 847
Blog Entries: 7
Thanks: 53
Thanked 205 Times in 124 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
Rep Power: 10
chrisplough has a spectacular aura aboutchrisplough has a spectacular aura aboutchrisplough has a spectacular aura about
Send a message via AIM to chrisplough
[SOLVED] Helpful DBA SQL Queries - Current Processes, Pig SQL

Hello!

Working with OTM - there are some SQL queries that you'll use over and over (and over!). I want to share them, as it may make your lives a bit easier

If you run these through SqlBackdoor, make sure you remove the ending ";".


This query will tell you what is currently running against the database just make sure to set your linesize from 20 to 1000.
Code:
select sid,username,osuser, sql_text 
from v$sqltext,v$session 
where address=sql_address 
and sql_hash_value=hash_value 
and status='ACTIVE' 
order by sid, piece;

Here is the historic pig SQL call:
Code:
select s.hash_value, s.sql_text, round(buffer_gets/executions) average_gets, round(disk_reads/executions) average_reads, s.executions, s.ROWS_PROCESSED from v$sqlarea s where executions > 0 and (buffer_gets + 100*disk_reads) / executions > 1000 order by (buffer_gets + 100*disk_reads) desc;

And this call is the current pig SQL calls against the database:
Code:
select s.hash_value, s.sql_text, round(buffer_gets/executions) average_gets, round(disk_reads/executions) average_reads, s.executions, s.ROWS_PROCESSED from v$sqlarea s where executions > 0 and (buffer_gets + 100*disk_reads) / executions > 1000 and exists (select vs.sql_address from  v$session vs where s.address = vs.sql_address ) order by (buffer_gets + 100*disk_reads) desc;
Hope this helps!

--Chris
__________________
Chris Plough
MavenWire

www.MavenWire.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to chrisplough For This Useful Post:
cheekythought (October 26th, 2007)
Reply



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Obtaining Thread Dumps from the OTM Java JVM Processes chrisplough SysAdmin and Management 0 June 13th, 2007 18:03



All times are GMT. The time now is 17:09.
Copyright © 2008, Open Book Solutions LLC. All rights reserved.

Sponsored by MavenWire - MavenWire.com


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37