#!/bin/bash
. ~/.bash_profile
sqlplus -S <<EOF
column minsnapid noprint new_value begsnapid
column maxsnapid noprint new_value endsnapid
column spreportname noprint new_value reportname
select min(snap_id) minsnapid
from perfstat.stats\$snapshot
where SNAP_TIME > trunc(sysdate) -1 ;
select max(snap_id) maxsnapid
from perfstat.stats\$snapshot
where SNAP_TIME > trunc(sysdate) -1
and SNAP_TIME <= trunc(sysdate) + 1/24;
select '/tmp/sp_' || instance || '_' || to_char(sysdate -1 , 'yyyy_mm_dd') || '.txt' spreportname
from v\$thread;
define begin_snap=&begsnapid
define end_snap=&endsnapid
define report_name=&reportname
@$ORACLE_HOME/rdbms/admin/spreport.sql
EOF
沒有留言:
張貼留言