深入理解Oracle Universal Installer (OUI)
Unix平台上OUI启动常见问题
Oracle Universal Installer是一种基于Java的图形界面应用程序,OUI为Oracle软件的安装、管理提供了统一的接口。在Unix平台上安装Oracle database software时,因为实际操作系统的差异,往往会出现OUI无法正常启动的问题,在这里我列出几种常见的启动问题和解决方案。
1.Itanium Montecito processors引起的JRE问题:在安腾平台上执行runInstaller启动OUI时会出现Java HotSpot错误如下:
An unexpected error has been detected by HotSpot Virtual Machine:
SIGILL (0x4) at pc=0x2000000000039a4070 pid=11459 tid=2305843009213968960
原因是9iR2,10gR1/R2自带的JRE在Montecito处理器相关的操作系统如Windows/Linux Itanium上存在Bug,该Bug在SUN JDK版本1.4.2_11(b02)中得到修复;如果遇到以上问题,那么可以follow 以下Metalink文档:
How To Install Oracle RDBMS Software On Itanium Servers With Montecito Processors [ID 400227.1]
How To Identify A Server Which Has Itanium2 (Montecito, Montvale, Tukwila….) Processors Installed [ID 401332.1]
2.DISPLAY显示环境变量设置不当导致图形界面无法显示,可以通过安装例如Xmanager的软件解决;也可以follow以下Metalink文档:
FAQ: X Server Testing and Troubleshooting [ID 153960.1]
3.临时目录/tmp空间应至少有400MB空间,且Oracle software安装用户对该目录有读写权限;在无奈之下可以通过修改用户的临时目录环境必变量$TMP来workaround:
Unable To Start OUI: not enough room in /tmp [ID 339657.1]
How To Set Temporary Space Directory [ID 177902.1]
4.必要时以”-debug”调试选项来调用OUI,通过阅读详细的OUI bootstrap引导流程日志以确认和保证以下2点:
- 在JRE解压阶段没有出现错误
- 在调用java命令启动OUI java图形界面阶段没有出现错误
如以下DEBUG示例:
[maclean@rh8 database]$ cd database [maclean@rh8 database]$ ./runInstaller -debug > debug.log Preparing to launch Oracle Universal Installer from /tmp/OraInstall2011-03-17_03-12-17PM. Please wait ...Archive: ../stage/Components/oracle.jdk/1.5.0.1.1/1/DataFiles/lib.jar inflating: /tmp/OraInstall2011-03-17_03-12-17PM/jdk/lib/dt.jar inflating: /tmp/OraInstall2011-03-17_03-12-17PM/jdk/lib/htmlconverter.jar inflating: /tmp/OraInstall2011-03-17_03-12-17PM/jdk/lib/ir.idl inflating: /tmp/OraInstall2011-03-17_03-12-17PM/jdk/lib/jconsole.jar inflating: /tmp/OraInstall2011-03-17_03-12-17PM/jdk/lib/orb.idl inflating: /tmp/OraInstall2011-03-17_03-12-17PM/jdk/lib/sa-jdi.jar inflating: /tmp/OraInstall2011-03-17_03-12-17PM/jdk/lib/tools.jar Archive: ../stage/Components/oracle.jdk/1.5.0.1.1/1/DataFiles/jre.jar EMPTY_DIR inflating: /tmp/OraInstall2011-03-17_03-12-17PM/jdk/jre/CHANGES inflating: /tmp/OraInstall2011-03-17_03-12-17PM/jdk/jre/COPYRIGHT inflating: /tmp/OraInstall2011-03-17_03-12-17PM/jdk/jre/LICENSE .................. LD_LIBRARY_PATH environment variable : ------------------------------------------------------- Total args: 22 Command line argument array elements ... Arg:0:/tmp/OraInstall2011-03-17_03-12-17PM/jdk/jre/bin/java: Arg:1:-Doracle.installer.library_loc=/tmp/OraInstall2011-03-17_03-12-17PM/oui/lib/linux: Arg:2:-Doracle.installer.oui_loc=/tmp/OraInstall2011-03-17_03-12-17PM/oui: Arg:3:-Doracle.installer.bootstrap=TRUE: Arg:4:-Doracle.installer.startup_location=/home/maclean/Downloads/database/install: Arg:5:-Doracle.installer.jre_loc=/tmp/OraInstall2011-03-17_03-12-17PM/jdk/jre: Arg:6:-Doracle.installer.nlsEnabled="TRUE": Arg:7:-Doracle.installer.prereqConfigLoc= : Arg:8:-Doracle.installer.unixVersion=2.6.35.11-83.fc14.i686: Arg:9:-mx150m: Arg:10:-cp: Arg:11:/tmp/OraInstall2011-03-17_03-12-17PM::/tmp/OraInstall2011-03-17_03-12-17PM/ext/jlib/orai18n-mapping.jar:/tmp/OraInstall2011-03-17_03-12-17PM/ext/jlib/orai18n-utility.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/OraInstaller.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/oneclick.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/xmlparserv2.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/share.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/OraInstallerNet.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/emCfg.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/OraPrereq.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/jsch.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/ssh.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/remoteinterfaces.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/http_client.jar:../stage/Components/oracle.swd.opatch/11.1.0.6.0/1/DataFiles/jlib/opatch.jar:../stage/Components/oracle.swd.opatch/11.1.0.6.0/1/DataFiles/jlib/opatchactions.jar:../stage/Components/oracle.swd.opatch/11.1.0.6.0/1/DataFiles/jlib/opatchprereq.jar:../stage/Components/oracle.swd.opatch/11.1.0.6.0/1/DataFiles/jlib/opatchutil.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/InstImages.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/InstHelp.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/InstHelp_de.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/InstHelp_es.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/InstHelp_fr.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/InstHelp_it.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/InstHelp_ja.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/InstHelp_ko.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/InstHelp_pt_BR.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/InstHelp_zh_CN.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/InstHelp_zh_TW.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/oracle_ice.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/help4.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/help4-nls.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/ewt3.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/ewt3-swingaccess.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/ewt3-nls.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/swingaccess.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/classes12.jar::/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/jewt4.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/jewt4-nls.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/orai18n-collation.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/orai18n-mapping.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/ojmisc.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/xml.jar:/tmp/OraInstall2011-03-17_03-12-17PM/oui/jlib/srvm.jar: Arg:12:oracle.sysman.oii.oiic.OiicInstaller: Arg:13:-scratchPath: Arg:14:/tmp/OraInstall2011-03-17_03-12-17PM: Arg:15:-sourceLoc: Arg:16:/home/maclean/Downloads/database/install/../stage/products.xml: Arg:17:-sourceType: Arg:18:network: Arg:19:-timestamp: Arg:20:2011-03-17_03-12-07PM: Arg:21:-debug: ------------------------------------------------------- Initializing Java Virtual Machine from /tmp/OraInstall2011-03-17_03-12-07PM/jdk/jre/bin/java. Please wait... [maclean@rh8 database]$ Oracle Universal Installer, Version 11.1.0.6.0 Production Copyright (C) 1999, 2007, Oracle. All rights reserved.
若以上JRE解压顺利完成但OUI仍无法启动图形欢迎界面(一般来说由java命令失败引起),那么很有可能是安装工具自带的JRE在目标系统上无法正常工作。建议客户自行安装目标系统上最新可用的JDK软件,并使用runInstaller的”-jreloc”选项以workaround。
5.为了进一步确认JRE的问题,我们可能需要将安装介质中自带的JRE手动解压出来并测试其java命令的可用性;可以通过如下流程测试:
/* 首先通过oraparam.ini配置文件了解介质自带JRE jar包所在路径 */ [maclean@rh8 tmp]$ cat database/install/oraparam.ini |grep JRE_LOCATION JRE_LOCATION=../stage/Components/oracle.swd.jre/1.4.2.8.0/1/DataFiles [maclean@rh8 tmp]$ ls database/stage/Components/oracle.swd.jre/1.4.2.8.0/1/DataFiles/ filegroup1.jar filegroup2.jar filegroup3.jar filegroup4.jar filegroup5.jar [maclean@rh8 tmp]$ mkdir /tmp/jre_test [maclean@rh8 tmp]$ cp database/stage/Components/oracle.swd.jre/1.4.2.8.0/1/DataFiles/*.jar /tmp/jre_test [maclean@rh8 tmp]$ cd /tmp/jre_test [maclean@rh8 jre_test]$ unzip filegroup1.jar Archive: filegroup1.jar inflating: jre/1.4.2/bin/ControlPanel inflating: jre/1.4.2/bin/java inflating: jre/1.4.2/bin/java_vm inflating: jre/1.4.2/bin/keytool inflating: jre/1.4.2/bin/kinit inflating: jre/1.4.2/bin/klist inflating: jre/1.4.2/bin/ktab inflating: jre/1.4.2/bin/orbd inflating: jre/1.4.2/bin/policytool inflating: jre/1.4.2/bin/rmid inflating: jre/1.4.2/bin/rmiregistry inflating: jre/1.4.2/bin/servertool inflating: jre/1.4.2/bin/tnameserv /* 使用unzip命令依次解压copy过来的jar文件,会出现jre目录 */ [maclean@rh8 jre_test]$ ls filegroup1.jar filegroup2.jar filegroup3.jar filegroup4.jar filegroup5.jar jre [maclean@rh8 jre_test]$ cd jre/1.4.2/bin [maclean@rh8 bin]$ chmod u+x java [maclean@rh8 bin]$ ./java -version java version "1.4.2_08" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_08-b03) Java HotSpot(TM) Client VM (build 1.4.2_08-b03, mixed mode) /* 可以看到在我们的场景中java命令运行正常 */
若以上测试的最后结果中java命令出错则说明Oracle安装介质自带的JRE存在问题,这可能是个例,在安装介质传输过程中出现网络错误所导致的文件损坏可能引起以上问题;可以通过checksum等方式验证安装介质包/ISO文件无误。若经过验证发现安装介质没有损坏,那么很有可能是自带JRE在目标操作系统上无法正常运行,用户可以到java.sun.com网站去下载指定平台最新可用的JDK软件,在成功安装后JDK后再次尝试以”-jreloc”选项启动runInstaller程序,命令示例如下:
./runInstaller -debug -jreLoc <JRE Install Home>
Oracle Solaris 11 Express发布了
甲骨文Solaris 11 Express操作系统在Solaris 10的基础上进一步加强了各种功能,Solaris 11 Express将为关键的企业系统环境提供最佳的UNIX体验(与之相对应的是Oracle Enterprise Linux,将提供最优的Linux体验)。举例而言新系统中基于网络的包管理工具(package management tools)可以大大减少系统停机时间,并提供完整安全的系统升级方案,同时其内建的网络虚拟化及委托管理将为应用程序的整合提供从所未有的灵活性,Solaris还将持续提供业界最高级别的系统安全。Oracle公司宣称Solaris 11 Express将是Solaris平台起劲为止最激动人心的版本。
Oracle Solaris 11 Express已经在多种多样或由Oracle或由其他第三方硬件供应商的提供的Sparce架构的或基于X86的硬件上通过了全面测试。此外支持Oracle独有的Exadata Database Machine数据库服务器和Exalogic云的Solaris 11 Express也即将到来。
现在我们可以从Oracle OTN下载到Solaris 11 Express的安装介质,Oracle自家的UNIX操作系统会是什么样子呢?
How to make BBED(Oracle Block Brower and EDitor Tool) on Unix/Linux/Windows
“BBED(Oracle Block Brower and EDitor Tool),用来直接查看和修改数据文件数据的一个工具,是Oracle一款内部工具,可以直接修改Oracle数据文件块的内容,简单来说就是一个针对 Oracle的二进制编辑工具。该工具不受Oracle支持,所以默认是没有生成可执行文件的,在使用前需要重新编译。”
在10g中编译该工具显得较简单:
[maclean@rh2 ~]$ cd $ORACLE_HOME/rdbms/lib [maclean@rh2 lib]$ make -f ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed make: `/s01/10gdb/rdbms/lib/bbed' is up to date. [maclean@rh2 lib]$ rm bbed [maclean@rh2 lib]$ make -f ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed Linking BBED utility (bbed) rm -f /s01/10gdb/rdbms/lib/bbed gcc -o /s01/10gdb/rdbms/lib/bbed -L/s01/10gdb/rdbms/lib/ -L/s01/10gdb/lib/ -L/s01/10gdb/lib/stubs/ /s01/10gdb/lib/s0main.o /s01/10gdb/rdbms/lib/ssbbded.o /s01/10gdb/rdbms/lib/sbbdpt.o `cat /s01/10gdb/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 /s01/10gdb/rdbms/lib/defopt.o -ldbtools10 -lclntsh `cat /s01/10gdb/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /s01/10gdb/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -lgeneric10 -lmm -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 `cat /s01/10gdb/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /s01/10gdb/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -lgeneric10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -lgeneric10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 `cat /s01/10gdb/lib/sysliblist` -Wl,-rpath,/s01/10gdb/lib -lm `cat /s01/10gdb/lib/sysliblist` -ldl -lm -L/s01/10gdb/lib [maclean@rh2 lib]$ cp bbed $ORACLE_HOME/bin [maclean@rh2 lib]$ bbed Password: BBED: Release 2.0.0.0.0 - Limited Production on Thu Sep 2 14:18:27 2010 Copyright (c) 1982, 2007, Oracle. All rights reserved. BBED> /* 你可能要问密码是什么? 呵呵 .. :) */
11.2.0.1中编译bbed可执行文件所需要的ssbbded.o和sbbdpt.o对象文件被移除了,所幸我们可以使用10g下的这2个对象文件在11.2.0.1中编译。
[maclean@rh2 lib]$ make -f ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed Linking BBED utility (bbed) rm -f /s01/11gdb/rdbms/lib/bbed gcc -o /s01/11gdb/rdbms/lib/bbed -m64 -L/s01/11gdb/rdbms/lib/ -L/s01/11gdb/lib/ -L/s01/11gdb/lib/stubs/ /s01/11gdb/lib/s0main.o /s01/11gdb/rdbms/lib/ssbbded.o /s01/11gdb/rdbms/lib/sbbdpt.o `cat /s01/11gdb/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -ldbtools11 -lclntsh `cat /s01/11gdb/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /s01/11gdb/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnnz11 -lzt11 -lztkg11 -lztkg11 -lclient11 -lnnetd11 -lvsn11 -lcommon11 -lgeneric11 -lmm -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 `cat /s01/11gdb/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /s01/11gdb/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lclient11 -lnnetd11 -lvsn11 -lcommon11 -lgeneric11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lclient11 -lnnetd11 -lvsn11 -lcommon11 -lgeneric11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 `cat /s01/11gdb/lib/sysliblist` -Wl,-rpath,/s01/11gdb/lib -lm `cat /s01/11gdb/lib/sysliblist` -ldl -lm -L/s01/11gdb/lib gcc: /s01/11gdb/rdbms/lib/ssbbded.o: No such file or directory gcc: /s01/11gdb/rdbms/lib/sbbdpt.o: No such file or directory [maclean@rh2 ~]$ cp /s01/10gdb/rdbms/lib/ssbbded.o /s01/11gdb/rdbms/lib [maclean@rh2 ~]$ cp /s01/10gdb/rdbms/lib/sbbdpt.o /s01/11gdb/rdbms/lib [maclean@rh2 ~]$ cp /s01/10gdb/rdbms/mesg/bbedus.ms* /s01/11gdb/rdbms/mesg/ /* bbed 需要用到bbedus.msg和bbedus.msb 2个信息文件 */ [maclean@rh2 lib]$ make -f ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed Linking BBED utility (bbed) rm -f /s01/11gdb/rdbms/lib/bbed gcc -o /s01/11gdb/rdbms/lib/bbed -m64 -L/s01/11gdb/rdbms/lib/ -L/s01/11gdb/lib/ -L/s01/11gdb/lib/stubs/ /s01/11gdb/lib/s0main.o /s01/11gdb/rdbms/lib/ssbbded.o /s01/11gdb/rdbms/lib/sbbdpt.o `cat /s01/11gdb/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -ldbtools11 -lclntsh `cat /s01/11gdb/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /s01/11gdb/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnnz11 -lzt11 -lztkg11 -lztkg11 -lclient11 -lnnetd11 -lvsn11 -lcommon11 -lgeneric11 -lmm -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 `cat /s01/11gdb/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /s01/11gdb/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lclient11 -lnnetd11 -lvsn11 -lcommon11 -lgeneric11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lclient11 -lnnetd11 -lvsn11 -lcommon11 -lgeneric11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 `cat /s01/11gdb/lib/sysliblist` -Wl,-rpath,/s01/11gdb/lib -lm `cat /s01/11gdb/lib/sysliblist` -ldl -lm -L/s01/11gdb/lib [maclean@rh2 lib]$ file bbed bbed: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped [maclean@rh2 lib]$ size bbed text data bss dec hex filename 154473 43448 32 197953 30541 bbed [maclean@rh2 lib]$ ldd bbed libclntsh.so.11.1 => /s01/11gdb/lib/libclntsh.so.11.1 (0x00002b042b883000) libnnz11.so => /s01/11gdb/lib/libnnz11.so (0x00002b042dead000) libdl.so.2 => /lib64/libdl.so.2 (0x00000039f2400000) libm.so.6 => /lib64/libm.so.6 (0x00000039f2000000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00000039f2800000) libnsl.so.1 => /lib64/libnsl.so.1 (0x00000039f5c00000) libc.so.6 => /lib64/libc.so.6 (0x00000039f1c00000) libaio.so.1 => /usr/lib64/libaio.so.1 (0x00002b042e293000) /lib64/ld-linux-x86-64.so.2 (0x00000039f1800000) [maclean@rh2 lib]$ cp bbed $ORACLE_HOME/bin [maclean@rh2 lib]$ which bbed /s01/11gdb/bin/bbed [maclean@rh2 lib]$ bbed Password: BBED: Release 2.0.0.0.0 - Limited Production on Thu Sep 2 15:18:37 2010 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. BBED>
如图:
11g内存管理新特性的internal表现
11g中自动内存管理(Automatic Memory Management ,amm), 令dba在数据库内存配置的相关工作更加简单. AMM现在将SGA与PGA整合到一起管理,而您只需要设置memory_target参数即可限定Oracle将使用到的内存尺寸,Oracle将自动分配这些内存空间.
您一定很困惑Oracle在unix平台上是如何对共享的sga内存空间与私有的pga内存空间进行切换的?这意味着Oracle需要经常释放sga中的部分内存以便允许pga去使用它们.传统的sys V 使用的共享内存shm接口不具备如此的灵活性.我们来看看Oracle是如何做到的?
先来获取我们需要的11g实例共享内存id(shared memory id)
[oracle@rh2 ~]$ sysresv // 该命令需要设置了正确的LD_LIBRARY_PATH
IPC Resources for ORACLE_SID “T11” :
Shared Memory:
ID KEY
65537 0x95c84bb8
Semaphores:
ID KEY
327681 0xdf521034
Oracle Instance alive for sid “T11”
试着找出对应的sys V共享内存段:
[oracle@rh2 ~]$ ipcs -m
—— Shared Memory Segments ——–
key shmid owner perms bytes nattch status
0x95c84bb8 65537 oracle 660 4096 0
对应的存在着共享内存段,但该段很小只有 4096 byte哦,既然Oracle不再把sga放到共享段中,那藏到哪里去了呢?
我们接下来检查Oracle实例进程的内存影射状况.
[oracle@rh2 ~]$ pmap `pgrep -f lgwr`|less
14889: ora_lgwr_T11
0000000000400000 155016K r-x– /usr/oracle/product/11g/db_1/bin/oracle
0000000009c62000 12404K rw— /usr/oracle/product/11g/db_1/bin/oracle
000000000a87f000 732K rwx– [ anon ]
0000000060000000 4K r–s- /dev/shm/ora_T11_65537_0
0000000060001000 16380K rw-s- /dev/shm/ora_T11_65537_0
0000000061000000 16384K rw-s- /dev/shm/ora_T11_65537_1
0000000062000000 16384K rw-s- /dev/shm/ora_T11_65537_2
0000000063000000 16384K rw-s- /dev/shm/ora_T11_65537_3
0000000064000000 16384K rw-s- /dev/shm/ora_T11_65537_4
0000000065000000 16384K rw-s- /dev/shm/ora_T11_65537_5
0000000066000000 16384K rw-s- /dev/shm/ora_T11_65537_6
0000000067000000 16384K rw-s- /dev/shm/ora_T11_65537_7
0000000068000000 16384K rw-s- /dev/shm/ora_T11_65537_8
0000000069000000 16384K rw-s- /dev/shm/ora_T11_65537_9
000000006a000000 16384K rw-s- /dev/shm/ora_T11_65537_10
000000006b000000 16384K rw-s- /dev/shm/ora_T11_65537_11
000000006c000000 16384K rw-s- /dev/shm/ora_T11_65537_12
000000006d000000 16384K rw-s- /dev/shm/ora_T11_65537_13
000000006e000000 16384K rw-s- /dev/shm/ora_T11_65537_14
000000006f000000 16384K rw-s- /dev/shm/ora_T11_65537_15
0000000070000000 16384K rw-s- /dev/shm/ora_T11_65537_16
0000000071000000 16384K rw-s- /dev/shm/ora_T11_65537_17
0000000072000000 16384K rw-s- /dev/shm/ora_T11_65537_18
0000000073000000 16384K rw-s- /dev/shm/ora_T11_65537_19
0000000074000000 16384K rw-s- /dev/shm/ora_T11_65537_20
0000000075000000 16384K rw-s- /dev/shm/ora_T11_65537_21
0000000076000000 16384K rw-s- /dev/shm/ora_T11_65537_22
0000000077000000 16384K rw-s- /dev/shm/ora_T11_65537_23
0000000078000000 16384K rw-s- /dev/shm/ora_T11_65537_24
0000000079000000 16384K rw-s- /dev/shm/ora_T11_65537_25
000000007a000000 16384K rw-s- /dev/shm/ora_T11_65537_26
000000007b000000 16384K rw-s- /dev/shm/ora_T11_65537_27
000000007c000000 16384K rw-s- /dev/shm/ora_T11_65537_28
000000007d000000 16384K rw-s- /dev/shm/ora_T11_65537_29
000000007e000000 16384K rw-s- /dev/shm/ora_T11_65537_30
000000007f000000 16384K rw-s- /dev/shm/ora_T11_65537_31
0000000080000000 16384K rw-s- /dev/shm/ora_T11_65537_32
0000000081000000 16384K rw-s- /dev/shm/ora_T11_65537_33
0000000082000000 16384K rw-s- /dev/shm/ora_T11_65537_34
0000000083000000 16384K rw-s- /dev/shm/ora_T11_65537_35
0000000084000000 16384K rw-s- /dev/shm/ora_T11_65537_36
0000000085000000 16384K rw-s- /dev/shm/ora_T11_65537_37
0000000086000000 16384K rw-s- /dev/shm/ora_T11_65537_38
0000000087000000 16384K rw-s- /dev/shm/ora_T11_65537_39
0000000088000000 16384K rw-s- /dev/shm/ora_T11_65537_40
0000000089000000 16384K rw-s- /dev/shm/ora_T11_65537_41
000000008a000000 16384K rw-s- /dev/shm/ora_T11_65537_42
............
0000003e79109000 4K rw— /lib64/tls/librt-2.3.4.so
0000003e7910a000 64K rw— [ anon ]
0000003e79600000 84K r-x– /lib64/libnsl-2.3.4.so
0000003e79615000 1020K —– /lib64/libnsl-2.3.4.so
0000003e79714000 4K r—- /lib64/libnsl-2.3.4.so
0000003e79715000 4K rw— /lib64/libnsl-2.3.4.so
0000003e79716000 8K rw— [ anon ]
0000007fbfff3000 52K rwx– [ stack ]
ffffffffff600000 4K r-x– [ anon ]
total 2497724K
pmap工具诠释了进程相关共享内存的情况,可以看到许多个16MB的"文件"对应了Oracle服务进程的空间地址.这是linux上POSIX风格的共享内存管理模式,使用"文件"形式包含共享内存段.
借助于将sga分割成许多块,Oracle可以很容易地把sga部分内存返回给OS,而服务器进程即可以利用到这些内存.(当memory_max_target>1024时,颗粒为16MB,否则为4MB).
接下来我们测试下Oracle是如何释放部分sga内存的.
对比实例启动前后:
启动前:
[oracle@rh2 ~]$ ls -l /dev/shm
总用量 0
启动后:
[oracle@rh2 ~]$ ls -l /dev/shm
总用量 1373704
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_0
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_1
-rw-r—– 1 oracle oinstall 0 9月 27 18:59 ora_T11_327680_10
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_100
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_101
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_102
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_103
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_104
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_105
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_106
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_107
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_108
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_109
-rw-r—– 1 oracle oinstall 0 9月 27 18:59 ora_T11_327680_11
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_110
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_111
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_112
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_113
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_114
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_115
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_116
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_117
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_118
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_119
-rw-r—– 1 oracle oinstall 0 9月 27 18:59 ora_T11_327680_12
可以看到启动后出现的16MB文件形式共享内存中部分大小为0,这些块被选出当发生内存交换时来被’destory’.使用pmap工具仍可以看到该部分影射,而实际上已经被Oracle释放了.
现在我们加大pga,观察其交换情况.
SQL> alter system set pga_aggregate_target=1900M ;
System altered.
[oracle@rh2 ~]$ ls -l /dev/shm
总用量 289984
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_0
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_1
-rw-r—– 1 oracle oinstall 0 9月 27 18:59 ora_T11_327680_10
-rw-r—– 1 oracle oinstall 0 9月 27 19:09 ora_T11_327680_100
-rw-r—– 1 oracle oinstall 0 9月 27 19:09 ora_T11_327680_101
-rw-r—– 1 oracle oinstall 0 9月 27 19:09 ora_T11_327680_102
-rw-r—– 1 oracle oinstall 0 9月 27 19:09 ora_T11_327680_103
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_104
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_105
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_106
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_107
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_108
-rw-r—– 1 oracle oinstall 16777216 9月 27 18:59 ora_T11_327680_109
-rw-r—– 1 oracle oinstall 0 9月 27 18:59 ora_T11_327680_11
-rw-r—– 1 oracle oinstall 0 9月 27 19:09 ora_T11_327680_110
-rw-r—– 1 oracle oinstall 0 9月 27 19:09 ora_T11_327680_111
-rw-r—– 1 oracle oinstall 0 9月 27 19:09 ora_T11_327680_112
-rw-r—– 1 oracle oinstall 0 9月 27 19:09 ora_T11_327680_113
-rw-r—– 1 oracle oinstall 0 9月 27 19:09 ora_T11_327680_114
-rw-r—– 1 oracle oinstall 0 9月 27 19:09 ora_T11_327680_115
-rw-r—– 1 oracle oinstall 0 9月 27 19:09 ora_T11_327680_116
-rw-r—– 1 oracle oinstall 0 9月 27 19:09 ora_T11_327680_117
-rw-r—– 1 oracle oinstall 0 9月 27 19:09 ora_T11_327680_118
-rw-r—– 1 oracle oinstall 0 9月 27 19:09 ora_T11_327680_119
-rw-r—– 1 oracle oinstall 0 9月 27 18:59 ora_T11_327680_12
-rw-r—– 1 oracle oinstall 0 9月 27 19:09 ora_T11_327680_120
-rw-r—– 1 oracle oinstall 0 9月 27 19:09 ora_T11_327680_121
可以看到出现了大量size为0的"文件",期许的交换出现了.
可见在11g中Oracle采用了新的共享内存实现方式,区别于旧的"一块式"共享段,更为灵活了.