RHEL5 enables and disables Oracle database instances in two steps: Step 1: Start the listener; Step 2: Start the database instance. $ ORACLE_HOME_LISTNE is found in the returned results.
RHEL5 enables and disables Oracle database instances in two steps: Step 1: Start the listener; Step 2: Start the database instance. $ ORACLE_HOME_LISTNE is found in the returned results.
RHEL5 enables and disables Oracle database instances in two steps: Step 1: Start the listener; Step 2: Start the database instance.
I. How to start a database instance
1. Go to sqlplus to start the instance
[Oracle @ RedHat ~] $ Su-oracle -- "switch to oracle user"
Password:
[Oracle @ redhat ~] $ Lsnrctl start -- "enable listener"
[Oracle @ redhat ~] $ Sqlplus/nolog -- "go to sqlplus"
SQL * Plus: Release 10.2.0.1.0-Production on Wed Oct 14 19:06:45 2009
Copyright (c) 1982,200 5, Oracle. All rights reserved.
SQL> conn/as sysdba -- "connect to sysdba"
Connected to an idle instance.
SQL> startup -- "start a database instance
SQL> shutdown immediate -- "close database instance"
[Oracle @ redhat ~] $ Lsnrctl stop -- "Disable listener"
2. Start and close database instances with dbstart and dbshut
Start lsnrctl start
Start instance dbstart
It is convenient to start the database using the dbstart command. However, after installing oracle on linux, the following error may be reported when you use the dbstart command for the first time:
Failed to auto-start Oracle Net Listene using/ade/vikrkuma_new/oracle/bin/tnslsnr
It seems that the listener does not exist, but in fact, the listener can be started successfully.
Let's take a look at the dbstart script, which is placed under $ ORACLE_HOME/bin.
Search for tnslsnr in dbstart:
Grep tnslsnr dbstart
Returned results:
If [-f $ ORACLE_HOME_LISTNER/bin/tnslsnr]; then
Echo "Failed to auto-start Oracle Net Listene using $ ORACLE_HOME_LISTNER/bin/tnslsnr"
$ ORACLE_HOME_LISTNER variable is found in the returned result. It may be that the path of the variable is incorrect. We will continue to search for ORACLE_HOME_LISTNER.
Grep ORACLE_HOME_LISTNER dbstart
Returned results:
#3) Set ORACLE_HOME_LISTNER
ORACLE_HOME_LISTNER =/ade/vikrkuma_new/oracle
If [! $ ORACLE_HOME_LISTNER]; then
Echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener"
LOG = $ ORACLE_HOME_LISTNER/listener. log
If [-f $ ORACLE_HOME_LISTNER/bin/tnslsnr]; then
$ ORACLE_HOME_LISTNER/bin/lsnrctl start >$ LOG 2> & 1 &
Export VER10LIST = '$ ORACLE_HOME_LISTNER/bin/lsnrctl version | grep "LSNRCTL for" | cut-d ''-f5 | cut-d'.'-f1'
Echo "Failed to auto-start Oracle Net Listene using $ ORACLE_HOME_LISTNER/bin/tnslsnr"
$ LOGMSG "Restart Oracle Net Listener using an alternate ORACLE_HOME_LISTNER: lsnrctl start"
We found that the specified path in ORACLE_HOME_LISTNER =/ade/vikrkuma_new/oracle is incorrect. We need to re-edit this line so that the path is set to $ ORACLE_HOME.
Use vi to edit dbstart and change ORACLE_HOME_LISTNER =/ade/vikrkuma_new/oracle
Export ORACLE_HOME_LISTNER = $ ORACLE_HOME
Save and exit. Then run dbstart again. No error is reported, but no response is returned. ps the process and no oracle process. This means that the oracle instance has not started properly.
The reason for this is that the setting of/etc/oratab is incorrect.
Zgz:/home/oracle/product/10g: N
The last setting is "N" (there is only one instance in my environment, so there is only one line of configuration statement). We need to change "N" to "Y ".
After the above work is done, dbstart can be used normally:
[Oracle @ redhat bin] $ lsnrctl start -- "start listener"
[Oracle @ redhat bin] $ dbstart -- "Start database instance"
[Oracle @ redhat bin] $ dbshut -- "close database instance"
[Oracle @ redhat bin] $ lsnrctl stop -- "Disable listener"
Ii. How to enable the database instance and the linux system together
Add the following statement to/etc/rc. d/rc. local to start the instance of the same system:
Su-oracle-c "lsnrctl start"