0

OS -> Linux

DB -> Oracle 11gR2

Normally my .bash_profile file looks like this:

TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=abcde.localdomain; export ORACLE_HOSTNAME
ORACLE_UNQNAME=DB11G; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=DB11G; export ORACLE_SID
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

But I need to do that:

ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/newdb

After that I have to create a new database in newdb.

I'm a newbie oracler and I couldn't find any clear solution. Should I create a directory as newdb and set a new .bash_profile file? If it's a clear solution, how can I do it and after that will my dbca and netca operations work fine? Or something else like this?

Thank you.

  • ORACLE_HOME has nothing to do with the location of a new database; you can create a new database without changing the ORACLE_HOME value. – mustaccio Nov 7 at 18:11
  • 2
    If all you want to do is create a new Oracle instance, do not change ORACLE_HOME or create any directories. Just set ORACLE_SID to the name of the new instance & run dbca. Multiple databases (instances) can run from the same ORACLE_HOME. This is not the case in newer versions of Oracle, as you can use PDBs instead – Philᵀᴹ Nov 7 at 18:12
  • @Philᵀᴹ Sir I know it but I have to do. My new directory should be newdb and I have to create my new database in it. – neworacler Nov 7 at 18:16
  • @mustaccio Sir I know it but I have to do. My new directory should be newdb and I have to create my new database in it. – neworacler Nov 7 at 18:16
  • 1
    Welcome to DBA.SE and thanks for your participation. Could you elaborate why you (think) you need a sub-directory and/or a new ORACLE_HOME? Normally you would install multiple instances of Oracle RDBMS using the same ORACLE_HOME and ORACLE_BASE directories with use of individual ORACLE_SID settings. If you are unable to elaborate on your issue, then your question might be closed as unclear what you are asking. We are reluctant to give bad advice. (see above comments). – John aka hot2use Nov 8 at 12:12
1

First, remove all that junk from .bash_profile. Use oraenv. Example:

$ grep u01 /etc/oratab
MIN112:/u01/app/oracle/product/11.2.0/dbhome_1:N
MIN121:/u01/app/oracle/product/12.1.0/dbhome_1:N

$ . oraenv
ORACLE_SID = [oracle] ? MIN112
The Oracle base has been set to /u01/app/oracle
$ env | grep ORA | sort
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
ORACLE_SID=MIN112

$ . oraenv
ORACLE_SID = [MIN112] ? MIN121
The Oracle base remains unchanged with value /u01/app/oracle
$ env | grep ORA | sort
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
ORACLE_SID=MIN121

Second, forget /u01/app/oracle/product/newdb. Just run /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbca and create your other database and provide the necesarry path for datafiles. You do not need another ORACLE_HOME for another database.

When you have multiple databases, just put them in /etc/oratab (dbca will do this automatically in 11.2), and use oraenv or just set ORACLE_SID in case of the same ORACLE_HOME for switching between them.

Not the answer you're looking for? Browse other questions tagged or ask your own question.