Hi,
I'd like to generate statspack report once per day and send automatically to my emial important parts of this report. Right now I have such sript:
su - oracle -c "sqlplus perfstat/perfstat" << EOF
column esnap new_value end_snap noprint
select max(snap_id) as esnap from stats$snapshot;
column bsnap new_value begin_snap noprint
select max(snap_id)-24 as bsnap from stats$snapshot;
define report_name=/home/oracle/sp_proba.lst
@?/rdbms/admin/spreport
EOF
Of course I delete lines below which parse and send information to my email. Important for me is that those command works when I paste it line by line to perfstat session (from sqlplus), but when I run it from script it receive an error ORA-20200. Of course it's obvious that this snap_id exist because I select it from statspack view! Question is, why this code works when I execute it line by line from sqlplus session, but doesn't work when it's run from script? Anyone have such problem?
Best.