Starting oracle database under Linux

1. Start Oracle under Linux

1. Log in to the Linux server (ssh)
2. Switch to oracle user permissions
(the command is: # su –l oracle )
Insert image description here

3. Enter the sqlplus interface (the command is: $ sqlplus /nolog or sqlplus / as sysdba).
Insert image description here
The original screen will change to
SQL>
Then please enter

SQL>conn/as sysdba;
input

SQL> startup (function: start database instance)

Insert image description here

In addition, the command to stop the database is as follows:
SQL> shutdown immediate

2. Check whether the Oracle database is started

Return to the terminal mode and enter: ps -ef|grep ora_ (The function is to check whether there is an Oracle process. If there is, in most cases it means it has been started.)

[oracle@localhost ~]$ ps -ef|grep ora_

oracle 12193 1 0 11:00 ? 00:00:00 ora_pmon_orcl
oracle 12195 1 0 11:00 ? 00:00:00 ora_vktm_orcl
oracle 12199 1 0 11:00 ? 00:00:00 ora_gen0_orcl
oracle 12201 1 0 11:00 ? 00:00:00 ora_diag_orcl
oracle 12203 1 0 11:00 ? 00:00:00 ora_dbrm_orcl
oracle 12205 1 0 11:00 ? 00:00:00 ora_psp0_orcl
oracle 12207 1 0 11:00 ? 00:00:00 ora_dia0_orcl
oracle 12209 1 0 11:00 ? 00:00:00 ora_mman_orcl
oracle 12211 1 0 11:00 ? 00:00:00 ora_dbw0_orcl
oracle 12213 1 0 11:00 ? 00:00:00 ora_lgwr_orcl
oracle 12215 1 0 11:00 ? 00:00:00 ora_ckpt_orcl
oracle 12217 1 0 11:00 ? 00:00:00 ora_smon_orcl
oracle 12219 1 0 11:00 ? 00:00:00 ora_reco_orcl
oracle 12221 1 0 11:00 ? 00:00:00 ora_mmon_orcl
oracle 12223 1 0 11:00 ? 00:00:00 ora_mmnl_orcl
oracle 12225 1 0 11:00 ? 00:00:00 ora_d000_orcl
oracle 12227 1 0 11:00 ? 00:00:00 ora_s000_orcl
oracle 12239 1 0 11:00 ? 00:00:00 ora_qmnc_orcl
oracle 12257 1 0 11:00 ? 00:00:00 ora_cjq0_orcl
oracle 12277 1 0 11:00 ? 00:00:00 ora_q000_orcl
oracle 12279 1 0 11:00 ? 00:00:00 ora_q001_orcl
oracle 12389 10058 0 11:01 pts/0 00:00:00 grep --color=auto ora_

[oracle@localhost ~]$

3. Check whether the Oracle DB listener is normal

Input: $ lsnrctl status (The function is to check whether the monitoring is started.) The following means it is not started.

[oracle@localhost ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 17-MAR-2022 11:03:33
 
Copyright © 1991, 2009, Oracle. All rights reserved.
 
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: 2: No such file or directory
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
[oracle@localhost ~]$ ^C
[oracle@localhost ~]$

If it is not started, you can enter: $ lsnrctl start (function: start the listener)

[oracle@localhost ~]$ lsnrctl start
 
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 17-MAR-2022 11:04:48
 
Copyright © 1991, 2009, Oracle. All rights reserved.
 
Starting /data/oracle/product/11.2.0/bin/tnslsnr: please wait…
 
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /data/oracle/product/11.2.0/network/admin/listener.ora
Log messages written to /data/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
 
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 17-MAR-2022 11:04:48
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /data/oracle/product/11.2.0/network/admin/listener.ora
Listener Log File /data/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@localhost ~]$

In addition, the instructions to stop monitoring are as follows:

$ lsnrctl stop

Guess you like

Origin blog.csdn.net/weixin_43828467/article/details/131891481