Top 60 Oracle Blogs

Recent comments

Easy and fast environment framework

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

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


$ s       @gas      
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP and Real Application Testing options

BTW, parts of the code came from this blog by Coskan Gundogar 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! </p />

    	  	<div class=