User Tools

Site Tools


useful_aliases

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
useful_aliases [2018/12/08 12:49] – created 0.0.0.0useful_aliases [2019/01/30 11:32] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Useful_aliases ====== 
- 
 A small collection of my most used aliases. A small collection of my most used aliases.
  
-======Unix====== +===== Unix ===== 
-=====Quickly get into a database=====+==== Quickly get into a database ====
 Set these in the .(bash_)profile of the oracle account Set these in the .(bash_)profile of the oracle account
 +<code>
  alias dba='sqlplus / as sysdba'  alias dba='sqlplus / as sysdba'
-This will only work if a database has already been selected using ". oraenv"<br />+</code> 
 +This will only work if a database has already been selected using ". oraenv"\\
 When I work out how to use multi-line in an alias, this can be made better with something like: When I work out how to use multi-line in an alias, this can be made better with something like:
 +<code>
  alias dba='export ORAENV_ASK="NO";export ORACLE_SID="$1". oraenv;sqlplus / as sysdba'  alias dba='export ORAENV_ASK="NO";export ORACLE_SID="$1". oraenv;sqlplus / as sysdba'
 +</code>
 Then it could be used like so Then it could be used like so
 +<code>
  dba dev02  dba dev02
 +</code>
  
-=====Set the SQL prompt so you can see what database you are on=====+==== Set the SQL prompt so you can see what database you are on ====
 In the file $ORACLE_HOME/sqlplus/admin/glogin.sql, put: In the file $ORACLE_HOME/sqlplus/admin/glogin.sql, put:
 +<code>
  set sqlprompt "_USER'@'_CONNECT_IDENTIFIER _PRIVILEGE> "  set sqlprompt "_USER'@'_CONNECT_IDENTIFIER _PRIVILEGE> "
 +</code>
 Might be useful to add some other often used settings: Might be useful to add some other often used settings:
 +<code>
  set linesize 200  set linesize 200
  set pagesize 200  set pagesize 200
 +</code>
 Very useful as of 10g is that this file is re-read after a connect from inside SQL*Plus Very useful as of 10g is that this file is re-read after a connect from inside SQL*Plus
  
 There is also a login.sql file that will be read (if it exists) which can either be in the current directory or in an environment variable $SQLPATH There is also a login.sql file that will be read (if it exists) which can either be in the current directory or in an environment variable $SQLPATH
  
-======Windows====== +===== Windows ===== 
-=====Quickly get into a database=====+==== Quickly get into a database ====
 Create a file dba.bat that contains: Create a file dba.bat that contains:
 +<code>
  @echo off  @echo off
  set ORACLE_SID=%1  set ORACLE_SID=%1
  sqlplus / as sysdba  sqlplus / as sysdba
 +</code>
 Then this file will either have to be put somewhere on the %PATH%, the %PATH% modified to include the script dir or cd to the script dir before calling it. Then this file will either have to be put somewhere on the %PATH%, the %PATH% modified to include the script dir or cd to the script dir before calling it.
 +
useful_aliases.1544273361.txt.gz · Last modified: 2018/12/08 12:49 by 0.0.0.0

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki