Easy and fast environment framework Reply

Getting tired of typing and setting your ORACLE_HOME, ORACLE_SID and troubleshooting your . oraenv ?
going/connecting to different client sites with different platforms and server environments sometimes it is frustrating just how long it takes to get a proper SQL*Plus environment

So I always make use of this script
http://karlarao.tiddlyspot.com/#%5B%5Bstep%20by%20step%20environment%5D%5D

and for every server that I access I just have to do three bits of typing:

. ~oracle/.karlenv <<– set the environment
2 <<– choose an instance
s <<– rlwrap'd sqlplus alias

see example usage below:


[root@desktopserver ~]# su - oracle
[oracle@desktopserver ~]$
[oracle@desktopserver ~]$ vi .karlenv      <-- copy the script from the "Install environment framework - karlenv" section of the wiki link above
[oracle@desktopserver ~]$
[oracle@desktopserver ~]$ ls -la | grep karl
-rw-r--r--  1 oracle dba   6071 Dec 14 15:58 .karlenv
[oracle@desktopserver ~]$
[oracle@desktopserver ~]$ . ~oracle/.karlenv      <-- set the environment








 1-       +ASM
 2-         dw

Select the Oracle SID with given number [1]:
2      <-- choose an instance
Your profile configured for dw with information below:
The Oracle base has been set to /u01/app/oracle

ORACLE_SID=dw
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

oracle@desktopserver.local:/home/oracle:dw
$ s       @gas      
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP and Real Application Testing options
oracle@desktopserver.local:/home/oracle:dw

BTW, parts of the code came from this blog by Coskan Gundogar http://goo.gl/cqRPK and I’ve edited/added some lines on the setsid and showsid sections making it suitable for most unix(solaris,aix)/linux environments

Also I’ve added lines of code before and after the setsid and showsid to get the following info:

  • software homes installed
  • – very useful on troubleshooting if you have multiple homes (RDBMS/Grid Infra/EMGC)

  • get DBA scripts location
  • – quickly plugin your script folders by editing the “# SCRIPTS LOCATION” section

  • set alias
  • – quickly add alias by editing the “# ALIAS” section

Hope I’ve shared you some good stuff!🙂





Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s