Skip to content
Home » Oracle » How to Revert Read-Only Oracle Home 21c Linux

How to Revert Read-Only Oracle Home 21c Linux

Read-Only Oracle Home

After installing Oracle database 21c on Linux, we found that some features are different from our sense. That's because Read-Only ORACLE_HOME is now the default feature since 21c.

Oracle's "Read-only Oracle home" does not really mean unchangeable, it means that the directory now become a place to store product binaries and patched updates only.

oradb21home1

All configuration files now go to a new place ORACLE_BASE_HOME. The default name of home directory is oradb21home1 for Oracle database 21c.

The idea of read-only Oracle home is good, but it changes the way we manage the product. Some rules need to be changed to adapt the new feature.

However, the feature of read-only Oracle home can be switched back to the original mode to operate our databases as usual. Let's see how we revert it by the following steps.

Stop Services

We should stop database related services before doing it.

For a single-instance database, we can do this.

[oracle@test ~]$ dbshut $ORACLE_HOME

Which stops listener and database services.

Copy Configuration Files Back to ORACLE_HOME

There're 2 types of configuration files that you should copy back to ORACLE_HOME.

Database Configuration

We copied all files related to the instance, such as parameter file (PFILE), server parameter file (SPFILE), password file and snapshot controlfile back to ORACLE_HOME.

[oracle@test ~]$ cp -p $ORACLE_BASE/dbs/* $ORACLE_HOME/dbs/

That's right, the server parameter file (SPFILE) in use is at $ORACLE_BASE/dbs, not ORACLE_BASE_HOME.

Network Configuration

We copied all files related to the network, such as listener.ora, tnsnames.ora and sqlnet.ora back to ORACLE_HOME.

Let's see current ORACLE_BASE_HOME. The Oracle command orabasehome points to it.

[oracle@test ~]$ orabasehome
/u01/app/oracle/homes/OraDB21Home1

Then we make a move.

[oracle@test ~]$ cp -p $(orabasehome)/network/admin/* $ORACLE_HOME/network/admin/

Turn Off Read-Only Mode of Oracle Home

We revert the feature by setting a letter N in orabasetab.

[oracle@test ~]$ vi $ORACLE_HOME/install/orabasetab
/u01/app/oracle/product/21.0.0/dbhome_1:/u01/app/oracle:OraDB21Home1:N:

N means that we use the first filed as our oracle base home.

Start Services

We should start database related services to take it effect.

For a single-instance database, we can do this.

[oracle@test ~]$ dbstart $ORACLE_HOME

Which starts listener and database services.

Check Results

We checked the following items to make sure that we have reverted read-only Oracle home to the original mode.

ORACLE_BASE_HOME

We use Oracle command orabasehome to determine current ORACLE_BASE_HOME.

[oracle@test ~]$ orabasehome
/u01/app/oracle/product/21.0.0/dbhome_1

SPFILE Location

SQL> select value from v$parameter where name = 'spfile';

VALUE
--------------------------------------------------------------------------------
/u01/app/oracle/product/21.0.0/dbhome_1/dbs/spfileORCLCDB.ora

Listener File

[oracle@test ~]$ lsnrctl status
...
Listener Parameter File   /u01/app/oracle/product/21.0.0/dbhome_1/network/admin/listener.ora

Snapshot Controlfile

RMAN> show snapshot controlfile name;

RMAN configuration parameters for database with db_unique_name ORCLCDB are:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/21.0.0/dbhome_1/dbs/snapcf_ORCLCDB.f'; # default

They're back.

2 thoughts on “How to Revert Read-Only Oracle Home 21c Linux”

  1. Hello,

    I am not sure if this was tested on 21c only.

    On 19c versions, manually changing the file $ORACLE_HOME/install/orabasetab file from Y to N is not working. After doing this, “sqlplus / as sysdba” is failing with ORA-12547: TNS:lost contact.

    [oracle@oraclevm ~]$ cat $ORACLE_HOME/install/orabasetab
    #orabasetab file is used to track Oracle Home associated with Oracle Base
    /u01/app/oracle/product/19.0.0/dbhome_1:/u01/app/oracle:OraDB19Home1:N:
    [oracle@oraclevm ~]$ sqlplus / as sysdba

    SQL*Plus: Release 19.0.0.0.0 – Production on Tue Jan 23 13:01:00 2024
    Version 19.3.0.0.0

    Copyright (c) 1982, 2019, Oracle. All rights reserved.

    ERROR:
    ORA-12547: TNS:lost contact

    Enter user-name: ^C
    [oracle@oraclevm ~]$

    The correct method was to use “roohctl -disable”. When running this command it changes the file $ORACLE_HOME/install/orabasetab from Y to N and no more ORA-12547: TNS:lost contact errors.

    Just thought to share my views. Thanks!

    Thanks,
    Rijesh Chandran

Leave a Reply

Your email address will not be published. Required fields are marked *