一. Oracle 启动步骤:
- su - oracle //切换到自己的oracle账户
- sqlplus /nolog //登录oracle
- startup //启动oracle
- conn /as sysdba //连接服务
- 退出登录
- lsnrctl start //启动oracle监听
二. 踩坑过程
(1). 进入oracle 用户
[root@oracle-server ~]# su oracle
(2).登陆sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on 星期一 6月 24 11:04:29 2019
Copyright (c) 1982, 2009, Oracle. All rights reserved.
(3). 登陆数据库
请输入用户名: XX
输入口令:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
进程 ID: 0
会话 ID: 0 序列号: 0
连接错误。。。
(4). 登陆 sqplus nolog,立即关闭数据库
SQL> shutdown immediate
ORA-01012: not logged on
报错, oracle 没有登陆。
(5). 连接sysdba
SQL> conn / as sysdba
已连接到空闲例程。
(6). 启动oracle
SQL> shutdown immediate
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
SQL> startup
ORACLE 例程已经启动。
Total System Global Area 1586708480 bytes
Fixed Size 2213736 bytes
Variable Size 1107298456 bytes
Database Buffers 469762048 bytes
Redo Buffers 7434240 bytes
数据库装载完毕。
数据库已经打开。
SQL> quit
从 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options 断开
oracle成功打开。
(7). lsnrctl start //启动oracle监听
oracle 监听该对象时出错: (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)
是因为服务器IP地址变更了,监听不到原来的host了。 解决方法:切回root账户,修改/etc/hosts 文件 的host地址。再切到oracle 用户下,执行 lsnrctl start
bash-4.2$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 02-9月 -2020 11:31:19
Copyright (c) 1991, 2009, Oracle. All rights reserved.
TNS-01106: 使用名称LISTENER的监听程序已经启动
(8). 最后登陆数据库
请输入用户名: XX
输入口令:
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options