Sqlplus - saving environment options from session to session

Posted on 2004-10-20
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 125 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 125 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 125 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
add more rows to hierarchy 3 46
Huge BLOB data type in Oracle how to retrieve in and crystal reports 6 77
Oracle perfomance issue. 4 49
Shared Service Environment 2 54
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
This post first appeared at Oracleinaction  ( Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

734 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