You are on page 1of 4

<br> what will you do if your UNIX/LINUX server hangs?

</br></br> Check for user's resource utilization using top/prstat. If the user is NOT oracle then consult with your system admin. If oracle, take the PID and check what is the SQL that is problem. If PID=19633 then , The below query will show you the problematic Query. select sql_text from v$process a, v$session b, v$sqltext c where spid =19633 and a.addr =b.paddr and b.sql_address = c.address; Show all connected users set lines 100 pages 999 col ID format a15 select username , sid ',' serial# "ID" , status , last_call_et "Last Activity" from v$session where username is not null order by status desc , last_call_et desc / Time since last user activity set lines 100 pages 999 select username , floor(last_call_et / 60) "Minutes" , status from v$session where username is not null order by last_call_et / Sessions sorted by logon time set lines 100 pages 999 col ID format a15 col osuser format a15 col login_time format a14 select username , osuser , sid ',' serial# "ID" , status , to_char(logon_time, 'hh24:mi dd/mm/yy') login_time , last_call_et from v$session where username is not null order by login_time / Show user info including os pid

col "SID/SERIAL" format a10 col username format a15 col osuser format a15 col program format a40 select s.sid ',' s.serial# "SID/SERIAL" , s.username , s.osuser , p.spid "OS PID" , s.program from v$session s , v$process p Where s.paddr = p.addr order by to_number(p.spid) / Show a users current sql Select sql_text from v$sqlarea where (address, hash_value) in (select sql_address, sql_hash_value from v$session where username like '&username') / Display any long operations set lines 100 pages 999 col username format a15 col message format a40 col remaining format 9999 select username , to_char(start_time, 'hh24:mi:ss dd/mm/yy') started , time_remaining remaining , message from v$session_longops where time_remaining = 0 order by time_remaining desc / Startup time select to_char(startup_time, 'HH24:MI DD-MON-YY') "Startup time" from v$instance / How large is the database col "Database Size" format a20 col "Free space" format a20 col "Used space" format a20 select round(sum(used.bytes) / 1024 , round(sum(used.bytes) / 1024 round(free.p / 1024 / 1024 / , round(free.p / 1024 / 1024 / from (select bytes

/ 1024 / 1024 ) ' GB' "Database Size" / 1024 / 1024 ) 1024) ' GB' "Used space" 1024) ' GB' "Free space"

from v$datafile union all select bytes from v$tempfile union all select bytes from v$log) used , (select sum(bytes) as p from dba_free_space) free group by free.p / Show the ten largest objects in the database col col col col select , , , from owner format a15 segment_name format a30 segment_type format a15 mb format 999,999,999 owner segment_name segment_type mb ( select owner , segment_name , segment_type , bytes / 1024 / 1024 "MB" from dba_segments order by bytes desc ) rownum < 11

where /

Is java installed in the database? This will return 9000'ish if it is... select count(*) from all_objects where object_type like '%JAVA%' and owner = 'SYS' /

Display character set information select * from nls_database_parameters / Show all used features select , from where / name detected_usages dba_feature_usage_statistics detected_usages > 0

List users

set pages 999 lines 100 col username format a20 col status format a8 col tablespace format a20 col temp_ts format a20 select username , account_status status , created , default_tablespace tablespace , temporary_tablespace temp_ts from dba_users order by username /

You might also like