#!/usr/bin/ksh #set -xv # Program : smenu_asm.sh # Author : Bernard Polarski # date : 09 October 2007 # with age I become extremly lazy. Most script taken from dbasupport.com # instead of typing mine. I need to be slashed a bit like slaves in pharaonic time # in order to revigorate a bit. # 12 December 2007 added 'asm -mv' to move easily files in ASM from diskgroups HOST=`hostname` PAR1=$1 function help { cat < EOF } if [ -z "$1" ];then help exit fi while [ -n "$1" ] do case "$1" in -a ) CHOICE="ALIAS" ;; -cli ) CHOICE="CLIENT" ;; -d ) SQL="col path format a50 col failgroup format a10 select group_number, disk_number, mount_status, header_status, state, path, failgroup from v\$asm_disk;" ;; -dv ) CHOICE="DV" ;; -f ) SQL="select group_number, name, total_mb, free_mb, state, type from v\$asm_diskgroup;" ;; -g ) SQL="SELECT group_number,name,state,TOTAL_MB, FREE_MB,USABLE_FILE_MB, BLOCK_SIZE ,UNBALANCED,REQUIRED_MIRROR_FREE_MB from v\$asm_diskgroup;" ;; -l ) CHOICE="FILE" ;; -mv ) CHOICE=MV ; FILE_ID=$2; DISKGROUP=$3 ; shift; shift ;; -o ) CHOICE=OVERVIEW ;; -p ) CHOICE="PERF" ;; -slo ) CHOICE="SLO" ;; -tpl ) CHOICE="TPL" ;; -h ) help; exit ;; * ) help; exit ;; esac shift done . $SBIN/scripts/passwd.env . ${GET_PASSWD} $S_USER $ORACLE_SID if [ "x-$CONNECT_STRING" = "x-" ];then echo "could no get a the password of $S_USER" exit 0 fi # -------------------------------------------------------- if [ "$CHOICE" = "OVERVIEW" ];then SQL=" SET serverout on feedback off linesize 200 column instance_name format a20 column db_name format a20 column name format a20 column software_version format a20 column compatible_version format a20 column reads format 999999999 column writes format 999999999 column read_errs format 999999999 column write_errs format 999999999 column read_time format 999999999 column write_time format 999999999 column mb_read format 999999999 column mb_written format 999999999 column state format a20 column total_mb format 999999999 column free_mb format 999999999 column path format a40 column header_status format a20 column redundancy format a20 column mount_status format a20 SET heading off select '*** CLIENT INFO ***' ci from dual; SET heading on select instance_name, db_name, status, software_version, compatible_version from v\$asm_client; SET heading off select '*** DISKGROUP INFO ***' di from dual; SET heading on select name, state, block_size, type, total_mb, free_mb from v\$asm_diskgroup; SET heading off select '*** DISK INFO ***' di from dual; SET heading on select name, mount_status, header_status, redundancy, path from v\$asm_disk; select name, total_mb, free_mb, repair_timer,reads, writes, read_errs, write_errs, read_time, write_time, round(bytes_read/(1024*1024)) mb_read, round(bytes_written/(1024*1024)) mb_written from v\$asm_disk; " # -------------------------------------------------------- elif [ "$CHOICE" = "MV" ];then if [ -z "$DISKGROUP" ];then echo "I need a target disk group" exit fi if [ -z "$FILE_ID" ];then echo "I need a SOURCE FILE ID " exit fi VAR=`sqlplus -s "$CONNECT_STRING" <