No ADR base is set
To manage Automatic Diagnostic Repository (ADR), we used to use ADRCI command line to interact with server.
Node 1
[oracle@primary01 oracle]$ adrci
ADRCI: Release 19.0.0.0.0 - Production on Thu Jul 31 15:25:45 2021
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
ADR base = "/u01/app/oracle"
adrci>
It seems no problem at all. But for node 2, we found nothing there.
Node 2
[oracle@primary02 oracle]$ adrci
ADRCI: Release 19.0.0.0.0 - Production on Thu Jul 31 15:24:02 2021
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
No ADR base is set
adrci>
No ADR base is set means that ADRCI cannot find the correct location to set ADR base for further operations.
No ADR homes are set
As a result, we have "No ADR homes are set", if we tried to show all ADR homes.
adrci> show homes
No ADR homes are set
Additionally, if you perform some commands on ADR home, you might see DIA-48494: ADR home is not set, the corresponding operation cannot be done.
Rationale
In fact, ADRCI use a pointer file to store the base location of repository. If the file was missing, it cannot find the ADR base.
Let's check existing of the file on node 1 and node 2.
Node 1
grid
[grid@primary01 grid]$ ls -l $ORACLE_HOME/log/diag/adrci_dir.mif
-rw-r----- 1 grid oinstall 14 Jul 06 14:09 /u01/app/19.0.0/grid/log/diag/adrci_dir.mif
oracle
[oracle@primary01 oracle]$ ls -l $ORACLE_HOME/log/diag/adrci_dir.mif
-rw-r----- 1 oracle asmadmin 16 Jul 31 15:08 /u01/app/oracle/product/19.0.0/db_1/log/diag/adrci_dir.mif
OK, node 1 has no problem.
Node 2
grid
[grid@primary01 grid]$ ls -l $ORACLE_HOME/log/diag/adrci_dir.mif
-rw-r----- 1 grid oinstall 14 Apr 22 08:35 /u01/app/19.0.0/grid/log/diag/adrci_dir.mif
oracle
[oracle@primary02 oracle]$ ls -l $ORACLE_HOME/log/diag/adrci_dir.mif
ls: 0653-341 The file /u01/app/oracle/product/19.0.0/db_1/log/diag/adrci_dir.mif does not exist.
For user oracle, the file does not exist in node 2. That's the problem.
Solution
To resolve the error, we take the following steps to set ADR base correctly.
- Create a folder for the pointer file.
- Make sure $ORACLE_BASE is set correctly.
- Create the pointer file.
- Make sure the content of the file is correctly set.
- Verify the result.
Since there's no such directory on node 2, we have to create one for it.
[oracle@primary02 oracle]$ mkdir -p $ORACLE_HOME/log/diag
Normally, we set the environment variable in the user's profile. So we can just check the value like this:
[oracle@primary02 oracle]$ echo $ORACLE_BASE
/u01/app/oracle
Or you may use the command to set it at run-time.
[oracle@primary02 oracle]$ export ORACLE_BASE=/u01/app/oracle
We take the second argument as a string to print into the pointer file.
[oracle@primary02 oracle]$ printf "%s" "$ORACLE_BASE" > $ORACLE_HOME/log/diag/adrci_dir.mif
Please note that, printf does not leave any newline (\n).
[oracle@primary02 oracle]$ cat $ORACLE_HOME/log/diag/adrci_dir.mif
/u01/app/oracle[oracle@primary02 oracle]$
As we expect, there's no newline in the file.
We enter ADRCI interactive mode again.
[oracle@primary02 oracle]$ adrci
ADRCI: Release 19.0.0.0.0 - Production on Thu Jul 31 15:28:38 2021
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
ADR base = "/u01/app/oracle"
adrci>
We have set it correctly.
Later on, we should purge ADR trace files on a regular basis for reclaiming some precious space.