21c, ROOH

ROOH – Read-Only Oracle Home – is the new way to work with Oracle 21c where the Oracle Home folder is read-only. Now, (besides the previous version like 19c) it is the default for 21c, and this means that some activities need to be changed from now.

Recently I was playing with Data Guard and when I was creating it I passed over two situations: tnsnames and password files. Where they suppose to be placed? Bellow, I will show some examples, but I recommend you to read the official documentation for ROOH to understand all the details and file paths. But basically, you don’t need to touch anymore the Oracle Home to edit files.

TNSNAMES

So, I needed to add the new entries for tnsnames but below you can see that I edited the tnsnames.ora at the same way that we made in the past (until 19c), inside Oracle Home:

[oracle@orcl21s ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/21.0.0.0/dbhome_1
[oracle@orcl21s ~]$
[oracle@orcl21s ~]$ ls -l $ORACLE_HOME/network/admin
total 8
drwxr-xr-x 2 oracle oinstall 4096 Jul 27 23:00 samples
-rw-r--r-- 1 oracle oinstall 1624 Feb 18  2020 shrept.lst
[oracle@orcl21s ~]$
[oracle@orcl21s ~]$ echo $TNS_ADMIN

[oracle@orcl21s ~]$
[oracle@orcl21s ~]$ vi $ORACLE_HOME/network/admin/tnsnames.ora
[oracle@orcl21s ~]$
[oracle@orcl21s ~]$ cat $ORACLE_HOME/network/admin/tnsnames.ora
ORA21DG =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = orcl21p-scan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ora21dg)
    )
  )

[oracle@orcl21s ~]$

And if I try to do tnsping, you can see that not works because can’t find the entry:

[oracle@orcl21s ~]$ tnsping ORA21DG

TNS Ping Utility for Linux: Version 21.0.0.0.0 - Production on 23-AUG-2021 22:55:53

Copyright (c) 1997, 2021, Oracle.  All rights reserved.

Used parameter files:

TNS-03505: Failed to resolve name
[oracle@orcl21s ~]$

Following the official doc, and editing the correct file placed inside of ORACLE_BASE_HOME (ORACLE_BASE/homes/HOME_NAME or /u01/app/oracle/homes/OraDB21Home1) at ORACLE_BASE_HOME/network/admin, you can see that now it is working:

[oracle@orcl21s ~]$ vi /u01/app/oracle/homes/OraDB21Home1/network/admin/tnsnames.ora
[oracle@orcl21s ~]$
[oracle@orcl21s ~]$ cat /u01/app/oracle/homes/OraDB21Home1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/homes/OraDB21Home1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORA21DG =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = orcl21p-scan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ora21dg)
    )
  )

[oracle@orcl21s ~]$
[oracle@orcl21s ~]$ tnsping ORA21DG

TNS Ping Utility for Linux: Version 21.0.0.0.0 - Production on 23-AUG-2021 22:58:24

Copyright (c) 1997, 2021, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = orcl21p-scan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ora21dg)))
OK (10 msec)
[oracle@orcl21s ~]$

So, even if is possible to create tnsnames.ora file inside Oracle Home, it will not work (even with TNS_ADMIN) not set. By default, Oracle will search the file in the new correct path.

Password File

Another file that is common to edit (and create manually) is the Oracle password file, even more, when creating the Data Guard. When you create the database (by dbca) it will be put in the correct place (at AMS or local file system – depending on what is your environment and what you are using), but while you are creating the Data Guard you need to put it at the correct place.

So, during the creation of the database I copied the password file from production and put it in the $ORACLE_HOME/dbs folder:

[oracle@orcl21s ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/21.0.0.0/dbhome_1
[oracle@orcl21s ~]$
[oracle@orcl21s ~]$ cp /tmp/orapwdgpry $ORACLE_HOME/dbs/orapwdg21nf1
[oracle@orcl21s ~]$
[oracle@orcl21s ~]$ orapwd describe file=$ORACLE_HOME/dbs/orapwdg21nf1
Password file Description : format=12
[oracle@orcl21s ~]$ 
[oracle@orcl21s ~]$ sqlplus sys/oracle@dg21nf as sysdba

SQL*Plus: Release 21.0.0.0.0 - Production on Tue Aug 24 00:35:40 2021
Version 21.3.0.0.0

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

ERROR:
ORA-01017: invalid username/password; logon denied


Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied


Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied


SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
[oracle@orcl21s ~]$

As you can see, not work. So now I put at the new (and correct) path – ORACLE_BASE_CONFIG/dbs – and you can see that worked perfectly:

[oracle@orcl21s ~]$ mv $ORACLE_HOME/dbs/orapwdg21nf1 /u01/app/oracle/dbs/orapwdg21nf1
[oracle@orcl21s ~]$
[oracle@orcl21s ~]$ sqlplus sys/oracle@dg21nf as sysdba

SQL*Plus: Release 21.0.0.0.0 - Production on Tue Aug 24 00:36:18 2021
Version 21.3.0.0.0

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


Connected to:
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0

SQL> exit
Disconnected from Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
[oracle@orcl21s ~]$

So, starting with 21c you need to know where to copy your files. Now, the Oracle Home is Read-Only and if you continue to put files there (as made until 19c) you can have problems identifying and troubleshooting the error. Even more for Data Guard where sometimes you need to edit tnsnames and password files manually. Read the official documentation for ROOH to understand all the details and file paths.

 

Disclaimer“The postings on this site are my own and don’t necessarily represent my actual employer positions, strategies or opinions. The information here was edited to be useful for general purpose, specific data and identifications were removed to allow reach the generic audience and to be useful for the community. Post protected by copyright.”

1 thought on “21c, ROOH

  1. Pingback: Creating a Standby on 21c [Single Instance] - Project42

Leave a Reply

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