auto ash v1
startdate=$1
enddate=$2
#reporttype=$3
#reportformat='text'
oraclehome=`echo $ORACLE_HOME`
dbid=`sqlplus -s "/ as sysdba" <<EOF
set head off
set echo off
set feedback off
set linesize 120 ;
set pagesize 0;
set heading off;
select distinct dbid from gv\\$database;
quit;
EOF
`
instname=`sqlplus -s "/ as sysdba" <<EOF
set head off
set echo off
set feedback off
set linesize 120 ;
set pagesize 0;
set heading off;
select instance_name from gv\\$instance;
quit;
EOF
`
echo "generate the ash report sql...."
$ORACLE_HOME/bin/sqlplus -s "/ as sysdba" <<EOF
rem autoash.sql
set echo off;
set feedback off;
set termout on;
set heading off;
variable rpt_options number;
define NO_OPTIONS = 0;
-- define ENABLE_ADDM = 8;
rem according to your needs, the value can be 'text' or 'html'
define report_type='html';
column ext new_value ext noprint
column fn_name new_value fn_name noprint;
column lnsz new_value lnsz noprint;
select 'html' ext from dual where lower('&report_type') = 'html';
select 'ash_report_html' fn_name from dual where lower('&report_type') = 'html';
select '1500' lnsz from dual where lower('&report_type') = 'html';
set linesize &lnsz;
column report_name new_value report_name noprint;
select instance_name||'_ashrpt_1_'|| to_char(to_date('$startdate', 'yyyy-mm-dd hh24:mi:ss'), 'yyyymmddhh24miss') ||'.'||'&ext' report_name
from v\$instance a;
set termout off;
spool &report_name;
select output from table(dbms_workload_repository.&fn_name('$dbid', '$inst_num',to_date('$startdate', 'yyyy-mm-dd hh24:mi:ss'),to_date('$enddate', 'yyyy-mm-dd hh24:mi:ss'),0));
spool off;
set termout on;
clear columns sql;
ttitle off;
repfooter off;
undefine report_name
undefine report_type
undefine fn_name
undefine lnsz
undefine NO_OPTIONS
quit;
EOF
chmod +x autoash.sh
sh autoash.sh '2016-06-29 10:15:00' '2016-06-29 10:30:00'
auto ash v1的更多相关文章
- auto和decltype(c++11)
1.auto 1)auto是一个类型说明符(类型说明符就是像int.double这样的),用来定义一个变量,它可以让编译器去分析表达式的类型,并使用该表达式的值去初始化变量 //auto定义的变量必须 ...
- C++ auto类型说明符
本系列文章由 @yhl_leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/50864612 编程时常常需要把表达式的 ...
- leetcode 165
才一周没刷leetcode,手就生了,这个题目不难,但是完全AC还是挺费劲的. 题目描述: Compare two version numbers version1 and version2.If v ...
- 【cpp】Vector
这vector 很有用 // compile with: /EHsc #include <vector> #include <iostream> int main() { us ...
- C++STL -- vector 使用
vector是一种顺序容器. vector常用API: 现在一个个分析: 1. assign 这是一种赋值方法,但是会覆盖原来容器内的值. void assign( size_type num, co ...
- 一种高效的 vector 四则运算处理方法
实现 vector 的四则运算 这里假设 vector 的运算定义为对操作数 vector 中相同位置的元素进行运算,最后得到一个新的 vector.具体来说就是,假如 vector<int&g ...
- 《C++Primer》复习——with C++11 [4]
考虑到STL的掌握主要靠的是练习,所以对于STL这部分,我把书中的练习都做一遍,加深印象.这些练习是第9.10.11.17章的,分别是顺序容器.泛型算法和关联容器等. ——10月22日 /*----- ...
- C++ 11 vlearning
1.新增算术类型 longlong,最小不比long小,一般为64位. 2.列表初始化 int units_sold = {0};或者 int units_sold{0};非11标准 ...
- c++ primer (5)1
第一章 1.包含来自标准库的头文件用<>,不属于标准库用"". 2.默认情况,读cin会刷新cout:程序非正常终止时也会刷新cout. 3.默认情况,cerr不缓冲, ...
随机推荐
- MySQL索引入门
MySQL索引的建立对于MySQL的高效运行是很重要的,索引可以大大提高MySQL的检索速度. 索引分单列索引和组合索引.单列索引,即一个索引只包含单个列,一个表可以有多个单列索引,但这不是组合索引. ...
- Marble 绘制线
#include <QtGui/QApplication> #include <marble/MarbleWidget.h> #include <marble/GeoPa ...
- Chapter 14_2 全局变量声明
Lua中的全局变量不需要声明就可以使用.对于小程序十分方便,但是大型程序中 一处简单的笔误就可能造成难以发现的bug. 不过,这种性能可以改变.由于Lua将全局变量放在一个普通的table中,可以通过 ...
- chapter8_3 c代码和错误
1.C代码 Lua提供的所有关于动态链接的功能都集中在一个函数中,即package.loadlib. 该函数有两个字符串参数:动态库的完整路径和一个函数名称: local path = "/ ...
- 深度探索C++对象模型之C++对象模型笔记
0.菜鸟觉得,在看这本书的时候最好切换角色,把自己的思维转换成编译器开发者,去考虑问题,这样会容易理解些.(当然这样很难,就想着自己要解决什么样的问题好了) 1.在C++中,类的数据成员有两种:静态和 ...
- MVC jsonModelBuilder
/// <summary> /// JsonModelBinderAttribute /// author:BearLee /// 2015/5/20 11:48:40 /// </ ...
- java的静态方法的使用
静态的方法和属性,你可以这么理解,就是所有对象公用的,比如一个属性是这样定义的: private static String name; 那么他的意思就是说,因为他是静态的,我所有的对象的name属性 ...
- G - 小晴天老师系列——可恶的墨水瓶
G - 小晴天老师系列——可恶的墨水瓶 Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Othe ...
- 28.按要求编写一个Java应用程序: (1)定义一个类,描述一个矩形,包含有长、宽两种属性,和计算面积方法。 (2)编写一个类,继承自矩形类,同时该类描述长方体,具有长、宽、高属性, 和计算体积的方法。 (3)编写一个测试类,对以上两个类进行测试,创建一个长方体,定义其长、 宽、高,输出其底面积和体积。
//矩形父类 package d922A; public class Rect { private double l,w; Rect(double c,double k) { l=c; w=k; } ...
- 配置pyqt5环境 for python3.4 on Linux Mint 17.1
1.安装QT 配置QT PATH 在 /etc/profile文件中追加 export QTDIR=/usr/local/Qt5.4.2/5.4/gcc_64 export LD_LIBRARY_PA ...