上一步我们解决了无法创建连接的问题,这次我们面对的是用户名、密码的问题。
ORA-01031: insufficient privileges是一个多发的错误,最常见的原因就是没有密码文件。
在11.2 Grid环境中,关于密码文件我们需要注意两点:
在11.2之前,ASM实例、RDBMS实例的密码文件命名格式为orapw[sid],比如像orapw+ASM1、orapw+ASM2、orapwwxxrdb2这样。
从11,2开始,密码文件不再是这样的了,而是orapw[dbname]这样的了,就是orapw+ASM、orapwwxxrdb。
因此,我们需要给ASM、RDBMS两个数据库都准备密码文件。
[grid@indexserver2 dbs]$ orapwd file=orapw+ASM password=Yourpassword entries=5
[oracle@indexserver2 dbs]$ orapwd file=orapwwxxrdb password=Yourpassword entries=5
其次,要注意这两个密码文件的位置。密码文件用于特权用户的特权连接,需要放在监听器能够找到的地方,Oracle 11.2之前的RAC中只有一个监听器,即DB的$ORACLE_HOME下的监听器。而11.2 RAC中,监听器被前移到Grid的$ORACLE_HOME下,因此要保证监听器能够找到密码文件。可以把两个密码文件都拷贝到$GRID_HOME/dbs目录下。
我们再来试试
[oracle@indexserver1 bin]$ emca -config dbcontrol db -repos create -cluster ... ... SEVERE: null Refer to the log file at /u01/app/oracle/cfgtoollogs/emca/wxxrdb/emca_2012_07_06_14_05_57.log for more details. Could not complete the configuration. Refer to the log file at /u01/app/oracle/cfgtoollogs/emca/wxxrdb/emca_2012_07_06_14_05_57.log for more details
这次两个ORA错误都没有了,但是日志最后显示配置并不成功。
这回又出什么幺蛾子了,我们看看这个日志文件吧:
CONFIG: Path: /u01/app/oracle/11.2.0.2/database/indexserver2_wxxrdb found in oracleHomeCache. Shared: false Jul 6, 2012 2:18:47 PM oracle.sysman.emcp.util.ClusterUtil getLocalNode CONFIG: isLocalNodeDone: true localNode: indexserver1 Jul 6, 2012 2:18:48 PM oracle.sysman.emcp.EMConfig perform SEVERE: null Refer to the log file at /u01/app/oracle/cfgtoollogs/emca/wxxrdb/emca_2012_07_06_14_05_57.log for more details. Jul 6, 2012 2:18:48 PM oracle.sysman.emcp.EMConfig perform CONFIG: Stack Trace: java.lang.NullPointerException at oracle.cluster.deployment.ractrans.ClientHandlerSupervisor.broadcastCommand(ClientHandlerSupervisor.java:678) at oracle.cluster.deployment.ractrans.RACTransferCore.sendDummyStructureToNodes(RACTransferCore.java:474) at oracle.cluster.deployment.ractrans.RACTransfer.transferDirStructureToNodes(RACTransfer.java:718) at oracle.cluster.deployment.ractrans.RACTransfer.transferDirToNodes(RACTransfer.java:253) at oracle.ops.mgmt.cluster.ClusterCmd.transferDirToNodes(ClusterCmd.java:2543) at oracle.ops.mgmt.cluster.ClusterCmd.transferDirToNodes(ClusterCmd.java:2448) at oracle.sysman.emcp.util.ClusterUtil.copyDirs(ClusterUtil.java:242) at oracle.sysman.emcp.util.ClusterUtil.copyDirsToCluster(ClusterUtil.java:350) at oracle.sysman.emcp.EMAgentConfig.deployStateDirs(EMAgentConfig.java:4739) at oracle.sysman.emcp.EMAgentConfig.instantiateEMConfigFiles(EMAgentConfig.java:3937) at oracle.sysman.emcp.EMAgentConfig.updateAgentConfigFiles(EMAgentConfig.java:3477) at oracle.sysman.emcp.EMAgentConfig.performConfiguration(EMAgentConfig.java:1465) at oracle.sysman.emcp.EMAgentConfig.invoke(EMAgentConfig.java:300) at oracle.sysman.emcp.EMAgentConfig.invoke(EMAgentConfig.java:278) at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:259) at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:599) at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1482) at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:583) at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:529)
说实话,凭我这可怜的Java经验来说,从这个NullPointerException没看出任何有价值的线索。索性,我还有一招——推到重来。
我怀疑之前犯错、改错、再犯、再改的过程中,难免有什么误操作,有什么不干净的东西留下。
[oracle@indexserver1 bin]$ emca -deconfig dbcontrol db -repos drop -cluster ... INFO: Repository successfully dropped Enterprise Manager configuration completed successfully FINISHED EMCA at Jul 6, 2012 2:35:01 PM
[oracle@indexserver1 bin]$ emca -config dbcontrol db -repos create -cluster WARNING: Error executing /u01/app/oracle/11.2.0.2/database/bin/emctl config emkey -repos -host indexserver1 -sid wxxrdb Jul 6, 2012 2:48:54 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole WARNING: Configuring EM-Key failed for node indexserver1. Jul 6, 2012 2:52:24 PM oracle.sysman.emcp.util.PlatformInterface executeCommand WARNING: Error executing /u01/app/oracle/11.2.0.2/database/bin/emctl config emkey -repos -host indexserver2 -sid wxxrdb Jul 6, 2012 2:52:24 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole WARNING: Configuring EM-Key failed for node indexserver2. Jul 6, 2012 2:55:54 PM oracle.sysman.emcp.util.PlatformInterface executeCommand WARNING: Error executing /u01/app/oracle/11.2.0.2/database/bin/emctl config emkey -repos -host indexserver3 -sid wxxrdb Jul 6, 2012 2:55:54 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole WARNING: Configuring EM-Key failed for node indexserver3. Jul 6, 2012 2:55:54 PM oracle.sysman.emcp.EMDBPostConfig setRACWarnMsg INFO: Error securing Database Control. Database Control has not been brought-up on nodes indexserver1 indexserver2 indexserver3 . Execute the following command(s) on nodes: indexserver1 indexserver2 indexserver3 . 1) Set the environment variable ORACLE_UNQNAME to Database unique name 2) /u01/app/oracle/11.2.0.2/database/bin/emctl config emkey -repos -sysman_pwd < Password for SYSMAN user > -host <node> -sid < Database unique name > 3) /u01/app/oracle/11.2.0.2/database/bin/emctl secure dbconsole -sysman_pwd < Password for SYSMAN user > -host <node> -sid < Database unique name > 4) /u01/app/oracle/11.2.0.2/database/bin/emctl start dbconsole To secure Em Key, run /u01/app/oracle/11.2.0.2/database/bin/emctl config emkey -remove_from_repos -sysman_pwd < Password for SYSMAN user > Jul 6, 2012 2:55:54 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration INFO: >>>>>>>>>>> The Database Control URL is http://indexserver1:1158/em <<<<<<<<<<< Jul 6, 2012 2:55:54 PM oracle.sysman.emcp.EMDBPostConfig showClusterDBCAgentMessage INFO: **************** Current Configuration **************** INSTANCE NODE DBCONTROL_UPLOAD_HOST ---------- ---------- --------------------- wxxrdb indexserver1 indexserver1 wxxrdb indexserver2 indexserver1 wxxrdb indexserver3 indexserver1 Error securing Database Control. Database Control has not been brought-up on nodes indexserver1 indexserver2 indexserver3 . Execute the following command(s) on nodes: indexserver1 indexserver2 indexserver3 . 1) Set the environment variable ORACLE_UNQNAME to Database unique name 2) /u01/app/oracle/11.2.0.2/database/bin/emctl config emkey -repos -sysman_pwd < Password for SYSMAN user > -host <node> -sid < Database unique name > 3) /u01/app/oracle/11.2.0.2/database/bin/emctl secure dbconsole -sysman_pwd < Password for SYSMAN user > -host <node> -sid < Database unique name > 4) /u01/app/oracle/11.2.0.2/database/bin/emctl start dbconsole To secure Em Key, run /u01/app/oracle/11.2.0.2/database/bin/emctl config emkey -remove_from_repos -sysman_pwd < Password for SYSMAN user >