查询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