查询PDB会话(巡检使用)

#!/bin/bash
export ORACLE_SID=gtzygis1
sqlplus -s / as sysdba <<EOF
spool selsessgis.txt append;
select to_char(sysdate,'yyyymmdd hh24:mi:ss') from dual;
select CON_ID,INST_ID,count(1) cnt from gv\$session where type='USER' group by CON_ID,INST_ID;
spool off;
exit
EOF
export ORACLE_SID=gtzyywdb1
sqlplus -s / as sysdba <<EOF
spool selsessyw.txt append;
select to_char(sysdate,'yyyymmdd hh24:mi:ss') from dual;
select CON_ID,INST_ID,count(1) cnt from gv\$session where type='USER' group by CON_ID,INST_ID;
spool off;
exit
EOF

posted @ 2022-09-15 00:04  TAOJH  阅读(42)  评论(0编辑  收藏  举报