Difference between revisions of "Ora2:Login file"
Line 1: | Line 1: | ||
[[Main Page]] >> [[Oracle|Oracle and SQL]] >> [[Oracle_Workbook|Workbook]] >> login.sql | [[Main Page]] >> [[Oracle|Oracle and SQL]] >> [[Oracle_Workbook|Workbook]] >> login.sql | ||
− | == | + | == User Profile == |
When you login to Oracle it will search for a file called login.sql in the current working directory (normally the U:\ drive, or Documents folder on the University labs). | When you login to Oracle it will search for a file called login.sql in the current working directory (normally the U:\ drive, or Documents folder on the University labs). | ||
− | This can contain any SQL or SQL*Plus commands that you want Oracle to execute when you first login | + | This can contain any SQL or SQL*Plus commands that you want Oracle to execute when you first login. This is similar to an autoexec.bat, or .profile file. |
To create a login file: | To create a login file: | ||
Line 37: | Line 37: | ||
Note, no noticeable differences will be seen until a query is run! | Note, no noticeable differences will be seen until a query is run! | ||
+ | |||
+ | You may want to add your own changes to this file, such as changing the prompt (SET SQLPROMPT) - search the online documentation for further details. | ||
Revision as of 16:25, 18 February 2016
Main Page >> Oracle and SQL >> Workbook >> login.sql
User Profile
When you login to Oracle it will search for a file called login.sql in the current working directory (normally the U:\ drive, or Documents folder on the University labs).
This can contain any SQL or SQL*Plus commands that you want Oracle to execute when you first login. This is similar to an autoexec.bat, or .profile file.
To create a login file:
ed login
Then add the following to the file:
SET PAGESIZE 50 SET LINESIZE 120 SET PAUSE 'Press RETURN to Continue...' SET PAUSE ON ALTER SESSION SET NLS_DATE_FORMAT = "DD-MON-YYYY";
Save and exit.
What this does:
- PAGESIZE affect how many rows are shown before a page break
- LINESIZE affects how many characters are shown before it wraps the line
- The PAUSE commands will show 50 lines at a time, prompting you to press return in between (useful if you have a lot of rows in your database)
- NLS_DATE_FORMAT command will show dates in 4-digit year format. The default is to show 2-digit dates.
Note:
- make sure the file is saved in the top level of your Documents folder (U:\ drive on Windows), or your home directory on Linux.
- This is Oracle’s working directory, do not save the file to a different disk or drive, otherwise it will not work.
- You will not notice any changes until you logout and in again to Oracle.
In the meantime the effects of the file can be invoked by running the file:
start login
Note, no noticeable differences will be seen until a query is run!
You may want to add your own changes to this file, such as changing the prompt (SET SQLPROMPT) - search the online documentation for further details.
Next Step
This completes Section 2. Return to the Workbook for the next section.