2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Oracleのセッション数を確認するシェルスクリプト

2
Posted at
# !/bin/bash
# set environment
export ORACLE_SID=xxx
export ORACLE_HOME=/path/to/oracle/home
export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG=American_America.AL32UTF8

CONN=user/password@$ORACLE_SID
LOG_FILE=/var/www/html/ora_sessions/print_ora_sessions.`date +%Y%m%d%H%M%S`.log


sqlplus -s $CONN >> $LOG_FILE <<EOF
  set pages 10000
  set lines 150
  COLUMN sid FORMAT 99999
  COLUMN machine FORMAT a20
  COLUMN username FORMAT a20
  COLUMN status FORMAT a10
  COLUMN program FORMAT a50

  ALTER SESSION SET nls_date_format='yyyy/mm/dd hh24:mi:ss';

  SELECT sid,serial#,machine,program,username,logon_time,status
    FROM v\$session
    ORDER BY logon_time;

  quit
EOF
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?