# Variables and aliases

## for dmk behavior

### `DEBUG`

If this variable is set to 1, DMK prints more verbose output of what it internally does.

### `DMK_INITIALSID`

The ORACLE\_SID (can be a real or a "dummy" SID) that should be set if dmk.sh / dmk.cmd is sourced without the sid parameter

### 🪟 `DMK_NO_DESKTOP_LINK`

If missing, DMK creates a Windows desktop link to start a terminal with DMK environment (cmd or ps1). If you prefer no, or another name for the desktop link, set the variable `DMK_NO_DESKTOP_LINK`to 1.

### `DMK_PRE_CMD` / `DMK_POST_CMD`

In these variables you can specify commands to run:

* `DMK_PRE_CMD`: before setting the `[INTERNAL]` variables and after restore of SET\_DMK\_\* variables.
* `DMK_POST_CMD`: after setting the aliases.

:warning: This mechanism is not recommended and not supported if you change settings handled by DMK. Use it at your own risk!\
The idea is to run custom scripts or binaries. The value of the variable will be added as-is (without enclosing quotes) to the dmk environment file ($DMK\_TEMPFILE). It can be one or more script to be sourced or executables to run.\
Examples:

```
var::DMK_PRE_CMD::=::nowarn::"echo \"This is the pre-command at $(date)\""::
var::DMK_POST_CMD::=::nowarn::'ls; date; id'::  #execute 3 commands
var::DMK_POST_CMD::=::nowarn::'. /home/oracle/customscript.inc':: #source script
```

### `DMK_SAVE_LAST_ENVFILE`

Copy the last generated environment file (`$DMK_TEMPFILE`) to the file specified in `DMK_SAVE_LAST_ENVFILE`. Example:

```
# $etc/dmk.conf.local
var::DMK_SAVE_LAST_ENVFILE::=::nowarn::"/tmp/dmkenv.$(id -un).inc"::
```

Stores the last env-file as `/tmp/dmkenv.oracle.inc`

### `PERL_EXEC`

Explicitly specify the `perl` binary to use for startup (sourcing) of DMK. After DMK is sourced, it switches to the Perl of the current ORACLE\_HOME (if available).

## for dmk configuration files

**Aliases for editing configuration files**

| Alias   | Description                                                                                                                   |
| ------- | ----------------------------------------------------------------------------------------------------------------------------- |
| vid     | vi dmk.conf.local ; the configuration file with the machine-specific settings                                                 |
| vis     | <p>vi ${DMK\_ORA\_ADMIN\_SID}/dmk/${ORACLE\_SID}.conf<br>the configuration file with the ORACLE\_SID specific settings in</p> |
| viohome | vi ${DMK\_HOME}/etc/ora\_homes                                                                                                |
| viosid  | vi ${DMK\_HOME}/etc/ora\_sids                                                                                                 |

**Variables for generating the dummy-name of a new ORACLE\_HOME**

| Variable                   | Description                                             |
| -------------------------- | ------------------------------------------------------- |
| DMK\_HOMEFORMAT\_RDBMS     | Naming pattern for database homes                       |
| DMK\_HOMEFORMAT\_GRINF     | Naming pattern for Grid Infrastructure (usually 1 home) |
| DMK\_HOMEFORMAT\_*PRODUCT* | *PRODUCT* is the product-name in ora\_homes             |

For details, see chapter ora\_sids above.

## related to ORACLE\_HOME / ORACLE\_SID

**Variables depending on the Oracle release/version**

| Variable        | Description                                                                                           |
| --------------- | ----------------------------------------------------------------------------------------------------- |
| DMK\_GRID\_BASE | The ORACLE\_BASE of the grid infrastructure                                                           |
| DMK\_GRID\_HOME | The ORACLE\_HOME of the active grid infrastructure (see /etc/oracle/olr.loc)                          |
| DMK\_ORA\_REL   | Release of Oracle; Format aabc (new: bc=00 if >=18c), e.g. 1900, 0920                                 |
| DMK\_ORA\_VER   | Version of Oracle, Format aabbcc, e.g. 191500, 090200                                                 |
| DMK\_SQLPLUS    | sqlplus-binary for the current SID (For Oracle8 it is svrmgrl instead of sqlplus)                     |
| DMK\_SYSCONNECT | '/ as sysasm' for +ASM\* instances, otherwise '/ as sysdba' (for Oracle8: command="connect internal") |

For Oracle <18c version and release is the same

`SQL*Plus: Release** 9.2.0.6.0 - Production on Mon Nov 14 13:56:09 2022`

For Oracle >= 18c the release number (oraversion -baseversion) is always the same for all release updates (RU/RUR), but the version shows the RU's (oraversion -compositeVersion)

`SQL*Plus: Release 18.0.0.0.0 - Production on Mon Nov 14 13:59:37 2022`

**`Version 18.10.0.0.0`**

The sq and sqh alias now uses $DMK\_SQLPLUS "$DMK\_SYSCONNECT" instead of hardcoded values.

**Variables and aliases related to read-only / conventional ORACLE\_HOME's**

With Oracle > 12c you can configure (21c it is the default) that files that are not part of the ORACLE\_HOME installation (e.g. spfile, tnsnames.ora, trace-files) will be written in $ORACLE\_BASE instead of $ORACLE\_HOME.

```
roohctl -enable
```

The "dbs/" directory with spfile, passwordfile, etc. is now in $ORACLE\_BASE/dbs, other files are now below $ORACLE\_BASE/homes/${DMK\_HOME\_INVNAME}/

| Variable              | Description                                                                                 |
| --------------------- | ------------------------------------------------------------------------------------------- |
| DMK\_DBS              | <p>$ORACLE\_BASE/dbs (for rooh)<br>$ORACLE\_HOME/dbs (for non-rooh)</p>                     |
| DMK\_ORACLE\_HOME\_RW | <p>$ORACLE\_BASE/homes/${DMK\_HOME\_INVNAME} (for rooh)<br>$ORACLE\_HOME (for non-rooh)</p> |
| DMK\_HOME\_INVNAME    | Name in the oraInventory, e.g. OraDB21Home1                                                 |
| DMK\_HOME\_PRODUCT    | see ora\_homes file. Examples: rdbms\_ee, rdbms\_se                                         |
| ORACLE\_BASE          | The ORACLE\_BASE of the current ORACLE\_HOME                                                |
| GRID\_BASE            | The ORACLE\_BASE of the grid-infrastructure home. Also set in database homes                |
| DMK\_DIAG\_DEST       | "diag/" directory, derived from ORACLE\_BASE                                                |
| DMK\_ORA\_ADMIN       | "admin/" directory, derived from ORACLE\_BASE                                               |

| Alias | Description               |
| ----- | ------------------------- |
| cddbs | cd $DMK\_DBS              |
| cdh   | cd $ORACLE\_HOME          |
| cdhrw | cd $DMK\_ORACLE\_HOME\_RW |
| cdob  | cd $ORACLE\_BASE          |

**Variables and aliases related to SID's**

| Variable                   | Description                                                             |
| -------------------------- | ----------------------------------------------------------------------- |
| DMK\_INITIALSID            | Which SID should be initially set.                                      |
| DMK\_SID\_PDB\_NAME        | The name of the current pluggable database (CDB$ROOT for the container) |
| DMK\_SID\_PDB              | The $DMK\_SID\_PDB\_NAME formatted to be used in the PS1 prompt         |
| DMK\_SID\_TYPE             | The 'type' field in ora\_sids for the current ORACLE\_SID               |
| DMK\_SID\_CRSTYPE          | The 'crstype' field in ora\_sids file for the current ORACLE\_SID       |
| DMK\_SID\_INSTANCES        | The 'instances' field in ora\_sids file for the current ORACLE\_SID     |
| NLS\_LANG                  | See chapter about $ORACLE\_SID.conf file                                |
| DMK\_ORA\_DB\_UNIQUE\_NAME | db\_unique\_name of the current SID                                     |
| DMK\_ORA\_DB\_NAME         | db\_name of the current SID                                             |
| DMK\_ORA\_SID\_ALERTLOG    | Alertlog of the current SID                                             |
| DMK\_ORA\_SID\_LOG         | Trace/Logfile directory of the current SID                              |

Per default, the initial ORACLE\_SID that is set in a new environment is the first "**H**"ome-Entry in ora\_sids. With the variable DMK\_INITIALSID (defined in dmk.conf.local) you can specify any other SID in ora\_sids. You can also specify a Perl reguar expression, e.g. rdbms.\* (mind the "." before "*": The "." the representation of any character, together with the "*" it matches 0-n characters after 'rdbms') , then the alphabetically latest entry (e.g. rdbms191700) will be set. The advantage is that if you deinstall an old home you do not need to adapt the variable. It always uses the latest home.

If the given SID does not exist, fallback to the default mechanism.

| Alias     | Description                      |
| --------- | -------------------------------- |
| SID / sid | . ${DMK\_HOME}/bin/dmk.sh \<SID> |

**Variables and aliases related to Grid Infrastructure**

If a Grid Infrastructure home is found, the following variables are available in all SID-environments:

| Variable                | Description                                                                                                                                  |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| GRID\_HOME              | The ORACLE\_HOME of the grid infrastructure                                                                                                  |
| GRID\_BASE              | The ORACLE\_BASE of the grid infrastructure                                                                                                  |
| DMK\_ORA\_SID\_ALERTLOG | <p>if +ASM%: the alertlog of the ASM instance<br>if -MGMTDB: the alertlog of the Management instance<br>else: the alerlog of clusterware</p> |

| Alias                    | Description                                                                                                                                                                                                               |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| crsctl                   | <p>${GRID\_HOME}/bin/crsctl<br>uses the crsctl in $GRID\_HOME without the need to change a PATH variable</p>                                                                                                              |
| cdh                      | <p>${PERL\_EXEC} ${DMK\_HOME}/bin/status.pl crs<br>Shows the clusterware resource status</p>                                                                                                                              |
| <p>+ASM<br>+ASM\[nr]</p> | <p>Set the environment for the ASM instance.<br>The number is optional; DMK can detect the number itself</p>                                                                                                              |
| \<DB\_UNIQUE\_NAME>      | For a RAC databases: the environment for this home is set and the SID is the db\_unique\_name. Intended for policy-managed databases if the instance is currently not allocated to this host                              |
| \<RAC-SID>\[nr] rac1     | Set the environment for the rac-instance (admin-managed)                                                                                                                                                                  |
| \<RAC-PREFIX>\_\[nr]     | Set the environment for the rac-instance (policy-managed, rac-one-node). This alias is only available if the instance is running on this host at startup of dmk. If the instance is relocated, the alias becomes invalid. |
| \<RAC-PREFIX>%           | Wildcard-format. `dmk.sh` checks at runtime, if an instance with this rac-prefix is running and sets the environment for it. If no instance is running, the environment will be set with the db\_unique\_name.            |

To simplify setting RAC SID environments in shell-scripts, DMK offers the following possibilities:

`dmk.sh` accepts for RAC instances the format \<RAC\_PREFIX>%, also for admin-managed databases. With that, the script can be written independent of the host.

```
oracle@rac19a2:~/ [grinf19] . dmk.sh RAC%
oracle@rac19a2:~/ [RAC2 (CDB$ROOT)]
```

Similar possibilities for setting ASM instance environment (example: +ASM2 is on this host):

```
. dmk.sh +ASM2
. dmk.sh +ASM
. dmk.sh +ASM%
```

## Related to status display

The new status script `status.pl` will use the color definition of the Perl module Term::ANSIColor; The format is in the following scheme: "***foreground-color*** on\_***background-color***"

The script uses the following defaults, which are optimized for terminals with white background and black font (e.g. Putty: "Use system colours"):

| Variable              | Default value                   | Description                                                           |
| --------------------- | ------------------------------- | --------------------------------------------------------------------- |
| DMK\_COLOR\_RW        | black on\_bright\_green         | Instance open read-write                                              |
| DMK\_COLOR\_RO        | bright\_yellow on\_green        | Instance open read-only                                               |
| DMK\_COLOR\_MO        | black on\_bright\_yellow        | Instance started in mount state                                       |
| DMK\_COLOR\_NO        | bright\_white on\_bright\_black | Instance started in nomount state                                     |
| DMK\_COLOR\_UP        | green on\_bright\_white         | <p>Process started<br>(for instances: effective state is unknown)</p> |
| DMK\_COLOR\_OF        | bright\_white on\_black         | Process not started, down                                             |
| DMK\_COLOR\_ONL       | green on\_bright\_white         | Clusterware resource is ONLINE on this host                           |
| DMK\_COLOR\_OFF       | black on\_bright\_white         | Clusterware resource is OFFLINE on this host                          |
| DMK\_COLOR\_INT       | yellow on\_bright\_white        | Clusterware resource is INTERMEDIATE on this host                     |
| DMK\_COLOR\_OKU       | bright\_white on\_green         | Clusterware status is OK and up (online)                              |
| DMK\_COLOR\_OKD       | bright\_white on\_black         | Clusterware status is OK and down (offline)                           |
| DMK\_COLOR\_ERR       | bright\_white on\_bright\_red   | Clusterware status is Error                                           |
| DMK\_COLOR\_WAR       | black on\_bright\_yellow        | Clusterware status is Warning                                         |
| DMK\_COLOR\_NO\_COLOR | (not set)                       | if set to non-empty and not 0: status.pl will not use colors          |

To change the default values, set these variables before calling status.pl. To disable the color for a variable, use the keyword "reset". To permanently change the default, configure it in dmk.conf.local;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dbi-services.gitbook.io/dmk-oracle-manual/installation-and-configuration/variables-and-aliases.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
