<%@ LANGUAGE="VBScript" %> Open Cursors <% If Request("SID")<>"" Then SID=CInt(Request("SID")) Else SID=0 End If Set Connection = Server.CreateObject("ADODB.Connection") Connection.Mode = adModeRead Connection.Open phdb_rd SQLStmt = "select count(*) open_cursors from v$open_cursor" Set RS0 = Connection.Execute(SQLStmt) open_cursors=CInt(RS0("open_cursors")) Set RS0=nothing If SID=0 Then %>

Open Cursors

<% Else %>

Open Cursors for Session <%=SID%>

<% End If %>

There are presently <%=open_cursors%> open cursors out of the maximum of 200

<% SQLStmt = "select sid,user_name,sql_text " SQLStmt = SQLStmt & " from v$open_cursor " If sid<>0 Then SQLStmt = SQLStmt & " where sid= ? " End If SQLStmt = SQLStmt & " order by sid" ' response.write(SQLStmt) Set Cmd = Server.CreateObject("ADODB.Command") Cmd.ActiveConnection = Connection Cmd.CommandText = SQLStmt Cmd.CommandType = 1 If sid<>0 Then Set Param = Cmd.CreateParameter("sid", adInteger, adParamInput) Cmd.Parameters.Append Param Param.Value = sid End If Set RS = Cmd.Execute() nopen=0 Do While Not RS.EOF nopen=nopen+1 %> <% RS.Movenext Loop %>
Cursor Counter Session ID User Name SQL Statement
<%=nopen%> <%=RS("sid")%> <%=RS("user_name")%> <%=RS("sql_text")%>
<% Connection.Close Set Connection=nothing Set RS=nothing %>