《Oracle Developer Day》

摘要:《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

總結: 這是一個美好的經驗,接下來就好好探索囉。