Send a message to all logged in users

Disclaimer: This will work only in Windows

REM
REM Script: send.sql
REM
Rem
Rem Name: Send.Sql
Rem Function: Send a message to all connect users on NT.
Rem Usage: Execute the file connected as SYS from SQL*Plus
Rem

Set Pages 0 Feed Off Term Off Echo Off
Spool Temp.Bat
Select Distinct 'Net Send ' || Terminal|| ' Please log off now.'
From V$Session Where UserName Is Not Null and terminal is not null;
Spool Off
Host Temp
exit

2 comments :

  1. Hi,
    Your blog is very nice.
    and in the above post please check there is typo mistake.

    1. in sql statement "||" is missing
    2. in where clause field name ternimal spelling is wrong.

    regards
    Taj

    ReplyDelete
  2. Thanks Taj for the review and comments. The problems has been rectified in the post.

    Thanks a lot.

    ReplyDelete