Ora2:Login file
From mi-linux
Jump to navigationJump to search
Main Page >> Oracle and SQL >> Workbook >> login.sql
login.sql
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, 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!
Next Step
This completes Section 2. Return to the workbook for the next section.