支持AIX\HP-UX\Linux,自动判断运行中的Oracle用户,支持多Oracle用户,自动判断Listener名称,获取包括主机版本、IP地址、文件系统、物理内存、交换空间、文件缓存配置、主机字符集环境、ORACLE环境变量、Listener状态、Oracle字符集、Oracle用户、Oracle版本、SGA、PGA、数据文件路径等信息。
使用:
root下执行
info.sh >info
info.sh
#!/bin/ksh
typeset -u g_os=`uname`case $g_os in
AIX*)
echo ‘——————————————————’
echo ‘AIX OS Version:’
oslevel -r
echo ”
echo ‘——————————————————’
echo ‘IP Configuration:’
ifconfig -a
echo ”
echo ‘——————————————————’
echo ‘FileSystem:’
df -g
echo ”
echo ‘——————————————————’
echo ‘Physical Memory:’
lsattr -El mem0
echo ”
echo ‘——————————————————’
echo ‘Swap Info:’
lsps -a
echo ”
echo ‘——————————————————’
echo ‘maxperm and minperm:’
vmo -a|grep ‘perm’
;;
HP*)
echo ‘——————————————————’
echo ‘HP-UX OS Version:’
uname -a
echo ”
echo ‘——————————————————’
echo ‘IP Configuration:’
netstat -in
echo ”
echo ‘——————————————————’
echo ‘FileSystem:’
bdf
echo ”
echo ‘——————————————————’
echo ‘Physical Memory:’
dmesg|grep Physical
echo ”
echo ‘——————————————————’
echo ‘Swap Info:’
swapinfo -a
echo ”
echo ‘——————————————————’
echo ‘ dbc_max_pct and dbc_min_pct:’
kctune |grep ‘dbc’
;;
LINUX*)
echo ‘——————————————————’
echo ‘Linux OS Version:’
uname -a
cat /etc/redhat-release
echo ”
echo ‘——————————————————’
echo ‘IP Configuration:’
ifconfig
echo ”
echo ‘——————————————————’
echo ‘FileSystem:’
df -h
echo ”
echo ‘——————————————————’
echo ‘Physical Memory:’
grep MemTotal /proc/meminfo
echo ”
echo ‘——————————————————’
echo ‘Swap Info:’
free -m;;
esac
echo ”
echo ‘——————————————————’
echo ‘OS Language Environment:’
env |grep LANG
echo ‘NLS_LANG:’$NLS_LANG
echo ”
echo ‘——————————————————’
echo ‘Oracle Process Info:’
ps -ef|grep ora_smon|grep -v ‘grep’
ps -ef|grep tns|grep -v ‘grep’echo ”
echo ‘——————————————————’echo ‘vmstat:’
vmstat 1 10echo ”
echo ‘——————————————————’
echo ‘Oracle User Info:’
ora_username=`ps -ef|grep ora_smon|grep -v grep|awk -F" " ‘{print $1}’|awk ‘!a[$0]++’`
for i in $ora_username
do
id $i
done
echo ”
echo ‘——————————————————’
echo ‘Oracle User Environment:’oracle_info=’sqlplus -s "/as sysdba"<<EOF
set feedback off;
set pagesize 300;
prompt ;
prompt ——————————————————;
prompt Oracle SGA:;show sga;
col name for a15;
col value for a15;
show parameter sga;
prompt ;
prompt ——————————————————;
prompt Oracle PGA:;show parameter pga;
prompt ;
prompt ——————————————————;
prompt Oracle Version:;
select * from v\$version;
prompt ;
prompt ——————————————————;
prompt Oracle Datafile Location:;
col name for a45;
select name,bytes/1024/1024/1024 "size(GB)" from v\$datafile;
col parameter for a30;
col value for a30;
prompt ;
prompt ——————————————————;
prompt Oracle NLS Parameters:;
select * from nls_database_parameters;
prompt ;
prompt ——————————————————;
prompt Oracle Users:;
col USERNAME for a30;
col DEFAULT_TABLESPACE for a30;
select username,DEFAULT_TABLESPACE from dba_users;
exit
EOF’
for i in $ora_username
do
case $g_os in
AIX*|LINUX*)
echo ‘————’;
echo ‘username:’$i;
echo ‘————’;
lsnrn=`ps -ef|grep tns|grep -v grep|awk -F" " ‘{print $1,$(NF-1)}’|grep $i|awk -F" " ‘{print $2}’`
su – $i "-c env |grep -E ‘ORACLE_BASE|ORACLE_HOME|ORACLE_SID’;echo ”;echo ‘——————————————————’;echo ‘Oracle Listener Info:’;lsnrctl status $lsnrn;$oracle_info;";
;;
HP*)
echo ‘————’;
echo ‘username:’$i;
echo ‘————’;
lsnrn=`ps -ef|grep tns|grep -v grep|awk -F" " ‘{print $1,$(NF-1)}’|grep $i|awk -F" " ‘{print $2}’`
su – $i -c "env |grep -E ‘ORACLE_BASE|ORACLE_HOME|ORACLE_SID’;echo ”;echo ‘——————————————————’;echo ‘Oracle Listener Info:’;lsnrctl status $lsnrn;$oracle_info;";
;;
esac
done