By Clemens Bleile
From Oracle Database Appliance (ODA) version 19.11. onwards the ORACLE_HOMEs and ORACLE_BASE will be created on ACFS, i.e. take space from an ASM-diskgroup instead of taking filesystem space from /u01. See this blog concerning details.
If the ODA has been upgraded from a release < 19.11. to 19.11. or newer, then you usually have diag- and admin-data in 2 ORACLE_BASE-locations:
1 | /u01/app/oracle |
for databases created before migrating to ODA 19.11. or newer and
1 | /u01/app/odaorabase/oracle |
for databases created after the migration to ODA 19.11. or newer.
An ORACLE_HOME is associated to an ORACLE_BASE. This can be shown by running the command orabase:
1 2 | oracle@dbi-oda-x8: /home/oracle/ [rdbms191300] orabase /u01/app/odaorabase/oracle |
orabase takes its info from
1 | $ORACLE_HOME /install/orabasetab |
Migrating databases created before ODA 19.11. to an ORACLE_HOME created after the installation of ODA 19.11. causes diagnostics and admin-data to remain in the “old” ORACLE_BASE /u01/app/oracle, but the command orabase points to the “new” ORACLE_BASE /u01/app/odaorabase/oracle. Tools, which rely on a global ORACLE_BASE settings may have problems handling 2 ORACLE_BASE locations on a machine.
REMARK: The dbi-services tool DMK Management Kit can handle the situation with different ORACLE_BASE on a machine by specifying the ORACLE_BASE-location per database in separate sections in $DMK_HOME/etc/dmk.conf.
The following instructions will show the steps to move the diag- and admin-data of a database from an “old” ORACLE_BASE /u01/app/oracle to the “new” ORACLE_BASE /u01/app/odaorabase/oracle:
E.g. assume we have a Database CBLTEST which has an ORACLE_BASE /u01/app/oracle and a newly created database CBLTEST2 with an ORACLE_BASE /u01/app/odaorabase0:
1 2 3 4 5 6 | [root@dbi-oda-x8 log] # odacli list-databases ID DB Name DB Type DB Version CDB Class Shape Storage Status DbHomeID ---------------------------------------- ---------- -------- -------------------- ---------- -------- -------- ---------- ------------ ---------------------------------------- f9e51c56-fcd2-47a3-bcb4-56587a710f1e CBLTEST SI 19.9.0.0.201020 false OLTP odb1 ASM CONFIGURED d9d1b8dd-4abc-46fe-aae4-d52162d66dab 34fd593b-7586-41c9-a58d-71dfc0cf1d90 CBLTEST2 SI 19.13.0.0.211019 true OLTP odb1s ASM CONFIGURED 4dda330d-feed-491b-bace-006c22b75672 |
After bringing CBLTEST to 19.13. with
1 | # odacli update-dbhome -i d9d1b8dd-4abc-46fe-aae4-d52162d66dab -v 19.13.0.0.0 |
it has the following ORACLE_BASE-setting:
1 2 | oracle@dbi-oda-x8: /home/oracle/ [CBLTEST] orabase /u01/app/odaorabase/oracle |
but the diagnostics-data still below the “old” ORACLE_BASE.
Here the steps to copy your diag- and admin-data for CBLTEST to the new ORACLE_BASE:
REMARK 1: The situation with Read-Only ORACLE_HOMEs is not covered here.
REMARK 2: Before doing this in production you should test this on a test system carefully. If in doubt open a Service Request with Oracle.
1. Change diagnostic_dest and the audit_file_dest in the spfile
1 2 3 | sqlplus / as sysdba SQL> alter system set diagnostic_dest= '/u01/app/odaorabase/oracle' scope=spfile; SQL> alter system set audit_file_dest= '/u01/app/odaorabase/oracle/admin/CBLTEST/adump' scope=spfile; |
2. Shutdown the DB
1 | srvctl stop database -db CBLTEST |
3. Copy the rdbms-diag-data to new ORACLE_BASE
1 | cp -pR /u01/app/oracle/diag/rdbms/cbltest /u01/app/odaorabase/oracle/diag/rdbms |
4. Copy the admin-directory to the new ORACLE_BASE
1 | cp -pR /u01/app/oracle/admin/CBLTEST /u01/app/odaorabase/oracle/admin |
5. Copy the audit-data for spillover-files from unified auditing.
1 | cp -pR /u01/app/oracle/audit/CBLTEST /u01/app/odaorabase/oracle/audit |
6. Change ORACLE_BASE to the new value and adjust your scripts, which do set ORACLE_BASE. E.g. for DMK adjust $DMK_HOME/etc/dmk.conf
1 | export ORACLE_BASE= /u01/app/odaorabase/oracle |
REMARK: You may check if the environment variable ORACLE_BASE has been stored in the Oracle Cluster registry:
1 2 3 | oracle@dbi-oda-x8: /home/oracle/ [CBLTEST] srvctl getenv database -d CBLTEST -t "ORACLE_BASE" CBLTEST: PRKF-1128 : Environment variable ORACLE_BASE is not defined. |
If it has been set (which would be very unusuable on an ODA) then you can overwrite it with
1 2 3 4 | oracle@dbi-oda-x8: /home/oracle/ [CBLTEST] srvctl setenv database -d CBLTEST -t "ORACLE_BASE=/u01/app/odaorabase/oracle" oracle@dbi-oda-x8: /home/oracle/ [CBLTEST] srvctl getenv database -d CBLTEST -t "ORACLE_BASE" CBLTEST: ORACLE_BASE= /u01/app/odaorabase/oracle |
7. Startup the DB
1 | srvctl start database -db CBLTEST |
8. Check that everything is correct
8.1. Re-login as oracle, set the environment and connect “as sysdba”. Here with DMK sourced:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | oracle@dbi-oda-x8: /home/oracle/ [rdbms191300] CBLTEST ********* dbi services Ltd. ********* STATUS : OPEN DB_UNIQUE_NAME : CBLTEST OPEN_MODE : READ WRITE LOG_MODE : ARCHIVELOG DATABASE_ROLE : PRIMARY FLASHBACK_ON : NO FORCE_LOGGING : YES VERSION : 19.13.0.0.0 CDB Enabled : NO ************************************* oracle@dbi-oda-x8: /home/oracle/ [CBLTEST] echo $ORACLE_BASE /u01/app/odaorabase/oracle oracle@dbi-oda-x8: /home/oracle/ [CBLTEST] sqh SQL*Plus: Release 19.0.0.0.0 - Production on Fri Jan 21 20:51:48 2022 Version 19.13.0.0.0 Copyright (c) 1982, 2021, Oracle. All rights reserved. Connected to: Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production Version 19.13.0.0.0 SQL> select value from v $diag_info where value like '/u01%' ; VALUE --------------------------------------------------------------------------------- /u01/app/odaorabase/oracle /u01/app/odaorabase/oracle/diag/rdbms/cbltest/CBLTEST /u01/app/odaorabase/oracle/diag/rdbms/cbltest/CBLTEST/trace /u01/app/odaorabase/oracle/diag/rdbms/cbltest/CBLTEST/alert /u01/app/odaorabase/oracle/diag/rdbms/cbltest/CBLTEST/incident /u01/app/odaorabase/oracle/diag/rdbms/cbltest/CBLTEST/cdump /u01/app/odaorabase/oracle/diag/rdbms/cbltest/CBLTEST/hm /u01/app/odaorabase/oracle/diag/rdbms/cbltest/CBLTEST/trace/CBLTEST_ora_45735 .trc /u01/app/odaorahome/oracle/product/19 .0.0.0 /dbhome_4 9 rows selected. SQL> quit Disconnected from Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production Version 19.13.0.0.0 oracle@dbi-oda-x8: /home/oracle/ [CBLTEST] cda oracle@dbi-oda-x8: /u01/app/odaorabase/oracle/admin/CBLTEST/ [CBLTEST] ls -l total 364 drwxr-x--- 2 oracle oinstall 20480 Jan 13 22:01 adump drwxr-xr-x 2 oracle oinstall 20480 Jan 13 22:48 backup drwxr-x--- 2 oracle oinstall 20480 Jan 13 12:27 dpdump drwxr-xr-x 2 oracle oinstall 20480 Jan 13 18:01 etc drwxr-xr-x 2 oracle oinstall 20480 Jan 13 22:48 log drwxr-x--- 2 oracle oinstall 20480 Jan 13 12:29 pfile drwxr-x--- 2 oracle oinstall 20480 Jan 13 12:23 xdb_wallet oracle@dbi-oda-x8: /u01/app/odaorabase/oracle/admin/CBLTEST/ [CBLTEST] |
8.2. Check adrci
1 2 3 4 5 6 7 8 9 10 | oracle@dbi-oda-x8: /home/oracle/ [CBLTEST] adrci ADRCI: Release 19.0.0.0.0 - Production on Fri Jan 21 19:51:30 2022 Copyright (c) 1982, 2019, Oracle and /or its affiliates. All rights reserved. ADR base = "/u01/app/odaorabase/oracle" adrci> show base ADR base is "/u01/app/odaorabase/oracle" adrci> |
–> The Base-setting in adrci is coming from the file $ORACLE_HOME/log/diag/adrci_dir.mif
9. Cleanup
If everything is correct, then you may delete the data from the “old” ORACLE_BASE:
1 2 3 | rm -rf /u01/app/oracle/diag/rdbms/cbltest rm -rf /u01/app/oracle/admin/CBLTEST rm -rf /u01/app/oracle/admin/audit/CBLTEST |
References
https://marcelpils.de/orabase-doesnt-show-the-current-oracle-base-path
https://www.thegeekdiary.com/oracle-database-how-to-set-environment-variables-using-srvctl
https://logic.edchen.org/how-to-resolve-no-adr-base-is-set
MOS Notes
How To Change The Value For ORACLE_BASE In The Inventory Of A 12.1 RDBMS Home (Doc ID 2010941.1)
orabase command returns no value instead of ORACLE_BASE value (Doc ID 2225573.1)