Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Raja.

Asked: September 13, 2000 - 12:00 am UTC

Last updated: November 22, 2005 - 10:25 am UTC

Version: 8.1.5

Viewed 1000+ times

You Asked

Dear Tom ,

1. Can you please eloborate ( importance and differences )
of the v$ and gv$ Views ?

2. Why is Oracle maintaining same two views :

v$parameter & v$parameter2

v$system_parameter & v$system_parameter2

Regards
Raja





and Tom said...


v$ are single instance views.
gv$ are multiple instance views (for Oracle Parallel Server)

From the Server Reference:

<quote>
V$ Views

The actual dynamic performance views are identified by the prefix V_$. Public synonyms for these views have the prefix V$. Database administrators and other users should access only the V$ objects, not the V_$ objects. The dynamic performance views are used by Enterprise Manager and Oracle Trace, which is the primary interface for accessing information about system performance. Once the instance is started, the V$ views that read from memory are accessible. Views that read data from disk require that the database be mounted, and some require that the database be open.


GV$ Views

For almost every V$ view described in this chapter, Oracle has a corresponding GV$ (global V$) view. In a parallel server environment, querying a GV$ view retrieves the V$ view information from all qualified instances. In addition to the V$
information, each GV$ view contains an extra column named INST_ID of datatype INTEGER. The INST_ID column displays the instance number from which the associated V$ view information was obtained. The INST_ID column can be used as a filter to retrieve V$ information from a subset of available instances.
</quote>

V$parameter shows "denormalized" views of parameters, eg:


1* select * from v$parameter where num = 240
ops$tkyte@ORA8I.WORLD> /

NUM NAME TYPE
---------- ------------------------------ ----------
VALUE
------------------------------------------------------------
ISDEFAULT ISSES ISSYS_MOD ISMODIFIED ISADJ
--------- ----- --------- ---------- -----
DESCRIPTION
------------------------------------------------------------
240 rollback_segments 2
rbs_01, rbs_02, rbs_03, rbs_04, rbs_05, rbs_06, rbs_07, rbs_
08, rbs_09, rbs_10, rbs_11, rbs_12, rbs_13, rbs_14, rbs_15,
rbs_16, rbs_17, rbs_18, rbs_19, rbs_20, rbs_21, rbs_22, rbs_
23, rbs_24, rbs_25, rbs_26, rbs_27, rbs_28, rbs_29, rbs_30
FALSE FALSE FALSE FALSE FALSE
undo segment list

if we goto v$parameter2, the one line is turned into many rows

ops$tkyte@ORA8I.WORLD> c/ter/ter2
1* select * from v$parameter2 where num = 240
ops$tkyte@ORA8I.WORLD> /

NUM NAME TYPE
---------- ------------------------------ ----------
VALUE
------------------------------------------------------------
ISDEFA ISSES ISSYS_MOD ISMODIFIED ISADJ
------ ----- --------- ---------- -----
DESCRIPTION
------------------------------------------------------------
240 rollback_segments 2
rbs_01
FALSE FALSE FALSE FALSE FALSE
undo segment list

240 rollback_segments 2
rbs_02
FALSE FALSE FALSE FALSE FALSE
.....



Rating

  (7 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Is there any way ?

Ravi, April 04, 2002 - 1:00 am UTC

Hi Tom,

I have a procedure that opens a cursor and loops through it and do some processing. It is taking too long to finish. Can we findout from any of the dynamic views, how many rows the cursor has selected and which row it is currently processing.

Thanks,
Ravi.

Tom Kyte
April 04, 2002 - 11:43 am UTC

You can call dbms_application_info (a supplied package, if you have my book -- i have a chapter on it, if not see the supplied packages guide)

Using that you can

o set client_info, module, action in v$session easily
o use session_longops to do a more detailed progress report.

Sagi, October 02, 2002 - 8:22 am UTC

Hi Tom!

I think you forgot about v$system_parameter.

I saw that the different between V$SYSTEM_PARAMETER and V$SYSTEM_PARAMETER2. You explanation for V$PARAMETER & V$PARAMETER2 stands good here too.

But what is the difference between V$PARAMETER and V$SYSTEM_PARAMETER?

Thanx in advance.

REgards,
Sagi

Tom Kyte
October 02, 2002 - 10:36 am UTC

check out that nifty reference guide I refered to and quoted heaving from.

Amazingly -- it describes each and every single one of these magic v$ view (he says totally tongue in cheek)




dbms_application_info and parallel

David, February 11, 2003 - 10:51 am UTC

Tom,

I'm using dbms_application_info.set_module and I see this when I query from v$session in the module_name column. However, if a process is running in parallel, I don't see the module_name filled in for the parallel sessions. For example, we have 4 cpu's - I see my main session with the module name filled in, but the four sessions spawned off for parallel operations have null in the module_name column. Is there any way to have the module_name filled in for these other four sessions?

Thanks!

Tom Kyte
February 11, 2003 - 4:55 pm UTC

Nope, but you can use v$px_session to see who goes with who so you know the QC/slave relationship

How does Oracle do this ?

Adrian, May 04, 2005 - 4:19 am UTC

Tom,

There's a strange recursive relationship going on between V_$ views and their respective synonyms. An exercise in obfuscation by Oracle no doubt, but I'd be interested to know how this is being done...

SYS@ORA10 as SYSDBA> SELECT name, type, referenced_name, referenced_type FROM dba_dependencies WHERE name = 'V$RESERVED_WORDS';

NAME TYPE REFERENCED_NAME REFERENCED_TYPE
-------------------- ----------------- -------------------- -----------------
V$RESERVED_WORDS SYNONYM V_$RESERVED_WORDS VIEW

SYS@ORA10 as SYSDBA> SELECT name, type, referenced_name, referenced_type FROM dba_dependencies WHERE name = 'V_$RESERVED_WORDS';

NAME TYPE REFERENCED_NAME REFERENCED_TYPE
-------------------- ----------------- -------------------- -----------------
V_$RESERVED_WORDS VIEW V$RESERVED_WORDS VIEW

SYS@ORA10 as SYSDBA> SELECT object_type FROM dba_objects WHERE object_name = 'V$RESERVED_WORDS';

OBJECT_TYPE
-------------------
SYNONYM

SYS@ORA10 as SYSDBA> SELECT text FROM dba_views WHERE view_name = 'V_$RESERVED_WORDS';

TEXT
--------------------------------------------------------------------------------
select "KEYWORD","LENGTH" from v$reserved_words

There's something sneaky going on with the V$ synonyms - the second query against dependencies tells me it's a view...

Regards
Adrian

Tom Kyte
May 04, 2005 - 9:05 am UTC

v$ and x$ views are magic, they are somewhat "burned into" the definition of the database.

just consider them magic and done in a fashion you cannot replicate.

Just like SYS is magic (and not subject to the same rules as you and I.... things work different for SYS)

Just like DBA is magic (that role name is special, things happen just because you are in the DBA role)

some more dollars

Matthias Rogel, May 04, 2005 - 9:42 am UTC

$ strings $ORACLE_HOME/bin/oracle | grep -i reserved_words
GV$RESERVED_WORDS
V$RESERVED_WORDS
select KEYWORD, LENGTH from GV$RESERVED_WORDS where inst_id = USERENV('Instance')


question: if I would use a hex-editor and would replace
all occurrencies of RESERVED_WORDS in $ORACLE_HOME/bin/oracle
by RESERVED_WORMS
would my database still do its job after restart ?

(just for the sake of understanding how magic v$ and x$ views are)

Tom Kyte
May 04, 2005 - 10:15 am UTC

I would not expect it to work correctly, no.

You could have no reasonable expectations that it would work.



What is FLOB ?

Raghu, November 22, 2005 - 8:31 am UTC

Thomas, Greetings to you.
what is FLOB ?
it is available as part of the reserved words under v$reserved_words .
one ACE has posted this question in the forum.
you would be the right person to answer.

Tom Kyte
November 22, 2005 - 8:50 am UTC

it is nothing.

Not really used you just esquive a question

Yoann Mainguy, November 22, 2005 - 9:28 am UTC

You can say you don't want to explain, which we can understand, but we are curious and can also let our mind go and Googelise for it.

Is this explanation actual: </code> http://www.cs.aau.dk/~csj/Papers/Files/2003_breunigLNCS-2520.pdf <code>

Thanks

PS: Anyway your work is fantastic on this site, ...

Tom Kyte
November 22, 2005 - 10:25 am UTC

I'll clarify:

it is nothing -- to you and me it is nothing, it is at best something internal or something not yet implemented.

;)