Detailed analysis of Oracle tracking event: setevents

Source: Internet
Author: User
Oracle tracking files are divided into three types: Background alarm log files, which record the activities of background processes during database startup, shutdown, and running, such as tablespace creation,

Oracle tracking files are divided into three types: Background alarm log files, which record the activities of background processes during database startup, shutdown, and running, such as tablespace creation,

1. Oracle tracking File

There are three types of Oracle trace files: one is the background alarm log file, which records the activity of background processes during database startup, shutdown, and running, such as creating tablespaces, creating rollback segments, some alter commands, log switching, and error messages. When the database fails, you should first check the file, but the information in the file is not necessarily related to any error status. The background alarm LOG file is saved in the directory specified by the BACKGROUND_DUMP_DEST parameter. The file format is SIDALRT. LOG. Another type is the background trace files created by background processes such as DBWR, LGWR, and SMON. The background trace file is generated based on the running status of the background process. The background trace file is also saved in the directory specified by the BACKGROUND_DUMP_DEST parameter. The file format is siddbwr. trc and sidsmon. trc. Another type is the user trace file generated by the user process connected to Oracle. These files are generated only when errors occur during user sessions. In addition, you can execute an oracle tracking event (see the following section) to generate this type of file. The User tracking file is saved in the directory specified by the USER_DUMP_DEST parameter. The file format is oraxxxxx. trc, xxxxx is the process number (or thread number) of the file to be created ).

Ii. Oracle tracking events

Oracle provides a class of commands to dump information contained in various Oracle internal structures to a trace file, so that users can solve various faults according to the file content. There are two ways to set the tracking event. One is to set the event in the init. ora file, so that after the database is opened, all sessions will be affected. The format is as follows:

EVENT = "eventnumber trace name eventname [forever,] [level levelnumber]:..."

You can use the symbol to set multiple events in a row or multiple events in a row.

Another method is to use the alter session set events command during the session process, which only affects the current session. The format is as follows:

Alter session set events '[eventnumber | immediate] trace name eventname [forever] [, level levelnumber]: ......'

Through the symbol, you can set multiple events consecutively, or you can use alter session set events consecutively to set multiple events.

Format description: eventnumber refers to the event number that triggers dump. The event number can be an Oracle error number (the specified event is tracked when an error occurs) or an internal oralce event number, the internal event number is between 10000 and 10999, and cannot be used with the immediate keyword.

The immediate keyword indicates that the specified structure is immediately dumped to the trace file after the command is issued. This keyword is only used in the alter session Statement and cannot be used with the eventnumber or forever keyword.

Trace name is a keyword.

Eventname refers to the event name (see the following section), that is, the actual structure name for dump. If eventname is context, internal event numbers are used for tracking.

The forever keyword indicates that the event remains valid during the instance or session period and cannot be used with immediate.

Level is the event-level keyword. But the error stack (errorstack) does not have a level.

Levelnumber indicates the event level number. Generally, from 1 to 10, 1 indicates only the dump structure header information, and 10 indicates all the information of the dump structure.

1. buffers event: db buffer Structure in the dump SGA buffer

Alter session set events 'immediate trace name buffers level 1'; -- indicates the dump buffer header.

2. blockdump event: dump data file, index file, and rollback segment file structure

Alter session set events 'immediate trace name blockdump level 100'; -- indicates that the dump block address is 66666.

After Oracle 8, the command has been changed:

Alter system dump datafile 11 block 9; -- indicates that the dump data file number is the 9th data blocks in column 11.

3. controlf event: dump control file structure

Alter session set events 'immediate trace name controlf level 10'; -- all contents of the dump control file.

4. locks event: the lock information of the dump LCK Process

Alter session set events 'immediate trace name locks level 5 ';

5. redohdr event: dump redo log header information

Alter session set events 'immediate trace name redohdr level 1'; -- indicates the control file entry in the dump redo log header.

Alter session set events 'immediate trace name redohdr level 2'; -- indicates the general file header of the dump redo log.

Alter session set events 'immediate trace name redohdr level 10'; -- indicates the full file header of the dump redo log.

Note: dump of redo logs can use the following statement:

Alter system dump logfile 'logfilename ';

6. loghist event: log history items in the dump Control File

Alter session set events 'immediate trace name loghist level 1'; -- indicates that only the earliest and latest log history items are dumped.

When levelnumber is greater than or equal to 2, it indicates the levelnumber of 2 to the power of log history.

Alter session set events 'immediate trace name loghist level 4'; -- indicates 16 log history items in dump.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.