chora - Switching between Oracle databases
Introduction:
This code goes into a user's .bash_profile file. This file is normally hidden from a directory listing (any filename starting with a '.' is normally hidden), but can be seen by typing the command; 'ls -al', or just 'll'.
This creates the shell function; 'chora'. The advantage of a function over a local script is that it runs in the current shell and, therefore, doesn't have to be called like this; '. ./chora'.
There are 2 types of parameter for this function:
'?' - This reports the current SID and lists all available SIDs.
SID - Calling 'chora SID' swithes the user's environment to the new SID if it exists.
When the user logs in, this reports availability.
Aim:
Give users a quick and simple way of switching between SIDs.
Requirements:
Obviously, this only operates in an Oracle environment.
Procedure:
- Log in as the user.
- Open Terminal.
- # cd
- # vi .bash_profile
- Add the following lines. They would normally go somewhere between a line that sets the initial Oracle SID (e.g. 'export ORACLE_SID...'), and the umask line.:
- Best; Download here.
- Or; Cut and paste the lines of code between the dotted lines:
... |
Testing:
This will demonstrate that the function is available but won't switch SIDs until databases have been built:
- Source .bash_profile:
- $ . ./.bash_profile
- This returns with either a list of SIDs or an error message; 'grep: /etc/oratab: No such file or directory' if there are no databases installed.
- Run chora in query mode:
- $ chora ?
- This returns with either a list of SIDs or an error message; 'grep: /etc/oratab: No such file or directory' if there are no databases installed.
0 Comments:
Post a Comment
<< Home