温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

shell脚本如何获取隐含参数

发布时间:2021-11-08 10:48:05 来源:亿速云 阅读:132 作者:小新 栏目:建站服务器

这篇文章给大家分享的是有关shell脚本如何获取隐含参数的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

脚本涉及:gethidpar.sql 获取隐含参数
          gettrcname.sql 获取当前trace文件名称
          getplan.sql  获取sql语句的执行计划,通过v$sql_plan视图。

gethidpar.sql内容如下:

set linesize 120
col name for a30
col value for a20
col describ for a60

select x.ksppinm name, y.ksppstvl value, x.ksppdesc describ
from sys.x$ksppi x,sys.x$ksppcv y
where x.indx = y.indx
and x.ksppinm like '%&par%'

/

gettrcname.sql 内容如下:
select
a.value || b.symbol || c.instance_name || '_ora_'  || d.spid || '.trc' trace_file_name
from (select value from v$parameter where name = 'user_dump_dest')a,
(select substr(value,-6,1) symbol from v$parameter where name = 'user_dump_dest') b,
(select instance_name from v$instance) c,
(select spid from v$session s,v$process p,v$mystat m where s.paddr = p.addr and s.sid = m.sid and m.statistic#=0) d

/

getplan.sql 内容如下:
set linesize 120
col operation format a55
col cost format 99999
col kbytes format 999999
col object format a25

select hash_value,child_number,
lpad(' ',2*depth) || operation || ' ' || options || decode(id,0,substr(optimizer,1,6) || 'Cost=' || to_char(cost)) operation,
object_name object,
cost,
round(bytes/1024) kbytes
from v$sql_plan
where hash_value in (
    select a.sql_hash_value from v$session a,v$session_wait b
    where a.sid = b.sid and b.event = '&waitevent')
order by hash_value,child_number,id;
 
/

感谢各位的阅读!关于“shell脚本如何获取隐含参数”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI