« 2006年10月 | (回到Blog入口) | 2006年12月 »

2006年11月 归档

2006年11月28日

美国的医疗保险制度(转)

首先我们来解释一下美国的医疗保险制度。美国的医疗保险,分为公私两大块。大部分的美国人参加私立医疗保险。公司的雇员一般可以从几百家医疗保险公司当中,选择一家符合自己需要的保险公司购买医疗保险。

*雇主雇员分担*

由于美国医疗保险的费用非常昂贵,一般的做法是公司负担百分之八十到九十,个人负担百分之十到二十 。如果公司效益好,比如在网络经济红火的时代,很多高科技公司百分之百地负担雇员及其家属的医疗保险费用。

美国的医疗保险计划分个人和全家两种。如果你是单身,那就只需要购买个人医疗保险计划。如果你有家室,那就可以买家庭保险计划,每个月交纳的费用也相应多一些。一人购买,涵盖全家,包括配偶和未成年子女。

*保险费*

交纳医疗保险费一般占收入的多少呢?以美国首都华盛顿为例,根据2005年美国人口统计局公布的数字,美国大华府都市区家庭年收入的中线是89300美元,每个月中等家庭平均收入为7741元。医疗保险费一般由所在单位承担百分之80,个人负担百分之20,大概每个家庭平均每个月要从工资单中扣除120美元左右用于医疗保险,医疗保险的费用占家庭收入的百分之1.5。

*穷人老人*

从克林顿时代开始,美国医疗保健制度改革的话题此起彼伏,一直没有间断过。其中一个很重要的焦点就是由于医疗保险费用昂贵,很多美国人买不起保险。听众朋友们一定会问,低收入的美国人,或者退休的老年人,他们的医疗保险是怎么安排的呢?

低收入和老年人这两部分人通过参加政府的医疗福利计划而获得医疗保险。根据“全美亚太裔耆老中心”的介绍,国家医疗保健福利计划分为两种:一种是给老年人提供的,称为“老年医疗保险”(Medicare);另一种是为低收入的美国人提供的,称之为“医疗辅助保险”(Medicaid)。

先让我们介绍一下“老年医疗保险”的情况。申请老年医疗保险首先有年龄的限制:年满65岁才符合资格申请联邦老年医疗保险(Medicare)。参加这个计划不受收入和资产方面的限制。也就是说,百万富翁和工薪阶层的普通退休职工在参加联邦老年医疗保险计划方面是一视同仁的,而且这一计划一旦申请通过,一般享受终身。

另一种专门给低收入家庭和个人提供的医疗保健计划由州政府负责,这种计划称为“医疗辅助保险”(Medicaid)。申请这种保险有一定的限制。

据纽约出版的中文报纸世界日报报道:以纽约州为例,单身职工每个月收入必须低于692美元,(相当于5536元人民币),资产在4150美元之下,才有资格申请政府医疗补助计划。不过这里的资产不包括汽车和住房,仅仅指各种银行存款的账户加起来的数字不得超过4千多美元。

换句话说,申请政府提供的“医疗辅助保险”(Medicaid),只要每个月的工资不够高,而且银行里面没有存很多钱,就可以申请医疗保险,对你拥有一部什么样的汽车和拥有什么样的房产并没有任何限制。

*急诊救助 无分贫富*

另外,我们还要介绍一下美国的急诊室。在美国看急诊,只要打一个电话,救护车就会呼啸而至,然后由急救人员把病人用救护车拉到急诊室抢救。

美国的医院奉行救死扶伤的原则,不论发生什么情况,先救人要紧。即使被拉进急诊室的是一名没有任何收入,没有任何身份的非法移民,医院急诊室的医疗和护理人员也不得追问病人的移民身分,也不会向移民局打报告,透露申请者的移民身分。美国国土安全部的相关人员也无权向医疗单位调阅求诊人的医疗和个人资料。

根据联邦 EMTALA 法的规定,任何医院的急诊室都不能因为无法支付医药费或非法移民身分而把需要就医的病人伤患送走,或拒绝提供医药救助。

另外,据有关专家的介绍,非法移民期间或者没有合法身分期间所累积的医疗费用,并不需要在以后归化成美国公民或取得合法身分时偿还;除非是用诈欺方式取得医疗补助。

*代价高 困难大*

不过,美国的急诊护理业近几年来也出现一些问题。美国华盛顿邮报六月刊登一篇呼吁改善美国急诊的文章。文章中说,美国的急诊室面临严重亏损的危险。约14%的急诊室病人没有医疗保险,约16%的病人有联邦和州府政府为穷人提供的医疗保险,约21%的病人有为老人提供的联邦医疗保险。半数以上医院声称,为这些病人提供急诊护理会导致亏损。

美国西海岸旧金山湾区的医疗卫生以及保险方面的专家孙晓光博士说,很多情况下,私人医院不堪重负,最后破产倒闭。

华盛顿邮报的文章指出,美国急诊护理业的问题除了经济方面的压力外,还有急诊室床位少病人多的矛盾,医院(尤其是农村地区的医院)常常找不到愿意去急诊室工作的专门医师,急诊室的压力和嘈杂的环境造成医生误诊等问题。有关专家呼吁成立一个新的联邦机构来管理急诊护理系统。

*揭示危机以消除危机*

美国媒体一贯以立法,司法,行政之外的第四权力机构自称,认为大众传播媒体的社会责任就是监督政府,媒体在危机到来之前喊狼来了更是天经地义的做法。

例如,众所周知,美国的教育体系,特别是高等教育,是世界各地莘莘学子深造的首选,然而美国媒体和教育界经常疾呼教育危机,籍危机感保持领先的地位。华盛顿邮报的这篇文章,也有异曲同工之处。

关于教育的一些报道

*民国时代已开始 民初教师地位高*

其实义务教育的概念,在中国已经不是什么新闻了。早在1901年,当时的大清就意识到教育的重要性,并且指派从英国任大使回来的张百熙为管学大臣。和当时的很多知识分子一样,张百熙在英国任大使期间,一直在观察研究英国为何能够船坚炮利,并且号称是日不落帝国的原因。他得出的结论是:一定要振兴教育。

1904年,根据张百熙的计划,清政府颁定《奏定学堂章程》,规定:“儿童自6岁起受蒙学4年,10岁入寻常小学修业3年。埃各处学堂一律办齐后,无论何色人等皆应受此7年教育,然后听其任为各项事业。”中国自此开始有了义务教育的概念。

孙中山推翻满清成立了中华民国后,立即强调在中国实行免费义务教育。1912年9月29日,中华民国教育部公布《学校征收学费规程》16条,明确规定:“初小、师范、高等师范免收学费”。当时很多家境贫穷的学生,免费上师范就成了他们接受教育的唯一途径。中国前国家领袖毛泽东就是在湖南师范学校毕业的。

和今天中国中小学教师的待遇和地位相比,民国初年教师的地位是相当高的,这也说明当时的中华民国政府对教育的重视。据中国教育方面的专家介绍说,当时普通警察一个月两块银洋,县长一个月20块银洋。而国小校长老师一个月可以拿到40块银洋,民国时期小学教师的地位和待遇要远远超过县长。

即使是在抗战期间的兵荒马乱的年月,当时的国民政府在财政状态极为艰苦的情况下,仍然坚持免费教育的做法。1939年7月28日,当时的国民政府教育部公布《师范学校毕业生服务规程》21条。其中规定:“6岁至12岁之学龄儿童,一律受基本教育,免纳学费。”“已逾学龄未受基本教育之人民,一律受补习教育,免纳学费。”

*七年普及成泡影 义务教育终虚话*

建国后,一度对义务教育非常重视。据教育专家提供的数字,1952年,全国学龄儿童入学率已达49.2%,小学毕业生升学率高达96%。
*学费猛涨 负担如山*

中国老百姓形象地把教育危机称作是“上不起学,看不起病,买不起房”这新三座大山之一。

据中国媒体透露,如今,每年全国义务教育阶段的杂费收入已达上百亿元之巨!中共中央求是杂志社主管的《小康》杂志社七月四号报道说:中国近20年期间,大学费用已经上涨了25倍。学费涨幅远远超过了国民收入增长速度。从支付能力看,中国现阶段的大学支出是世界大学教育支付最高的国家的3倍以上。

小康杂志问道:近20年,什么价格在中国上涨的速度最快?答案是:大学费用。

20年前,在中国上大学的学费大约为每年200元,现在已经上涨至每年平均5000元。近20年时间里,上涨了25倍。而1994年至今的10余年间,中国国民人均收入却增长不到4倍,学费涨幅远远超过了国民收入增长速度。

2006年全国两会期间,全国政协委员孙继业也提出,高等教育收费过高,已经超出了普通家庭的承受能力。

中国的《小康》杂志调查数据显示,支持一个大学生的教育花费,在农村要占到家庭收入的将近三分之一,为32.6%,而对城市家庭来说,养活一个大学生的花费,要占家庭收入的四分之一,为25.9%。

*美国严控公立学校学费*

美国的高等教育傲视全球,然而在这个世界上最发达的国家,大学的学费,特别是州立大学等公立学校的学费,受到严格的控制。每个州的州立大学,都对居住在本州,并且在本州纳税的居民提供子女上大学的优惠收费标准。据统计数字表明,在美国,大学学费平均仅占人均收入的六分之一左右。

*中国高校扩招大跃进*

由于中国教育改革产业化和市场化,导致中国大学生的学费高昂,各个大学最近几年都想方设法,巧立名目,多收学生,特别是多招自费生,为学校创收。

中国大学的扩大招生,受到中国媒体的盛赞。《小康》杂志报道说:

“1999年,我国高校开始大举进行扩招。此后,高校扩招每年都以40万人以上的速度递增。7年时间里,我国高校在校生总规模从1998年的643万人,增加到2005年的2300多万人,翻了近三番,此增长速度居全世界第一。中国高等教育规模的扩张,只用4年时间就走过了美国27年历程。”

*毕业即失业者的比例*

而目前旅居美国的中国教育专家何清涟认为,这种所谓的扩招,成为国家对中国普通平民百姓的又一次剥夺和清洗。农民倾家荡产培养出一个高价大学生,而毕业之后竟然一半以上的人找不到工作,成为中国高等教育改革的又一个弊端。

根据何清涟女士的研究,中国从2004年开始,在参加高考的考生人数723万人当中,农村考生人数首次超过城镇,占考生人数达55%。然而,这些跳入龙门的大学生毕业之后,面临的却是一个非常严峻的就业市场。

何清涟女士指出,中国2003年高校毕业生一次就业率低于50%。

大学生就业难的问题严重到什么样的程度了呢?根据中国媒体的报道,中国政府有关部门反复强调要将城市下岗工人、大学毕业生与农村过剩劳动力的就业当作最重要的政府工作来抓。大学毕业生已经成为中国就业难的三大社会群体之一,大学生毕业就业难的局面,由此可见一斑。

*国家教育投入少 校园贫困学生多*

何清涟女士还通过研究,用数字说话,揭露了中国教育的畸形现状。何清涟女士说,首先中国公共教育经费居世界上最低。据中国政府公布的数字,二OOO年,中国的教育经费占全国GDP的2.3%,而联合国教科文组织年鉴提供的资料仅为2%),比一九八O年的2.5%下降了0.2个百分点,低于世界各国5.1%的平均水平。

何清涟女士提请注意的另一个数字是中国在校贫困大学生比例偏高。近年来,由于教育产业化政策的推行,不少家庭无法支付日益昂贵的学费,贫困大学生数量增大,成了高等教育中一道让人感到悲哀的风景线。据调查,在北京大学、清华、复旦这类一流学校中,贫困大学生(每月伙食费150元人民币)比例为15%;而在普通高校中,则高达30%以上。这些学生因长期吃不饱饭而营养严重不良。在就业机会稀缺的中国,不少大学生被迫卖血、求乞,女大学生被迫卖淫。

作家何建明经过两年多调查,写了一本反映贫困大学生群体的报告文学《落泪是金》。另外一位名叫陈杰人的记者发表了一篇《女大学生卖淫调查》,引起刊登该报导的《青年参考》杂志主编被撤职。

*高科技人才不足 知识型劳力过剩*

然而,在中国却出现了一个奇怪的现象,大学本科毕业生的就业率越低,上大学的费用越来越高,而愿意在大学本科教育上大量投资的人反而越多,没有任何出路的农家子弟只有通过参加高考才能摆脱贫困的境地,反过来,这又刺激了大学的持续膨胀,导致大学毕业生的就业率进一步下降。从而造成一方面中国目前还有大量文盲,迫切需要各种高科技人才,而另一方面,中国政府又承认,“知识型劳力过剩”现象在中国将会长期存在。中国教育资源的配置不当,投资效率低下,受过相当教育的知识型劳动者处在闲置和半闲置状态中,人力资源严重浪费。

--------

2006年11月26日

也说墨攻

墨攻,编剧/导演 张之亮

主演:刘德华,王志文,安圣基(韩国)

昨天想看电影,查了下各个电影院的电影排期,没有想看的《三峡好人》 。别的电影都没有什么兴趣。

早上表哥打电话问要不要看,他有票。于是出门赶10:30的点。

看下来感觉就是一个中国版的“大片” ,所谓大片,现在的感觉就是没有思想,或者想表达什么思想但是因为语无伦次而让观众不知所云,比如《英雄》。

稍微有点感觉的是 安圣基演的将军的角色比较有光彩。

至于故事情节,对白都是普普通通,连bug也是普普通通。

比如刘德华里面提到的因果,在战国时期,佛教还没有到中国,何来因果一词?

攻入梁城的赵军,被不知道怎么来的地下水和几辆百姓推来的烧着草的车包围拿下。

那个时候有老外吗?还是个奴隶。

莫明其妙

一个词,不推荐看

--------

2006年11月25日

持斋一周

上周的今天开始持斋,虽然开始前试着持了几天,但是吃饭的时候,还是遇到一些麻烦:素食很少或者几乎没有。

所以这几天对素食的定义一再宽松,鸡蛋是不是素食存在有争议,我觉得现在的鸡蛋和历史上的都不一样:历史上不会有现在社会这样大规模养殖的方式,现在的方式导致我们买到的鸡蛋(尤其是比较便宜的),都应该是没有受精的。 我觉得吃它们,应该不算杀生。

对一些菜,比如芹菜,韭菜,葱,蒜。葱很难不吃,因为很多时候作为调料了,蒜,韭菜,芹菜可以不主动吃。不过我还是只把蒜列为不吃,别的还不是很严格。

这样下来一周,除了和老婆一起吃饭时点菜需要注意外,别的都挺好。因为中午不吃大荤菜,相对吃的好像少了一些,下午比较容易饿,有时吃了一些萨琪玛。

今天早上称体重,空腹已经67公斤了。长了1斤。我和老婆都分析是萨琪玛的原因。

--------

2006年11月23日

differences between global partitioned index and local partitioned index

You Asked (Jump to Tom's latest followup)

Hi Tom, please explain the differences between global partitioned index and
local partitioned index.

Thanks! 
and we said...

<quote src=expert one on one Oracle>
Partitioning Indexes
Indexes, like tables, may be partitioned. There are two possible methods to
partition indexes. You may either:

    Equipartition the index with the table – Also known as a local
index. For every table partition, there will be an index partition that indexes
just that table partition. All of the entries in a given index partition point
to a single table partition and all of the rows in a single table partition are
represented in a single index partition.
    Partition the index by range – Also known as a global index. Here
the index is partitioned by range, and a single index partition may point to any
(and all) table partitions.

In the locally partitioned index, the index entries in a given partition, point
into exactly one table partition. The globally partitioned index diagram
however, shows that the index entries in a global index may point into any or
all of the table partitions. Also, note that the number of index partitions may
in fact be different than the number of table partitions.

Since global indexes may be partitioned by range only, you must use local
indexes if you wish to have a hash or composite partitioned index. The local
index will be partitioned using the same scheme as the underlying table.

</quote>

--------

2006年11月22日

现代企业职位新解(转贴)

所谓社会百态

现代企业职位新解:

总是在裁人,简称总裁;

老是板着脸,所以称老板;

总想监视人,所以叫总监;

经常没道理,就叫经理;

让领导秘密舒服,称为秘书。


--------

参加ISA巡展

昨天有幸参加了ISA优化运营信息中心巡回展。
ISA: Intanium Solutions Alliance 安腾解决方案联盟

包括成员:
BULL, Fujitsu, Fujitsu Siemens Computers, Hitachi, HP, Intel, NEC, SGI, Unisys.
都是硬件厂商。

这里面有些是以前大名鼎鼎的,现在没落的,比如SGI. BULL 第一次听说;Fujitsu Siemens Computers是富士通和西门子在德国的合资公司;

几种芯片架构:
RISC: Reduced Instruction Set Computing 精简指令计算, 比如IBM的 Power芯片,Sun的sparc芯片
CISC: Complex Instruction Set Computer 复杂指令计算,比如Intel, AMD的X86 ,Xeon.
IA-64 : EPIC: Explicitly Parallel Instruction Computers 精确并行计算机, 不兼容X86的应用,只有安腾芯片。
X86-64 :(AMD64 / EM64T)兼容X86的应用

安腾的优势: 多家硬件,软件厂商支持,可以运行Windows, Linux, HP-UX等。安腾的解决方案是开放的。不会把用户锁在一家硬件厂商,比如如果觉得HP的服务器不好,可以换富士通的,而应用不用修改。比较RISC各个硬件厂商不通的RISC架构,导致被硬件厂商绑架,厂商要什么价格就是什么价格,没有选择的余地。

其中,SGI是一家mainframe 技术很强的公司。他们的服务器可以最多配置1024个core,2T内存,注意,不是cluster,是一个OS. 一个典型的应用是可以把数据都放在内存里面, 比如Oracle的TimesTen内存数据库,放在内存里面可以达到一般的DBMS不能相象的速度。TOP500里面SGI最前面的是第八

BULL公司是一家法国的IT公司,历史上曾经很强,比如IC卡是BULL发明的。现在top500 超级计算里面,第七名是BULL的。

安腾的劣势:不兼容X86的软件,很多C/C++/Fortuan应用在移植时要重新编译。

分析:随着Linux的发展,在x86上的服务器已经逐步成为主流,在x86 linux上安装oracle成为很多中小企业少花钱,多办事的解决方案。在高端,如果安腾解决方案能逐步成为主流,那么Linux在服务器的前途不可限量。

附:top500中,linux最多,达到75.2%

Operating system Family
Operating system Family Count Share % Rmax Sum (GF) Rpeak Sum (GF) Processor Sum
Linux 376 75.20 % 2014910 3195766 516189
Unix 86 17.20 % 559636 807423 142104
BSD Based 3 0.60 % 47697 53248 5888
Mixed 32 6.40 % 872226 1104103 350484
Mac OS 3 0.60 % 32989 53008 6296
Totals 500 100% 3527458.35 5213548.18 1020961

附录:
















64位技术


 
 







 
    这里的64位技术是相对于32位而言的,这个位数指的是CPU GPRs(General-Purpose Registers,通用寄存器)的数据宽度为64位,64位指令集就是运行64位数据的指令,也就是说处理器一次可以运行64bit数据。64bit处理器并非现在才有的,在高端的RISC(Reduced Instruction Set Computing,精简指令集计算机)很早就有64bit处理器了,比如SUN公司的UltraSparc Ⅲ、IBM公司的POWER5、HP公司的Alpha等。

    64bit计算主要有两大优点:可以进行更大范围的整数运算;可以支持更大的内存。不能因为数字上的变化,而简单的认为64bit处理器的性能是32bit处理器性能的两倍。实际上在32bit应用下,32bit处理器的性能甚至会更强,即使是64bit处理器,目前情况下也是在32bit应用下性能更强。所以要认清64bit处理器的优势,但不可迷信64bit。

    要实现真正意义上的64位计算,光有64位的处理器是不行的,还必须得有64位的操作系统以及64位的应用软件才行,三者缺一不可,缺少其中任何一种要素都是无法实现64位计算的。目前,在64位处理器方面,Intel和AMD两大处理器厂商都发布了多个系列多种规格的64位处理器;而在操作系统和应用软件方面,目前的情况不容乐观。因为真正适合于个人使用的64位操作系统现在就只有Windows XP X64,而Windows XP X64本身也只是一个过渡性质的64位操作系统,在Windows Vista发布以后就将被淘汰,而且Windows XP X64本身也不太完善,易用性不高,一个明显的例子就是各种硬件设备的驱动程序很不完善,而且现在64位的应用软件还基本上没有,确实硬件厂商和软件厂商也不愿意去为一个过渡性质的操作系统编写驱动程序和应用软件。所以要想实现真正的64位计算,恐怕还得等到Windows Vista普及一段时间之后才行。

    目前主流CPU使用的64位技术主要有AMD公司的AMD64位技术、Intel公司的EM64T技术、和Intel公司的IA-64技术。其中IA-64是Intel独立开发,不兼容现在的传统的32位计算机,仅用于Itanium(安腾)以及后续产品Itanium 2,一般用户不会涉及到,因此这里仅对AMD64位技术和Intel的EM64T技术做一下简单介绍。


  • AMD64位技术


    AMD64的位技术是在原始32位X86指令集的基础上加入了X86-64扩展64位X86指令集,使这款芯片在硬件上兼容原来的32位X86软件,并同时支持X86-64的扩展64位计算,使得这款芯片成为真正的64位X86芯片。这是一个真正的64位的标准,X86-64具有64位的寻址能力。

    X86-64新增的几组CPU寄存器将提供更快的执行效率。寄存器是CPU内部用来创建和储存CPU运算结果和其它运算结果的地方。标准的32-bit x86架构包括8个通用寄存器(GPR),AMD在X86-64中又增加了8组(R8-R9),将寄存器的数目提高到了16组。X86-64寄存器默认位64-bit。还增加了8组128-bit XMM寄存器(也叫SSE寄存器,XMM8-XMM15),将能给单指令多数据流技术(SIMD)运算提供更多的空间,这些128位的寄存器将提供在矢量和标量计算模式下进行128位双精度处理,为3D建模、矢量分析和虚拟现实的实现提供了硬件基础。通过提供了更多的寄存器,按照X86-64标准生产的CPU可以更有效的处理数据,可以在一个时钟周期中传输更多的信息。


  • EM64T技术


    Intel官方是给EM64T这样定义的:EM64T全称Extended Memory 64 Technology,即扩展64bit内存技术。EM64T是Intel IA-32架构的扩展,即IA-32e(Intel Architectur-32 extension)。IA-32处理器通过附加EM64T技术,便可在兼容IA-32软件的情况下,允许软件利用更多的内存地址空间,并且允许软件进行32 bit线性地址写入。EM64T特别强调的是对32 bit和64 bit的兼容性。Intel为新核心增加了8个64 bit GPRs(R8-R15),并且把原有GRPs全部扩展为64 bit,如前文所述这样可以提高整数运算能力。增加8个128bit SSE寄存器(XMM8-XMM15),是为了增强多媒体性能,包括对SSE、SSE2和SSE3的支持。

    Intel为支持EM64T技术的处理器设计了两大模式:传统IA-32模式(legacy IA-32 mode)和IA-32e扩展模式(IA-32e mode)。在支持EM64T技术的处理器内有一个称之为扩展功能激活寄存器(extended feature enable register,IA32_EFER)的部件,其中的Bit10控制着EM64T是否激活。Bit10被称作IA-32e模式有效(IA-32e mode active)或长模式有效(long mode active,LMA)。当LMA=0时,处理器便作为一颗标准的32 bit(IA32)处理器运行在传统IA-32模式;当LMA=1时,EM64T便被激活,处理器会运行在IA-32e扩展模式下。

    目前AMD方面支持64位技术的CPU有Athlon 64系列、Athlon FX系列和Opteron系列。Intel方面支持64位技术的CPU有使用Nocona核心的Xeon系列、使用Prescott 2M核心的Pentium 4 6系列和使用Prescott 2M核心的P4 EE系列。



 

--------

2006年11月20日

持21天戒

从2006.11.18号(农历9月28)开始。

--------

2006年11月17日

转贴一个幽默的回帖

原帖子:
http://www.itpub.net/663021,3.html

1:你最擅长的是oracle哪部分?

shutdown immediate;


2:喜欢oracle吗?喜欢上论坛吗?或者偏好oracle的哪一部分?

n/a? n/a?我不知道oracle有没有下半部分。


3:随意说说你觉得oracle最有意思的部分或者最困难的部分

oracle最有意思的部分就是oracle给我提示:Please contract your database administrator ...
TNND,我就是database administrator !!!


4:为何要选择做DBA呢?

当时太小,不懂事,以为DBA就是NBA...

--------

查lock的信息

有时因为DML语句没有及时commit,导致其它session等待其占用的锁,引起hang.

引用:
http://www.itpub.net/244694.html
http://www.builder.com.cn/developer/database/story/0,3800066906,39451598-1,00.htm

1.找到等待的session

select /*+ NO_MERGE(a) NO_MERGE(b) NO_MERGE(c) */ 'Wait' "Status", a.username, a.machine, a.sid, a.serial#, a.last_call_et "Seconds", b.id1, c.sql_text "SQL"
from v$session a, v$lock b, v$sqltext c
where a.username is not null
and a.lockwait = b.kaddr
and c.hash_value =a.sql_hash_value
union
select /*+ NO_MERGE(a) NO_MERGE(b) NO_MERGE(c) */ 'Lock' "Status", a.username, a.machine, a.sid, a.serial#, a.last_call_et "Seconds", b.id1, c.sql_text "SQL"
from v$session a, v$lock b, v$sqltext c
where b.id1 in
(select /*+ NO_MERGE(d) NO_MERGE(e) */ distinct e.id1
from v$session d, v$lock e
where d.lockwait = e.kaddr)
and a.username is not null
and a.sid = b.sid
and b.request=0
and c.hash_value =a.sql_hash_value;

2.取出session等待的信息

select row_wait_obj#,row_wait_file#,row_wait_block#,row_wait_row# from v$session where sid = &sid;

3.取出等待的对象,所在的表空间

select owner, segment_name, segment_type, tablespace_name from dba_extents
where file_id = &fileid_in
and &blockid_in between block_id and block_id + blocks - 1

但是还不能查到引起持有资源的那个sql?


check-lock.txt

其它:

asktom上tom对lock的一个答复

You Asked (Jump to Tom's latest followup)

Hi Tom,


Here are the few questions on Locking.

1)How do I use v$lock to figure out lock details ? Details like
whos has locked,on which table,who else is waiting, and what type
of locking (shared or exlusive ?), since when it is locked.

2)Why and when exclusive/shared locks are used ? Could you give me
example please ?

Thanks for the answer, I understand better.

3)Could you tell me significance of v$mystat and v$locked_object ?

Thank you .

4) Do we have page level locking in Oracle ?

Thank you


Thanks in advance,

Gururaj


and we said...

1) Here is a small example showing how this happens. We will use three V$ tables
in order to see how this works; V$TRANSACTION, V$SESSION, and V$LOCK.
V$TRANSACTION contains an entry for every active transaction. V$LOCK contains an
entry for all locks held as well as locks being waited on. V$SESSION shows us
the sessions logged in. We'll start by starting a transaction in one session and
looking at the state of the system at that point:

tkyte@TKYTE816> update dept set deptno = deptno+10;
4 rows updated.

tkyte@TKYTE816> select username,
2 v$lock.sid,
3 trunc(id1/power(2,16)) rbs,
4 bitand(id1,to_number('ffff','xxxx'))+0 slot,
5 id2 seq,
6 lmode,
7 request
8 from v$lock, v$session
9 where v$lock.type = 'TX'
10 and v$lock.sid = v$session.sid
11 and v$session.username = USER
12 /

USERNAME SID RBS SLOT SEQ LMODE REQUEST
-------- ---------- ---------- ---------- ---------- ---------- ----------
TKYTE 8 2 46 160 6 0

tkyte@TKYTE816> select XIDUSN, XIDSLOT, XIDSQN
2 from v$transaction
3 /

XIDUSN XIDSLOT XIDSQN
---------- ---------- ----------
2 46 160

The interesting things to note here are:

ć The LMODE is 6 in the V$LOCK table and the request is 0. If you refer to the
definition of the V$LOCK table in the Oracle Server Reference, you will find
that LMODE=6 is an exclusive lock. A value of 0 in the request means we are not
making a request ¡V we have the lock.
ć There is only one row in this table. This V$LOCK table is more of a queuing
table than a lock table. Many people expect there would be four rows in V$LOCK
since we have four rows locked. What you must remember however is that Oracle
does not store a master list of every row locked anywhere. To find out if a row
is locked, we must go to that row.
ć I took the ID1 and ID2 columns, and performed a bit of bit manipulation on
them. Oracle needed to save three 16bit numbers, but only had two columns in
order to do it. So, the first column ID1 holds two of these numbers. By dividing
by 2^16 with trunc(id1/power(2,16)) rbs and by masking out the high bits with
bitand(id1,to_number('ffff','xxxx'))+0 slot, I am able to get the two numbers
that are hiding in that one number back out.
ć The RBS, SLOT, and SEQ values match the V$TRANSACTION information. This is my
transaction ID.

Now I'll start another session using the same user name, update some rows in
EMP, and then try to update DEPT:

tkyte@TKYTE816> update emp set ename = upper(ename);
14 rows updated.

tkyte@TKYTE816> update dept set deptno = deptno-10;


I am now blocked in this session. If we run the V$ queries again, we see:

tkyte@TKYTE816> select username,
2 v$lock.sid,
3 trunc(id1/power(2,16)) rbs,
4 bitand(id1,to_number('ffff','xxxx'))+0 slot,
5 id2 seq,
6 lmode,
7 request
8 from v$lock, v$session
9 where v$lock.type = 'TX'
10 and v$lock.sid = v$session.sid
11 and v$session.username = USER
12 /

USERNAME SID RBS SLOT SEQ LMODE REQUEST
-------- ---------- ---------- ---------- ---------- ---------- ----------
TKYTE 8 2 46 160 6 0
TKYTE 9 2 46 160 0 6
TKYTE 9 3 82 163 6 0

tkyte@TKYTE816> select XIDUSN, XIDSLOT, XIDSQN
2 from v$transaction
3 /

XIDUSN XIDSLOT XIDSQN
---------- ---------- ----------
3 82 163
2 46 160

What we see here is that a new transaction has begun ¡V (3,82,163) is the
transaction ID. It has two rows in V$LOCK this time. One row represents the
locks that it owns (where LMODE=6). It also has a row in there that shows a
REQUEST with a value of 6. This is a request for an exclusive lock. The
interesting thing to note here is that the RBS/SLOT/SEQ values of this request
row are the transaction ID of the holder of the lock. We can easily see that the
transaction with SID=8 is blocking the transaction with SID=9. Now, if we commit
in SID = 8 the above changes:

tkyte@TKYTE816> select username,
2 v$lock.sid,
3 trunc(id1/power(2,16)) rbs,
4 bitand(id1,to_number('ffff','xxxx'))+0 slot,
5 id2 seq,
6 lmode,
7 request, block
8 from v$lock, v$session
9 where v$lock.type = 'TX'
10 and v$lock.sid = v$session.sid
11 and v$session.username = USER
12 /

USERNAME SID RBS SLOT SEQ LMODE REQUEST
-------- ---------- ---------- ---------- ---------- ---------- ----------
TKYTE 9 3 82 163 6 0

tkyte@TKYTE816> select XIDUSN, XIDSLOT, XIDSQN
2 from v$transaction
3 /

XIDUSN XIDSLOT XIDSQN
---------- ---------- ----------
3 82 163

that request row has gone ¡V it disappeared the instant the other session gave
up its lock. That request row was the queuing mechanism. The database is able to
wake up the blocked sessions the instant the transaction is completed. Note that
the above gives us a very easy way to see blockers and waiters:

tkyte@TKYTE816> select
(select username from v$session where sid=a.sid) blocker,
2 a.sid,
3 ' is blocking ',
4 (select username from v$session where sid=b.sid) blockee,
5 b.sid
6 from v$lock a, v$lock b
7 where a.block = 1
8 and b.request > 0
9 and a.id1 = b.id1
10 and a.id2 = b.id2
11 /

BLOCKER SID 'ISBLOCKING' BLOCKEE SID
-------- ---------- ------------- -------- ----------
TKYTE 8 is blocking TKYTE 9

simply by doing a self-join of V$LOCK with itself (I ran this query before
committing the session with SID=8).

2) exclusive lock -- I updated a row. no one else can update it until I commit.
I have an X lock on that row and only one person at a time can have an X lock.
an X lock provides serialization to a resource.

A shared lock -- when I update a table, I take a shared lock on the DEFINITION
of the table. Everyone else can do that as well (more then one session can get
a shared lock on the table definition). So, more than one person at a time can
update the table. If you wanted to ALTER the table, you would need an X lock on
the defintion. You cannot get an X lock when there are shared locks so you wait
until there are no shared locks.

3) mystat has the statistics (cpu use, blocks read, cursors opened, etc) for
your session only. v$locked_object shows you all of the locks in the system.

4) no, never.

showsql script from Tom

--------

2006年11月16日

32bit-linux 上使用8G内存

查了几个比较好的参考文档
1.http://www.puschitz.com/TuningLinuxForOracle.shtml(推荐)
2.http://www1.ap.dell.com/content/topics/topic.aspx/ap/topics/power/zhcn/ps3q03_mahmood?c=cn&l=zh&s=bsd

参考第一个文档,使用VLM方式,写了个简单的step by step.尚未test


Step by step – using vlm on RHEL4 for Oracle 9206

一、 参考文档:
 http://www.puschitz.com/TuningLinuxForOracle.shtml
 http://www1.ap.dell.com/content/topics/topic.aspx/ap/topics/power/zhcn/ps3q03_mahmood?c=cn&l=zh&s=bsd
二、 说明
扩大SAG的一种方法是扩展缓冲缓存或超大内存(VLM)。这一方法不支持Oracle9i Release2的一些特性,例如动态SGA在数据库中存在多个数据块大小。

三、 步骤:

1. 规划内存使用
8G 内存,配置4G给SGA,其中db cache : 3G, shared pool 400m,

db_block_size=8192
db_block_buffers=393216
shared_pool_size=419430400

2. 配置OS
a) 配置ramfs

假设oracle 的primary group 为oinstall

# umount /dev/shm
# mount -t ramfs ramfs /dev/shm
# chown oracle:oinstall /dev/shm

修改/etc/rc.local,加上

umount /dev/shm
mount –t ramfs ramfs /dev/shm
chown oracle:oinstall /dev/shm
b) 配置memlock

修改 /etc/security/limits.conf,加上:

oracle soft memlock 3145728
oracle hard memlock 3145728

配置后,以oracle登录,检查
$ulimit –l
是否为3145728

3. 配置Oracle
修改初始化文件

a) 加上:

use_indirect_data_buffers=true
db_block_size=8192
db_block_buffers=393216
shared_pool_size=419430400

b) 把db_cache_size 注释


4. 启动oracle

Now try to start the database. Note the database startup can take a while. Also, the sqlplus banner or show sga may not accurately reflect the actual SGA size in older Oracle versions.

The 3GB file for the database buffer cache can be seen in the ramfs shared memory filesystem:
$ ls -al /dev/shm
total 120
drwxr-xr-x 1 oracle dba 0 Nov 20 16:29 .
drwxr-xr-x 22 root root 118784 Nov 20 16:25 ..
-rw-r----- 1 oracle dba 3221225472 Nov 20 16:30 ora_orcl_458754
$


--------

2006年11月14日

10g 安装没有gb18030字符集

又是一个oracle bug. 10g 在dbca建库时没有gb18030的字符集选择。
解决方法有2种,一是先用US7创建,然后改为gb18030,一是用dbca生成scripts,修改scripts,改为gb18030字符集,再执行scripts.
建库完成后,查看nls_characterset _parameters 确认。

如下是metalink上得到的答复:

这个metalink的产生还挺麻烦。
直接8008100366过去,还是下午5点多,metalink中文服务到6点。我选择了英文服务,
以为可以直接和工程师对话,结果也是hub,不过是英文的hub。痛苦的对话后,huber给我创建了一个tar,后来发现我说的GB,被听成了GP,结果写出来是GP18030,不幸中的万幸是,创建的是一个2级tar,所以处理速度应该还可以。

后面第一个回复我,问我是否使用了locale builder(lbuilder),我感觉有些偏了,因为9i安装时不需要这个。

后来打了2次电话催,一次让工程师回电,没有收到;
后来打电话,找中文的服务,huber解释目前负责的是老美,老美还在睡觉呢,就帮我把负责的工程师切换到亚太,很快就回复了。

感觉以后要催,还是要找中文的。


QUESTION
=========
When I tried to create database with dbca, I select the character set from the
character sets list, but I can't find the ZHS32GB18030, which can be found when
I run dbca on Oracle 9i.

so My question is : does Oracle 10g doesn't support ZHS32GB18030 any longer?
or Is there a character set which contains ZHS32GB18030?

eos (end of section)

ANSWER
=======
Oracle still supports the character set ZHS32GB18030. But
DBCA not listing the characterset seems to be a new BUG.

I understand that your concern is to create a database with the characterset
ZHS32GB18030 . So , please follow the workaroud below.

+ Create a database selecting the characterset US7ASCII from the DBCA dropdown
list .

+ Then change the database characterset to ZHS32GB18030 with 'ALTER DATABASE '
command .

To change the characterset to ZHS32GB18030 from US7ASCII using 'alter database'
------------------------------------------------
Once the database with US7ASCII is created using DBCA , perform the following
steps :

SHUTDOWN IMMEDIATE;
-- make sure there is a database backup you can rely on, or create one
STARTUP MOUNT;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;
ALTER DATABASE OPEN;
ALTER DATABASE CHARACTER SET ZHS32GB18030;
-- a alter database takes typically only a few minutes or less,
-- it depends on the number of columns in the database, not the
-- amount of data.
SHUTDOWN;


New info : liyuefu@yahoo.com.cn : Thanks for kindly reply.

Can I create the scripts with dbca, and then change the script to use GB18030 ,
and then create database with new scripts?


14-NOV-06 05:56:47 GMT

.
UPDATE
======

Hi Yuefu,

Yes. You can do like that also. There shouldnot be any problem.
After creating the database you can query nls_characterset _parameters to confirm the character set.

--------

一次归档日志异常快速增长分析

1 问题描述

客户数据库服务器在06年11月8日归档日志快速增长,认为有异常情况,请求协助分析。

2 问题分析
启用logmnr分析
检查归档日志,发现大概每分钟产生1个到2个归档,每个200M.
为分析具体的内容,使用logmnr分析日志。

execute dbms_logmnr.add_logfile(logfilename=>'/oradata10/oracle/arch/arch_1_56478.arc',
options=>dbms_logmnr.addfile);

exec dbms_logmnr.start_logmnr();

分析插入操作的情况

spool inssql.txt
select session_info ,sql_redo from v$logmnr_contents where upper(operation) = 'INSERT';
spool off


因为归档日志太大,没有分析完就停止。 绝大部分内容是

insert into "UNKNOWN"."OBJ# 31552"() values ();


查看对象情况:

SQL> select object_name, owner from dba_objects where object_id = 31552;

OBJECT_NAME
--------------------------------------------------------------------------------
OWNER
------------------------------
GLTMP_ASSORA
NC31


查看表结构:

--------------------------------------------------------------------------------

CREATE GLOBAL TEMPORARY TABLE "NC31"."GLTMP_ASSORA"
( "ASSID" CHAR(20)
) ON COMMIT DELETE ROWS

分析是NC软件在这个时间端有大量的临时表数据插入.


分析DELETE:


spool delsql.txt
select session_info ,sql_redo from v$logmnr_contents where upper(operation) = 'DELETE';
spool off

查看delsql.txt,大部分是如下内容:
delete from "UNKNOWN"."OBJ# 34216" where "COL 1" = HEXTORAW('3131313756323130303
030303030303053454b57') and ROWID = 'AARpmJAABAABpt/AAw';

查具体的segment:

SQL> select owner, object_name, object_type, temporary as TEMP from dba_objects where object_id = 34216;

OWNER
------------------------------
OBJECT_NAME
--------------------------------------------------------------------------------
OBJECT_TYPE T
------------------ -
NC31
ASSTEMPORA
TABLE Y

查看其创建SQL

SQL>set long 9000
SQL> select dbms_metadata.get_ddl('TABLE','ASSTEMPORA','NC31') from dual;

DBMS_METADATA.GET_DDL('TABLE','ASSTEMPORA','NC31')
--------------------------------------------------------------------------------

CREATE GLOBAL TEMPORARY TABLE "NC31"."ASSTEMPORA"
( "ASSID" CHAR(20)
) ON COMMIT DELETE ROWS


分析,归档日志内容大部分是global temporary表的操作引起的。应该属于正常的业务。

查是否存在bug:
查到是9204的bug:
2874489: Excessive REDO generated for INSERT as SELECT into GLOBAL TEMPORARY TABLES.
Fixed: 9205
确实命中了bug. 这个bug导致临时表的insert as select 操作产生大量的redo 日志。


向客户了解这几天的业务情况:

原dba介绍
以前开archivelog 时也差不多每分钟产生一个归档。

比较同期归档日志:

发现2006-10-7号下午13:40到15:00直接归档日志产生的频率也达到每分钟1-2个。

dba发现归档产生非常多后,停止了归档模式, 后来因为shareplex的需要,重新启动了归档模式。
Mon Sep 18 23:55:58 2006
alter database archivelog
Mon Sep 18 23:55:58 2006
Completed: alter database archivelog


财务部
发生问题的几天大量查报表,业务量比上个月增加。


3 总结和建议

因为应用使用了较多的global temporary 进行数据处理, 而9204版本存在的bug使得这些操作产生更多的arch log。针对业务的需要,在业务繁忙的时候,提高清理归档日志频率; 如果归档太多影响到业务,可以考虑升级到9206。


4.附测试9204bug

测试9204的这个bug:

D:MyDocument>sqlplus lyf/lyf

SQL*Plus: Release 9.2.0.1.0 - Production on 星期四 11月 9 10:56:28 2006

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.


连接到:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production

SQL> create table cc1(c1 number);

表已创建。

SQL> set autotrace trace stat
SQL> insert into cc1 select rownum from dba_objects;

已创建29521行。


Statistics
----------------------------------------------------------
909 recursive calls
809 db block gets
23119 consistent gets
215 physical reads
461400 redo size
614 bytes sent via SQL*Net to client
546 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
17 sorts (memory)
0 sorts (disk)
29521 rows processed

SQL> create global temporary table cc2(c1 number);

表已创建。

SQL> set autotrace trace stat
SQL> insert into cc2 select rownum from dba_objects;

已创建29522行。


Statistics
----------------------------------------------------------
17 recursive calls
30189 db block gets
22776 consistent gets
4 physical reads
3675880 redo size
618 bytes sent via SQL*Net to client
546 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
2 sorts (memory)
0 sorts (disk)
29522 rows processed

SQL>

SQL> delete from cc2;

已删除29522行。


Statistics
----------------------------------------------------------
24 recursive calls
30374 db block gets
59 consistent gets
0 physical reads
4755880 redo size
620 bytes sent via SQL*Net to client
515 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
29522 rows processed

SQL> delete from cc1;

已删除29521行。


Statistics
----------------------------------------------------------
24 recursive calls
30499 db block gets
65 consistent gets
0 physical reads
6648772 redo size
620 bytes sent via SQL*Net to client
515 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
29521 rows processed

SQL>

使用global temporary 产生的日志达到3M,而普通表产生的日志400k
临时表删除时也产生了4.5M日志。



在oracle 10g 上测试:

[oracle@iassrv oracle]$ sqlplus lyf/lyf

SQL*Plus: Release 10.1.0.4.2 - Production on Fri Nov 10 12:31:11 2006

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.4.2 - Production
With the Partitioning, OLAP and Data Mining options

SQL> create table cc1 (c1 number);

Table created.

SQL> set autotrace trace stat
1* insert into cc1 select rownum from dba_objects
SQL> /

60303 rows created.


Statistics
----------------------------------------------------------
1732 recursive calls
1536 db block gets
12848 consistent gets
752 physical reads
973516 redo size
632 bytes sent via SQL*Net to client
556 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
27 sorts (memory)
0 sorts (disk)
60303 rows processed

SQL> create global temporary table cc2 (c1 number);

Table created.

SQL> insert into cc2 select rownum from dba_objects;

60304 rows created.


Statistics
----------------------------------------------------------
33 recursive calls
708 db block gets
12275 consistent gets
455 physical reads
167188 redo size
636 bytes sent via SQL*Net to client
555 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
2 sorts (memory)
0 sorts (disk)
60304 rows processed

SQL>

Global temporary 的 redo log 比一般的表少很多。


在oracle 9206上测试

D:oracleora92sqlplusadmin>sqlplus lyf/lyf

SQL*Plus: Release 9.2.0.6.0 - Production on 星期五 11月 10 22:03:39 2006

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.


连接到:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production

SQL> create table cc1 (c1 number);
SQL> create global temporary table cc2 (c1 number);

SQL> set autotrace on statistics
SQL> insert into cc1 select rownum from dba_objects;

已创建29524行。


Statistics
----------------------------------------------------------
781 recursive calls
767 db block gets
23018 consistent gets
203 physical reads
464500 redo size
611 bytes sent via SQL*Net to client
546 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
17 sorts (memory)
0 sorts (disk)
29524 rows processed

SQL> insert into cc2 select rownum from dba_objects;

已创建29524行。


Statistics
----------------------------------------------------------
9 recursive calls
350 db block gets
22787 consistent gets
0 physical reads
79260 redo size
616 bytes sent via SQL*Net to client
546 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
2 sorts (memory)
0 sorts (disk)
29524 rows processed

SQL>

分析: 9206已经没有这个问题。Global temporary表比一般表生成的redo少。


--------

持戒推迟到从下周开始

因为计数器还没有收到,计数会遇到困难。
今天刚刚又买了一个(给老婆用,数胎动),今天发货,估计周四收到。

--------

2006年11月02日

What is a certified copy of a document?

What is a certified copy of a document?

Answer:
A certified copy is a duplicate of an original document that is certified as a true copy by the officer having custody of the original. Michigan notaries are prohibited from issuing certified copies of public records or any other documents. Requests for certified copies should be directed to the agency that holds or issued the original.

--------

2006年11月01日

dba薪水及IMS数据库

想了解一下dba的薪水,看到一个2005年dba薪水统计

2004年的统计

DATABASE ADMINISTRATOR SALARIES

Year-to-Year Change
2005 2004 2002 2001 1-year change Change 01-05
$70,500 $71,400 $71,500 $66,800 -1.3% +5.5%
Average Annual Bonus
2005 2004 2002 2001 1-year change Change 01-05
$3,750 $3,600 $3,360 $5,350 +4.2% -29.9%

By Experience Level
<5 years <10 years 10+ years Differential
$60,600 $66,600 $78,700 +29.9%

By Operating System Environment
Mainframe Midrange AIX/Unix Windows Non-Mainframe
Linux
$75,500 $71,500 $73,700 $66,800 $66,400

By Database Environment
DB2 IMS Oracle SQL Server Sybase MySQL
$73,500 $75,100 $72,700 $69,100 $72,900 $67,800

其中有个 IMS,不知什么冬冬,google了一把(不知道是否有吹牛的嫌疑)
http://articles.e-works.net.cn/471/Article40956.htm


IBM信息管理系统(IBM Information Management System,IMS)是 IBM 最早的事务和层次数据库管理系统.

IMS 是 IBM 最早的事务和层次数据库管理系统,它非常适合支持高可用性、高性能、高容量、高完整性和低成本的关键性联机操作应用程序和数据。如今,IMS 管理着世界上一些任务关键型数据,并且继续在随需应变领域担任重要角色。全世界范围内 IMS 客户的 MIPS 已经迅速增长到超过 260 万。迁移到最新版 IMS 的客户一直都在迅速增长,并且比以前的版本增加的数目更多。

在我们朝着随需应变计算这个新的领域前进时,IMS 始终处于领导地位。自从首次 IMS-ready 消息用于 Apollo 太空计划 35 年多来,IMS 以及 zSeries 始终领导着这个行业,并不断突破技术壁垒。IMS 一直提供使用最新技术来满足客户需求的解决方案。

在利用新技术以及在满足日益增加的需求和客户复杂性之间平衡优先级等方面,IMS 客户一直处于最前沿。IMS 客户一直以来对性能、可用性、互操作性、灵活性以及支持新兴技术方面有很高的要求。IMS 始终提供解决方案来满足这些需求。为了将客户的现有资产扩展到现在的随需应变体系架构中,IMS 通过利用一个面向服务、随需应变的体系架构来进行集成和开放访问从而达到企业的现代化。

--------

一个报表查询优化优化

在出报表时,其它应用不能执行

Statspack查看报告


Event Waits Wait Time (cs) % Total Wt Time
-------------------------------------------- ------------ ------------ -------
direct path read 54,393 29,687 47.85
direct path write 34,272 28,559 46.03
log file parallel write 1,723 1,314 2.12
log file sync 1,326 1,215 1.96
control file parallel write 373 416 .67


运行了不到20分钟, direct path read/write就等待了 60000/100/60=10分钟。成为瓶颈。
查direct path read/write:
direct path read

When a session is reading buffers from disk directly into the PGA (opposed to the buffer cache in SGA), it waits on this event. If the I/O subsystem does not support asynchronous I/Os, then each wait corresponds to a physical read request.
If the I/O subsystem supports asynchronous I/O, then the process is able to overlap issuing read requests with processing the blocks already existing in the PGA. When the process attempts to access a block in the PGA that has not yet been read from disk, it then issues a wait call and updates the statistics for this event. Hence, the number of waits is not necessarily the same as the number of read requests (unlike 'db file scattered read' and 'db files sequential read').
V$SESSION_WAIT Parameter Columns
P1 - File_id for the read call
P2 - Start block_id for the read call
P3 - Number of blocks in the read call
Causes
This happens in the following situations:
• The sorts are too large to fit in memory and go to disk. If a sort does not fit into memory, then some of the sort data is written out directly to disk. This data is later read back in, using direct reads.
• Parallel slaves are used for scanning data.
• The server process is processing buffers faster than the I/O system can return the buffers. This can indicate an overloaded I/O system.
Actions
The file_id shows if the reads are for an object in TEMP tablespace (sorts to disk) or full table scans by parallel slaves. This is the biggest wait for large data warehouse sites. However, if the workload is not a DSS workload, then examine why this is happening.
Sorts to Disk
Examine the SQL statement currently being run by the session experiencing waits to see what is causing the sorts. Query V$TEMPSEG_USAGE to find the SQL statement that is generating the sort. Also query the statistics from V$SESSTAT for the session to determine the size of the sort. See if it is possible to reduce the sorting by tuning the SQL statement. If WORKAREA_SIZE_POLICY is MANUAL, then consider increasing the SORT_AREA_SIZE for the system (if the sorts are not too big) or for individual processes. If WORKAREA_SIZE_POLICY is AUTO, then investigate whether to increase PGA_AGGREGATE_TARGET.

查看目前sga配置:

SGA regions Size in Bytes
------------------------------ ----------------
Database Buffers 734,003,200
Fixed Size 75,804
Redo Buffers 77,824
Variable Size 196,767,744
----------------
sum 930,924,572

服务器内存有3G。可以适当调大sort_area_size.

把sort_area_size 调整为512k.

ALTER SYSTEM ... DEFERRED
Alter system set sort_area_size=524288;


调整后,重启,再运行此报告。用sysevent查看:
Avg
Total Total Time Ela Time % of
Event Name Waits Timeouts (in Hours) (Secs) Concern
------------------------------ ---------------- --------------- ----------- ----------- -------
CPU time 0.10 68.21
db file sequential read 16,742 0 0.02 0.01 15.88

direct read, direct write 已经消失。

初步判断问题解决。


--------

关于 2006年11月

此页面包含了在2006年11月发表于山上有风的所有日记,它们从老到新列出。

前一个存档 2006年10月

后一个存档 2006年12月

更多信息可在 主索引 页和 归档 页看到。

Powered by
Movable Type 3.34