1. sqlplus cannot be started in linux
Problem description:
[Root @ localhost oracle] # su-oracle
[Oracle @ localhost oracle] $ sqlplus "as/sysdba"
-Bash: sqlplus: command not found
[Oracle @ localhost oracle] $/u01/app/oracle/product/11.1.0/db_1/bin/sqlplus
Error 6 initializing SQL * Plus
Message file sp1.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
[Oracle @ localhost oracle] $
Solution:
The environment variable is not set. You can edit the. profile file to set environment variables.
Open/etc/profile bottom insert
Export ORACLE_SID = demo1 (database instance id)
Export ORACLE_HOME =/u01/app/oracle/product/11.1.0/db_1
Export PATH = $ PATH: $ ORACLE_HOME/bin
Save and shut down. restart the system or execute the source/ect/profile settings to take effect immediately.
2. Start the database instance in two steps: Step 1: Start the listener; Step 2: Start the 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"
LSNRCTL for Linux: Version 10.2.0.1.0-Production on 14--200-2009 19:06:40
Copyright (c) 1991,200 5, Oracle. All rights reserved.
Starting/home/oracle/product/10g/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0-Production
System parameter file is/home/oracle/product/10g/network/admin/listener. ora
Log messages written to/home/oracle/product/10g/network/log/listener. log
Listening on: (DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (KEY = EXTPROC2 )))
Listening on: (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = redhat) (PORT = 1522 )))
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC2 )))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0-Production
Start Date 14--200-2009 19:06:40
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File/home/oracle/product/10g/network/admin/listener. ora
Listener Log File/home/oracle/product/10g/network/log/listener. log
Listening Endpoints Summary...
(DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (KEY = EXTPROC2 )))
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = redhat) (PORT = 1522 )))
Services Summary...
Service "PLSExtProc" has 1 instance (s ).
Instance "PLSExtProc", status UNKNOWN, has 1 handler (s) for this service...
The command completed successfully
[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 database instance"
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218968 bytes
Variable Size 88082024 bytes
Database Buffers 188743680 bytes
Redo Buffers 7168000 bytes
Database mounted.
Database opened.
SQL> shutdown immediate -- "close database instance"
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production
With the Partitioning, OLAP and Data Mining options
[Oracle @ redhat ~] $ Lsnrctl stop -- "Disable listener"
LSNRCTL for Linux: Version 10.2.0.1.0-Production on 14--200-2009 19:08:06
Copyright (c) 1991,200 5, Oracle. All rights reserved.
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC2 )))
The command completed successfully
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 ORACLE_HOME_LISTNER =/ade/vikrkuma_new/oracle
.
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.
Dbstop is set as above.
The reason for this is that the setting of/etc/oratab is incorrect.
Demo1:/home/oracle/product/11.1.0/db _! : 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"
LSNRCTL for Linux: Version 10.2.0.1.0-Production on 14--200-2009 19:44:53
Copyright (c) 1991,200 5, Oracle. All rights reserved.
Starting/home/oracle/product/10g/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0-Production
System parameter file is/home/oracle/product/10g/network/admin/listener. ora
Log messages written to/home/oracle/product/10g/network/log/listener. log
Listening on: (DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (KEY = EXTPROC2 )))
Listening on: (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = redhat) (PORT = 1522 )))
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC2 )))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0-Production
Start Date 14--200-2009 19:44:53
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File/home/oracle/product/10g/network/admin/listener. ora
Listener Log File/home/oracle/product/10g/network/log/listener. log
Listening Endpoints Summary...
(DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (KEY = EXTPROC2 )))
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = redhat) (PORT = 1522 )))
Services Summary...
Service "PLSExtProc" has 1 instance (s ).
Instance "PLSExtProc", status UNKNOWN, has 1 handler (s) for this service...
The command completed successfully
[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"
LSNRCTL for Linux: Version 10.2.0.1.0-Production on 14--200-2009 19:45:33
Copyright (c) 1991,200 5, Oracle. All rights reserved.
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC2 )))
The command completed successfully
3. 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"
4. oracle em (Enterprise Management) Cannot be opened
Problem description:
Http://localhost.localdomain: 1158/em prompts that the page cannot be displayed.
Solution:
-- Check whether the dbconsole service is started.
1. emctl status dbconsole
-- Set ORACLE_SID
-- 2.SET ORACLE_SID = & ORACLE_SID (I did not execute this because export ORACLE_SID = demo1 is set in/etc/profile)
-- Start DBCONSOLE
3. emctl start dbconsole
-- After ORACLE_SID is set, enter EMCTL to view the help of this command.
V,Start isqlplus
[Oracle @ graduate ~] $ Isqlplusctl start
ISQL * Plus 10.2.0.1.0
Copyright (c) 2003,200 5, Oracle. All rights reserved.
Warning, got duplicate tcp line.
Starting iSQL * Plus...
ISQL * Plus started.
Http://www.uplook.cn/kbase-Index-show-view18369.html