Sets the database operation

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

Oracle 連線標識,由 oci_connect()oci_pconnect(),或 oci_new_connect() 返回。

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;

註釋

警告

Roundtrip Gotcha

一些 OCI8 函式會導致 Roundtrips. 對數據庫來說當啟用結果快取時,查詢可能不產生 Roundtrips。

參見

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *