Database Reference
In-Depth Information
A Net service name definition in tnsnames.ora for connecting through the listener defined
in the preceding code section might be as follows:
TEN_IPC.WORLD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = TEN))
)
(CONNECT_DATA =
(SERVICE_NAME = TEN)
)
)
The only difference between connecting with bequeath vs. IPC is that the Net service
name from tnsnames.ora (e.g., TEN_IPC.WORLD ) is inserted in $data_source after DBI:Oracle:
and there is no need to set the environment variable ORACLE_SID , since the value of the param-
eter SERVICE_NAME is taken from the Oracle Net service name definition instead.
use DBI;
my $dbh = DBI->connect("DBI:Oracle:TEN_IPC.WORLD", "ndebes", "secret") or die
"Connect failed: $DBI::errstr";
The Net service name definition might also contain (SID=TEN) instead of (SERVICE_NAME=TEN)
in the section CONNECT_DATA . Use of SERVICE_NAME is recommended, since the service name is
reflected in the view V$SESSION and may be used for tracing the subset of sessions using this
service name with DBMS_MONITOR .
SQL> SELECT sid, service_name, module, action
FROM v$session
WHERE program='perl.exe';
SID SERVICE_NAME MODULE ACTION
---- -------------------- ------------ ------
137 TEN perl.exe
SQL> EXEC dbms_monitor.serv_mod_act_trace_enable('TEN','perl.exe','', true, true);
PL/SQL procedure successfully completed.
Unfortunately, with this approach, the view V$SESSION does not reflect the fact that tracing
has been switched on.
SQL> SELECT sql_trace, sql_trace_waits, sql_trace_binds
FROM v$session
WHERE sid=137;
SQL_TRACE SQL_TRACE_WAITS SQL_TRACE_BINDS
--------- --------------- ---------------
DISABLED FALSE FALSE
When the parameter SID is used in tnsnames.ora , V$SESSION.SERVICE_NAME has the rather
meaningless default setting of SYS$USERS .
Search WWH ::




Custom Search