我正在尝试获取 Oracle 数据库的 ADDM 报告。输出以 .txt 形式的数组形式。我需要以表格行格式显示它。但是,我没有得到想要的输出。
$today = date("His");
$taskname =$username.$today;
$taskquery = "BEGIN DBMS_ADDM.ANALYZE_INST(:tname, :bsnap,:esnap,:instnum);END;";
$stid = oci_parse($conn,$taskquery);
oci_bind_by_name($stid, ":tname", $taskname);
oci_bind_by_name($stid, ":bsnap", $bsnap);
oci_bind_by_name($stid, ":esnap", $esnap);
oci_bind_by_name($stid, ":instnum", $inst);
oci_execute($stid);
$mainquery = "SELECT DBMS_ADDM.GET_REPORT(:tname) from dual";
$stid = oci_parse($conn,$mainquery);
oci_bind_by_name($stid, ":tname", $taskname);
oci_execute($stid);
echo "<table border='1'>\n";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
echo "<tr>\n";
foreach ($row as $item) {
echo " <td>" . $item . "</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
现在这会返回一条错误消息: OCI-Lob 类的对象无法转换为字符串
所以我在 $stid 上做了一个 oci_fetch_all 之后尝试了一个 var_dump,得到了这个:
array (size=1)
'DBMS_ADDM.GET_REPORT(:TNAME)' =>
array (size=1)
0 => string ' ADDM Report for Task...and rest of the report shows here'
我如何回显显示报告的字符串,因为它以正确的格式显示它,我会在 shell 上得到它。这是为了前端 UI 目的。