无意义的脚本,大神勿喷/
[root@test Desktop]# vim oraclesh.sh #!/bin/bash clear #函数 test_parameter1() { `echo `su - oracle -c 'sqlplus /nolog'<<end conn sys/sys as sysdba select '-------show parameter --*******查看系统所有初始化参数******' sga from dual; show parameter; exit end ``; echo ; echo -e "\t show parameter --*******查看系统所有初始化参数******"; } test_sga2() { #1.用户SGA信息 #`echo `su - oracle -c 'sqlplus / as sysdba'<<exit `echo `su - oracle -c 'sqlplus /nolog'<<end conn sys/sys as sysdba clear screen; select '-------show parameter sga--查看SGA参数' sga from dual; show parameter sga; select '-------show parameter sga_max_size--查看系统SGA当前最大上限' sga from dual; show parameter sga_max_size; select '-------show sga--查看用户SGA信息' sga from dual; show sga; select '-------select sum(current_size) from v\$sga_dynamic_components--查看当前共享内存SGA总大小' sga from dual; select sum(current_size) from v\$sga_dynamic_components; exit end ``; echo " "; echo -e "\t show parameter sga --查看SGA参数 "; echo -e "\t show parameter sga_max_size --查看系统SGA当前最大上限"; echo -e "\t show sga --查看用户SGA信息"; echo -e "\t select sum(current_size) from v\$sga_dynamic_components--查看当前共享内存SGA总大小"; echo " "; } test_shared3() { `echo `su - oracle -c 'sqlplus /nolog'<<end conn sys/sys as sysdba clear screen; show parameter shared_pool_size; select component,current_size from v\$sga_dynamic_components where component='shared pool'; exit end ``; echo ; echo -e "\t 查看共享池大小 \n \t show parameter shared_pool_size \n"; echo -e "\t select component,current_size from v\$sga_dynamic_components \n \t where component='shared pool'"; } test_data4() { `echo `su - oracle -c 'sqlplus / as sysdba'<<end select '-------select name from v\$datafile--查看数据文件' sga from dual; select name from v\$datafile; select '-------select name from v\$tempfile' sga from dual; select name from v\$tempfile; exit end ``; echo -e "\n\t 查看数据文件:\n \t select name from v\$datafile; \n \t select name v\$tempfile;\n"; } #数组 ora=(test_parameter1 test_sga2 test_shared3 test_data4) #查询 PS3="查询信息:" name=( "用户parameter初始化信息查询! " "用户SGA信息查询! " "用户分享池大小! " "查看数据文件磁盘所在位置! " ) select i in "${name[@]}" do case $REPLY in 1|2|3|4) clear ${ora[$[$REPLY - 1]]} echo ;; *) echo echo "选择错误,退出!" exit 1;; esac done [root@test Desktop]# sh oraclesh.sh 1) 用户parameter初始化信息查询! 2) 用户SGA信息查询! 3) 用户分享池大小! 4) 查看数据文件磁盘所在位置! 查询信息:3 SQL> NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ shared_pool_size big integer 0 SQL> 2 COMPONENT CURRENT_SIZE ---------------------------------------------------------------- ------------ shared pool 369098752 SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options 查看共享池大小 show parameter shared_pool_size select component,current_size from v$sga_dynamic_components where component='shared pool' 查询信息: 1) 用户parameter初始化信息查询! 2) 用户SGA信息查询! 3) 用户分享池大小! 4) 查看数据文件磁盘所在位置! 查询信息:4 SQL> SGA ------------------------------------------------------ -------select name from v$datafile--查看数据文件 SQL> NAME -------------------------------------------------------------------------------- /u01/app/oracle/oradata/orcl/system01.dbf /u01/app/oracle/oradata/orcl/sysaux01.dbf /u01/app/oracle/oradata/orcl/undotbs01.dbf /u01/app/oracle/oradata/orcl/users01.dbf /u01/app/oracle/oradata/orcl/example01.dbf SQL> SGA ---------------------------------- -------select name from v$tempfile SQL> NAME -------------------------------------------------------------------------------- /u01/app/oracle/oradata/orcl/temp01.dbf SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options 查看数据文件: select name from v$datafile; select name v$tempfile; 查询信息:e 选择错误,退出! [root@test Desktop]#
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。