1

In my Windows Oracle 21c XE installation I have the product installed under:

C:\Oracle\product\21c

Below that there is:

dbhomeXE

which contains the bin directory and also network.

However, I also have:

C:\Oracle\product\21c\homes\OraDB21Home1

This also has network/admin.

It looks like dbhomeXE should be the Oracle home, but I have seen it also mentioned that it should be the directory above.

I assume TNS_ADMIN should be $ORACLE_HOME/network/admin?

But how does it matter anyway? What uses ORACLE_HOME? It isn't currently set on my system and sqlplus launches, although it can't find the PDB I have created.

EDIT:

The variables are used in a batch script to run sqlplus, so I am talking about the client side really, although both the server and the client are on the same PC.

1
  • 1
    $ORACLE_HOME is also used as a reference to find other files, like the $ORACLE_HOME/dbs directory, which contains init parameters for the databases, or the network/admin directory if $TNS_ADMIN isn't set.
    – pmdba
    Oct 10, 2022 at 10:27

1 Answer 1

1

You are quoting Windows paths, so I guess that you have installed OracleXE on windows. $ORACLE_HOME and $TNS_ADMIN are unix-style variables, which won't exist on a windows system.

On windows, Oracle uses the registry to store and retrieve the environment variables. They are in dbhome sub-keys under HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE, e,g, HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\OraDB21Home1 - see Database Administrator's Reference for Microsoft Windows for more information.

To access a PDB, you need to have an Oracle listener running and access that PDB via SQLNet. It is not possible to connect directly. The listener should be a windows service, if it is included in XE (I don't have an XE installation to check).

You can of course also connect to the PDB by opening a session in the root container and then setting the container to the PDB with the ALTER SESSION SET CONTAINER command.

2
  • Indeed it is Windows. I have updated the question. The variables are used in a batch file that runs sqlplus (amongst other things). It sounds like you are saying they are not required.
    – rghome
    Oct 31, 2022 at 13:18
  • The variables can be set in Windows as well, but if they aren't, the values from the registry should be used. If you look in that registry hive, you should see the entries for all oracle homes on the machine. If some are missing, the software may have been copied from somewhere else instead of properly installed.
    – Tony
    Nov 2, 2022 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.