July 17, 2008
Oracle Database 11g 体系结构图下载
作者:eygle
出处:http://blog.eygle.com
Kamus在ITPUB上发布了一张Oracle Database 11g的体系结构图。
文件很大,详细绘制了Oracle11g的数据库体系结构:
感觉很不错,转载一个在这里,供下载。10g版本的在视图结构本站也有提供。
-The End-
Posted by eygle at 12:12 PM | Comments (4)
July 16, 2008
ORA-07445 数据库也会旧病复发
作者:eygle
出处:http://blog.eygle.com
去年曾经帮助客户处理了一则ORA-07445的错误,当时客户的症状是每个月出一次07445错误,然后Down机。
主机上SUN V880,采用的双机热备的系统。第一次出现故障是在2007年6月左右。我在9月底帮助客户解决了问题。
昨天客户找到我,说数据库7月初又出现了07445错误,我摘录一下错误信息:
Exception signal: 11 (SIGSEGV), code: 1 (Address not mapped to object), addr: 0x166, PC: [0x10289ce30, 000000010289CE30]
*** 2008-07-11 23:58:40.743
ksedmp: internal or fatal error
ORA-07445: exception encountered: core dump [000000010289CE30] [SIGSEGV] [Address not mapped to object] [0x000000166] [] []
Current SQL information unavailable - no session.
我开玩笑说,一年了,数据库旧病复发!数据库问题不会复发么?会的,不要以为这是玩笑。
如果一个问题可能会反复出现,那它就一定会反复出现,系统会在一定周期内出问题,数据库逢节假就问题频发。
还有些上市公司,总是在出财报时出现问题,所以,墨菲定律无处不在。
上一次我在客户现场待了三天,解决问题之后稳定运行了9个月,也算是不错的业绩了,可是客户总是在问题解决之后就觉得不再需要技术人员了。这是做技术的悲哀。
-The End-
Posted by eygle at 3:15 PM | Comments (8)
July 15, 2008
SPFILE参数修改错误的解决办法
作者:eygle
出处:http://blog.eygle.com
昨天在火车站,一个朋友打电话过来,说他将SPFILE修改错了,数据库无法启动,问我怎么办。我说你创建一个PFILE,改一下用PFILE启动,而他说数据库无法连接,是Windows的环境。
Ok,这类问题很多很多,我描述一下解决办法供参考。
假如我们修改了以下参数:
SQL> alter system set sga_max_size=5G scope=spfile;
System altered.
那么下次启动,如果内存不足,数据库是无法启动的:
SQL> shutdown immediate;在Unix、Linux上可以连接到数据库,创建pfile:
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORA-27102: out of memory
SQL> create pfile from spfile;如果在Window上,你手上还没有任何可供参考的参数文件,那么很简单,用记事本(Notepad)编辑一个文件,包含如下两行:
File created.
[oracle@test126 dbs]$ cat initeygle.ora
SPFILE='/opt/oracle/product/10.2.0/dbs/spfileeygle.ora'
sga_max_size=1073741824
第一行指向SPFILE,第二行写上出错的参数,给一个正确的值。这个值在实例启动时会覆盖之前错误的设置。
然后就可以使用这个文件启动数据库实例了:
SQL> startup pfile=$ORACLE_HOME/dbs/initeygle.ora
ORACLE instance started.
Total System Global Area 1073741824 bytes
Fixed Size 1223540 bytes
Variable Size 918553740 bytes
Database Buffers 146800640 bytes
Redo Buffers 7163904 bytes
Database mounted.
Database opened.
如果在Windows上,你只能通过服务起停数据库,那么Oracle缺省的还是会寻找SPFILE,一个办法是将SPFILE改名。
比如将spfileeygle.ora更改为spfileeygle2.ora,然后再pfile里引用这个参数文件,下次startup就不用指定pfile。
数据库可以自动找到这个参数文件,启动数据库。
[oracle@test126 dbs]$ mv spfileeygle.ora spfileeygle2.ora数据库可以自动使用PFILE启动:
[oracle@test126 dbs]$ cat initeygle.ora
SPFILE='/opt/oracle/product/10.2.0/dbs/spfileeygle2.ora'
sga_max_size=1073741824
SQL> startup
ORACLE instance started.
Total System Global Area 1073741824 bytes
Fixed Size 1223540 bytes
Variable Size 918553740 bytes
Database Buffers 146800640 bytes
Redo Buffers 7163904 bytes
Database mounted.
Database opened.
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /opt/oracle/product/10.2.0/dbs
/spfileeygle2.ora
-The End-
Posted by eygle at 10:10 AM | Comments (4)
《深入浅出Oracle》一书修订进度
作者:eygle
出处:http://blog.eygle.com
从决定修订《深入浅出Oracle》一书到现在已经过去快6个月了,今天检查一下,基本上已经快完成了。
原书共9章,修订后增加了一章,预计有10章,还剩最后2章就完成了。
修订中,对原书内容做了大幅改动,有些切掉,有些部分增加很多,充实了大量Oracle10g以及Oracle11g的内容,但是全书的整体结构未作大的变动。
在修订过程中,还是有很多收获,在对原来内容做引申的时候,发现了一些以前没有注意到的特性以及Oracle的变化。同时也发现以前很多地方写得很粗糙,幸好有机会做这样一次全面全新的审视。
希望这本书能够更完善,少留遗憾!
Posted by eygle at 9:37 AM | Comments (5)
July 14, 2008
Donald Knuth:串行并行、单线程及多线程
作者:eygle
出处:http://blog.eygle.com
在7月号的程序员杂志上刊登了一篇Donald Knuth的访谈录,其中关于并行与串行,单线程以及多线程的探讨颇引起了我的兴趣,程序员网站上提供了部分中文版译文,英文在这里。学习且记录一下。
首先是Andrew的提问:
Andrew: One of the emerging problems for developers, especially client-side developers, is changing their thinking to write programs in terms of threads. This concern, driven by the advent of inexpensive multicore PCs, surely will require that many algorithms be recast for multithreading, or at least to be thread-safe. So far, much of the work you've published for Volume 4 of The Art of Computer Programming (TAOCP) doesn't seem to touch on this dimension. Do you expect to enter into problems of concurrency and parallel programming in upcoming work, especially since it would seem to be a natural fit with the combinatorial topics you're currently working on?
Andrew:对于开发者,尤其是客户端开发者,正在面临一个日渐明显的问题,即改变他们的思考方式,从线程的角度去编写程序。这个问题是由廉价的多核PC的出现导致的。它一定需要很多算法进行多线程化的改造,至少也需要做到线程安全的。到目前为止,从你已经发布的《计算加程序设计的艺术》(TAOCP)第4卷的大部分内容来看,还没有涉及到这方面内容。你接下来的工作会和并发与并行程序设计有关么?尤其是这个问题天生就与你现在研究的组合算法非常适合。
Donald: The field of combinatorial algorithms is so vast that I'll be lucky to pack its sequential aspects into three or four physical volumes, and I don't think the sequential methods are ever going to be unimportant. Conversely, the half-life of parallel techniques is very short, because hardware changes rapidly and each new machine needs a somewhat different approach. So I decided long ago to stick to what I know best. Other people understand parallel machines much better than I do; programmers should listen to them, not me, for guidance on how to deal with simultaneity.
Donald:组合算法的研究领域非常庞杂,而我将有幸在三或四卷书中介绍它串行方面的内容,我认为串行方法的重要性不会降低。相反,并行技术的"半衰期"其实非常短,因为硬件总在快速地变化,每一个新的机器都需要一些不同的方法。所以,很久以前我就决定在书中保留我最了解的内容。有很多人比我更了解并行机器,他们可以指导你如何面对同时性的问题;程序员应该听听他们的建议,而不是我的。
Andrew: Vendors of multicore processors have expressed frustration at the difficulty of moving developers to this model. As a former professor, what thoughts do you have on this transition and how to make it happen? Is it a question of proper tools, such as better native support for concurrency in languages, or of execution frameworks? Or are there other solutions?
Andrew:很多多核处理器的供应商都在帮助开发者转移到多核模型的过程中,表现得力不从心。做为一名著名的教授,你对于这种转变有什么看法?什么因素才能促使这种转变?如果有更好的工具可以解决问题么,比如在语言中加入对并发更好的本地支持,或者使用框架?或者还有其他的方案么?
Donald: I don't want to duck your question entirely. I might as well flame a bit about my personal unhappiness with the current trend toward multicore architecture. To me, it looks more or less like the hardware designers have run out of ideas, and that they're trying to pass the blame for the future demise of Moore's Law to the software writers by giving us machines that work faster only on a few key benchmarks! I won't be surprised at all if the whole multithreading idea turns out to be a flop, worse than the "Itanium" approach that was supposed to be so terrific--until it turned out that the wished-for compilers were basically impossible to write.
Donald:我不想回避你的问题。也许我个人的一些观点会为当前流行的多核架构趋势泼一盆冷水。在我看来,这种现象或多或少是由于硬件设计者已经无计可施了导致的,他们将Moore定律失效的责任推脱给软件开发者,而他们给我们的机器只是在某些指标上运行得更快了而已。如果多线程的想法被证明是失败的,我一点都不会感到惊讶,也许这比当年的Itanium还要糟糕----人们基本上无法开发出它所需要的编译器。
Let me put it this way: During the past 50 years, I've written well over a thousand programs, many of which have substantial size. I can't think of even five of those programs that would have been enhanced noticeably by parallelism or multithreading. Surely, for example, multiple processors are no help to TeX.[1]
这么说吧:在过去的50年间,我编写过一千多个程序,其中有很多规模都很可观。但是如果说哪些程序的性能可以在并行或多核环境下有明显的改进,我恐怕连五个都说不来。比如,多核处理器对TeX肯定没有什么帮助。
How many programmers do you know who are enthusiastic about these promised machines of the future? I hear almost nothing but grief from software people, although the hardware folks in our department assure me that I'm wrong.
你听说过有多少程序员对这种未来一片光明的机器抱有强烈的兴趣?我几乎没有听说过,除了他们的诉苦。尽管我们学院那些搞硬件的家伙一直想让我相信我是错的。
I know that important applications for parallelism exist--rendering graphics, breaking codes, scanning images, simulating physical and biological processes, etc. But all these applications require dedicated code and special-purpose techniques, which will need to be changed substantially every few years.
我知道有很多重要的应用依赖于并行----图形渲染、密码破解、图像扫描、物理与生物过程模拟等等。但是这些应用需要非常专业的代码以及特定用途的技术,而这些技术无疑每隔若干年都要变化。
Even if I knew enough about such methods to write about them in TAOCP, my time would be largely wasted, because soon there would be little reason for anybody to read those parts. (Similarly, when I prepare the third edition of Volume 3 I plan to rip out much of the material about how to sort on magnetic tapes. That stuff was once one of the hottest topics in the whole software field, but now it largely wastes paper when the book is printed.)
即使我对那些方法非常了解,可以把它们写入TAOCP中,这对于我的时间也是巨大的浪费,因为过不了多久,这部分内容就没有什么价值值得别人去读它了。(类似地,当我在准备第3卷的第三版时,也打算删除掉关于如何在磁带上排序的内容。这些内容曾经是软件领域里最热门的主题,现在再把它印在书中就是巨大的浪费了。)
The machine I use today has dual processors. I get to use them both only when I'm running two independent jobs at the same time; that's nice, but it happens only a few minutes every week. If I had four processors, or eight, or more, I still wouldn't be any better off, considering the kind of work I do--even though I'm using my computer almost every day during most of the day. So why should I be so happy about the future that hardware vendors promise? They think a magic bullet will come along to make multicores speed up my kind of work; I think it's a pipe dream. (No--that's the wrong metaphor! "Pipelines" actually work for me, but threads don't. Maybe the word I want is "bubble.")
我今天所用的机器有两个处理器。而我只有在同时运行两个独立的作业时,才会用到这两个处理器;这样很好,不过每周这种情况只会发生几分钟而已。如果我有四个、八个甚至更多的处理器,我同样得不到任何好处,想一想我是做什么的----我几乎每天每时每刻都在使用计算机。所以,我为什么要为硬件供应商承诺的未来而高兴?他们认为多核的到来可以为我的工作提速,我认为这是"白日梦"(pipe dream)。(不----这个比喻不准确!我是会用"Pipeline"的,但是不会用线程。也许我应该说这是个"泡影(bubble)")
From the opposite point of view, I do grant that web browsing probably will get better with multicores. I've been talking about my technical work, however, not recreation. I also admit that I haven't got many bright ideas about what I wish hardware designers would provide instead of multicores, now that they've begun to hit a wall with respect to sequential computation. (But my MMIX design contains several ideas that would substantially improve the current performance of the kinds of programs that concern me most--at the cost of incompatibility with legacy x86 programs.)
不过,我认为Web浏览器可能会由于多核的出现而有所改变。我是从技术性的工作,而不是消遣的角度在说。我也承认我还没有什么很好的想法,到底硬件设计者应该给我们除多核以外什么样的产品,不过他们现在在串行计算上的确遇到了麻烦。(但是我的MMIX设计中包含了很多考量,可以有效地提高我最关注的一些程序当前的性能----代价是与遗留的x86程序无法兼容。)
Posted by eygle at 10:42 AM | Comments (0)
July 12, 2008
一只熟睡的咪
作者:eygle
出处:http://blog.eygle.com
墨墨回到北京,我的工作就变成了跟班,整天爬在他后边照看他。还要一天几次带他到楼下去散步。
这是一个专职爸爸的日常工作了。
难得北京这个周末看见了蓝天,看见了明媚的阳光,窗外知了声声,告诉我们北京的夏天终于来到了。
夏日的午后,最好是有一个摇椅,在阳光边上的阴凉里,美美的看会书,困了,就蜷缩的睡上一觉。
多了美好的时光!
Posted by eygle at 1:42 PM | Comments (6)
July 7, 2008
孩子改变世界
作者:eygle
出处:http://blog.eygle.com
今天看到乔布斯的一段话:
我告诉你一个能够改变你看问题的方法的例子。
一旦你有了孩子,就会自然而然地意识到每个人都是父母所生,应该有人像爱自己的孩子那样爱他们,这听起来并不深奥,但是许多人忽略了这一点。
所以现在对我而言,解雇苹果公司的员工要比以前痛苦得多,但我没有办法,这是我的工作。
我设身处地地想象他们回到家中告诉妻子儿女自己被雇的情景,我从来没有像现在这样感情用事过。
忽然想到,孩子真的可以改变世界,我们都曾经是孩子,现在我们又被孩子所改变。
这些天陪儿子玩,感悟良多。
Posted by eygle at 9:34 PM | Comments (0)
July 3, 2008
ORA-00704 与 bootstrap 错误
作者:eygle
出处:http://blog.eygle.com
今天有一个客户在升级数据库到10g之后遇到了如下错误:
ORA-00704: bootstrap process failure
ORA-00604: error occurred at recursive SQL level 1
ORA-01406: fetched column value was truncated
Error 704 happened during db open, shutting down database
USER: terminating instance due to error 704
Instance terminated by USER, pid = 20971
ORA-1092 signalled during: ALTER DATABASE OPEN...
一般来说,见到bootstrap错误都是很严重的故障,bootstrap过程失败数据库肯定就无法打开。很多时候bootstrap$表损坏也会导致bootstrap失败。
以上一系列错误说明在升级的过程中出现问题,升级是不完全的,从而导致数据库无法bootstrap。
可以尝试从备份中恢复数据库,再次进行升级。
记以录之。
-The End-
Posted by eygle at 4:07 PM | Comments (4)
July 1, 2008
《循序渐进Oracle》再次重印
作者:eygle
出处:http://blog.eygle.com
今天接到出版社的通知,《循序渐进Oracle》再次重印,此次重印了1000册。
那么《循序渐进Oracle》一书的印刷就是 5000 + 2000 + 1000,8000册也许是这本书的极限值了。
不过还是纪念一下,在出版不到一年的时间内,《循序渐进Oracle》实现了印刷8000册。
《循序渐进Oracle》这本书对我的意义非常之大,这将成为一个分界点,以后我的写作方向会有一个极大的转变。
好了,仅仅记录一下这件事情而已。
Posted by eygle at 12:16 PM | Comments (6)
使用cldump工具查看HACMP状态
作者:eygle
出处:http://blog.eygle.com
客户的HACMP出了点问题,我对HACMP是不懂的,找了点资料,记住几个命令,一点一滴积累吧。cldump 命令可以用于显示当前Cluster的状态信息,以报告形式输出,以下是这个问题集群当前的状态:
[db1][root][/]#/usr/sbin/cluster/utilities/cldump
Obtaining information via SNMP from Node: node2...
_____________________________________________________________________________
Cluster Name: cl_01
Cluster State: UP
Cluster Substate: STABLE
_____________________________________________________________________________
Node Name: node1 State: DOWN
Network Name: net_ether_01 State: DOWN
Address: 172.16.3.56 Label: db1_boot State: DOWN
Address: 192.168.3.56 Label: db1_sby State: DOWN
Network Name: net_rs232_01 State: DOWN
Node Name: node2 State: UP
Network Name: net_ether_01 State: UP
Address: 172.16.3.57 Label: db2_boot State: DOWN
Address: 172.16.3.77 Label: db2_svc State: UP
Address: 192.168.3.57 Label: db2_sby State: UP
Network Name: net_rs232_01 State: DOWN
Cluster Name: cl_01
Resource Group Name: RG_ora
Startup Policy: Online On Home Node Only
Fallover Policy: Fallover To Next Priority Node In The List
Fallback Policy: Never Fallback
Site Policy: ignore
Node Group State
---------------------------- ---------------
node1 OFFLINE
node2 OFFLINE
Resource Group Name: db2_service
Startup Policy: Online On Home Node Only
Fallover Policy: Fallover To Next Priority Node In The List
Fallback Policy: Never Fallback
Site Policy: ignore
Node Group State
---------------------------- ---------------
node2 ONLINE
node1 OFFLINE
记以录之。
-The End-
Posted by eygle at 12:07 PM | Comments (1)

