Sunday, October 21, 2007

How gv$ views are populated?

Today I was reading something very basic about RAC. A thought came into my mind on gv$ views.. From where they are getting data.. The instance to which client connects to query gv$ views can n't however store all instance information.. After a little bit of reading got the answer. It uses a parallel query mechanism with query co-ordinator on the node where client connects and spawaing slave process on other instances to collect respective values...

Wanted to prove this.. (hmm I dont belive without seeing !!!).

1. Loged into rac2 machine.
#ps -ef grep oracle..
observed the last process.
2) Logged into rac1 instance .. issued a query aganist gv$log.

3) Refreshed the ps-ef grep oracle output in rac2 machine..
here comes "ora_pz99_rac2" process. So "pznn" is the parallel query slaves starts on each node to collection required information for a gv$ query and submit it to the co-ordinator running on the node where client connect to .

Hmmm one more proof.. (this time Oracle came to me with proof :)


Instance rac1 open
rac2 nomount;

Query from rac1 on gv$thread.... output says...


SQL> select thread#,status from gv$thread;
select thread#,status from gv$thread
*ERROR at line 1:ORA-12801: error signaled in parallel query server PZ99, instance core1:rac2(2)ORA-01507: database not mounted

But is n't this a bug ? Otherwise it wont allow certain gv$queries when all instances are not open !!!







(gv# views has got an additional column inst_id and these views contains data for all instances)

No comments: