Sqlplus - saving environment options from session to session

Posted on 2004-10-20
Medium Priority
Last Modified: 2008-01-09
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?).

Question by:booksplus
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 12360793
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.
LVL 23

Accepted Solution

paquicuba earned 500 total points
ID: 12361149
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
LVL 23

Expert Comment

ID: 12361164
Target should look like: C:\oracle\ora92\bin\sqlplus.exe <your_user_id>/<your_password>@<database> @commands.txt
Hope this helps!
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 23

Assisted Solution

paquicuba earned 500 total points
ID: 12361188
actually Target should look like: C:\oracle\ora92\bin\sqlplus.exe <your_user_id>/<your_password>@<database> @commands.sql

Author Comment

ID: 12361338
How do I enter the commands in the file -
I want linesize to be 130 and word wrap turned off.

LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 12361362
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

LVL 23

Assisted Solution

paquicuba earned 500 total points
ID: 12361505
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.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question