wrx0815 发表于 2013-12-19 14:26:07

关于srvctl命令的理解

本帖最后由 wrx0815 于 2013-12-19 14:26 编辑



关于srvctl命令,大多数人和我应够都只停留在命令的使用上,但在RAC环境下,它和直接对实例的操作有什么具体的区别呢?特想maclean请教一下。也是最近发现了一个现象。
我的测试环境是10.2.0.1,RAC和单点都是这样。

当我使用 srvctl 命令启动RAC端的监听时,在单点上通过 tnsnames 中的连接字符串却无法正常连接到数据库。我使用的是:
RACDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))
    (FAILOVER=YES)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = RACDB)
    )
  )

报错提示 no listener,但我使用lsnrctl命令启动每个节点监听后,单点通过tnsnames却可以正常连接数据库,每次连接都成功。

我自己没想明白为什么,srvctl 命令执行的时候,到底做了哪些工作?

Liu Maclean(刘相兵 发表于 2013-12-19 15:23:11

你可以理解为 srvctl  做了组合拳, 具体如何组合的 你可以参考crsd.log

wrx0815 发表于 2013-12-19 15:39:21

Liu Maclean(刘相兵 发表于 2013-12-19 15:23 static/image/common/back.gif
你可以理解为 srvctl  做了组合拳, 具体如何组合的 你可以参考crsd.log

一下是抓到的 srvctl 组合拳内容:
/u01/crs1020/jdk/jre/bin/java -classpath /u01/crs1020/jlib/netcfg.jar:/u01/crs1020/jdk/jre/lib/rt.jar:/u01/crs1020/jdk/jre/lib/i18n.jar:/u01/crs1020/jlib/srvm.jar:/u01/crs1020/jlib/srvmhas.jar:/u01/crs1020/jlib/srvmasm.jar:/u01/crs1020/srvm/jlib/srvctl.jar -DTRACING.ENABLED=true -DTRACING.LEVEL=2 oracle.ops.opsctl.OPSCTLDriver start listener -n rac2
  tracing is true at level 2 to file null
  Security manager is set
  parsing cmdline args
  parsing 2-word cmdline
  Going into GetActiveNodes constructor...
  Module init : 16
  Local Module init : 19
  Created instance of Library.
  Loading libsrvmhas10.so...
  oracleHome null
  Loading  library srvmhas10 from path=
/u01/crs1020/jdk/jre/lib/i386/client:/u01/crs1020/jdk/jre/lib/i386:/u01/crs1020/jdk/jre/../lib/i386:/u01/crs1020/lib32:/u01/crs1020/srvm/lib32:/u01/crs1020/lib:/u01/crs1020/srvm/lib:
  Loaded library srvmhas10 from path=
/u01/crs1020/jdk/jre/lib/i386/client:/u01/crs1020/jdk/jre/lib/i386:/u01/crs1020/jdk/jre/../lib/i386:/u01/crs1020/lib32:/u01/crs1020/srvm/lib32:/u01/crs1020/lib:/u01/crs1020/srvm/lib:
  prsr_trace: no lsf ctx, line=Native: allocHASContext
  
allocHASContext: Came in
  

wrx0815 发表于 2013-12-19 15:39:39

allocHASContext: META context
  
allocHASContext: LSF context
  prsr_trace: Native: prsr_initCLSS

  
allocHASContext: CLSS context
  
allocHASContext: retval
  HAS Context Allocated: 1 to oracle.ops.mgmt.has.ClusterUtil@8a0d5d
  ClusterUtil Instance created
  ClusterUtil m_bSKGXN=true
  prsr_trace: Native: getLocalNodeName

  prsr_trace: Native: getLocalNodeName:nodenumber: 1

  prsr_trace: Native: getLocalNodeName:nodename: rac1

  prsr_trace: Native: getNodeNames

  prsr_trace: Native: getNodeNames:number of nodes: 2

  prsr_trace: Native: getNodeNames:node 1 is alive k = 0

  prsr_trace: Native: getNodeNames:1 nodename: rac1

  prsr_trace: Native: getNodeNames:node 2 is alive k = 1

  prsr_trace: Native: getNodeNames:2 nodename: rac2

wrx0815 发表于 2013-12-19 15:39:56

  Inside GetActiveNodes :rac1
  Started clusterware daemon thread
  Out of GetActiveNodes constructor.
  srvctl: nodes in cluster:
  srvctl: node 0: rac1
  srvctl: node 1: rac2
  executing srvctl command
  executing 2-word command verb=3 noun=107
  in constructor with rac2
  Creating listener with node name as rac2 and resource name as ora.rac2.LISTENER_RAC2.lsnr and listener name as LISTENER_RAC2
  Trying to find the status of ora.rac2.LISTENER_RAC2.lsnr on node rac2
  Setting to be a synchronized operation
  Module init : 6
  Local Module init : 4
  prsr_trace: Native: allocHASContext

  
allocHASContext: Came in
  prsr_trace: Native: prsr_initSCLS

  
allocHASContext: SCLS context
  
allocHASContext: retval
  HAS Context Allocated: 2 to oracle.ops.mgmt.has.Util@1ccb029
  Util Instance created.
  prsr_trace: Native: getCRSHome

  prsr_trace: Native: getCRSHome crs_home=/u01/crs1020(**)

wrx0815 发表于 2013-12-19 15:40:13

  /u01/crs1020
  getCRSHome: ret=/u01/crs1020
  CRS_HOME: /u01/crs1020
  Checking an existence of CRS command
  SyncBufferFull:Acquire called by thread GetActiveNodesThread m_count=0
  Finding the status of ora.rac2.LISTENER_RAC2.lsnr on rac2
  LocalCommand.execute: Calling run method
  Executing the HA operation /u01/crs1020/bin/crs_statora.rac2.LISTENER_RAC2.lsnr
  CRS cmd is: /u01/crs1020/bin/crs_stat -u ora.rac2.LISTENER_RAC2.lsnr
  Calling Runtime.exec() with the command
  /u01/crs1020/bin/crs_stat
  -u
  ora.rac2.LISTENER_RAC2.lsnr
  In StreamReader.run
  runCommand: Waiting for the process
  runCommand: process returns 0
  In StreamReader.run
  OUTPUT>NAME=ora.rac2.LISTENER_RAC2.lsnr
  OUTPUT>TYPE=application
  OUTPUT>TARGET=OFFLINE
  OUTPUT>STATE=OFFLINE
  OUTPUT>
  RunTimeExec: output>
  NAME=ora.rac2.LISTENER_RAC2.lsnr
  TYPE=application
  TARGET=OFFLINE
  STATE=OFFLINE
  
  RunTimeExec: error>
  Returning from RunTimeExec.runCommand
  set status OK
  Returned from executing the HA Operation
  OUTPUT> NAME=ora.rac2.LISTENER_RAC2.lsnr
  OUTPUT> TYPE=application
  OUTPUT> TARGET=OFFLINE
  OUTPUT> STATE=OFFLINE
  OUTPUT>
  ERROR>
  LocalCommand.execute: Returned from run method
  got status: resource=ora.rac2.LISTENER_RAC2.lsnrtarget=OFFLINE status=OFFLINE host=null
  online status of ora.rac2.LISTENER_RAC2.lsnr on rac2 is false
  Running new start ..
  Setting to be a synchronized operation
  Module init : 6
  Local Module init : 0
  HAS Context Allocated: 3 to oracle.ops.mgmt.has.Util@1764be1
  Util Instance created.
  prsr_trace: Native: getCRSHome

wrx0815 发表于 2013-12-19 15:40:33

  prsr_trace: Native: getCRSHome crs_home=/u01/crs1020(**)

  /u01/crs1020
  getCRSHome: ret=/u01/crs1020
  CRS_HOME: /u01/crs1020
  Checking an existence of CRS command
  Starting service for ora.rac2.LISTENER_RAC2.lsnr on rac2
  LocalCommand.execute: Calling run method
  Executing the HA operation /u01/crs1020/bin/crs_startora.rac2.LISTENER_RAC2.lsnr
  CRS cmd is: /u01/crs1020/bin/crs_start ora.rac2.LISTENER_RAC2.lsnr -f
  Calling Runtime.exec() with the command
  /u01/crs1020/bin/crs_start
  ora.rac2.LISTENER_RAC2.lsnr
  -f
  In StreamReader.run
  runCommand: Waiting for the process
  In StreamReader.run
  OUTPUT>Attempting to start `ora.rac2.LISTENER_RAC2.lsnr` on member `rac2`
  OUTPUT>Start of `ora.rac2.LISTENER_RAC2.lsnr` on member `rac2` succeeded.
  runCommand: process returns 0
  RunTimeExec: output>
  Attempting to start `ora.rac2.LISTENER_RAC2.lsnr` on member `rac2`
  Start of `ora.rac2.LISTENER_RAC2.lsnr` on member `rac2` succeeded.
  RunTimeExec: error>
  Returning from RunTimeExec.runCommand
  set status OK
  Returned from executing the HA Operation
  OUTPUT> Attempting to start `ora.rac2.LISTENER_RAC2.lsnr` on member `rac2`
  OUTPUT> Start of `ora.rac2.LISTENER_RAC2.lsnr` on member `rac2` succeeded.
  ERROR>
  LocalCommand.execute: Returned from run method
页: [1]
查看完整版本: 关于srvctl命令的理解