Created
August 16, 2016 00:20
-
-
Save mike-bourgeous/66e62f91b49debf4f2cb065ab29b3859 to your computer and use it in GitHub Desktop.
Scripts to improve launching Oracle's sqlplus client (put these in ~/bin, call orasql)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Launches an application with the Oracle instant client environment set. | |
# Created by Mike Bourgeous, DeseretBook.com | |
export CLIENT_PATH=/usr/lib/oracle/11.2/client64/lib | |
export PATH="$PATH:$CLIENT_PATH" | |
export LD_LIBRARY_PATH="$CLIENT_PATH" | |
export SQLPATH="$HOME/.oracle:$CLIENT_PATH" | |
export TNS_ADMIN="$HOME/.oracle" | |
export NLS_LANG="american_america.utf8" | |
"$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Script to generate a simple login.sql for sqlplus based on window size. | |
# Created August 2014 by Mike Bourgeous, DeseretBook.com | |
mkdir -p $HOME/.oracle | |
cat > $HOME/.oracle/login.sql <<SQL | |
-- This file was automatically generated by $0. Modifications will be lost. | |
set serveroutput on size unlimited | |
set editfile $HOME/.oracle/afiedt.sql | |
set pagesize $(tput lines) | |
set linesize $(tput cols) | |
set sqlprompt '$(printf "\033[35m&_user\033[0m@\033[36m&_connect_identifier\033[0m> ")' | |
set timing on | |
define _editor=vim | |
SQL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Oracle sqlplus launch script (requires rlwrap -- sudo apt install rlwrap) | |
# Created by Mike Bourgeous, DeseretBook.com | |
# Regenerate login.sql based on current window size | |
oralogin | |
if [ "$RLWRAP" = "0" ]; then | |
oralaunch sqlplus64 "$@" | |
else | |
oralaunch rlwrap -A sqlplus64 "$@" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Launch with
orasql user@DATABASE
.