Skip to content

Instantly share code, notes, and snippets.

@carloscasalar
Last active January 27, 2016 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carloscasalar/67ca39af7051c9f32744 to your computer and use it in GitHub Desktop.
Save carloscasalar/67ca39af7051c9f32744 to your computer and use it in GitHub Desktop.
Tips sqlplus

Sql*Plus

Install sql*plus on Ubuntu

Follow steps in Oracle Instant Client Ubuntu documentation.

Change client encoding

export NLS_LANG=SPANISH_SPAIN.AL32UTF8

tnsnames.ora on instant client

From instant client FAQ:

How do I ensure that my "tnsnames.ora" file is being used in Instant Client? Always set the TNS_ADMIN environment variable or registry to the location of the tnsnames.ora file (full directory path only, do not > include the file name). This practice will ensure that you are using the appropriate tnsnames.ora for your application when running > with Instant Client.

Execute all scripts in the current folder

This only works on linux and inside sql*plus.

!ls -1 -Q *.sql |sed 's/\(.\)/@@&/' > execAll.sql
@execAll

Remember to delete execAll.sql script before use the tip a second time in the same folder. Instead you can add an rm command at the begining:

!rm execAll.sql 2>/dev/null
!ls -1 -Q *.sql |sed 's/\(.\)/@@&/' > execAll.sql
@execAll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment