oci_set_db_operation

(PHP 7 >= 7.2.14, PHP 7.3.1 > 7.3 PECL OCI8 >= 2.2.0)

oci_set_db_operationSets the database operation

说锟斤拷

oci_set_db_operation ( resource $connection , string $dbop ) : bool

Sets the DBOP for Oracle tracing.

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

The database operation can subsequently be queried from database administration views such as V$SQL_MONITOR.

The oci_set_db_operation() function is available when OCI8 uses Oracle 12 (or later) Client libraries and Oracle Database 12 (or later).

锟斤拷锟斤拷

connection

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

dbop

User chosen string.

锟斤拷锟斤拷值

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

锟斤拷锟斤拷

Example #1 Setting the DBOP

<?php

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

// Record the operation
oci_set_db_operation($c'main query');

// 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 database operations
// being performed:

sqlplus system/welcome
SQL> select dbop_name from v$sql_monitor;

注锟斤拷

Caution

Roundtrip Gotcha

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

锟轿硷拷