Re: SQL*Net: creating a seamless environment

From: Tony Jambu <aaj_at_cmutual.com.au>
Date: Tue, 19 Jan 1993 22:44:06 GMT
Message-ID: <1993Jan19.224406.6263_at_cmutual.com.au>


In article <1993Jan18.212420.9517_at_ra.msstate.edu>, fwp_at_Jester.CC.MsState.Edu (Frank Peters) writes:
> Hello,
>
> I hope I'm missing something obvious here and someone can help me.
>
> We have two sun4 servers, Ra and Isis. Ra has an oracle database
> (version 6.0.33 if it matters) and sql*net running on it. From
> Isis I can connect to the database on Ra using T:Ra:oracle_sid
> with no problems.
>
> My goal is to make these two systems as seamlessly identical as
> possible. That is, I would like to be able to configure a user's
> environment on the two systems (which share common home directories)
> so that a user can log on to either system, type sqlplus (or whatever)
> and be connected to the academic database without worrying about
> which host s/he is on and which host the database is on.
>
> I've played with ORACLE_SID values and /etc/oratab files and the
> like to no availe and I can't find anything documented in the
> administrator's guide or the Sun4 installation and users guide.
>
> Is there some combination of user environment variables that will
> let me set this up? Or must I tell my users to invoke sqlplus
> differently depending upon which host they connect to?
>
> Thanks in advance for any suggestions.
>
> Frank Peters
> --
> Frank Peters - UNIX Systems Programmer - Mississippi State University
> Internet: fwp_at_CC.MsState.Edu - Phone: (601)325-7030 - FAX: (601)325-8921

Frank,

There is no automated way of achieving what you need. I have similar requirements as you have but it is related to DBA administration duties rather than application.

What I have done is to create my own /etc/oratab table/file call '/usr/local/etc/ora_admin_tab' which holds all the information required to carry out my duties. A sample of the file is included at the end of this mail.

I then have my own utility to get the full path name of the database ie Protocol:MachName:SID (T:Ra:oracle_SID) from this '/usr/local/etc/ora_admin_tab' file. The name of the utility is called 'get_DBnetpath' and its executed is shown below.

[1] % get_DBnetpath SID_A
T:Isis:SID_A
[2] %

What we do is then modify or create a new coraenv or oraenv such that it sets up the TWO_TASK with this string so that you never need to know where the database is held.

I am sure there are other ways of carrying out your objective and would like to
hear other solutions. My objective was to store all this information into one table and write scripts to extract them out.

  • ATTACHMENTS ===============================
FILE = /usr/local/etc/ora_admin_tab
---BEGIN CUT---
# Filemname     : ora_admin_tab        (C) 1990
# Usage         : Look up table.  Not an excutable file.
# Author        : Anthony A. Jambu
# Date          : Sometime in 1990
# Purpose       : This is a look up file for the purpose of Oracle
#                   administration.
# Description   :
# This file contains the Oracle SID, its path and the permissions or options
# available to Oracle for system adminstration functions.
# Each column represents a function to be carried out.
#
# FORMAT    =
#    ORACLE_SID:SQL*Net_Protocol:Mach:BU_exp:BU_arch:BU_script:Mon_Alert:
# where ORACLE_SID= The SQL*Net Protocol eg T for TCP/IP
#       SQL*Net   = The server path
#       Mach      = The host machine for the database
#       Run_Report= Run nightly reports [Y,N]
#       Validate_Idx = Validate All Indexes [Y,N]
#       BU_exp    = Backup Export files [Y,N]
#       BU_arch   = Backup Archive files [Y,N]
#       BU_script = Backup Create Scripts files [Y,N]
#       Mon_Alert = Monitor Alertfile [Y,N]
#       FileSystem= File System where the DB is on eg /PRD or /DDB
#       Stat_Snap = Capture V$.. statistics
# ORACLE_SID                    = The SQL*Net Protocol eg T for TCP/IP
# |   SQL*Net                   = The server path
# |   |  Mach                   = The host machine for the database
# |   |  |  Run_Report          = Run nightly reports [Y,N]
# |   |  |   | Validate_Idx     = Validate All Indexes [Y,N]
# |   |  |   | | BU_exp         = Backup Export files [Y,N]
# |   |  |   | | | BU_arch      = Backup Archive files [Y,N]
# |   |  |   | | | | BU_script  = B/U Create Scripts files [Y,N]
# |   |  |   | | | | | Mon_Alert = Monitor Alertfile [Y,N]
# |   |  |   | | | | | |  FileSystem= F/Sys where the DB is on eg /PRD or /DDB
# |   |  |   | | | | | |  |    Stat_Snap=Collect V$ stats
# |   |  |   | | | | | |  |    |
# |   |  |   | | | | | |  |    |
# |   |  |   | | | | | |  |    |
# v   v  v   v v v v v v  v    v
SID_A:T:Isis:Y:Y:N:N:N:Y:/SID_A:Y
SID_1:T:Isis:Y:Y:N:N:N:Y:/usr/DB/SID_1:Y
SID_B:T:Ra:Y:Y:N:N:N:Y:/SID_B:Y
SID_2:T:Ra:Y:Y:N:N:N:Y:/SID_2:Y
---END CUT --- FILE = get_DBnetpath
---BEGIN CUT ---
#!/bin/sh
# Filemname     : get_DBnetpath        CM Investement Management - (C) 1991
# Usage         : get_DBnetpath [ORACLE_SID]
# Description   :_at_(#)Returns the full Oracle DB path for the SID supplied or
the
#               current SID if no argument is supplied.
#
# Author        : Anthony A. Jambu
# Date          : Sat Jul 13 21:09:48 EST 1991


trap 'echo "$0 ABORTED!!!";exit 1' 1 2 3 9 13 15

# ------------ INITIALISATION ------------ USAGE="Usage: $0 [-?|-h] [ORACLE_SID]"
_ORACLE_SID=${ORACLE_SID}
oraadmin_file=/usr/local/etc/ora_admin_tab DB_field='$1'
Protocol_field='$2'
MachName_field='$3'
dbpath=''

# What are the parameters if any
if test $# -ne 0
then

    if test "$1" = "-h" -o "$1" = "-?"
    then

        echo $USAGE
        exit 0

    fi
    _ORACLE_SID=$1
fi

# Get the path now
dbpath=`awk -F: '/^'$_ORACLE_SID'/ \

        { printf ("%s:%s:%s\n", '$Protocol_field', '$MachName_field', $1) } ' \

        $oraadmin_file`

if test -z "$dbpath"
then

    exit 1
else

    echo $dbpath
    exit 0
fi
---END CUT ---

-- 
 _____       ________ / ____ |Tony Jambu, Database Administrator
  /_  __       /_ __ /       |Colonial Mutual Invest Mgmt Aust (ACN 004021809)
 /(_)/ ((_/ \_/(///(/_)/_(   |EMAIL:  TJambu_at_cmutual.com.au
 \_______/                   |PHONE:  +61-3-6418448       FAX:  +61-3-6076198
Received on Tue Jan 19 1993 - 23:44:06 CET

Original text of this message