自动生成ASH报告脚本


点击(此处)折叠或打开

  1. ###################################################################
  2. ## Script:genash.sh      ##
  3. ## Date:2016-08-22 ##
  4. ## Description:del gen ash report and sendport ##
  5. ###################################################################
  6. #!/bin/bash
  7. source /home/oracle/.bash_profile
  8. #if [ $# != 6 ]
  9. #then
  10. #!echo Syntax genash.sh dbid '01/30/11 11:00' duration credentials inst sid
  11. #exit 1
  12. #fi

  13. REMOTE_HOST=10.1.1.1
  14. REMOTE_DIR=/scripts/dbstatus/
  15. REMOTE_USER=access_user
  16. REMOTE_COMMAND="/scripts/sendash.py"
  17. l_dbid=1418194933
  18. l_start_time=`date -d '-3 hours' '+%m/%d/%y %H:%M'`
  19. #l_starttime_log=`echo $l_start_time|sed 'sg' | sed 's/ //'|sed 's/://'`
  20. l_duration=180
  21. l_credentials="dba_monitor/passwd"
  22. l_inst=1
  23. l_sid=$6
  24. l_logdir='/u01/script/awr'
  25. l_ash_log_file=${l_logdir}/ashrpt.html
  26.  
  27. sqlplus -s $l_credentials <<EOC > /tmp/ash.log
  28.  
  29. set head off
  30. set pages 0
  31. set lines 132
  32. set echo off
  33. set feedback off
  34. set termout off
  35.  
  36. define inst_num=${l_inst};
  37. define dbid=${l_dbid};
  38. define report_type='html';
  39. define report_name=${l_ash_log_file};
  40. define begin_time="${l_start_time}";
  41. define duration=${l_duration};
  42. --define target_session_id = ${l_sid};
  43. define target_session_id = '';
  44.  
  45. define slot_width = '';
  46. define target_sql_id     = '';
  47. define target_wait_class = '';
  48. define target_service_hash = '';
  49. define target_module_name = '';
  50. define target_action_name = '';
  51. define target_client_id    = '';
  52. define target_plsql_entry = '';
  53.  
  54. @$ORACLE_HOME/rdbms/admin/ashrpti
  55. EOC

  56. #send email to user
  57. scp ${l_logdir}/ashrpt.html "$REMOTE_USER"@"$REMOTE_HOST":$REMOTE_DIR
  58. ssh $REMOTE_USER@$REMOTE_HOST $REMOTE_COMMAND

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24486203/viewspace-2123809/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/24486203/viewspace-2123809/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值