RE: tail -f for windows

From: Tanel Poder <tanel_at_poderc.com>
Date: Sat, 23 May 2009 21:04:57 +0300
Message-ID: <62515A796A7344AC9B31071FE377FC35_at_porgand>



Yeah the adrci is for 11g and alert.log only. Tail gives you a generic way for monitoring any file.

Tail combined with start /b on windows allows you to see tracefile output right on your sqlplus screen as its generated. It can be helpful for experimentation and demoing (I demoed similar approach with grep and named pipes on unix some years ago at hotsos).

Here's an example of what I mean (see the tracefile output below), this is output as printed in my cmd.exe window:

SQL> exec dbms_system.ksdwrt(1,'dummy');

PL/SQL procedure successfully completed.

SQL> alter session set events '10704 trace name context forever, level 4';

Session altered.

SQL> host start /b tailgrep &trc ksqgtl.*mode

SQL>
C:\>tail -f
"C:\ORACLE\PRODUCT\10.2.0\ADMIN\WIN10G\UDUMP/win10g_ora_5040.trc" | grep -i 'ksqgtl.*mode'

SQL>
SQL> lock table t in share mode;

Table(s) Locked.

SQL> ksqgtl *** CU-28726310-00000000 mode=6 flags=0x10 timeout=300 *** ksqgtl *** TM-000163ed-00000000 mode=4 flags=0x401 timeout=21474836 ***

SQL> drop table t;

Table dropped.

SQL> ksqgtl *** TM-000163ed-00000000 mode=6 flags=0x401 timeout=0 ***

ksqgtl *** MD-000163ed-00000000 mode=6 flags=0x401 timeout=5 ***
ksqgtl *** TM-00000239-00000000 mode=3 flags=0x401 timeout=21474836 ***
ksqgtl *** TM-00000317-00000000 mode=3 flags=0x401 timeout=21474836 ***
ksqgtl *** TM-00000061-00000000 mode=3 flags=0x401 timeout=21474836 ***
ksqgtl *** TM-000000ff-00000000 mode=3 flags=0x401 timeout=21474836 ***
ksqgtl *** CU-24f7cf7c-00000000 mode=6 flags=0x10 timeout=300 ***
ksqgtl *** CU-24f7cf7c-00000000 mode=6 flags=0x10 timeout=300 ***
ksqgtl *** TM-0000009d-00000000 mode=3 flags=0x401 timeout=21474836 ***
ksqgtl *** TM-0000009a-00000000 mode=3 flags=0x401 timeout=21474836 ***
ksqgtl *** TM-000000a1-00000000 mode=3 flags=0x401 timeout=21474836 ***
ksqgtl *** TX-0009001f-00001501 mode=6 flags=0x401 timeout=0 ***

So you can grep tracefile contents right onto your sqlplus screen on windows as well...

The contents of tailgrep.cmd are simple:

C:\>cat c:\bin\tailgrep.cmd
tail -f "%1" | grep -i '%2'

--
Regards,
Tanel Poder
http://blog.tanelpoder.com


> -----Original Message-----
> From: Andre van Winssen [mailto:dreveewee_at_gmail.com]
> Sent: 23 May 2009 20:32
> To: tanel_at_poderc.com; oracle-l_at_freelists.org
> Subject: RE: tail -f for windows
>
> In 11g I use adrci for that:
> Adrci> show alert -tail -f
> but of course this sort of tail -f is limited to the files
> supported by adrci.
>
> I used to carry a tail.exe with me everywhere where there was
> oracle on windows, very handy.
>
> Andre
>
> -----Original Message-----
> From: oracle-l-bounce_at_freelists.org
> [mailto:oracle-l-bounce_at_freelists.org]
> On Behalf Of Tanel Poder
> Sent: zaterdag 23 mei 2009 18:29
> To: oracle-l_at_freelists.org
> Subject: tail -f for windows
>
> I don't find the original thread anymore, where someone asked
> whether there's a tail -f available for Windows. Such command
> exists in the windows resource kit as well:
>
> C:\oracle\admin\WIN92\bdump>"c:\Program Files\Windows
> Resource Kits\Tools\tail" -f alert_win92.log
> Completed: alter database open
> Wed May 20 23:17:23 2009
> Restarting dead background process QMN0
> QMN0 started with pid=9, OS id=2116
> Thu May 21 23:36:36 2009
> Thread 1 advanced to log sequence 52
> Current log# 3 seq# 52 mem# 0: C:\ORACLE\ORADATA\WIN92\REDO03.LOG
> Sat May 23 00:42:12 2009
> Thread 1 advanced to log sequence 53
> Current log# 1 seq# 53 mem# 0: C:\ORACLE\ORADATA\WIN92\REDO01.LOG
> Sat May 23 19:22:19 2009
> Thread 1 advanced to log sequence 54
> Current log# 2 seq# 54 mem# 0: C:\ORACLE\ORADATA\WIN92\REDO02.LOG
> ^C
>
>
> --
> Regards,
> Tanel Poder
> http://blog.tanelpoder.com
>
> --
> http://www.freelists.org/webpage/oracle-l
>
>
-- http://www.freelists.org/webpage/oracle-l
Received on Sat May 23 2009 - 13:04:57 CDT

Original text of this message