We have a large number of oracle database related scripts that utilize the environment variables $ORACLE_SID and $DBNAME. In a single instance database the $ORACLE_SID is the same as the database name $DBNAME. So we have simply set DBNAME = $ORACLE_SID. However, now that we are clustering with RAC, we have multiple $ORACLE_SID variables for each $DBNAME. Which means that DBNAME != $ORACLE_SID. An oracle provided script (oraenv) sets up most the environment automatically but does not set up $DBNAME.
Luckily, the $ORACLE_SID variables are just the $DBNAME with the node number added to the end. E.g. $DBNAME=ORCL $ORACLE_SID=ORCL1
What I need is a way to remove any and all digits from the end of the $ORACLE_SID variable. It should leave any digits that are at the beginning or middle of the $ORACLE_SID.
End result:
$ORACLE_SID $DBNAME
ORCL ORCL
ORCL1 ORCL
ORCL23 ORCL
4ORCL 4ORCL
4ORCL3 4ORCL
OR4CL OR4CL
Thanks in advance!