您好,登錄后才能下訂單哦!
無意義的腳本,大神勿噴/
[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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。