invokerzhang 2019-11-14
This project meant to provide useful scripts for DB maintance and management, to make work easier and interesting...
最近在开始把Oracle数据库的脚本转换成shell脚本,所以今天开始分享一下Oracle常用的一些脚本,后面不定期更新。这是第二部分~
use script settdb.sh for DB login details registry
1、getash.sh
#!/bin/bash echo "===================================================查看会话基本信息=====================================================" sqlplus -silent $DB_CONN_STR@$SH_DB_SID<
输出:
./getash.sh
2、sessmgr.sh
#!/bin/bash echo "===================================================会话信息统计=====================================================" issue_program1="sum(decode(program,'JDBC Thin Client',cnt,0))" issue_program2="sum(decode(substr(program,1,11),'application1',cnt,0))" issue_program3="sum(decode(substr(program,1,11),'application2',cnt,0))" sqlplus -s $DB_CONN_STR@$SH_DB_SID <50 order by total_cnt desc; EOF exit
输出:
./sessmgr.sh
觉得有用的朋友多帮忙转发哦!后面会分享更多devops和DBA方面的内容,感兴趣的朋友可以关注下~