[Contents] [Index] [Info] [Previous] [Next]

APPENDIX B. Sample ORASRV_NETV2 Command Procedure

This appendix shows the contents of the ORASRV_NETV2_COM.SAMPLE file.

You can find a copy of this file in the TNS_ADMIN directory.

Use this sample file as a base for creating an ORASRV_NETV2 command procedure which contains correct information about your database environment.

$! NAME: ORASRV_NETV2.COM sample file 
$! 
$! USAGE: In (PROGRAM=...) argument in LISTENER.ORA 
$! 
$! FUNCTION: Setup environment for RDBMS shadow processes and start them for 
$!           SQL*Net V2
$!
$! MODIFIED:
$!  SRavindh  07/30/97 - Set default to trace directory to create trace files
$!  Rgutherz  07/28/97 - Add authentication support 
$!  Rgutherz  06/24/97 - Change process name for PRESPAWN/DEDICATED server proc
$!  Rgutherz  06/24/97 - Grant all privileges needed to server process
$!  DSchwab   08/03/96 - rewritten (using suggestions from DHayter)
$!________________________________________________________________________________
$ on error then goto CLEANUP
$! This file serves as a template for the actual file that will be created on a  
$! per instance basis to setup environment for, and startup RDBMS shadow  
$! processes for SQL*Net V2 connections. 
$! 
$! Name of the actual .COM file will be specified in (PROGRAM='...') name-value
$! pair in the SID entry of LISTENER.ORA. 
$! 
$! To create ORASRV_NETV2.COM files for different databases, edit the following 
$! lines to substitute the SID of the database and its administration directory.
$!________________________________________________________________________________$ ora_db = "database administration directory" 
$ sid    = "sid name" 
$ dbname = "database name" 
$! 
$ define/job/nolog ora_sid 'sid' 
$ lnm = "ORA_RDBMS_LNM_"+sid 
$! 
$! When a database is started up, Server Manager creates and populates 
$! a logical name table ORA_RDBMS_LNM_<sid>.  If this logical name 
$! table doesn't (yet) exist then pick up the required logical names 
$! from the ORAUSER_<dbname>.COM command procedure.  This should only be 
$! the case if the database has not yet been started. 
$! 
$! If the logical name table DOES exist, then it should contain all of 
$! the logicals required for the server process to access message files 
$! etc. 
$! 
$ lnmx = f$trnlnm(lnm,"LNM$SYSTEM_DIRECTORY",,,,"TABLE") 
$ if lnmx 
$ then 
$   ora_rdbms = f$trnlnm("ORA_RDBMS",lnm) 
$   if ora_rdbms .eqs. "" then lnmx = "FALSE" 
$ endif 
$ if lnmx 
$ then 
$   if f$trnlnm("ORA_SYSTEM",lnm) .eqs. "" then define ora_system 'ora_rdbms' 
$   if f$trnlnm("ORA_PLSQL", lnm) .eqs. "" then define ora_plsql  'ora_rdbms' 
$   lnm = lnm + "," 
$ else 
$   v1 = f$verify(0)   ! We don't want to see ORAUSER stuff 
$   @'ora_db'orauser_'dbname'   ! Pick up the logicals this way 
$   v2 = f$verify(v1)  ! Switch VERIFY back on if it was originally on 
$   lnm = ""           ! Blank out logical name table 
$ endif 
$! 
$ old_priv = f$setprv{"PRMMBX,LOG_IO,TMPMBX,NETMBX,SYSNAM,DETACH,CMKRNL,WORLD")
$!
$ orasrv := $ORA_RDBMS:SRV.EXE 
$! 
$! Form name of our logical name table 
$! 
$ pid = f$getjpi("", "PID") 
$ tab = "TNS_" + pid 
$ define/table=lnm$process_directory lnm$file_dev - 
         'lnm''tab',lnm$process,lnm$job,lnm$group,lnm$system 
$ arg1 = f$trnlnm("arg1") 
$ arg2 = f$trnlnm("arg2") 
$ arg3 = f$trnlnm("arg3") 
$ arg4 = f$trnlnm("arg4") 
$ arg5 = f$trnlnm("arg5") 
$ arg6 = f$trnlnm("arg6") 
$ arg7 = f$trnlnm("arg7") 
$ arg8 = f$trnlnm("arg8") 
$!
$! _______________________________________________________________________________
$! 
$! Execute the Authentication command scripts, if present
$ oraroot = f$trnlnm("ORA_NETWORK") - "NETWORK]"
$ if f$search("''ORAROOT'netconfig]SECURID_USER.COM") .nes. "" then -
    @'ORAROOT'netconfig]SECURID_USER.COM
$ if f$search("''ORAROOT'netconfig]KERBEROS_USER.COM") .nes. "" then -
    @'ORAROOT'netconfig]KERBEROS_USER.COM
$!
$!
$! Check/Change process name (Rgutherz)
$! Check for prespawn/dedicated server process
$ len = f$length(arg1)
$ if f$locate("prespawn",arg1) .ne. len
$ then
$  type = "P"
$ else
$  type = "C"
$ endif
$ sname = f$edit(sid,"upcase")
$!
$ i = 1
$retry
$  if i .gt. 100
$  then
$    write sys$output "Error changing process name after 100 times"
$    exit
$  endif
$  on error then goto retry
$  time = f$time()
$  time = f$cvtime(time)
$  time = f$extract(17,5,time)
$  time = time - "."
$  i = i + 1
$  set process/name="ORA_''sname'''type'''time'"
$  on error then goto CLEANUP
$!
$! Set default to trace directory
$ oranetwork = f$trnlnm("ORA_NETWORK") - "]"
$ set default 'oranetwork'.TRACE]
$
$ if arg1 .eqs. "" 
$ then 
$   orasrv "(LOCAL=NO)" 
$ else 
$   orasrv 'arg1' 'arg2' 'arg3' 'arg4' 'arg5' 'arg6' 'arg7' 'arg8' 
$ endif 
$! 
$ CLEANUP:
$ sts = $status
$!
$ if sts .ne. 1
$ then
$  status = sts
$  trace_dir = ora_db - "]" + ".trace]
$  open/write trace_file 'trace_dir'orasrv_netv2_'pid'.trc
$  write trace_file "This trace file was generated by ORASRV_NETV2_''sid'.COM"
$  write trace_file "exit with STATUS - ''status'"
$  msg = f$message("''status'")
$  write trace_file "''msg'"
$  close trace_file
$ endif
$!
$ on error then continue 
$ deassign/user/table=lnm$system_directory 'tab' 
$ exit 'sts'


[Contents] [Index] [Info] [Previous] [Next]