ITPub博客

首页 > Linux操作系统 > Linux操作系统 > howto--如何判斷當前session連接DB的方式

howto--如何判斷當前session連接DB的方式

原创 Linux操作系统 作者:vongates 时间:2019-06-17 10:57:07 0 删除 编辑

大家都知道我們的DB可以在專用和共享兩種方式下工作。
當我們的DB工作在共享的模式下時,又有一些操作(如使用RMAN)必需在專用的進程中才能作業。
這時我們可以通過設定tnsnames.ora來實現我們的需求。看下面的例子喲
dedicated ==>專用
shared  ==>共享


To use RMAN with an MTS database:
Net8 configuration varies greatly from system to system. The following procedure illustrates only one method.

This scenario assumes that the following net service name in the tnsnames.ora file connects to the target database using the MTS architecture, where inst1 is a value of the SERVICE_NAMES initialization parameter:

inst1_mts =
(description=
(address=(protocol=tcp)(host=inst1_host)(port1521))
(connect_data=(service_name=inst1)(server=shared))
)

1. Create a net service name in the tnsnames.ora file that connects to the non-shared SID. For example, enter:
inst1_ded =
(description=
(address=(protocol=tcp)(host=inst1_host)(port1521))
(connect_data=(service_name=inst1)(server=dedicated))
)

2. Connect using SQL*Plus using both the MTS and dedicated service names to confirm the mode of each session. For example, to connect to a dedicated session you can issue:
SQL> connect sys/oracle@inst1_ded
Connected.
SQL> SELECT server FROM v$session WHERE sid = (SELECT DISTINCT sid FROM v$mystat);
SERVER
---------
DEDICATED
1 row selected.

To connect to an MTS session, you can issue:
SQL> connect sys/oracle@inst1_mts
Connected.
SQL> SELECT server FROM v$session WHERE sid = (SELECT DISTINCT sid FROM v$mystat);
SERVER
---------
SHARED
1 row selected.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29987/viewspace-51735/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2018-09-11

  • 博文量
    448
  • 访问量
    289956