oci_set_action

(PHP 5 >= 5.3.2, PHP 7, PECL OCI8 >= 1.4.0)

oci_set_actionSets the action name

说锟斤拷

oci_set_action ( resource $connection , string $action_name ) : bool

Sets the action name for Oracle tracing.

The action name is registered with the database when the next 'round-trip' from PHP to the database occurs, typically when an SQL statement is executed.

The action name can subsequently be queried from database administration views such as V$SESSION. It can be used for tracing and monitoring such as with V$SQLAREA and DBMS_MONITOR.SERV_MOD_ACT_STAT_ENABLE.

The value may be retained across persistent connections.

锟斤拷锟斤拷

connection

Oracle 锟斤拷锟接憋拷识锟斤拷锟斤拷 oci_connect()锟斤拷oci_pconnect()锟斤拷锟斤拷 oci_new_connect() 锟斤拷锟截★拷

action_name

User chosen string up to 32 bytes long.

锟斤拷锟斤拷值

锟缴癸拷时锟斤拷锟斤拷 TRUE锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE锟斤拷

锟斤拷锟斤拷

Example #1 Setting the action

<?php

$c 
oci_connect('hr''welcome''localhost/XE');

// Record the action
oci_set_action($c'Friend Lookup');

// Code that causes a round-trip, for example a query:
$s oci_parse($c'select * from dual');
oci_execute($s);
oci_fetch_all($s$res);

sleep(30);

?>
// While the script is running, the administrator can see the actions
// being performed:

sqlplus system/welcome
SQL> select action from v$session;

注锟斤拷

Note: Oracle 锟芥本锟斤拷锟斤拷

锟斤拷 PHP 锟斤拷锟斤拷 Oracle 锟斤拷锟捷匡拷 10g 锟斤拷锟斤拷锟铰版本锟斤拷 锟斤拷展锟斤拷锟斤拷锟斤拷时锟斤拷锟剿猴拷锟斤拷锟斤拷锟矫★拷

Tip

锟斤拷锟斤拷

使锟矫旧帮拷锟� OCI8 锟斤拷 ORACLE 锟斤拷锟捷匡拷 锟斤拷锟斤拷使锟斤拷 Oracle DBMS_APPLICATION_INFO 锟斤拷锟斤拷锟斤拷锟矫客伙拷锟斤拷锟斤拷息锟斤拷锟斤拷锟绞癸拷锟� oci_set_client_info() 锟较碉拷效锟斤拷

Caution

Roundtrip Gotcha

一些 OCI8 锟斤拷锟斤拷锟结导锟斤拷 Roundtrips. 锟斤拷锟斤拷锟捷匡拷锟斤拷说锟斤拷锟斤拷锟矫斤拷锟斤拷锟斤拷锟绞憋拷锟斤拷锟窖拷锟斤拷懿锟斤拷锟斤拷锟絉oundtrips锟斤拷

锟轿硷拷