Oracle 11g Clientid_overwrite Event

Source: Internet
Author: User

A new Clientid_overwrite event has been added to Oracle 11g so that v$session can automatically react to setting the result after executing the set_client_info information for the Dbms_application_info package.

By default, after the Set_client_info procedure is set, the Dbms_session set_identifier procedure is also executed to enable v$session to reflect the result of the setting:

Sql> SELECT * from V$version;

BANNER

--------------------------------------------------------------------------------

Oracle database11genterprise Edition release11.2.0.1.0-64bit Production

Pl/sql Release 11.2.0.1.0-production

CORE 11.2.0.1.0 Production

TNS for Linux:version 11.2.0.1.0-production

Nlsrtl Version 11.2.0.1.0-production

Sql> SELECT SID, serial#, Client_identifier

2 from V$session

3 WHERE SID in (SELECT SID from V$mystat);

SID serial# Client_identifier

---------- ---------- ----------------------------------------------------------------

243 7966

Sql> EXEC Dbms_application_info. Set_client_info (' TEST ')

The PL/SQL process has completed successfully.

Sql> SELECT SID, serial#, Client_identifier

2 from V$session

3 WHERE SID in (SELECT SID from V$mystat);

SID serial# Client_identifier

---------- ---------- ----------------------------------------------------------------

243 7966

Sql> VAR STR VARCHAR2 (4000)

Sql> EXEC Dbms_application_info. Read_client_info (: STR)

The PL/SQL process has completed successfully.

Sql> PRINT STR

Str

This column more highlights: http://www.bianceng.cn/database/Oracle/

--------------------------------------------------------------------------------------

TEST

Sql> EXEC dbms_session. Set_identifier (' TEST ')

The PL/SQL process has completed successfully.

Sql> SELECT SID, serial#, Client_identifier

2 from V$session

3 WHERE SID in (SELECT SID from V$mystat);

SID serial# Client_identifier

---------- ---------- ----------------------------------------------------------------

243 7966 TEST

The client identity set using the Dbms_application_info package can only be obtained through the read_client_info of this package, and if the result you want to set is displayed directly in the V$session view, you may set events Clientid_ OVERWRITE:

Sql> ALTER session SET EVENTS ' Clientid_overwrite ';

The session has changed.

Sql> EXEC Dbms_application_info. Set_client_info (' test_new ')

The PL/SQL process has completed successfully.

Sql> SELECT SID, serial#, Client_identifier

2 from V$session

3 WHERE SID in (SELECT SID from V$mystat);

SID serial# Client_identifier

---------- ---------- ----------------------------------------------------------------

243 7966 Test_new

Cancel this event by using the following statement:

Sql> ALTER session SET the EVENTS ' clientid_overwrite off ';

The session has changed.

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.