关于SQL_Trace

You work as a database administrator at Certkiller .com. In your test database, you find that a user's session is executing a lot of S
QL statements, resulting in the generation of a large number of trace
 files. While investigating the reason, you find that SQL trace has b
een enabled at the instance level. You want to disable SQL trace, rem
otely, only for that user session to reduce the volume of trace data
being generated. How do you achieve this objective? 
A. by setting the SQL_TRACE parameter to FALSE in the parameter file 
B. by using DBMS_MONITOR.SESSION_TRACE_DISABLE to disable the tracing
 for the user session 
C. by setting the SQL_TRACE parameter to FALSE by using the ALTER SYS
TEM command in the user session 
D. by setting the SQL_TRACE parameter to FALSE by using the ALTER SES
SION command in the user session 
Answer: B


 模块级别跟踪:
SQL> exec dbms_monitor.serv_mod_act_trace_enable(service_name =>
'EDGAR', module_name => 
用户级别跟踪:
SQL> exec dbms_monitor.client_id_trace_enable(client_id => 'DEMO');

Client_id 就是数据库中的用户名。
会话级别跟踪:SQL> exec dbms_monitor.session_trace_enable(138);138 就
是会话 ID. 
DBMS_MONITOR 是在 Oracle 10g 中引入的内置的程序包,通过该程序包可以
跟踪从客户机到中间层、再到后端数据库的任何用户的会话,从而可以较为容易
地标识创建大量工作量的特定用户。
SQL_TRACE 是 Oracle 提供的用于进行 SQL 跟踪的手段,是强有力的辅助诊断
工具.在日常的数据库问题诊断和解决中,SQL_TRACE 是非常常用的方法。
大多数时候我们使用 sql_trace 跟踪当前进程.通过跟踪当前进程可以发现当前
操作的后台数据库递归活动(这在研究数据库新特性时尤其有效),
研究 SQL 执行,发现后台错误等.
在 session 级启用和停止 sql_trace 方式如下:
启用当前 session 的跟踪:
SQL> alter session set sql_trace=true;
此时的 SQL 操作将被跟踪:
SQL> select count(*) from dba_users;
结束跟踪:
SQL> alter session set sql_trace=false;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值