重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2255|回复: 0
打印 上一主题 下一主题

[转载] 如何在spfile中设置event

[复制链接]
跳转到指定楼层
楼主
发表于 2016-4-19 13:01:56 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
How To Set EVENTS In The SPFILE (文档 ID 160178.1)

Applies to:
Oracle Database - Enterprise Edition - Version 9.0.1.0 and later
Information in this document applies to any platform.
Purpose

This note summarizes the syntax used to set trace and debug events when the server uses the binary server side parameter file (SPFILE).
Scope
Useful for Oracle Support and experienced DBAs.

Details
How to Set EVENTS in the SPFILE ?

You need to set several events in the parameter file. You can perform this task successfully in the text based parameter file, and need to do the same operation for an instance that uses the new Oracle9i binary server side
parameter file, also known as the SPFILE.

1)  An example of the text based parameter file syntax is:

      event="10325 trace name context forever, level 10"
      event="10015 trace name context forever, level 1"

    Inserting other parameters between these lines will cause the last
    event only to be included.

2a) One method to set the event in the SPFILE is to use the SQL syntax:


SQL> ALTER SYSTEM SET
           EVENT='10325 trace name context forever, level 10',
           '10015 trace name context forever, level 1'
           COMMENT='Debug tracing of control and rollback' SCOPE=SPFILE;   
System altered.

You can also, run the below command:
SQL> alter system set event='10325 trace name context forever, level 10:10015 trace name context forever, level 1' scope=spfile;

    The instance must be restarted for the events to take effect.

2b) The instance must have been started with an SPFILE.  Otherwise this ALTER command will fail as follows:



SQL> ALTER SYSTEM SET
           EVENT='10325 trace name context forever, level 10',
           '10015 trace name context forever, level 1'
           COMMENT='Debug tracing of control and rollback' SCOPE=SPFILE;

      ALTER SYSTEM SET
      *
      ERROR at line 1:
      ORA-32001: write to SPFILE requested but no SPFILE specified at startup

2c) You cannot set the event during the instance life:
  SQL> ALTER SYSTEM SET
           EVENT='10325 trace name context forever, level 10',
           '10015 trace name context forever, level 1'
           COMMENT='Debug tracing of control and rollback' SCOPE=BOTH;
      EVENT='10325 trace name context forever,
      *
      ERROR at line 2:
      ORA-02095: specified initialization parameter cannot be modified

      If you get an error like this, it is necessary to use SCOPE=SPFILE and restart the database.

2d) The command can be performed with the instance in NOMOUNT state.
    You can set events without having to open or mount the database.

3) If you need to alter, add or remove an event, you have to enter the whole new list in the ALTER SYSTEM command and restart.

4) To remove all events, use:
           

SQL> ALTER SYSTEM RESET EVENT SCOPE=SPFILE SID='*' ;
System altered.

    The asterisk ("*") in this example applies to all cases but Real Application Cluster. In a Real Application Cluster configuration environment the instance name is required instead of the asterisk.

5) To have events set up immediately, typically for dumping or tracing, use:


SQL> ALTER SESSION SET EVENTS 'immediate trace name controlf level 2' ;
System altered.

6) To configure a system-wide "triggered" event, use something like

SQL> alter system set events '942 trace name ERRORSTACK level 3';
System altered.

7) To turn off non-immediate system or session events interactively, you can use a syntax like the following:      

SQL> alter system set events '942 trace name ERRORSTACK off';     
System altered.     
SQL> alter system set events='10325 trace name context off';     
System altered.

Note the different syntax:
   
- "SESSION" versus "SYSTEM", "EVENTS" versus "EVENT", and no "," before the "level" keyword.
- Additionally, you can specify each event in a separate ALTER SESSION command.

References
BUG:2942335 - ALTER SYSTEM RESET EVENT SCOPE=SPFILE SID='*' NOT RESETING EVENTS
NOTE:168042.1 - ORA-2194 Starting up the Database
NOTE:1051056.6 - How to Set Multiple Events in INIT.ORA
NOTE:436036.1 - How To List All The Named Events Set For A Database
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-4-28 11:20 , Processed in 0.092484 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表