Migration to DMK
What is a shell environment
To work with Oracle, e.g. to start the instance or to run sqlplus, you will use a shell (usually bash or ksh). And in this shell you need variables, e.g.
ORACLE_HOME
: Location of the Oracle software to useORACLE_SID
: Identifier for the instanceNLS_LANG
: The local language settings used to communicate with the Oracle server-processTNS_ADMIN
: Directory of tnsnames.ora, listener.ora, ... that should be usedPATH
: A list of directories to look for executables, in the Oracle context: $ORACLE_HOME/bin
Optionally you can define aliases for your convenience
alias sq='sqlplus / as sysdba'
alias cdh='cd $ORACLE_HOME'
What is an environment software
An environment software for Oracle is a bundle of scripts and configuration files that will dynamically set the environment variables and aliases for a specific ORACLE_SID (SID). And it offers scripts/aliases to switch from one SID to another SID. To do that, it has to reset the old environment variables and to set the new environment variables. Example for the PATH variable: If SID1 uses Oracle version 19.19 and SID2 uses 19.22, then with a switch from SID1 to SID2, the old ORACLE_HOME directory must be replaced by the new ORACLE_HOME directory in the PATH variable. And if a database is updated to a new ORACLE_HOME, then the environment software has to detect that and update the environment automatically.
Additionally to the setting of the environment, a good environment software provides some helper scripts:
Show running/stopped Oracle daemons (instances, listeners, clusterware, ...)
Information/status of the current SID
Information/status of Grid Infrastructure
Information/status of Data Guard
Start/Stop scripts for
database-instance
listener
observer
...
Examples of environment software
"oraenv" scrpt from Oracle. Minimalistic software
"DMK" from dbi Services
"BasEnv" from Trivadis
"ocob" from Opitz Consulting
self-programmed inhouse scripts
Interchangeability of environment software
Oracle-defined variables (ORACLE_HOME, NLS_LANG, ...) are identical in all environment software products. And in most products you will switch the environment by typing the name of the desired ORACLE_SID. So if you only use this core functionality you can use any product "out-of-the-box".
But for variables not defined by Oracle there are probably naming differences. Often you will have a variable with the version of the current ORACLE_HOME, but it is named differently. If you want to switch to another product, you have to learn the new name, and if such variables are used in scripts, adapt it in the these scripts. Or you can map the new name to the old name.
The same applies to the aliases. Learning the new aliases or defining the old aliases.
But sometimes there is a naming conflict. Same name, but different content. In this case you have to decide what to keep. It is recommended to keep the new one.
Migration from BasEnv to DMK
BasEnv is an often used product in CH/DE/AT of the former company Trivadis (acquired by Accenture) with a similar functionality to dbi Services DMK.
Install DMK
Open a new Oracle session without sourcing BasEnv. Probably you have to comment it in .bash_profile
; Afterwards, install and configure DMK as described.
Compare both environments
Get an overview of all aliases and variables in a DMK and BasEnv environment and compare the output.
Evaluate what basenv specific variables you use in your own scripts and what aliases you want to keep in the future. If you have many old scripts you do not want to touch, or you do not know which scripts are in use, then you should map the required variables.
There is a template dmk/template/etc/migrate_basenv_to_dmk.conf.tpl
. This template contains the configuration to map DMK variable-names to BasEnv variable-names and some example aliases. Add the lines of this template to your dmk/etc/dmk.conf.local file in the [GLOBAL] section.
The following variables are defined differently
cdb
BasEnv software directory
ORACLE_BASE
cdd
cdd
diagnistic-directory
DMK software directory
cdal
The following aliases are defined differently
vid
vi drc*.log
vi dmk.conf.local
vidr
cdd
cd to diagnistic-directory
cd to DMK software directory
cdal
The variables/aliases cdl (directory of the tool installation) and etc (directory with the tool configuration files) are tool-specific. But the content is similar.
Using both environments selectively
If you do not automatically source one of the environment, you can create aliases to source the desired environment. Each of it can be used inependent.
Fully replace BasEnv by DMK
Remove sourcing of Basenv in your profile and add sourcing of DMK to your profile. Rename your basenv folder. So you can detect by an error message if a script still tries to access BasEnv.
Redirect BasEnv calls to DMK
Replace your basenv folder by a symlink to DMK and map basenv scripts to the equivalent dmk script by a symlink or a wrapper script.
If you mapped the variables and aliases as described above, your old scripts probably will work as before.
Combining both environments
This is not recommended. But if you use Perl libraries of Basenv, you can try it. Check your current basenv Perl variables env |grep PERL
and add it to the dmk configuration.
Last updated