標籤:學習記錄
無意義的指令碼,大神勿噴/
[[email protected] Desktop]# vim oraclesh.sh #!/bin/bashclear#函數test_parameter1(){`echo `su - oracle -c ‘sqlplus /nolog‘<<end conn sys/sys as sysdba select ‘-------show parameter --*******查看系統所有初始化參數******‘ sga from dual; show parameter; exitend``;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;exitend``;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‘;exitend``;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;exitend``;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[@]}"docase $REPLY in 1|2|3|4) clear ${ora[$[$REPLY - 1]]} echo ;; *) echo echo "選擇錯誤,退出!" exit 1;;esacdone[[email protected] Desktop]# sh oraclesh.sh1) 使用者parameter初始化資訊查詢! 2) 使用者SGA資訊查詢! 3) 使用者分享池大小! 4) 查看資料檔案磁碟所在位置! 查詢資訊:3SQL> NAME TYPE VALUE------------------------------------ ----------- ------------------------------shared_pool_size big integer 0SQL> 2 COMPONENT CURRENT_SIZE---------------------------------------------------------------- ------------shared pool 369098752SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionWith 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) 查看資料檔案磁碟所在位置! 查詢資訊:4SQL> 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.dbfSQL> SGA-----------------------------------------select name from v$tempfileSQL> NAME--------------------------------------------------------------------------------/u01/app/oracle/oradata/orcl/temp01.dbfSQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options 查看資料檔案: select name from v$datafile; select name v$tempfile;查詢資訊:e選擇錯誤,退出![[email protected] Desktop]#
本文出自 “一米陽光” 部落格,請務必保留此出處http://sunshine3.blog.51cto.com/3988340/1703840
學習的點點滴滴shell+sql