分类: Oracle
2010-10-21 14:11:18
tablespace_io.sh:
#!/bin/sh
# Oracle specific environment settings
export ORACLE_BASE=/ora01
export ORACLE_HOME=$ORACLE_BASE/9i
export ORACLE_SID=srm
# User specific environment and startup programs
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:.
datadate=`date +%D`
datatime=`date +%R`
datapath=/backup/scrīpt/tunning/tablespace_io
data=tablespace_io.data-`date +%Y-%m`
sqlplus '/as sysdba' @$datapath/tablespace_io.sql >$datapath/tablespace_io.log
#values=`/bin/cat $datapath/tablespace_io.log |egrep -v "SQL|Oracle|JServer|With|Disconnect|Connect|Total|-|rows"|sed '/^$/d'`
#values=`/bin/cat $datapath/tablespace_io.log |grep dbf|sed '/^$/d'`
/bin/cat $datapath/tablespace_io.log |grep dbf|sed '/^$/d' >> $datapath/$data
#echo $datadate $datatime $values >> $datapath/$data
/bin/cat $datapath/$data
tablespace_io.sql
set linesize 800;
set heading off;
set feedback off;
alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';
col name format a25;
col file for a45;
select current_date,df.tablespace_name name,df.file_name "file",f.phyrds pyr, f.phyblkrd pbr,f.phywrts pyw, f.phyblkwrt pbw from v$filestat f, dba_data_files df where f.file# = df.file_id order by df.tablespace_name;
exit;