Setup login.sql in sqlplus windows envrionment

it would be tiresome to enter environment variables each time you login to sqlplus, good thing is sqlplus allows us to use a script (login.sql) which has the environment variables defined each time we login (user profile) .  Once you define the sqlpath sqlplus looks for login.sql in the path directory and executes it once you login successful. This can be also configured at global level called site profile it allows the DBA to set default env for all the users. so when a user connects through sqlplus first the global site profile (glogin.sql) is executed and then the user profile (login.sql) is executed which is defined in SQLPATH environment variable in Windows




here %USERPROFILE% is an environment variable has default location of the user who is logged into the machine  C:\USERS\Username

we have to make sure we have login.sql available in that location


sql plus login sql


you can see below sqlprompt has changed to what we defined in login.sql  (‘&_user.@&_connect_identifier.>’)

sqlprompt sqlplus




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s