点击(此处)折叠或打开
- ###################################################################
- ## Script:genash.sh ##
- ## Date:2016-08-22 ##
- ## Description:del gen ash report and sendport ##
- ###################################################################
- #!/bin/bash
- source /home/oracle/.bash_profile
- #if [ $# != 6 ]
- #then
- #!echo Syntax genash.sh dbid '01/30/11 11:00' duration credentials inst sid
- #exit 1
- #fi
-
- REMOTE_HOST=10.1.1.1
- REMOTE_DIR=/scripts/dbstatus/
- REMOTE_USER=access_user
- REMOTE_COMMAND="/scripts/sendash.py"
- l_dbid=1418194933
- l_start_time=`date -d '-3 hours' '+%m/%d/%y %H:%M'`
- #l_starttime_log=`echo $l_start_time|sed 'sg' | sed 's/ //'|sed 's/://'`
- l_duration=180
- l_credentials="dba_monitor/passwd"
- l_inst=1
- l_sid=$6
- l_logdir='/u01/script/awr'
- l_ash_log_file=${l_logdir}/ashrpt.html
-
- sqlplus -s $l_credentials <<EOC > /tmp/ash.log
-
- set head off
- set pages 0
- set lines 132
- set echo off
- set feedback off
- set termout off
-
- define inst_num=${l_inst};
- define dbid=${l_dbid};
- define report_type='html';
- define report_name=${l_ash_log_file};
- define begin_time="${l_start_time}";
- define duration=${l_duration};
- --define target_session_id = ${l_sid};
- define target_session_id = '';
-
- define slot_width = '';
- define target_sql_id = '';
- define target_wait_class = '';
- define target_service_hash = '';
- define target_module_name = '';
- define target_action_name = '';
- define target_client_id = '';
- define target_plsql_entry = '';
-
- @$ORACLE_HOME/rdbms/admin/ashrpti
- EOC
-
- #send email to user
- scp ${l_logdir}/ashrpt.html "$REMOTE_USER"@"$REMOTE_HOST":$REMOTE_DIR
- ssh $REMOTE_USER@$REMOTE_HOST $REMOTE_COMMAND
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24486203/viewspace-2123809/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24486203/viewspace-2123809/