10046
1.进入某个pdb
SQL> alter session set container=ORA12CPDB4;
2.设置日志标识
SQL> alter session set tracefile_identifier='hxl'; ##这样完成后,trace文件名称就会加上hxl
可以通过如下的查询定位到trc文件
select distinct(m.sid),p.pid,p.tracefile from v$mystat m,v$session s,v$process p where m.sid=s.sid and s.paddr=p.addr;
3.开启10046跟踪
SQL> alter session set events '10046 trace name context forever, level 12';
4.执行某个语句
Select Count(1) From Dba_Data_Files;
5.停止10046事件跟踪
alter session set events '10046 trace name context off';
6.可以看到生成了带"hxl"标识的trc文件
[oracle@localhost trace]$ ls -al
total 288
drwxr-x--- 2 oracle oinstall 4096 Mar 20 10:21 .
drwxr-x--- 16 oracle oinstall 199 Feb 14 10:55 ..
-rw-r----- 1 oracle oinstall 2237 Mar 20 10:19 alert_ora12c.log
-rw-r----- 1 oracle oinstall 1091 Mar 20 10:19 ora12c_aqpc_22450.trc
-rw-r----- 1 oracle oinstall 915 Mar 20 10:19 ora12c_aqpc_22450.trm
-rw-r----- 1 oracle oinstall 3919 Mar 20 10:25 ora12c_dbrm_22357.trc
-rw-r----- 1 oracle oinstall 1147 Mar 20 10:25 ora12c_dbrm_22357.trm
-rw-r----- 1 oracle oinstall 1419 Mar 20 10:19 ora12c_fbda_27570.trc
-rw-r----- 1 oracle oinstall 1075 Mar 20 10:19 ora12c_fbda_27570.trm
-rw-r----- 1 oracle oinstall 26426 Mar 20 10:25 ora12c_gen0_22341.trc
-rw-r----- 1 oracle oinstall 4421 Mar 20 10:25 ora12c_gen0_22341.trm
-rw-r----- 1 oracle oinstall 26034 Mar 20 10:25 ora12c_mmon_22404.trc
-rw-r----- 1 oracle oinstall 4396 Mar 20 10:25 ora12c_mmon_22404.trm
-rw-r----- 1 oracle oinstall 56263 Mar 20 10:14 ora12c_ora_27502.trc
-rw-r----- 1 oracle oinstall 10261 Mar 20 10:14 ora12c_ora_27502.trm
-rw-r----- 1 oracle oinstall 4887 Mar 20 10:18 ora12c_ora_27915.trc
-rw-r----- 1 oracle oinstall 1232 Mar 20 10:18 ora12c_ora_27915.trm
-rw-r----- 1 oracle oinstall 78294 Mar 20 10:22 ora12c_ora_28001_hxl.trc
-rw-r----- 1 oracle oinstall 15634 Mar 20 10:22 ora12c_ora_28001_hxl.trm
-rw-r----- 1 oracle oinstall 1402 Mar 20 10:21 ora12c_ora_28001.trc
-rw-r----- 1 oracle oinstall 956 Mar 20 10:21 ora12c_ora_28001.trm
7.使用tkprof工具查看
[oracle@localhost trace]$ tkprof /u01/app/oracle/diag/rdbms/ora12c/ora12c/trace/ora12c_ora_28001_hxl.trc
这里提示输入输出文件名:
1.txt