Install  On Cygwin

Home Up

 



Install Cygwin
How to add shortcuts to your environment


Smenu run smoothly under Windows. It is even now the reference platform for its development.
The following page describe the full installation of Smenu under Windows using Cygwin.   To  perform the installation
We fiirst need to install Cygwin

 Installation procedure for cygwin

Install Cygwin

  -Go to http://www.cygwin.com, download 'setup.exe', run it.

  -You need the default download plus:

If you don't find the package (noticed it sometime disapear), just edit you .bashrc in your home directory and add the line:
  
bulletExpand category 'text' and select  'more' pkg      
bulletExpand category Shells and select 'pdksh' pkg
bulletExpand  category Editor and Select 'Vim'
     -Start the download install.
     -After the download is done, right  click on the icon 'Cygwin' to get the properties  and in the options add 'quick edit'.
       This is in fact the cut and paste of the mouse

    -Setup.exe has put an icon on your desktop: launch cygwin.

        Now congrats, you are in a Unix type shell on windows.
        type :

mkdir -p /usr/local/bin
 
     If you are not administrator of the windows box, you may have to issue a issue a chmod 755 on sqlplus binary and tnsping
    The preferred location to install Smenu will be /opt/smenu, so we put tar fil in /opt .

        tar xvf ./smenu_tar10g.tar

This create a directory ./smenu, and 3 files :

       -install.sh
       -README.txt
       -addpar.tail.

Here is the content of your directory after the tar xvf :

/opt> ls -l
total 2732
-rw-r--r--   1 oracle   dba         5739 Oct 26 21:40 addpar.tail
-rwxr-xr-x   1 oracle   dba         1757 Oct 26 21:40 install.sh
-rw-r--r--   1 oracle   dba      1054720 Oct 26 21:40 smenu_tar10.tar
-drwxrwxrwx  9 oracle   dba         512 Oct 26 21:40 smenu

 Now to customize your installation, type : sh install.sh
 
./install.sh    (reply to questions)


       Installation customized !

To launch Smenu, type :

        if your the dot  '.' is in your path
            cd smenu
            . ad
            sm        (if you are in ksh)                    
            or
            smenu.sh  (if you are in sh )


            if your . is not in your path
    
            cd ./smenu
            . ./ad
            ./sm   (if you are in ksh)
            or
            smenu.sh  (if you are in sh )


Change directory to ./smenu and launch smenu.

  cd ./smenu
    ../ad


       that's it!
 

    To be complete when I usually create a file I call '.bpa' in my home directory.
    When connect into Cygwin, I  type:
 
    . ./.bpa
 
    and this is enough to load Smenu.
 
    The file .bpa usually contains this:
PS1='[$PWD]> '
export PWD
ORACLE_SID=POLDEV
. /opt/smenu/ad
PATH=$PATH:.                 # Yes, I add the point in my path, yes I am guilty ....no, I still sleep very well.
export PATH


    How to add Shortcuts to your environment

  Shortcuts is just an easy and convenient way to expand your shell. They act as any unix command, except that they trigger Oracle SQL, output the result and return you to the dot prompt. This is an alternate way of using Smenu and also the preferred  method.To add the shortcuts in your environment, exit Smenu, go to your SBIN  directory (Directory where Smenu is installed), and just type ". ad" ( or . ./ad). Shortcuts works only in ksh.

      The SBIN directory is the root directory where Smenu is installed

    Why using Shortcuts :       Shortcuts add to your normal prompt a lot of commands. It gives immediate answer to your questions. Instead of journeying in all menu to launch a series of actions, you have the ability to launch these actions in sequence from the prompt.
   
    Automated connection :       Each time you launch a command or call a Shellscript that requires to connect to the Oracle DB, you must provide an Oracle account and a password. If you don't want to type the same user/password again and again, Smenu gives you the ability to save this information.

      In order to save this information, launch Smenu (type 'sm' or smenu.sh in SBIN ) and go to module 1 option 2 to add a user and a password. Some shortcuts works only with the user 'SYS', but usually they works using the default user of your SID.
      
    General default user and customized default user:  Smenu use a general default user (Defined in SM/1.1 and stored in SBIN/smenu.env). This user will be retrieved automatically by Smenu whenever it must connect to a DB. However, there are 4 exceptions to this rule :
 

# The command you launch requires Smenu to use 'SYS'. If SYS is not defined then the command failed to execute TRICK
# Any command that uses 'sqlplus / as sysdba' is executed whatever you set or not in you password file. (If you want to access a remote DB with SQL*Net, we recommend  to set the oraenv in this SID, even if it does not exists on this machine.)


# Smenu leaves you the ability to override the default user for each instance. Then for each program of Smenu you call, it will first try to fetch the default user for the corresponding ORACLE_SID. Thus it is important to position yourself in a target SID. Use 'oa' which is a nice and handy redifinition of the 'oraenv'.

This option is available in Smenu/1.3.

Date           : 24/07-13:24         Host  : test_dvl
Oracle SID     : DEV                 menu  : sm/1.3
  
   *************************************************************
   *                                                           *
   *       Maintain/defined a default user for each sid        *
   *                                                           *
   *************************************************************

                  Sid             Default User
               -----------   -----------------------
            1  : TEST             bibi
            2  : DEV              bpa
            3  : TEST_DVL         zz151
            4  : SAPDEV           system
 
 
 
         (n)d : Append d to row selection to remove it.
         a    : add
         e    : exit
 
   Selection ==>

 

 
How to add new shortcuts :    It is possible to add your own shortcuts : type 'vp' to edit addpar.sh (in SBIN/scripts), add the shortcuts in one of the 4 sections. Any shortcuts before 'sec3' is not visible by any 'sp' (show parameter) commands. However it will be part of your environment. if you add a shortcuts after 'sec3' then run 'rgs' to regen the sp views.   Be aware that your own shortcuts will be lost when you update release, so we advise you to keep a separate copy of 'addpar.sh' and reinitialize after each refresh.

 
How to easily add Smenu to your environment:   If you don't want to put 'addpar.sh' (ad) in your environment, you may do the following to add quickly smenu just for you

Add in you oracle (or what else is the owner of the DB) an alias called smd :

alias smd='cd /$SBIN'

Where sbin is the Smenu root directory, so that you can directly attack

with the next command : '. ad'

 
Use Smenu toward remote DB:   The best way to achieve this, is to add a dummy entry in your oratab (so that you can use 'oa' to switch). Add the sid in the tnsnames.ora on your local machine and set the password for the remote user in the form <passwd@<TNS_ENTRY>.   This feature is very interesting to manage NT SID as if they were on Unix box or to setup a central Unix box.

 Troubleshooting after refresh smenu:    If you want to install latest version of Smenu without loosing your current setting, you may run 'SBINS/refresh.sh'. This script suppose that you have a new version of Smenu, gzipped or not, in SBIN/..
After the operation you must type 'ad' to add all new shortcuts (refresh.sh automatically regen all shortcuts).

Verify that the first line of smenu.env is '#!/bin/ksh'
Otherwise your problem lies in $SBINS/addpar.sh. edit this file and verify that 'SBIN=' is pointing to your path.

 Modify default parameters:   Smenu does not provide a crypting function for password. If you have a crypting function in user, you must edit and replace the function 'smenu_get_passwd' in directory './smenu/scripts' with your own function or call.

   
'install.sh' create a file 'smenu.env' in the SBIN [./smenu] directory.

Here is the content of this file :

   
/opt/smenu> cat ./smenu/smenu.env

#----------------------------------------------------------------
# Update the following variables :
#
#       - /tmp/tt/smenu
#
# Optional : GET_PASSWD
# SBIN is the directory where you put smenu.sh.
# for Sun solaris, TR should be set to UCB
SBIN=/tmp/tt/smenu
SBINS=/tmp/tt/smenu/scripts
S_USER=system
NAWK=/usr/bin/awk
USER=SYSTEM
HOST=test_dev
MAIL_PRG=mailx
MAIL_DEF_LIST=/tmp/tt/smenu/module4/.mail_def_list.txt
GET_PASSWD=/tmp/tt/smenu/scripts/smenu_get_passwd
VERSION=4.10.05
COMPRESS_PRG=gzip
NN=-n
NC=
#


export SBIN USER NAWK SBINS HOST MAIL_PRG MAIL_DEF_LIST  NN NC GET_PASSWD


Email: bpolarsk@yahoo.com                             Last updated : 06 April 2006