ºìÁªLinuxÃÅ»§
Linux°ïÖú

Êý¾Ý×Öµä

·¢²¼Ê±¼ä:2006-09-17 00:14:27À´Ô´:ºìÁª×÷Õß:ĪÞÈ
Ê×ÏÈ£¬OracleµÄ×Öµä±íºÍÊÓͼ»ù±¾ÉÏ¿ÉÒÔ·ÖΪÈý¸ö²ã´Î¡£
1.X$±í
ÕâÒ»²¿·Ö±íÊÇOracleÊý¾Ý¿âµÄÔËÐлù´¡£¬ÔÚÊý¾Ý¿âÆô¶¯Ê±ÓÉOracleÓ¦ÓóÌÐò¶¯Ì¬´´½¨¡£
2.GV$ºÍV$ÊÓͼ
´ÓOracle8¿ªÊ¼£¬GV$ÊÓͼ¿ªÊ¼±»ÒýÈ룬Æ京ÒåΪGlobal V$.
³ýÁËһЩÌØÀýÒÔÍ⣬ÿ¸öV$ÊÓͼ¶¼ÓÐÒ»¸ö¶ÔÓ¦µÄGV$ÊÓͼ´æÔÚ¡£
GV$ÊÓͼµÄ²úÉúÊÇΪÁËÂú×ãOPS»·¾³µÄÐèÒª£¬ÔÚOPS»·¾³ÖУ¬²éѯGV$ÊÓͼ·µ»ØËùÓÐʵÀýÐÅÏ¢£¬¶øÿ¸öV$ÊÓͼ»ùÓÚGV$ÊÓͼ£¬Ôö¼ÓÁËINST_IDÁн¨Á¢£¬Ö»°üº¬µ±Ç°Á¬½ÓʵÀýÐÅÏ¢¡£
×¢Ò⣬ÿ¸öV$ÊÓͼ¶¼°üº¬ÀàËÆÓï¾ä£º
where inst_id = USERENV('Instance')
ÓÃÓÚÏÞÖÆ·µ»Øµ±Ç°ÊµÀýÐÅÏ¢¡£
ÎÒÃÇ´ÓGV$FIXED_TABLEºÍV$FIXED_TABLE¿ªÊ¼
SQL> select view_definition from v_$fixed_view_definition where view_name='V$FIXED_TABLE';
VIEW_DEFINITION
------------------------------------------------------------------------------------------------------
select NAME , OBJECT_ID , TYPE , TABLE_NUM from GV$FIXED_TABLE where inst_id = USERENV('Instance')
ÕâÀïÎÒÃÇ¿´µ½V$FIXED_TABLE»ùÓÚGV$FIXED_TABLE´´½¨¡£
SQL> select view_definition from v_$fixed_view_definition where view_name='GV$FIXED_TABLE';
VIEW_DEFINITION
--------------------------------------------------------------------------------------------------------
select inst_id,kqftanam, kqftaobj, 'TABLE', indx from x$kqfta
union all
select inst_id,kqfvinam, kqfviobj, 'VIEW', 65537 from x$kqfvi
union all
select inst_id,kqfdtnam, kqfdtobj, 'TABLE', 65537 from x$kqfdt
ÕâÑùÎÒÃÇÕÒµ½ÁËGV$FIXED_TABLEÊÓͼµÄ´´½¨Óï¾ä£¬¸ÃÊÓͼ»ùÓÚX$±í´´½¨¡£

3.GV_$,V_$ÊÓͼºÍV$,GV$ͬÒå´Ê
ÕâЩÊÓͼÊÇͨ¹ýcatalog.ql´´½¨¡£
µ±catalog.sqlÔËÐÐʱ:
create or replace view v_$fixed_table as select * from v$fixed_table;
create or replace public synonym v$fixed_table for v_$fixed_table;
create or replace view gv_$fixed_table as select * from gv$fixed_table;
create or replace public synonym gv$fixed_table for gv_$fixed_table;
ÎÒÃÇ×¢Òâµ½£¬µÚÒ»¸öÊÓͼV_$ºÍGV_$Ê×Ïȱ»´´½¨£¬v_$ºÍgv_$Á½¸öÊÓͼ¡£
È»ºó»ùÓÚV_$ÊÓͼµÄͬÒå´Ê±»´´½¨¡£
ËùÒÔ£¬Êµ¼ÊÉÏͨ³£ÎÒÃÇ·ÃÎʵÄV$ÊÓͼ£¬ÆäʵÊÇÖ¸ÏòV_$ÊÓͼµÄͬÒå´Ê¡£
¶øV_$ÊÓͼÊÇ»ùÓÚÕæÕýµÄV$ÊÓͼ(Õâ¸öÊÓͼÊÇ»ùÓÚX$±í½¨Á¢µÄ)¡£
¶øv$fixed_view_definitionÊÓͼÊÇÎÒÃÇÑо¿Oracle¶ÔÏó¹ØϵµÄÒ»¸öÈë¿Ú£¬×ÐϸÀí½âOracleµÄÊý¾Ý×Öµä»úÖÆ£¬ÓÐÖúÓÚÉîÈëÁ˽âºÍѧϰOracleÊý¾Ý¿âÖ»ÊÇ¡£
ÔÙ½øÒ»²½
1. X$±í
¹ØÓÚX$±í£¬Æä´´½¨ÐÅÏ¢ÎÒÃÇÒ²¿ÉÒÔ´ÓÊý¾Ý×ÖµäÖÐÒ»¿ú¾¿¾¹¡£
Ê×ÏÈÎÒÃÇ¿¼²ìbootstrap$±í£¬¸Ã±íÖмǼÁËÊý¾Ý¿âÆô¶¯µÄ»ù±¾¼°Çý¶¯ÐÅÏ¢¡£
SQL> select * from bootstrap$;
LINE# OBJ# SQL_TEXT
---------- ---------- --------------------------------------------------------------------------------
-1 -1 8.0.0.0.0
0 0 CREATE ROLLBACK SEGMENT SYSTEM STORAGE ( INITIAL 112K NEXT 1024K MINEXTENTS 1 M
8 8 CREATE CLUSTER C_FILE#_BLOCK#("TS#" NUMBER,"SEGFILE#" NUMBER,"SEGBLOCK#" NUMBER)
9 9 CREATE INDEX I_FILE#_BLOCK# ON CLUSTER C_FILE#_BLOCK# PCTFREE 10 INITRANS 2 MAXT
14 14 CREATE TABLE SEG$("FILE#" NUMBER NOT NULL,"BLOCK#" NUMBER NOT NULL,"TYPE#" NUMBE
5 5 CREATE TABLE CLU$("OBJ#" NUMBER NOT NULL,"DATAOBJ#" NUMBER,"TS#" NUMBER NOT NULL
6 6 CREATE CLUSTER C_TS#("TS#" NUMBER) PCTFREE 10 PCTUSED 40 INITRANS 2 MAXTRANS 255
7 7 CREATE INDEX I_TS# ON CLUSTER C_TS# PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE (
....

Õⲿ·ÖÐÅÏ¢£¬ÔÚÊý¾Ý¿âÆô¶¯Ê±×îÏȱ»¼ÓÔØ£¬¸ú×ÙÊý¾Ý¿âµÄÆô¶¯¹ý³Ì£¬ÎÒÃÇ·¢ÏÖÊý¾Ý¿âÆô¶¯µÄµÚÒ»¸ö¶¯×÷¾ÍÊÇ:
create table bootstrap$ ( line# number not null, obj#
number not null, sql_text varchar2(4000) not null) storage (initial
50K objno 56 extents (file 1 block 377))


Õⲿ·Ö´úÂëÊÇдÔÚOracleÓ¦ÓóÌÐòÖеģ¬ÔÚÄÚ´æÖд´½¨ÁËbootstrap$ÒÔºó£¬Oracle¾Í¿ÉÒÔ´Ófile 1,block 377É϶ÁÈ¡ÆäËûÐÅÏ¢£¬´´½¨ÖØÒªµÄÊý¾Ý¿â¶ÔÏó¡£
Õⲿ·ÖÄã¿ÉÒԲο¼biti_rainyµÄÎÄÕ¡£
X$±íÓɴ˽¨Á¢¡£ÕâÒ»²¿·Ö±í¿ÉÒÔ´Óv$fixed_tableÖв鵽£º
SQL> select count(*) from v$fixed_table where name like 'X$%';
COUNT(*)
----------
394

¹²ÓÐ394¸öX$¶ÔÏ󱻼Ǽ¡£
2.GV$ºÍV$ÊÓͼ
X$±í½¨Á¢ÒԺ󣬻ùÓÚX$±íµÄGV$ºÍV$ÊÓͼµÃÒÔ´´½¨¡£
Õⲿ·ÖÊÓͼÎÒÃÇÒ²¿ÉÒÔͨ¹ý²éѯV$FIXED_TABLEµÃµ½¡£
SQL> select count(*) from v$fixed_table where name like 'GV$%';
COUNT(*)
----------
259

ÕâÒ»²¿·Ö¹²259¸ö¶ÔÏó¡£
SQL> select count(*) from v$fixed_table where name like 'V$%';
COUNT(*)
----------
259

ͬÑùÊÇ259¸ö¶ÔÏó¡£
v$fixed_table¹²¼Ç¼ÁË:
394 + 259 + 259 ¹² 912 ¸ö¶ÔÏó¡£
ÎÒÃÇͨ¹ýV$PARAMETERÊÓͼÀ´×·×ÙÒ»ÏÂÊý¾Ý¿âµÄ¼Ü¹¹:
SQL> select view_definition from v$fixed_view_definition a where a.VIEW_NAME='V$PARAMETER';
VIEW_DEFINITION
--------------------------------------------------------------------------------
select NUM , NAME , TYPE , VALUE , ISDEFAULT , ISSES_MODIFIABLE , ISSYS_MODIFIA
BLE , ISMODIFIED , ISADJUSTED , DESCRIPTION, UPDATE_COMMENT from GV$PARAMETER wh
ere inst_id = USERENV('Instance')

ÎÒÃÇ¿´µ½V$PARAMETERÊÇÓÉGV$PARAMETER´´½¨µÄ¡£
SQL> select view_definition from v$fixed_view_definition a where a.VIEW_NAME='GV$PARAMETER';
VIEW_DEFINITION
--------------------------------------------------------------------------------
select x.inst_id,x.indx+1,ksppinm,ksppity,ksppstvl,ksppstdf, decode(bitand(kspp
iflg/256,1),1,'TRUE','FALSE'), decode(bitand(ksppiflg/65536,3),1,'IMMEDIATE',2,
'DEFERRED', 3,'IMMEDIATE','FALSE'), decode(bit
and(ksppstvf,7),1,'MODIFIED',4,'SYSTEM_MOD','FALSE'), decode(bitand(ksppstvf,2)
,2,'TRUE','FALSE'), ksppdesc, ksppstcmnt from x$ksppi x, x$ksppcv y where (x.i
ndx = y.indx) and ((translate(ksppinm,'_','#') not like '#%') or (ksppstdf = 'F
ALSE'))

ÔÚÕâÀïÎÒÃÇ¿´µ½GV$PARAMETERÀ´Ô´ÓÚx$ksppi,x$ksppcvÁ½¸öX$±í¡£ x$ksppi,x$ksppcv »ù±¾ÉÏ°üº¬ËùÓÐÊý¾Ý¿â¿Éµ÷Õû²ÎÊý£¬v$parameterÕ¹ÏÖµÄÊDz»°üº¬"_"¿ªÍ·µÄ²ÎÊý¡£ÒÔ"_"¿ªÍ·µÄ²ÎÊýÎÒÃÇͨ³£³ÆΪÒþº¬²ÎÊý£¬Ò»°ã²»½¨ÒéÐ޸ģ¬µ«ºÜ¶àÒòΪ¹¦ÄÜÇ¿´ó¾­³£Ê¹Óöø¹ãΪÈËÖª¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 1 ÌõÆÀÂÛ

  1. daveli2002 ÓÚ 2006-09-17 10:42:56·¢±í:

    Õâ¸öÒ²²»´íѽ,