[20210506]完善tix指令碼.txt

lfree發表於2021-05-07

[20210506]完善tix指令碼.txt

--//http://blog.itpub.net/267265/viewspace-2766793/,在原來基礎上做一些小改進:

$ cat tix.sql
--@@saveset
column _ti_sequence noprint new_value _ti_sequence
set feedback off heading off
select trim(to_char( &&_ti_sequence + 1 , '0999' )) "_ti_sequence" from dual;
alter session set tracefile_identifier="&&_ti_sequence";
set feedback on heading on
set termout off
column tracefile noprint new_value trc

        select value ||'/'||(select instance_name from v$instance) ||'_ora_'||
               (select spid||case when traceid is not null then '_'||traceid else null end
                from v$process where addr = (select paddr from v$session
                                                 where sid = (select sid from v$mystat
                                                            where rownum = 1
                                                       )
                                            )
               ) || '.trc' tracefile
        from v$parameter where name = 'user_dump_dest';

set termout on
--@@loadset

prompt New tracefile_identifier =  &&trc
prompt
col tracefile clear
set feedback 6 heading on

--//增加一些空格,這樣copy and paste 好選擇範圍。
SCOTT@book> @ tix

New tracefile_identifier = /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_4308_0002.trc




來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2771273/,如需轉載,請註明出處,否則將追究法律責任。

相關文章