In this Document
Oracle Internal Events, both named event (eg: ERRORSTACK) as numeric events (eg 10046) can be set at the session level. This document outlines how DataBase Administrators can verify which events have been set in a specific session or in the entire system.
This can be achieved through the ORADEBUG functionality. The exact syntax to use depends on the Oracle version you are using.
If you want to retrieve the events set in a specific session, then use the following oradebug commands to identify the session:
If you want to retrieve the events set in your current SESSION or at the SYSTEM level, you can use the following commands:
Oracle 8i / 9i
Oracle 10g / 11g and above
-- OR --
Example 1: Oracle 9i - system events
This example illustrates how to retrieve the events set at the system level in an Oracle 9i database.
After the event is set we dump the events information
The following information will be dumped in the in the trace file ORCL_ora_2620.trc.
Notice the line 2 "Dump event group for level SYSTEM" which tells you which level was used to dump the information. In our case level 1 was used to dump the session information.
In line 4 the second column value tells us the event that was set, in our case 942.
In line 6 the first column tells us the name of the event, in our case the named event "ERRORSTACK" appears. On the same line check the second column, the determines the level at which the event was set, in our case "3"
Hence from the above information was can conclude that the event "942 trace name ERRORSTACK level 3" was set at the system level
Example 2: Oracle 11g - events set at session user SCOTT
This example illustrates how to retrieve the events user SCOTT has set at his session in an Oracle 11g database:
Attach to the above identified session:
Get the event information:
Example 3: Oracle 11g - events set at your current session
This example illustrates how to retrieve the events set in your current session environment in an Oracle 11g database:
The following information will be dumped in the in the trace file l112_ora_32493.trc
A. Add an EVENT="..." line to their initialization file startup parameters or B. Use an ALTER SESSION / SYSTEM SET EVENTS='...'; commandPlease read the information here before setting any event. If you are not sure about an EVENT then contact Oracle Support. The exact syntax to be used between the quotation marks should be given to you either from Oracle Support or from the article which directed you to this Note. An EVENT is a special item used by the Oracle server to do one of the following:
2) Make sure you know the LEVEL that an event should be set at.
In many cases the LEVEL of an event affects the behaviour of the event. A typical event syntax is:
EVENT="12345 trace name context forever, level 99"In this example the EVENT is 12345 and the LEVEL is 99.
3. If a problem occurs when an event is set then it is worth seeing if the same problem reproduces without the event set. This is because events can enable code specific paths which are not normally used.
4. Any events set in the initSID.ora file should be re-assessed prior to any upgrade. This is important as the EVENT may have a different meaning in the release you wish to upgrade to.The syntax to set an event in the initSID.ora file should be specified in the document which tells you to set the event. If not then contact Oracle Support.
Note that ALL events in the initSID.ora file should be grouped together on successive lines.
For example: If you have to set event 10046 and event 10053 then put the entries on adjacent lines in the initSID.ora thus: EVENT="10046 trace name context forever, level 12" EVENT="10053 trace name context forever, level 1"It is sensible to always add a comment against any EVENT in the initSID.ora file describing:
When removing an event from the init.ora file it is sensible to comment it out with details of WHEN / WHERE / WHY it was removed rather than deleting the lines.
Customers using an spfile should follow the instructions in Note: 160178.1 'How to set EVENTS in the SPFILE'
For example, when set in the current session, the following event will remain active until the session is terminated:
ALTER SESSION SET EVENTS '10046 trace name context forever, level 12';Similarly, when set SYSTEM wide, the following event will remain active until the instance is shutdown:
ALTER SYSTEM SET EVENTS '10046 trace name context forever, level 12';However, the event can be disabled at any time using the following syntax:-
ALTER SESSION SET EVENTS '10046 trace name context off';
ALTER SYSTEM SET EVENTS '10046 trace name context off';
Note that enabling or disabling a SYSTEM wide event will only take effect for new connections and will not impact existing connections. For this reason it is only useful for restartable background processes.
***Checked for relevance on 03-Feb-2012*** PURPOSE ------- How do you set multiple events in the init.ora file? OVERVIEW -------- If you have to set more than one event in the init.ora, how can you specify multiple events on the same line? HOW TO SET MULTIPLE EVENTS IN INIT.ORA FILE ------------------------------------------- The syntax to specify multiple events in the init.ora is: event=":: : " you can also split the events on multiple lines by using the continuation "\" backslash character at the end of each event and continue the next event on the next line. Such As: event=":\ :\ : \ " For Example: event="\ 10210 trace name context forever, level 10:\ 10211 trace name context forever, level 10:\ 10231 trace name context forever, level 10:\ 10232 trace name context forever, level 10" After setting the events, bounce the instance and be sure to check the alert.log and verify if the events are in effect. The alert.log should show the events that are in effect, for example: System parameters with non-default values: ... event = "10210 trace name context forever, level 10:10211 trace name context forever, level 10:10231 trace name context forever, level 10:10232 trace name context forever, level 10" ... It is also possible to set multiple events in multiple subsequent lines in the init.ora, e.g. event="10210 trace name context forever, level 10" event="10211 trace name context forever, level 10" event="10231 trace name context forever, level 10" Note that using the separate lines it is essential to set the events on subsequent lines. Otherwise, only the last event will be used due to the generic parsing of the init.ora values. NOTE: ===== For current Oracle versions. e.g. 11g, you can also use the next commands to list the set event in a trace file: SQL> alter session set events 'immediate eventdump(session)'; SQL> alter system set events 'immediate eventdump(system)';Please note that from 11g the alter system set events also affects all current sessions, and not only the new ones.
This note summarizes the syntax used to set trace and debug events when the server uses the binary server side parameter file (SPFILE).
Useful for Oracle Support and experienced DBAs.
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:
You can also, run the below command:
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:
2c) You cannot set the event during the instance life:
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:
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:
6) To configure a system-wide "triggered" event, use something like
7) To turn off non-immediate system or session events interactively, you can use a syntax like the following:
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.
● QQ群：230161599 微信群：私聊
● 于 2017-04-28 09:00 ~ 2017-04-30 22:00 在魔都完成
来自 “ ITPUB博客 ” ，链接：http://blog.itpub.net/26736162/viewspace-2136855/，如需转载，请注明出处，否则将追究法律责任。