Thursday, March 28, 2013

Unix shell script to show oracle parameter

#!/bin/sh

$SU - oracle -c "sqlplus /NOLOG" << EOF
connect / as sysdba
set heading off
set pages 0
select name||' '||DISPLAY_VALUE from v\$parameter
where name in ('cpu_count', 'memory_target', 'memory_max_target', 'pga_aggregate_target', 'sga_target', 'sga_max_size' ,'db_8k_cache_size', 'db_cache_size', 'hash_area_size', 'java_pool_size', 'large_pool_size');
spool /tmp/tesdt.log
spool off
select granule_size from v\$sga_dynamic_components where rownum <= 1;
spool /tmp/tesdt.log append
/
spool off
quit
EOF