array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'function.oci-set-db-operation.php', 1 => 'oci_set_db_operation', 2 => 'Sets the database operation', ), 'up' => array ( 0 => 'ref.oci8.php', 1 => 'OCI8 関数', ), 'prev' => array ( 0 => 'function.oci-set-client-info.php', 1 => 'oci_set_client_info', ), 'next' => array ( 0 => 'function.oci-set-edition.php', 1 => 'oci_set_edition', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/oci8/functions/oci-set-db-operation.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

oci_set_db_operation

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

oci_set_db_operationSets the database operation

説明

oci_set_db_operation(resource $connection, string $action): 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

oci_connect()oci_pconnect() あるいは oci_new_connect() が返す Oracle 接続 ID。

action

User chosen string.

戻り値

成功した場合に true を、失敗した場合に false を返します。

例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;

注意

警告

データベースとのやりとりに関するメモ

OCI8 関数の中には、データベースとのやりとりを伴わないものもあります。 たとえば、結果のキャッシングが有効になっている場合、 クエリを実行してもデータベースとのやりとりを行わない可能性があります。

参考