摘要:《Oracle Developer Day》
这几年一直在 windows 平台操作 oracle database,早想要跨入 linux 平台学习 oracle database management,
但是从选定 unix like 的平台、版本、安装 OS、设定网络、x window、显卡,无一不是挫折,
既费时又没成就感可言,最近几天兴起又开始找相关的讨论,结果是远在天边近在眼前。
Oracle Technology Network Developer Day
http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html
Step by step download, mount 马上就有现成的 lab 环境,linux、database 11g R2、SQL Developer、TimesTen,
还有 x window、firefox;一切都是这么地美好,正当要开机时马上就挫败!
开机过没多久会先看到以下消息...
Memory for crash kernel (0x0 to 0x0) not within permissible range
然后就停止运行,在网络上有两种说法,一是不要理它,系统会继续运行;
我照作了,等了几个小时动都不动,最后放弃这个说法。
另一种是开启 VirtualBox IO APIC,it's work!
总算过这一关可以继续进行下去了,在这之前也曾在网络上看到有人反应安装 developer day,
DB、Listener 无法连线之类的问题,当时还信誓旦旦的说,我只要能登入x window 就一定可以连上 DB,
好歹也有 oracle 10g OCP 认证过的,结果还是要去问 google。
接下来这关是在登入 oracle 11g sqlplus fail,我作了以下检查:
tnsping OK、tnsnames.ora、listener.ora 设定、sqlplus login 都没有问题,
但是就是不能操作 DB,show sga、user 都会跳出以下错误。
ORA-24324 service handle not initialized
ORA-24323 value not allowed
ORA-03113: end-of-file on communication channel
傻眼! 试试 dbca、netca linux 平台是不是也有,果然命令是有的,但是错误消息也有。
Oracle Net Services Configuration:
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# SIGSEGV (0xb) at pc=0xa44b13a8, pid=2973, tid=3086891216
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_17-b02 mixed mode)
# Problematic frame:
# C [libnnz11.so+0x3c3a8]
#
# An error report file with more information is saved as hs_err_pid2973.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
/u01/app/oracle/product/11.2.0/dbhome_1/bin/netca: line 178: 2973
(类似上面的消息,但是 JVM 版本记得是 1.6)
神探追追追,用了上述的消息找到这篇 p8670579_112010_LINUX.zip的下载地址
转载来源 ZhangGang's blog
竟然是 oracle bug,而且在安装说明都没写到这点。
既然找到了那就来试试吧!
当时在 windows 平台知道有 opatch 这玩意,但是没操作过,只有在升级 oracle 9.2.0.1 到 9.2.0.8 时安装过 patch set,
不过这也是鼠标点两下,下一步下一步的操作。
所以下一个难关是怎么上 opatch。
参考这两篇 教你快速掌握如何使用"Opatch"打补丁
7 Oracle Software Patching Using OPatch
1. 检查 perl 版本
[oracle@localhost 8670579]$ perl -v
This is perl, v5.8.8 built for i386-linux-thread-multi
Copyright 1987-2006, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
2. 检查 opatch 版本 (原来在安装 oracle database 就会默认安装, oracle 建议使用最新的 opatch,但是要有 metalink 账号才可下载)
[oracle@localhost OPatch]$ perl opatch.pl lsinventory
Invoking OPatch 11.1.0.6.6
Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation. All rights reserved.
Oracle Home : /home/oracle/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /home/oracle/app/oraInventory
from : /etc/oraInst.loc
OPatch version : 11.1.0.6.6
OUI version : 11.2.0.1.0
OUI location : /home/oracle/app/oracle/product/11.2.0/dbhome_1/ouiLog file location : /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2011-01-24_06-05-56AM.log
Patch history file: /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch_history.txt
Lsinventory Output file location : /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2011-01-24_06-05-56AM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (1):
Oracle Database 11g 11.2.0.1.0
There are 1 products installed in this Oracle Home.
There are no Interim patches installed in this Oracle Home.
--------------------------------------------------------------------------------
OPatch succeeded.
3. 关闭所有 oracle service
listener : lsnrctl stop
db: shutdown abort (只能用 shutdown abort,其它模式会报错)
4. 接着上 patch (注意只能执行在 silent mode)
[oracle@localhost 8670579]$ perl /home/oracle/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch.pl apply -silent
Invoking OPatch 11.1.0.6.6
Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation. All rights reserved.
Oracle Home : /home/oracle/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /home/oracle/app/oraInventory
from : /etc/oraInst.loc
OPatch version : 11.1.0.6.6
OUI version : 11.2.0.1.0
OUI location : /home/oracle/app/oracle/product/11.2.0/dbhome_1/oui
Log file location : /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2011-01-24_06-20-41AM.log
Patch history file: /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch_history.txt
--------------------------------------------------------------------------------
The patch has more than one Archive Action but there is no Make Action.
--------------------------------------------------------------------------------
ApplySession applying interim patch '8670579' to OH '/home/oracle/app/oracle/product/11.2.0/dbhome_1'
Running prerequisite checks...
OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/home/oracle/app/oracle/product/11.2.0/dbhome_1')
Is the local system ready for patching? [y|n]
Y (auto-answered by -silent)
User Responded with: Y
Backing up files and inventory (not for auto-rollback) for the Oracle Home
Backing up files affected by the patch '8670579' for restore. This might take a while...
Backing up files affected by the patch '8670579' for rollback. This might take a while...
Patching component oracle.network.rsf, 11.2.0.1.0...
Updating archive file "/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.a" with "lib/libnnz11.a/ahseteco.o"
Updating archive file "/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.a" with "lib/libnnz11.a/am11rkg.o"
Updating archive file "/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.a" with "lib/libnnz11.a/amsha.o"
Updating archive file "/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.a" with "lib/libnnz11.a/cpui32.o"
Updating archive file "/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.a" with "lib/libnnz11.a/sha.o"
Updating archive file "/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.a" with "lib/libnnz11.a/x931rand.o"
Updating archive file "/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.a" with "lib/libnnz11.a/am11dkg.o"
Updating archive file "/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.a" with "lib/libnnz11.a/am931rnd.o"
Updating archive file "/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.a" with "lib/libnnz11.a/amsharnd.o"
Updating archive file "/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.a" with "lib/libnnz11.a/ghash.o"
Updating archive file "/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.a" with "lib/libnnz11.a/shacomm.o"
Copying file to "/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.so"
ApplySession adding interim patch '8670579' to inventory
Verifying the update...
Inventory check OK: Patch ID 8670579 is registered in Oracle Home inventory with proper meta-data.
Files check OK: Files from Patch ID 8670579 are present in Oracle Home.
The local system has been patched and can be restarted.
OPatch succeeded.
5. 重新启动 listener、db
[oracle@localhost 8670579]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 24-JAN-2011 06:21:14
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /home/oracle/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=80))(PROTOCOL_STACK=
PRESENTATION=HTTP)(SESSION=RAW)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=21))(PROTOCOL_STACK=
PRESENTATION=FTP)(SESSION=RAW)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 24-JAN-2011 06:21:14
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /home/oracle/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=80))(PROTOCOL_STACK=(PRESENTATION=HTTP)(SESSION=RAW)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=21))(PROTOCOL_STACK=(PRESENTATION=FTP)(SESSION=RAW)))
The listener supports no services
The command completed successfully
[oracle@localhost 8670579]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Mon Jan 24 06:21:18 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup
jORACLE instance started.
Total System Global Area 313860096 bytes
Fixed Size 1336232 bytes
Variable Size 281021528 bytes
Database Buffers 25165824 bytes
Redo Buffers 6336512 bytes
Database mounted.
Database opened.
SQL> show sga
Total System Global Area 313860096 bytes
Fixed Size 1336232 bytes
Variable Size 281021528 bytes
Database Buffers 25165824 bytes
Redo Buffers 6336512 bytes
总结: 这是一个美好的经验,接下来就好好探索啰。