V$Session Query
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: V$Session Query

  1. #1
    Join Date
    Aug 2001
    Location
    Waterloo, On
    Posts
    547
    I issue
    Select schemaname, username from V$Session;

    Why do I always get at 8 users (without name) logged on to the SYS Schema? Are these some Oracle Background processes?

    My second query is more basic. How can one have more than one user in the same schema? I mean when we create an Oracle user, his schema is automatically created with the same name. So why have two different columns (Scemaname and Username) in the V$Session view?

  2. #2
    Join Date
    Feb 2000
    Posts
    175
    Hi,

    The sessions with no username are background processes. To check look at the 'type' field in the v$session table.

    Are you running on Windows or NT?

    Cheers
    Moff.

  3. #3
    Join Date
    Oct 2000
    Posts
    467
    Hi,
    You are right about the Oracle background processes. the count depends upon the no of Oracle background processes.
    The foll. command gives a count of the no. of Oracle background processes in Unix :-

    ps -ef | grep ora_ | grep -v grep | wc -l

    I'm not sure about the Schemaname and Username - looks pretty much the same. Can anyone throw some light on it ?
    Vinit

  4. #4
    Join Date
    Jan 2001
    Posts
    2,828

    Talking

    Hello

    Those are Oracle processes you need not worry about them.


    regards
    hrishy

  5. #5
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Originally posted by Raminder
    My second query is more basic. How can one have more than one user in the same schema? I mean when we create an Oracle user, his schema is automatically created with the same name. So why have two different columns (Scemaname and Username) in the V$Session view?
    With appropriate privileges user can isue the following command: ALTER SESSION SET current_schema = [some_other_schema];

    I'm not going into details why this might be usefull, but this is exactly the reason why there are two columns in V$SESSION.

    If in the abowe example the connected user is SYSTEM and he isue:

    ALTER SESSION SET current_schema = SCOTT;

    then querying the V$SESSION for his session would return 'SYSTEM' as username and 'SCOTT' as schemaname.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  6. #6
    Join Date
    Aug 2001
    Location
    Waterloo, On
    Posts
    547
    Thanks a lot Jurij. It was indeed a revealation.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width