Sqlplus - saving environment options from session to session

I want to be able to set the linesize and set the wordwrap and then have the settings saved from session to session.

When I set the environment options, the setting reverts back after I close SQLPLUS and open a new SQLPLUS window.

How do I save my settings from session to session.  OR how do I open the SQLPLUS with my preferred options (command line options?).

Who is Participating?
paquicubaConnect With a Mentor Commented:
Open an SQLPLUS session and type EDIT COMMANDS, click yes, enter your commands, close it, click yes, close your session, right click on your SQLPLUS icon, in Target you should see C:\oracle\ora92\bin\sqlplusw.exe ,add the following at the end <your_user_id>/<your_password>@<database> @commands.txt
slightwv (䄆 Netminder) Commented:
Place these in either your login.sql or glogin.sql file.

They will be active each time you log in.  The only gotcha is that depending on your O/S, you may have to execute your login.sql file each time you connect as another user in the same sqlplus session.
Target should look like: C:\oracle\ora92\bin\sqlplus.exe <your_user_id>/<your_password>@<database> @commands.txt
Hope this helps!
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

paquicubaConnect With a Mentor Commented:
actually Target should look like: C:\oracle\ora92\bin\sqlplus.exe <your_user_id>/<your_password>@<database> @commands.sql
booksplusAuthor Commented:
How do I enter the commands in the file -
I want linesize to be 130 and word wrap turned off.

slightwv (䄆 Netminder) Commented:
exactly as you would enter it from the 'SQL>' prompt.  Place each entry on its own line.


contents of login.sql
set lines 130
set pages 100

paquicubaConnect With a Mentor Commented:
in SQLPLUS when you type EDIT COMMANDS, and click YES, you can type the commands in notepad like this:
set wrap off
set linesize 130
Then, close notepad and click YES to save it. What you do is creating an .sql file in your bin directory.
All Courses

From novice to tech pro — start learning today.