楼主: biti_rainy

[精华] 关于数据库open的深入探究

[复制链接]
论坛徽章:
60
2007年度最佳版主
日期:2008-04-03 16:46:15现任管理团队成员
日期:2011-05-07 01:45:08双黄蛋
日期:2011-06-15 17:03:34ITPUB十周年纪念徽章
日期:2011-11-01 16:19:412012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
11#
发表于 2004-3-31 18:57 | 只看该作者
[php]
create table tab$                                             /* table table */
( obj#          number not null,                            /* object number */
  /* DO NOT CREATE INDEX ON DATAOBJ#  AS IT WILL BE UPDATED IN A SPACE
   * TRANSACTION DURING TRUNCATE */
  dataobj#      number,                          /* data layer object number */
  ts#           number not null,                        /* tablespace number */
  file#         number not null,               /* segment header file number */
  block#        number not null,              /* segment header block number */
  bobj#         number,                /* base object number (cluster / iot) */
  tab#          number,    /* table number in cluster, NULL if not clustered */
  cols          number not null,                        /* number of columns */
  clucols       number,/* number of clustered columns, NULL if not clustered */
  pctfree$      number not null, /* minimum free space percentage in a block */
  pctused$      number not null, /* minimum used space percentage in a block */
  initrans      number not null,            /* initial number of transaction */
  maxtrans      number not null,            /* maximum number of transaction */
  flags         number not null, /* 0x00     = unmodified since last backup
                                    0x01     = modified since then
                                    0x02     = DML locks restricted to <= SX
                                    0x04     = DML locks <= SX not acquired
                                    0x08     = CACHE
                                    0x10     = table has been analyzed
                                    0x20     = table has no logging
                                    0x40     = 7.3 -> 8.0 data object
                                               migration required
                                    0x0080   = current summary dependency
                                    0x0100   = user-specified stats
                                    0x0200   = global stats
                                    0x0800   = table has security policy
                                    0x020000 = Move Partitioned Rows
                                   0x0400000 = table has sub tables
                                  0x00800000 = row dependencies enabled */
                /* 0x10000000 = this IOT has a  physical rowid mapping table */
                /* 0x20000000 = mapping table of an IOT(with physical rowid) */
  audit$        varchar2("S_OPFL" not null,             /* auditing options */
  rowcnt        number,                                    /* number of rows */
  blkcnt        number,                                  /* number of blocks */
  empcnt        number,                            /* number of empty blocks */
  avgspc        number,       /* average available free space/iot ovfl stats */
  chncnt        number,                            /* number of chained rows */
  avgrln        number,                                /* average row length */
  avgspc_flb    number,       /* avg avail free space of blocks on free list */
  flbcnt        number,                             /* free list block count */
  analyzetime   date,                        /* timestamp when last analyzed */
  samplesize    number,                 /* number of rows sampled by Analyze */
/*
* Legal values for degree, instances:
*     NULL (used to represent 1 on disk/dictionary and implies noparallel), or
*     2 thru EB2MAXVAL-1 (user supplied values), or
*     EB2MAXVAL (implies use default value)
*/
  degree        number,      /* number of parallel query slaves per instance */
  instances     number,        /* number of OPS instances for parallel query */
/* <intcols> => the number of dictionary columns => the number of columns
* that have dictionary meta-data associated with them. This is a superset of
* <usercols> and <kernelcols>.
*    <intcols> = <kernelcols> + <number_of_virtual_columns>
*/
  intcols       number not null,               /* number of internal columns */
/* <kernelcols> => the number of REAL columns (ie) columns that actually
* store data.
*/
  kernelcols    number not null,          /* number of REAL (kernel) columns */
  property      number not null,            /* table properties (bit flags): */
                              /* 0x01 = typed table, 0x02 = has ADT columns, */
                 /* 0x04 = has nested-TABLE columns, 0x08 = has REF columns, */
                      /* 0x10 = has array columns, 0x20 = partitioned table, */
               /* 0x40 = index-only table (IOT), 0x80 = IOT w/ row OVerflow, */
             /* 0x100 = IOT w/ row CLustering, 0x200 = IOT OVeRflow segment, */
               /* 0x400 = clustered table, 0x800 = has internal LOB columns, */
        /* 0x1000 = has primary key-based OID$ column, 0x2000 = nested table */
                    /* 0x4000 = View is Read Only, 0x8000 = has FILE columns */
       /* 0x10000 = obj view's OID is system-gen, 0x20000 = used as AQ table */
           /* 0x40000 = has user-defined lob columns */
                               /* 0x00080000 = table contains unused columns */
                            /* 0x100000 = has an on-commit materialized view */
                             /* 0x200000 = has system-generated column names */
                                      /* 0x00400000 = global temporary table */
                            /* 0x00800000 = session-specific temporary table */
                                        /* 0x08000000 = table is a sub table */
                                        /*   0x20000000 = pdml itl invariant */
                                          /* 0x80000000 = table is external  */
  trigflag      number,   /* first two bytes for trigger flags, the rest for */
                   /* general use, check tflags_kqldtvc in kqld.h for detail */
                                            /* 0x00000001 deferred RPC Queue */
                                                  /* 0x00000002 snapshot log */
                                        /* 0x00000004 updatable snapshot log */
                                             /* 0x00000008 = context trigger */
                                    /* 0x00000010 = synchronous change table */
                                       /* 0x00200000 = table had rowmovement */
                                     /* 0x00400000 = lobs use shared segment */
                                           /* enabled at some point in past  */
  spare1        number,                       /* used to store hakan_kqldtvc */
  spare2        number,         /* committed partition # used by drop column */
  spare3        number,                           /* summary sequence number */
  spare4        varchar2(1000),         /* committed RID used by drop column */
  spare5        varchar2(1000),      /* summary related information on table */
  spare6        date                                  /* flashback timestamp */
)
cluster c_obj#(obj#)
/

[/php]

使用道具 举报

回复
论坛徽章:
60
2007年度最佳版主
日期:2008-04-03 16:46:15现任管理团队成员
日期:2011-05-07 01:45:08双黄蛋
日期:2011-06-15 17:03:34ITPUB十周年纪念徽章
日期:2011-11-01 16:19:412012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
12#
发表于 2004-3-31 19:33 | 只看该作者

Re: Re: 关于数据库open的深入探究

最初由 Yong Huang 发布
[B]

biti_rainy's research worked up my appetite. In case biti knows, (what's biti's real name anyway!), do you know what Oracle really does to the physical database? By that I mean, Oracle apparently did NOT really create the bootstrap$, tab$ and others every time the database is opened. Otherwise, a trace of database shutdown should show corresponding drop of those tables and clusters. I traced it and didn't find those drop statements. It's also hard to believe a potentially huge table tab$ is always recreated whenever the database is opened. So those tables bootstrap$, tab$ etc. "created" at the database open time are already in SYSTEM tablespace. But SGA needs information for the instance to work properly. However, even that is a puzzle to me, because you won't find those create table bootstrap$ statement in library cache (v$sql) and there's no alter system flush shared pool in there either.
[/B]



Yong Huang,

before create tab$ and others objects ,Oracle seems to create SYSTEM tablespace :

create tablespace SYSTEM datafile "D_DBFN"
  "D_DSTG" online
/

but I don't know D_DBFN/D_DSTG 's meaing .

maybe a internal container for tab$ and others ?

Fenng

使用道具 举报

回复
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
13#
发表于 2004-4-1 05:35 | 只看该作者

Re: Re: Re: 关于数据库open的深入探究

最初由 Fenng 发布
[B]
Yong Huang,

before create tab$ and others objects ,Oracle seems to create SYSTEM tablespace :

create tablespace SYSTEM datafile "D_DBFN"
  "D_DSTG" online
/

but I don't know D_DBFN/D_DSTG 's meaing .

maybe a internal container for tab$ and others ?

Fenng [/B]


As I said, these physical objects (including SYSTEM tablespace) are probably not really created at instance startup time. The datafile for SYSTEM tablespace of course exists on the filesystem (or raw partition) when the instance is down. We all know that.

I don't know the meanings of those words either. It would be interesting to find out. First D may be "definition". DBFN sounds like database file name. DSTG sounds like some staging. Some templates inside Oracle?

Yong Huang

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
14#
 楼主| 发表于 2004-4-1 09:21 | 只看该作者
这些物理对象都是已经真实地存在的

而我们所做的“create”仅仅是在 SGA 中 创建这个一个对应的结构,然后好根据表的特征来读取数据

而为了生成 tab$ 等结构,这个结构的  sql 又来自 bootstrap$ ,最开始,oracle只要拥有了 bootstrap$ 的结构信息,在sga中创建了结构,则立即可以去 system  tablespace中获取bootstrap$的内容(而这个create的语句完全可以放在可执行程序或者dll中作为天生的一个蛋),然后逐步完成sga中字典表结构的建立。 当然所有这些过程中并没有真实地创建物理对象。

我没有明确地指出这点,但是,从一开始的描述应该是可以看出这个意思的。
我研究这个过程的目的,就是好奇oracle是怎么找到系统表空间的物理上的数据的,根据已经open的数据库来看是可以根据表方式访问的,那这个表的结构信息又来自哪里?  所以才追述出了上面的内容

使用道具 举报

回复
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
15#
发表于 2004-4-1 13:16 | 只看该作者
最初由 biti_rainy 发布
[B]这些物理对象都是已经真实地存在的

而我们所做的“create”仅仅是在 SGA 中 创建这个一个对应的结构,然后好根据表的特征来读取数据
... [/B]


Can you explain why creating these structures in SGA doesn't leave any trace in library cache or v$sql? Wouldn't any SQLs that had been run leave their information in v$sql or v$sqlarea, unless the shared pool was flushed? I didn't dump library cache. But I imagine a dump file would contain the same info as viewed in v$sql.

Yong Huang

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
16#
 楼主| 发表于 2004-4-1 14:25 | 只看该作者
仅仅是猜测:

1:shared pool 是为了重用,而这些sql不需要重用
2:shared pool 和 通常执行的sql,需要解析,需要相关数据字典信息来解析,而这些sql不需要相关字典信息,也不可能有相关信息。 所以我怀疑这些sql的解析机制就是不一样的。

使用道具 举报

回复
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
17#
发表于 2004-4-1 14:36 | 只看该作者
最初由 biti_rainy 发布
[B]仅仅是猜测:

1:shared pool 是为了重用,而这些sql不需要重用
2:shared pool 和 通常执行的sql,需要解析,需要相关数据字典信息来解析,而这些sql不需要相关字典信息,也不可能有相关信息。 所以我怀疑这些sql的解析机制就是不一样的。 [/B]


Interesting points. I wonder if we can issue any SQLs and at the same time tell Oracle not to cache them. I don't know any way. Anybody familiar with OCI can comment here? The layer below OCI is the undocumented UPI (http://www.oreilly.com/catalog/orinternals/chapter/ch01.html). Maybe at that layer we can.

Yong Huang

使用道具 举报

回复
招聘 : 数据库管理员
论坛徽章:
21
授权会员
日期:2005-10-30 17:05:332012新春纪念徽章
日期:2012-02-13 15:11:362012新春纪念徽章
日期:2012-02-13 15:11:362012新春纪念徽章
日期:2012-02-13 15:11:362012新春纪念徽章
日期:2012-02-13 15:11:36马上有车
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:142012新春纪念徽章
日期:2012-02-13 15:11:36
18#
发表于 2004-9-26 17:17 | 只看该作者
今天发现了一些宝藏!

使用道具 举报

回复
论坛徽章:
3
授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34优秀写手
日期:2013-12-18 09:29:13
19#
发表于 2004-9-26 18:18 | 只看该作者
最初由 grassbell 发布
[B]今天发现了一些宝藏! [/B]


是啊,grassbell版主整理贵版的时候还是有收获啊。
应了一句古话:吃亏是福!

所以我也要学着吃亏,至于如何吃亏,大家很快会知道的。

使用道具 举报

回复
论坛徽章:
113
生肖徽章2007版:羊
日期:2011-10-11 10:20:29生肖徽章2007版:羊
日期:2011-10-11 10:20:29生肖徽章2007版:羊
日期:2011-10-11 10:20:29生肖徽章2007版:羊
日期:2011-10-11 10:20:29生肖徽章:猴
日期:2007-04-10 01:23:40生肖徽章:虎
日期:2011-10-11 10:20:29生肖徽章:羊
日期:2007-08-12 22:22:56生肖徽章:兔
日期:2007-08-15 17:25:14生肖徽章:虎
日期:2011-10-11 10:20:29生肖徽章:虎
日期:2007-09-24 07:24:16
20#
发表于 2004-9-28 09:30 | 只看该作者
看不懂!

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表