Skip to content

Commit

Permalink
Allow local custom login.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
JanSchnacki committed Nov 8, 2023
1 parent 75326a4 commit 5001df4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# OPITZ CONSULTING Oracle scripts

## Description

This library contains scripts created and used by consultants from OPITZ CONSULTING Deutschland GmbH. They help us when working on our customers servers which are not allways configured in a homogenous way.

In general these scripts should be licensed GPL-3.0 or later

## Scripts

### ocenv

| License | OS compatibility | Required Shell |
| ---------------- | ---------------- | -------------- |
| GPL-3.0 or later | Linux, AIX | Bash >= 4.0 |

This script should be used by sourcing it directly or via .bashrc. It will create an alias "ocenv" in the .bashrc of the current user when sourced

After sourcing the script, the commands envhelp and varhelp can be used to get more information about available commands and variables respectively.
After sourcing the script, the commands envhelp and varhelp can be used to get more information about available commands and variables respectively.
11 changes: 11 additions & 0 deletions ocenv
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,15 @@ While sourcing the script it will set the environment of the active GRID_HOME
This script will create a file "${HOME}/.ocenvrc" containing a line like this:
export GV_SCRIPT_DIR="/path/where/your/ocenv/file/is/located/filename"
export GV_CUSTOM_LOGIN_SQL=""
This can be used to change the base-directory used for the subdirectories used
by this environemnt. The default value for GV_SCRIPT_DIR is the directory where
the script file is sourced from.
The variable "GV_CUSTOM_LOGIN_SQL" can be used to define a SQL file that should
be executed at the end of the login.sql file that is auto-generated by ocenv.
Example overview:
===========================================================================
home OraHome_OraDB19Home1 /u01/app/oracle/product/19.3.0/dbhome_1
Expand Down Expand Up @@ -329,6 +333,9 @@ applicable):
== Files and Paths
* GV_SQL_DIR Directory for SQL script files
* GV_BIN_DIR Directory for executables
* GV_SCRIPT_DIR Directory where ocenv is located
* GV_CUSTOM_LOGIN_SQL If defined, this file is executed at the
end of the login.sql when starting SQL*Plus
EOT
}

Expand Down Expand Up @@ -510,6 +517,10 @@ cat > "${GV_SQL_DIR}/login.sql" <<-"EOT"
SET TAB OFF
SET TERMOUT ON
EOT
if [[ -f ${GV_CUSTOM_LOGIN_SQL} ]]
then
echo "@${GV_CUSTOM_LOGIN_SQL}" >> "${GV_SQL_DIR}/login.sql"
fi

alias cdh='cd ${ORACLE_HOME}'
unalias cdt 2>/dev/null
Expand Down

0 comments on commit 5001df4

Please sign in to comment.