如何查看你的环境是否是RAC环境? 如何判断你有哪些option?如何enable或者disable他们?

联系:QQ(5163721)

标题:如何查看你的环境是否是RAC环境? 如何判断你有哪些option?如何enable或者disable他们?

作者:Lunar©版权所有[文章允许转载,但必须以链接方式注明源地址,否则追究法律责任.]

前几天一个老同事问我,客户不想买RAC 的license了,怎么办?
因为当时他们有其他机器安装新环境,因此,我当时就说,直接装一个单机库,把数据库迁移过去,cluster_database改成false,再清理掉thread,undo,redo就ok了。。。

今天忽然想起来,如果客户不买partition选项了,想关闭这个怎么办?或者客户没有新机器再装一个ORACLE_HOME了,怎么办?
后面的我们就研究下:
首先我们可以使用OUI或者opatch去看已经安装了哪些选项(当然,还可以看数据库视图)

方法1: 使用OUI去review
./runInstaller
里面有一个 “Installed Products”,这个是你已经安装的产品

方法2:使用OPATCH

[oracle@lunar lib]$ opatch lsinventory -detail
Invoking OPatch 11.2.0.1.7

Oracle Interim Patch Installer version 11.2.0.1.7
Copyright (c) 2011, Oracle Corporation. All rights reserved.

Oracle Home : /u01/app/oracle/product/11.2.0.3/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /etc/oraInst.loc
OPatch version : 11.2.0.1.7
OUI version : 11.2.0.3.0
Log file location : /u01/app/oracle/product/11.2.0.3/dbhome_1/cfgtoollogs/opatch/opatch2013-11-12_05-43-12AM.log

Lsinventory Output file location : /u01/app/oracle/product/11.2.0.3/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2013-11-12_05-43-12AM.txt

——————————————————————————–
Installed Top-level Products (1):

Oracle Database 11g 11.2.0.3.0
There are 1 products installed in this Oracle Home.

Installed Products (136):

Agent Required Support Files 10.2.0.4.3
Assistant Common Files 11.2.0.3.0
Bali Share 1.1.18.0.0
Buildtools Common Files 11.2.0.3.0
Character Set Migration Utility 11.2.0.3.0
Cluster Verification Utility Common Files 11.2.0.3.0
Database Configuration and Upgrade Assistants 11.2.0.3.0
Database SQL Scripts 11.2.0.3.0
Database Workspace Manager 11.2.0.3.0
Deinstallation Tool 11.2.0.3.0
Enterprise Edition Options 11.2.0.3.0
Enterprise Manager Agent 10.2.0.4.3
Enterprise Manager Agent Core Files 10.2.0.4.4
Enterprise Manager Common Core Files 10.2.0.4.4
Enterprise Manager Common Files 10.2.0.4.3

。。。。。。。。。。。。。。。。。。。。。

Oracle中,option的enable或者disable的信息包含在 libknlopt.a 文件中(archive file),因此,可以查看这个文件是否包含了相应的对象文件(“.o”文件)来判断某个功能是enable状态,还是disable状态:
第一个环境,12.1的Standalone,查看下是否包含了ASM选件:

[root@lunar ~]# su – grid
[grid@lunar lib]$ env|grep ORA
ORACLE_SID=+ASM
ORACLE_BASE=/u01/app/grid
ORACLE_HOME=/u01/app/12.1/grid
[grid@lunar lib]$
[grid@lunar ~]$ cd $ORACLE_HOME/rdbms/lib
[grid@lunar lib]$ ar -t libknlopt.a | grep -c kfon.o
1
[grid@lunar lib]$

可见,这里已经enable了ASM

第二个环境,是11.2的单机文件系统数据库:

[oracle@lunar lib]$ ar -t libknlopt.a | grep -c kfon.o
0
[oracle@lunar lib]$ env|grep ORA
ORACLE_SID=bb
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1
[oracle@lunar lib]$ pwd
/u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib
[oracle@lunar lib]$
[oracle@lunar lib]$
显然,我这个环境没有ASM的动态库。

另外,之前大家一起讨论过关于RAC和单机上,软件的区别,这里你可以看到,enable RAC时,你应该有kcsm.o文件,而disable RAC选件的时候,你使用了 ksnkcs.o文件
我这个是12.1的Standalone环境,自然应该ASM option被安装,而RAC是没有被安装的:

[grid@lunar lib]$ ar -t libknlopt.a | grep -c kcsm.o —没有RAC选件
0
[grid@lunar lib]$ ar -t libknlopt.a | grep -c ksnkcs.o —–已经安装了ASM选件
1
[grid@lunar lib]$

下面列出一些常用OPTION对应的动态库的列表:

Oracle Partitioning kkpoban.o
Database Vault kzvidv.o
ASM kfon.o
Real Application Cluster kcsm.o
RAT kecwr.o

这里只是说是否安装了,如果查看是否运行了RAC,那很简单,只需要查看LMON进程: ps -ef|grep lmon

如果已经安装了一些选件,但是比如renew等问题,你需要disable某些选件,可以使用下面两种方法:
方法1:

+++++++++enable partition选项:
$ cd $ORACLE_HOME/rdbms/lib
$ make -f ins_rdbms.mk part_on ioracle

+++++++++Disable partition选项:
——-
$ cd $ORACLE_HOME/rdbms/lib
$ make -f ins_rdbms.mk part_off ioracle

+++++++enable RAC:
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk rac_on ioracle

+++++++disable RAC:
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk rac_ff ioracle

方法2:从11.2开始,可以使用chopt 命令完成,例如:
+++++++++enable partition选项:
$ chopt enable partitioning

+++++++++Disable partition选项:
$ chopt disable partitioning

先把数据库关闭,然后disable partition选项:

[oracle@lunar lsinv]$ cd $ORACLE_HOME/rdbms/lib
[oracle@lunar lib]$ ar -t libknlopt.a | grep -c kkpoban.o
1
[oracle@lunar lib]$
[oracle@lunar lib]$ chopt disable partitioning

Writing to /u01/app/oracle/product/11.2.0.3/dbhome_1/install/disable_partitioning.log…
/usr/bin/make -f /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/ins_rdbms.mk part_off ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1
/usr/bin/make -f /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/ins_rdbms.mk ioracle ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1

[oracle@lunar lib]$ ar -t libknlopt.a | grep -c kkpoban.o
0 +++++++++++=这里看到,已经没有partition选项了
[oracle@lunar lib]$

这是因为,它使用ar d选项将这个动态库从libknlopt.a 归档文件中把目标分区选项的文件 kkpoban.o 给删除了,详细日志如下:

[oracle@lunar ~]$ tail -f /u01/app/oracle/product/11.2.0.3/dbhome_1/install/disable_partitioning.log
/usr/bin/make -f /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/ins_rdbms.mk part_off ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1
/usr/bin/ar d /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/libknlopt.a kkpoban.o
/usr/bin/ar cr /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/libknlopt.a /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/ksnkkpo.o
/usr/bin/make -f /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/ins_rdbms.mk ioracle ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1
chmod 755 /u01/app/oracle/product/11.2.0.3/dbhome_1/bin

– Linking Oracle
rm -f /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/oracle
gcc -o /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/oracle -m64 -L/u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/ -L/u01/app/oracle/product/11.2.0.3/dbhome_1/lib/ -L/u01/app/oracle/product/11.2.0.3/dbhome_1/lib/stubs/ -Wl,-E /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/opimai.o /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/ssoraed.o /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/ttcsoi.o -Wl,–whole-archive -lperfsrv11 -Wl,–no-whole-archive /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/nautab.o /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/naeet.o /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/naect.o /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/naedhs.o /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/config.o -lserver11 -lodm11 -lcell11 -lnnet11 -lskgxp11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lclient11 -lvsn11 -lcommon11 -lgeneric11 -lknlopt `if /usr/bin/ar tv /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/libknlopt.a | grep xsyeolap.o > /dev/null 2>&1 ; then echo “-loraolap11” ; fi` -lslax11 -lpls11 -lrt -lplp11 -lserver11 -lclient11 -lvsn11 -lcommon11 -lgeneric11 `if [ -f /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/libavserver11.a ] ; then echo “-lavserver11” ; else echo “-lavstub11”; fi` `if [ -f /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/libavclient11.a ] ; then echo “-lavclient11” ; fi` -lknlopt -lslax11 -lpls11 -lrt -lplp11 -ljavavm11 -lserver11 -lwwg `cat /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnnz11 -lzt11 -lmm -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lztkg11 `cat /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnnz11 -lzt11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 `if /usr/bin/ar tv /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/libknlopt.a | grep “kxmnsd.o” > /dev/null 2>&1 ; then echo ” ” ; else echo “-lordsdo11”; fi` -L/u01/app/oracle/product/11.2.0.3/dbhome_1/ctx/lib/ -lctxc11 -lctx11 -lzx11 -lgx11 -lctx11 -lzx11 -lgx11 -lordimt11 -lclsra11 -ldbcfg11 -lhasgen11 -lskgxn2 -lnnz11 -lzt11 -lxml11 -locr11 -locrb11 -locrutl11 -lhasgen11 -lskgxn2 -lnnz11 -lzt11 -lxml11 -loraz -llzopro -lorabz2 -lipp_z -lipp_bz2 -lippdcemerged -lippsemerged -lippdcmerged -lippsmerged -lippcore -lippcpemerged -lippcpmerged -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lsnls11 -lunls11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lasmclnt11 -lcommon11 -lcore11 -laio `cat /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/sysliblist` -Wl,-rpath,/u01/app/oracle/product/11.2.0.3/dbhome_1/lib -lm `cat /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/sysliblist` -ldl -lm -L/u01/app/oracle/product/11.2.0.3/dbhome_1/lib
test ! -f /u01/app/oracle/product/11.2.0.3/dbhome_1/bin/oracle ||\
mv -f /u01/app/oracle/product/11.2.0.3/dbhome_1/bin/oracle /u01/app/oracle/product/11.2.0.3/dbhome_1/bin/oracleO
mv /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/oracle /u01/app/oracle/product/11.2.0.3/dbhome_1/bin/oracle
chmod 6751 /u01/app/oracle/product/11.2.0.3/dbhome_1/bin/oracle

再折腾回去吧:

[oracle@lunar lib]$ time chopt enable partitioning

Writing to /u01/app/oracle/product/11.2.0.3/dbhome_1/install/enable_partitioning.log…
/usr/bin/make -f /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/ins_rdbms.mk part_on ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1
/usr/bin/make -f /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/ins_rdbms.mk ioracle ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1

real 2m31.104s
user 0m7.656s
sys 0m9.109s
[oracle@lunar lib]$
[oracle@lunar lib]$ cat /u01/app/oracle/product/11.2.0.3/dbhome_1/install/enable_partitioning.log
/usr/bin/make -f /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/ins_rdbms.mk part_on ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1
/usr/bin/ar d /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/libknlopt.a ksnkkpo.o
/usr/bin/ar cr /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/libknlopt.a /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/kkpoban.o
/usr/bin/make -f /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/ins_rdbms.mk ioracle ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1
chmod 755 /u01/app/oracle/product/11.2.0.3/dbhome_1/bin

– Linking Oracle
rm -f /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/oracle
gcc -o /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/oracle -m64 -L/u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/ -L/u01/app/oracle/product/11.2.0.3/dbhome_1/lib/ -L/u01/app/oracle/product/11.2.0.3/dbhome_1/lib/stubs/ -Wl,-E /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/opimai.o /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/ssoraed.o /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/ttcsoi.o -Wl,–whole-archive -lperfsrv11 -Wl,–no-whole-archive /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/nautab.o /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/naeet.o /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/naect.o /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/naedhs.o /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/config.o -lserver11 -lodm11 -lcell11 -lnnet11 -lskgxp11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lclient11 -lvsn11 -lcommon11 -lgeneric11 -lknlopt `if /usr/bin/ar tv /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/libknlopt.a | grep xsyeolap.o > /dev/null 2>&1 ; then echo “-loraolap11” ; fi` -lslax11 -lpls11 -lrt -lplp11 -lserver11 -lclient11 -lvsn11 -lcommon11 -lgeneric11 `if [ -f /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/libavserver11.a ] ; then echo “-lavserver11” ; else echo “-lavstub11”; fi` `if [ -f /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/libavclient11.a ] ; then echo “-lavclient11” ; fi` -lknlopt -lslax11 -lpls11 -lrt -lplp11 -ljavavm11 -lserver11 -lwwg `cat /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnnz11 -lzt11 -lmm -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lztkg11 `cat /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnnz11 -lzt11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 `if /usr/bin/ar tv /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/libknlopt.a | grep “kxmnsd.o” > /dev/null 2>&1 ; then echo ” ” ; else echo “-lordsdo11”; fi` -L/u01/app/oracle/product/11.2.0.3/dbhome_1/ctx/lib/ -lctxc11 -lctx11 -lzx11 -lgx11 -lctx11 -lzx11 -lgx11 -lordimt11 -lclsra11 -ldbcfg11 -lhasgen11 -lskgxn2 -lnnz11 -lzt11 -lxml11 -locr11 -locrb11 -locrutl11 -lhasgen11 -lskgxn2 -lnnz11 -lzt11 -lxml11 -loraz -llzopro -lorabz2 -lipp_z -lipp_bz2 -lippdcemerged -lippsemerged -lippdcmerged -lippsmerged -lippcore -lippcpemerged -lippcpmerged -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lsnls11 -lunls11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lasmclnt11 -lcommon11 -lcore11 -laio `cat /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/sysliblist` -Wl,-rpath,/u01/app/oracle/product/11.2.0.3/dbhome_1/lib -lm `cat /u01/app/oracle/product/11.2.0.3/dbhome_1/lib/sysliblist` -ldl -lm -L/u01/app/oracle/product/11.2.0.3/dbhome_1/lib
test ! -f /u01/app/oracle/product/11.2.0.3/dbhome_1/bin/oracle ||\
mv -f /u01/app/oracle/product/11.2.0.3/dbhome_1/bin/oracle /u01/app/oracle/product/11.2.0.3/dbhome_1/bin/oracleO
mv /u01/app/oracle/product/11.2.0.3/dbhome_1/rdbms/lib/oracle /u01/app/oracle/product/11.2.0.3/dbhome_1/bin/oracle
chmod 6751 /u01/app/oracle/product/11.2.0.3/dbhome_1/bin/oracle
[oracle@lunar lib]$

注意最后一行,总有人弄不清楚oracle的执行权限, 6751,记住了吧,O(∩_∩)O哈哈~

此条目发表在 FAQ, RAC 分类目录,贴了 , , 标签。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注