我生之初,尚无为;我生之后,逢此百罹。

关于虚拟机linux下启动oracle数据库的那些事

使用sqlplus / as sysdba进行数据库时显示连接到一个空实例:

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Jun 3 11:26:25 2022
Version 19.3.0.0.0

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

Connected to an idle instance.

 

这里有几种情况,一种是上一次退出之前使用shutdown等命令(如shutdown immediate)关闭了数据库,可以试着用 startup 直接打开

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/db/product/19.3/db_1/dbs/inittest.ora'

 

此时显示不能打开参数文件,原因可能是SID设置错误

 

ls /u01/app/db/product/19.3/db_1/dbs   查看该目录下的文件,显示有一个文件,名为orapwTESTDB

不出意外的话SID是TESTDB

 

可以用export ORACLE_SID=TESTDB  进行临时修改

也可以把这个写入ORACLE用户的环境变量中

ORACLE_SID=TESTDB; export ORACLE_SID

 

查看进程ps -ef|grep oracle

查看集群状态  crsctl stat res -t

 

 

此报错也可能是ASM存储没有启动,先退出数据库,然后在grid用户下执行

sqlplus / as sysasm

如果显示

Connected to an idle instance.

输入  startup  进行启动

启动后再到oracle用户下登录数据库,这时显示应该还是

Connected to an idle instance.

输入  startup  进行启动

 

 

 

 

 

 

 

startup 后显示

SQL> startup
ORA-03113: end-of-file on communication channel

不清楚原因,先使用shutdown immediate关闭数据库,然后显示

SQL> shutdown immediate
ORA-10997: another startup/shutdown operation of this instance inprogress
ORA-09968: unable to lock file
Linux-x86_64 Error: 11: Resource temporarily unavailable
Additional information: 6361

没看懂,尝试用startup nomount打开到nomount状态

SQL> startup nomount;
ORA-01081: cannot start already-running ORACLE - shut it down first

这个我会,不能启动已经在跑的数据库,使用shutdown abort将数据库关闭

SQL> shutdown abort;
ORACLE instance shut down.

然后使用startup nomount;看看能否打开到nomount状态

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1828713632 bytes
Fixed Size                  8897696 bytes
Variable Size             754974720 bytes
Database Buffers         1056964608 bytes
Redo Buffers                7876608 bytes

运气不差,打开了,然后就是

alter database mount;

alter database opne;

SQL> alter database mount;
Database altered.


SQL> alter database open;
Database altered.

使用select open_mode from v$database;查看数据库状态

SQL> select open_mode from v$database;


OPEN_MODE
------------------------------------------------------------
READ WRITE

显示为读写,说明数据库正常。

 

 

 

 

 

 

 

 

sqlplus / as sysdba进行数据库后显示连接到一个空实例

然后使用shutdown abort关闭数据库,这里因为是测试,正常应该是先看看服务监听等有没有启动。

使用startup nomount 启动到nomount状态报错,因为想起前一天修改了sga和pga的参数。

学疏才浅,只能找到之前的静态参数文件启动然后创建新的动态参数文件。

Connected to an idle instance.

SQL> shutdown abort
ORACLE instance shut down.
SQL> startup nomount;
ORA-27104: system-defined limits for shared memory was misconfigured


SQL> startup pfile=/u01/app/db/admin/orcl/pfile/init.ora.4302022204044
ORACLE instance started.

Total System Global Area 1828714320 bytes
Fixed Size                  9135952 bytes
Variable Size             436207616 bytes
Database Buffers         1375731712 bytes
Redo Buffers                7639040 bytes
Database mounted.
Database opened.



SQL> create spfile='+DATA' from pfile='/u01/app/db/admin/orcl/pfile/init.ora.4302022204044';

File created.

另:如果找不到静态参数文件在哪里,可以尝试用find / -name pfile进行查找。

 

 

 

 

 

 

今天碰到一个没有监听的错误,不知道怎么解决,重启Linux后又好了,不清楚原因,记录一下。

posted @ 2022-06-29 11:11  舍旃  阅读(349)  评论(0编辑  收藏  举报
我生之初,尚无造;我生之后,逢此百忧。