URGENT - Scripts Active and Inactive Processes

DBA Geral (instalação, configuração do banco, scripts do Sql*Plus, shell scripts, batch scripts, etc...)
Post Reply
Carbachuts
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 3
Joined: Mon, 03 May 2010 11:54 am
Location: SP

Good morning everyone ....

I am a trainee and I need a script to show the active and inactive processes of the bank ...... can anyone help me ??

grateful.
Dulima-SP
Rank: DBA Júnior
Rank: DBA Júnior
Posts: 193
Joined: Thu, 24 Jan 2008 1:56 pm
Location: SP
Dulima

DBA Oracle Jr

Follow

Select all

 
col sid            for 9999       head 'SID' justify right 
col Serial         for 99999      head 'Serial' 
col user_ora       for a13        head 'Oracle|User' justify left 
col process        for a5         head 'PID' justify right 
col comando        for a8         head 'Statment' 
col hash_value     for 9999999999 head 'Hash value' 
col disk           for 99999999   head 'Leituras|Fisicas' justify right 
col changes        for 99999999   head 'Blocos|Alterados' justify right 
col OsUser         for a16        head 'OS User'   JUSTIFY left 
col kinstance_name for a10        head "Instance" 
col Evento         for a64        head "Nome do Evento" 
 
select a.sid                            SID, 
       a.serial#                        Serial, 
       b.spid                           PROCESS, 
       decode(a.lockwait,'','N','S')    L, 
       a.username                       USER_ORA, 
       substr(a.osuser,1,16)            OsUser, 
       a.sql_hash_value                 hash_value, 
       d.consistent_gets                gets, 
       d.physical_reads                 disk, 
       d.block_changes                  changes, 
       c.name                           COMANDO, 
       g.instance_name                  kinstance_name, 
       h.event                          Evento 
  from gv$session    a , 
       gv$process    b , 
       audit_actions c , 
       gv$sess_io    d , 
       gv$sesstat    e , 
       gv$statname   f , 
       gv$instance   g , 
       gv$session_wait h 
where a.paddr    = b.addr 
  and a.username <> ' ' 
  and a.sid not in (SELECT SID 
                      FROM V$SESSION 
                     WHERE audsid = userenv('SESSIONID')) 
  and a.status     = 'ACTIVE' 
  and a.command    = c.action 
  and a.sid        = d.sid 
  and a.sid        = e.sid 
  and e.STATISTIC# = f.STATISTIC# 
  and e.STATISTIC# = 12 
  and f.STATISTIC# = 12 
  and a.inst_id    = g.inst_id 
  and h.event not like 'SQL*Net message%' 
  and h.event not like 'rdbms%' 
  and h.event not like 'pmon%' 
  and h.event not like 'smon%' 
  and a.sid = h.sid 
order by DISK 
/ 
 
What do you need?
diegolenhardt
Moderador
Moderador
Posts: 1177
Joined: Thu, 15 Oct 2009 10:28 am
Location: Recife

Select all

 
select * from v$session,  
Detail for the Status column,

Active, Inactive,
Carbachuts
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 3
Joined: Mon, 03 May 2010 11:54 am
Location: SP

Dulima, I'm going to try to explain to you ......

A script that gives the active and inactive process information from the bank, it will run at a certain time, type to each One hour, then it generates a txt and at the end of the month I need to set up a chart through this information ......
Carbachuts
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 3
Joined: Mon, 03 May 2010 11:54 am
Location: SP

Can no more help me ???
diegolenhardt
Moderador
Moderador
Posts: 1177
Joined: Thu, 15 Oct 2009 10:28 am
Location: Recife

Now that you explained it gets easier, in reality the select in v $ session has everything you need,

just create a job or schedule, use the utl_file to generate the file text ..

Have you considered using Enterprise Manager information?
Dulima-SP
Rank: DBA Júnior
Rank: DBA Júnior
Posts: 193
Joined: Thu, 24 Jan 2008 1:56 pm
Location: SP
Dulima

DBA Oracle Jr

Exact

creates a job with UTL ...

or one you populate a table !!!

and takes off the report with UTL at the end of the month !!
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest