zoukankan      html  css  js  c++  java
  • 如何切换用户到不同用户Session上

    CREATE OR REPLACE PACKAGE BODY TMS.SESSION_TMS
    AS
       PROCEDURE SESSION_TMS (STATUS VARCHAR2)
       IS
          tmpVar           VARCHAR2 (3);
          present_schema   VARCHAR2 (10);
          present_user     VARCHAR2 (10);
          mesg             VARCHAR2 (300);
      BEGIN
          tmpVar := 'OFF';
          present_schema := '';
          present_user := '';
          mesg := '';

          IF SYS_CONTEXT ('USERENV', 'SESSION_USER') = 'TMS_GUEST'
             AND upper(STATUS) = 'ON'
          THEN
             EXECUTE IMMEDIATE ('ALTER SESSION SET CURRENT_SCHEMA=TMS');

             PRESENT_SCHEMA := 'TMS';
             PRESENT_USER := 'TMS_GUEST';
          END IF;
          IF SYS_CONTEXT ('USERENV', 'SESSION_USER') = 'TMS_GUEST'
             AND upper(STATUS) = 'OFF'
          THEN
             EXECUTE IMMEDIATE ('ALTER SESSION SET CURRENT_SCHEMA=TMS_GUEST');

             PRESENT_SCHEMA := 'TMS_GUEST';
             PRESENT_USER := 'TMS_GUEST';
          END IF;

          mesg := ' Your present schema ' || present_schema;
          mesg := mesg || '  User session is ' || present_user;
          DBMS_OUTPUT.put_line (mesg);
       END;
    --SELECT   SYS_CONTEXT ('USERENV', 'CURRENT_SCHEMA'),
    --             SYS_CONTEXT ('USERENV', 'session_user')
    --    INTO   present_schema, present_user
    --  FROM   DUAL;
    END SESSION_TMS;
    /

  • 相关阅读:
    hdp (ambari) 集成hue
    Hive的metastore
    windows 常用cmd命令
    HDFS datanode心跳与运维中的实际案例
    scala drools and map
    hadoop nn 运维一例
    Eclipse 多行注释选择
    JSP SERVLET 基础知识
    记录一次代码错误,elastic search的INDEX需要使用小写字母
    HIVE大数据出现倾斜怎么办
  • 原文地址:https://www.cnblogs.com/tracy/p/2067688.html
Copyright © 2011-2022 走看看