Database: Oracle 8.1.7 Operating System: IBM-AIX 4.3.3
Requires the script as follows:
1./rdbm/orasrv/orasrv
#! / bin / ksh
Usage = "usage: ilasrv [start | stop]" if test $ # --ne 1then echo "$ usage" exit 1elif test $ 1 = startthenecho "----------------- -------------------------------------------
Now Start Oracle Database Server ...
-------------------------------------------------- ------------ "
ECHO / "Connect Internal Startupquit" | SVRMGRL
Elif Test $ 1 = stopthenecho "------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------
Now Stop Oracle Database Server ...
-------------------------------------------------- ------------ "
Echo / "Connect InternalShutdown Immediatequit" | SVRMGRLSE ECHO "$ usage" exit 1fi
2. /rdbm/orasrv/.kshrc (environment variable, not required) # .Kshrc # this file is executed by the ksh shell at startup, after .profile. # Set the command line editing to be in emacs style.
Set -o Emacs
# Set the trackall Option. # Turn on Command TRACKING (Build Working Set of Commands).
Set -o trackall
# Let Control-D Logout
Set o ignoreeof
# Background Job Run At Low Priority.
Set -o bgnice
# All Variables set area set with the export attribute. # "Export variable" is not needed.
Set -o alleXport
# Aliases.
. ~ / .ksh_alias
# function definitions
. ~ / .ksh_fxns
3. /rdbm/orasrv/.ksh_fxns (environment variable, not required)
#! / bin / ksh ############################################################################################################################################################################################################################################################################### ############################################################################################################################################################################################################################################################################################ ######################################################################################################################################################################################################################################################################################################## ##################### --------- set temporary prompt variable to the command number # followd by a Colonps0 = "` Hostname`: "## ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------- # - Define Korn Shell Functions # ---- -------------------------------------------------- ------------------------ ## ---------- Function_CD # - Changes Director, Then Set The Command # Prompt To : "Command-number: Pathname>" Function _Dir {IF (($ # == 0)) Then 'ls' -lrt Elif (($ # == 1)) Then 'ls' $ 1 fi} alias -x dir = _DIRTYPESET-FX _DIR
Function _CD {IF (($ # == 0)) Then 'cd' ps1 = "$ PS0 $ PWD>" Elif (($ # == 1)) Then 'CD' $ 1 PS1 = "$ PS0 $ PWD>" Elif (($ # == 2)) Then 'CD' $ 1 $ 2 ps1 = "$ PS0 $ PWD>" Fi} ## ---------- Alias the cd command to the _cd function # and export THE _CDTYPESET -FX _CD ## ---------- Function _Bmake # - Run Make in the background, Writing all output to # a file callakerrrin current directoryFunction _bmake {ified (( $ # == 0)) THEN NOHUP MAKE 2> | $ PWD / BMAKERR 1> & 2 & Elif (($ # == 1)) THEN NOHUP MAKE $ 1 2> | $ PWD / BMAKERR 1> & 2 & Elif (($ #> 1)) The echo 'usage: bmake [target]' Fi} ## ---------- alias the bmake command to the _bmake function # and extra _bmake functionalias -x bmake = _bmaketypeset -fx _Bmake ### ---------- Function _BGM # - Run GM in the background, Writing all output to # a file called bgmerr in current DirectoryFunction_BGM {IF ( ($ # == 0)) THEN # NOHUP GM 2> | $ PWD / BGMERR 1> & 2 & Nohup GM - NO-CM >> BGMERR 2> & 1 & Elif (($ #> 0)) THEN Echo 'usage : bgm 'fi} ## ---------- Alias the bgm command to the _bgm function # and extra _bgm functionalias -x bgm =
_BGMTYPESET -FX _BGM ### ---------- Function _vib # - first backup all existing files on the command line. # The backup file (s) create has a ~ appended To The FileName. # Note: Backups Will Be Made Only IF You Are Aable To Write # in The Current Directory # - THEN INVOKE VI To Edit All Files.Function_vib {IF (($ # == 0)) THEN 'VI' Elif (($ # <0)) THEN Echo 'Usage: E [FileName List]' Else for File IN $ * DO IF ([[-A $ file]]) THEN [[-A $ file ~ && " $ FILE ~ || (! -W $ file ~))]] && rm -f $ file ~ cp $ file $ file ~ chmod 664 $ file ~ fi done 'vi' $ * fi} ## ----- ---- Alias the vi command to the _vib function # and export the _vib function # alias -x vi = _vib # typeset -fx _vib4. /rdbm/orasrv/.ksh_alias (environment variable, not required)
5. /etc/rc.startdb
Echo "Starting Oracle 8.1.7 Database Sever ........." Su - Orasrv -c "ORASRV START" Su - ORASRV-C "Lsnrctl Start" Echo "Startup of Oracle Completed !!!"
6. /etc/rc.stopdbecho "stoping oracle 8.1.7 database sever ........." su - orasrv -c "ORASRV Stop" Su - ORASRV-C "LSNRCTL Stop" Echo "Stop of Oracle Completed !!! "
7./etc/rc.shutdown (system automatically execute, don't worry) #! / Bin / ksh / etc / rc.stopdb
8. Need to join in the / etc / inittab file, implement the database boot from startup
Startdb: 2345678: Wait: /etc/rc.startdb
It should be noted that the above scripts should have execution permissions.