1.Login Status.
[oracle@localhost ~]$ sqlplus/as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Jul 1 09:15:35 2019
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
2.If you connect to an idle instance, it may be that the database listener is not started or the database is not started, start the listener first and then the database.
Check the listener status first
[oracle@localhost ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 01-JUL-2019 09:15:55
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
3.If the listener is not started, it is started first
[oracle@localhost ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 01-JUL-2019 09:16:01
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait…
TNSLSNR for Linux: Version 11.2.0.3.0 – Production
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 – Production
Start Date 01-JUL-2019 09:16:02
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully.
4.Login to the database, if you can’t login here, check if ORACLE_SID is configured correctly in .bash_profile first
[oracle@localhost ~]$ sqlplus/as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Jul 1 09:16:05 2019
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
5.After login, there is still an idle instance, maybe the database is not started, start the database
SQL> startup
ORACLE instance started.
Total System Global Area 764121088 bytes
Fixed Size 2232272 bytes
Variable Size 494927920 bytes
Database Buffers 264241152 bytes
Redo Buffers 2719744 bytes
Database mounted.
Database opened.
6.Start successfully, query operation
SQL> select * from v$version;
BANNER
——————————————————————————–
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit Production
PL/SQL Release 11.2.0.3.0 – Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 – Production
NLSRTL Version 11.2.0.3.0 – Production
7.Done!