Database Reference
In-Depth Information
CHAPTER 20
■ ■ ■
DBMS_SYSTEM
T
he package
DBMS_SYSTEM
is installed by default in Oracle9
i
and subsequent releases. Execute
permission on this package is only available to the user SYS. There are a few references to the
package
DBMS_SYSTEM
in manuals, but it is undocumented in the
Oracle9i Supplied PL/SQL
Packages and Types References
as well as in the
Oracle Database PL/SQL Packages and Types
Reference
of Oracle10
g
Release 2 and Oracle11
g
Release 1.
The package
DBMS_SYSTEM
provides a wide array of useful functionality, such as enabling
SQL trace at all supported levels in any database session, setting events, generating dumps
without using the SQL*Plus command
ORADEBUG
, writing custom entries to the alert log or trace
files, getting environment variable values, and changing parameters in running sessions. Since
the package
DBMS_SUPPORT
is not installed by default,
DBMS_SYSTEM
is an alternative to using
DBMS_SUPPORT
for tracing sessions.
GET_ENV Procedure
This procedure gives read-only access to environment variables of the process servicing a data-
base client. In case you have ever been desperately seeking for a way to ask a DBMS instance
what
ORACLE_HOME
it is running in, look no further. While the machine a DBMS instance is
running on (
V$INSTANCE.HOST_NAME
) as well as the
ORACLE_SID
of the instance (
V$INSTANCE.
INSTANCE_NAME
) are available through the view
V$INSTANCE
, none of the V$ views tell what the
setting of
ORACLE_HOME
is. The procedure
GET_ENV
is not available in Oracle9
i
.
Syntax
DBMS_SYSTEM.GET_ENV(
var IN VARCHAR2,
val OUT VARCHAR2);
Parameters
Parameter
Description
var
Name of an environment variable
val
Value of the environment variable
197