This article is unlikely to be of interest to the Oracle gurus, except as an object of criticism. My experience with administering Oracle servers on a Linux system is a little over a year. The installation process of the Oracle database server, both 10g and 11g, is described quite well in many sources, for example,
here , or
here , or
here , or in Russian,
here , so we will not dwell on this issue.
Suppose that we have the task of installing 2 independent Oracle database servers, for example, Oracle 10gR2 and Oracle11gR1 on the same Linux server (we will not consider different virtualization options, suppose that we have 1 most common server with the installed Linux system on board). It was precisely this task that I faced in my time, and the solution was not immediately found. As a Linux system, we will consider CentOS 5.4 (any other variant of RedHat, Fedora, etc. will do).
What do we need for this? To begin with, we will install our Oracle, with each in its own separate directory. I have a section for the whole oraklina farm / opt. In it, I created the oracle directory and I will install our Oracle servers there. To avoid unnecessary problems and conflicts, we will create 2 system users oracle10 and oracle11, each of which will be used to operate servers 10g and 11g, respectively. We will keep the groups (dba, oinstall) common, that is, we will add both our users to both groups.
So, following the above installation instructions, install Oracle 10gR2 in the /opt/oracle/product/10.2.0 directory, and install Oracle 11gR1 in /opt/oracle/product/11.2.0, using the appropriate system accounts (oracle10 for installing Oracle 10gR2, oracle11 for installing Oracle 11gR1). After the installation is completed, we will edit the configuration files .bash_profile located in the home directories of the oracle10 and oracle11 users (by default, the bash shell is used for users on my system). Edit them so that they look like this for oracle10:
# .bash_profile
')
# Get the aliases and functions
if [-f ~ / .bashrc]; then
. ~ / .bashrc
fi
# User specific environment and startup programs
ORACLE_BASE = / opt / oracle
ORACLE_HOME = $ ORACLE_BASE / product / 10.2.0 / db_1
ORACLE_SID = orcl
ORACLE_HOME_LISTNER = $ ORACLE_HOME
LD_LIBRARY_PATH = $ ORACLE_HOME / lib
PATH = $ PATH: $ HOME / bin: / $ ORACLE_HOME / bin
export PATH ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATHand for oracle11 respectively:
# .bash_profile
# Get the aliases and functions
if [-f ~ / .bashrc]; then
. ~ / .bashrc
fi
# User specific environment and startup programs
ORACLE_BASE = / opt / oracle
ORACLE_HOME = $ ORACLE_BASE / product / 11.2.0 / db_1
ORACLE_SID = orcl2
ORACLE_HOME_LISTNER = $ ORACLE_HOME
LD_LIBRARY_PATH = $ ORACLE_HOME / lib
PATH = $ PATH: $ HOME / bin: / $ ORACLE_HOME / bin
export PATH ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATHFinally, create the appropriate startup scripts for both servers. To do this, in the /etc/rc.d/init.d directory, create the oradb10 and oradb11 files.
Content oradb10:
case "$ 1" in
start) echo "Starting Oracle Database (s)"
su - oracle10 -c "lsnrctl start; dbstart $ ORACLE_HOME; emctl start dbconsole »
touch / var / lock / subsys / oracle10
;;
stop) echo "Shutting down Oracle Database (s)"
rm -f / var / lock / subsys / oracle10
su - oracle10 -c "emctl stop dbconsole; dbshut $ ORACLE_HOME; lsnrctl stop »
;;
*)
echo $ "Usage: $ 0 {start | stop}"
esacContent oradb11:
case "$ 1" in
start) echo "Starting Oracle Database (s)"
su - oracle11 -c "lsnrctl start; dbstart $ ORACLE_HOME; emctl start dbconsole »
touch / var / lock / subsys / oracle11
;;
stop) echo "Shutting down Oracle Database (s)"
rm -f / var / lock / subsys / oracle11
su - oracle11 -c "emctl stop dbconsole; dbshut $ ORACLE_HOME; lsnrctl stop »
;;
*)
echo $ "Usage: $ 0 {start | stop}"
esacThen add the appropriate services with the commands:
chkconfig –add oradb10
chkconfig –add oradb11
And finally, we will edit the configuration file / etc / oratab, for example as follows:
orcl: /opt/oracle/product/10.2.0/db_1: Y
orcl2: /opt/oracle/product/11.2.0/db_1: Y
As it is easy to guess, as a result, when starting the system, now each of our servers will automatically start its own database, orcl to server 10g and orcl2 on server 11g.
Now if we need to perform any actions with one of the servers, just log in with the appropriate user, for example oracle10 (or execute the command su - oracle10), if we need an Oracle 10g server, and then run the commands we need to work with the corresponding oracle server eg sqlplus or others.
That's basically all, as we see nothing complicated. If something is missed or was mistaken somewhere, I think the guru will be corrected :)
UPD: Small correction: in order to avoid a conflict, the Enterprise Manager consoles need to correct the port for one of the servers from the standard value of 1158 to some other one, like this:
emca -reconfig ports -DBCONTROL_HTTP_PORT <port_number>ZY My first post on Habré. Thank you so much
habrachelovek number 1 for an invite!