Start an Oracle database instance in Linux: 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
Su-oracle -- "switch to oracle user"
Lsnrctl start -- "enable listener"
Sqlplus/nolog -- "go to sqlplus"
SQL> conn/as sysdba -- "connect to sysdba"
Connected to an idle instance.
SQL> startup -- "Start database instance"
SQL> shutdown immediate -- "close database instance"
SQL> exit
[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:
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage:/u01/app/oracle/product/10.2.0/db_1/bin/dbstart ORACLE_HOME
Cause:
The settings of ORACLE_HOME_LISTNER in the dbstart and dbshut script files are incorrect. Open the two files and find them: Use vi to edit dbstart, ORACLE_HOME_LISTNER = $1, and change it
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. We can find that
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"
Processing Database instance "zgz": log file/home/oracle/product/10g/startup. log
[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"
Su-oracle-c "dbstart"