linux 下启动Oracle

时间:2022-06-11 04:13:46

我的实验环境(之前在Centos上安装Oracle两次都出错卡死,重装了一台Oracle Linux 服务器,Oracle安装非常顺利,运行也很稳定):

//远程登陆实验环境
[[email protected] ~]$ cat /proc/version Linux version 2.6.39-400.17.1.el6uek.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP Fri Feb 22 18:16:18 PST 2013 [[email protected] ~]$ cat /etc/issue Oracle Linux Server release 6.4 Kernel r on an m

首先使用 lsnrctl status 命令查看Oracle监听状态:

[[email protected] ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 27-DEC-2019 09:53:59

Copyright (c) 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: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oem.localdomain)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
[[email protected] ~]$

  使用 lsnrctl start 命令启动监听:

[[email protected] ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 27-DEC-2019 09:56:58

Copyright (c) 1991, 2009, 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.1.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/oracle1/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle1)(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                27-DEC-2019 09:56:59
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/oracle1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle1)(PORT=1521)))
The listener supports no services
The command completed successfully

  监听启动成功,如果是首次安装Oracle,需要修改host name 和监听IP。

  接下来需要启动Oracle实例,首先以system用户身份登陆

[[email protected] ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Fri Dec 27 10:09:34 2019

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

SQL> 
SQL> conn as sysdba
Enter user-name: system
Enter password: 
Connected to an idle instance.

  然后以startup命令启动实例:

SQL>  startup
ORACLE instance started.

Total System Global Area 5077495808 bytes
Fixed Size		    2212976 bytes
Variable Size		 3489663888 bytes
Database Buffers	 1543503872 bytes
Redo Buffers		   42115072 bytes
Database mounted.
Database opened.

  如何新建Oracle 用户及授权,参考另一篇https://www.cnblogs.com/williamzou/p/12102898.html