Wednesday, June 18, 2025

-bash: oraenv: No such file or directory

-bash: oraenv: No such file or directory


What Are Root.sh And OrainstRoot.sh Scripts In A Standalone RDBMS Installation? (Doc ID 1493121.1)

Issue:

Unable to run oraenv to set oracle environmental variable 

Error Message:

[oracle@oraclelab1 ~]$ . oraenv
-bash: oraenv: No such file or directory

Cause:

/usr/local/bin/oraenv environmental executable file might have got corrupted or root.sh script has not ran as part of Oracle Home installation

Fix:

recreate or rebuild /usr/local/bin/oraenv environmental executable file by running root.sh script as root user

Error Logs and commands output:

1. Check the database instance status and oracle owner

[root@oraclelab1 ~]# ps -ef|grep smon
root     18125 17601  0 23:48 pts/1    00:00:00 grep --color=auto smon
oracle   28764     1  0 May01 ?        00:00:31 ora_smon_MALLIK
[root@oraclelab1 ~]#
[root@oraclelab1 ~]# su - oracle
Last login: Mon Jun 16 23:33:49 IST 2025 on pts/1
[oracle@oraclelab1 ~]$

2. When we are trying the set the oracle environmental variable by running .oraenv it is failing with error message oraenv: No such file or directory

/usr/local/bin/oraenv environmental executable file might have got corrupted or root.sh script has not ran as part of Oracle Home installation

[oracle@oraclelab1 ~]$ . oraenv
-bash: oraenv: No such file or directory
[oracle@oraclelab1 ~]$
[oracle@oraclelab1 ~]$ which oraenv
/usr/bin/which: no oraenv in (/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin)
[oracle@oraclelab1 ~]$ env |grep ORA
[oracle@oraclelab1 ~]$

3. recreate or rebuild /usr/local/bin/oraenv environmental executable file by running root.sh script as root user

[root@oraclelab1 ~]# cat /etc/oratab
#
# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
MALLIK:/u01/app/oracle/product/19.0.0.0/dbhome_1:N
[root@oraclelab1 ~]#
[root@oraclelab1 ~]# /u01/app/oracle/product/19.0.0.0/dbhome_1/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/19.0.0.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
   Copying oraenv to /usr/local/bin ...
The contents of "coraenv" have not changed. No need to overwrite.

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Oracle Trace File Analyzer (TFA - Standalone Mode) is available at :
    /u01/app/oracle/product/19.0.0.0/dbhome_1/bin/tfactl

Note :
1. tfactl will use TFA Service if that service is running and user has been granted access
2. tfactl will configure TFA Standalone Mode only if user has no access to TFA Service or TFA is not installed

[root@oraclelab1 ~]#

4. Now try to set the oracle environmental variable by running .oraenv which worked fine without any issue. 

[root@oraclelab1 ~]# su - oracle
Last login: Mon Jun 16 23:48:35 IST 2025 on pts/1
[oracle@oraclelab1 ~]$
[oracle@oraclelab1 ~]$ . oraenv
ORACLE_SID = [oracle] ? MALLIK
The Oracle base has been set to /u01/app/oracle
[oracle@oraclelab1 ~]$
[oracle@oraclelab1 ~]$ env |grep ORA
ORACLE_SID=MALLIK
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1
[oracle@oraclelab1 ~]$
[oracle@oraclelab1 ~]$ which oraenv
/usr/local/bin/oraenv
[oracle@oraclelab1 ~]$
[oracle@oraclelab1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jun 16 23:49:48 2025
Version 19.3.0.0.0

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

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> select instance_name, status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
MALLIK           OPEN

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oraclelab1 ~]$


-bash: oraenv: No such file or directory

-bash: oraenv: No such file or directory What Are Root.sh And OrainstRoot.sh Scripts In A Standalone RDBMS Installation? (Doc ID 1493121.1) ...