数据库启动关闭原理之一:nomount状态浅析

Oracle数据库启动过程包括nomount、mount和open三个状态。nomount状态只需参数文件即可启动实例,不涉及控制文件、数据文件和日志文件。本文详细解析了nomount状态下如何检查使用的参数文件,以及实例启动过程中后台进程的启动顺序,并通过示例展示了在没有参数文件时如何启动实例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

知识点参考:盖国强:《由浅入深oracle-DBA入门,进阶和诊断案例》

概念解释:

(Instance)实例:指一组后台进程(linux)/线程(windows)和一块(shared pool)共享内存区域.

数据库启动过程:

(1)  启动数据库到nomount状态;

(2)  启动数据库到mount状态;

(3)  启动数据库到open状态

一:nomount状态:

启动数据库的第一步,首先查找参数文件(pfile/spfile),根据参数文件中的配置创建实例进行内存区域的分配,启动后台进程(/线程)

由于在nomount状态,不需要控制文件,数据文件和日志文件的参与,因此,只需要参数文件就可以启动实例:


那么怎么检查数据库运行使用的是哪一个参数文件呢?往下看:

SQL> show parameter spfile

 

NAME                                 TYPE        VALUE

----------------------------------------------- ------------------------------

spfile                               string      /u01/app/oracle/10.2.0/db01/db

                                                s/spfileorcl.ora

若启动失败,我们从告警文件alert_$ORACLE_SID.ora中查找错误原因

告警文件路径:$ORACLE_HOME/admin/$ORACLE_SID/alert_$ORACLE_SID.ora


后台进程启动的顺序:



或者使用linux操作系统中的ps命令进行查看oracle后台进程:

[oracle@oracle bdump]$ ps -ef|grep ora_

oracle   6324     1  0 17:01 ?        00:00:00 ora_pmon_orcl

oracle   6326     1  0 17:01 ?        00:00:00 ora_psp0_orcl

oracle   6328     1  0 17:01 ?        00:00:00 ora_mman_orcl

oracle   6330     1  0 17:01 ?        00:00:00 ora_dbw0_orcl

oracle   6332     1  0 17:01 ?        00:00:00 ora_lgwr_orcl

oracle   6334     1  0 17:01 ?        00:00:00 ora_ckpt_orcl

oracle   6337     1  0 17:01 ?        00:00:00 ora_smon_orcl

oracle   6339     1  0 17:01 ?        00:00:00 ora_reco_orcl

oracle   6341     1  0 17:01 ?        00:00:00 ora_cjq0_orcl

oracle   6343     1  0 17:01 ?        00:00:00 ora_mmon_orcl

oracle   6345     1  0 17:01 ?        00:00:00 ora_mmnl_orcl

oracle   6535  5000  0 17:11 pts/2    00:00:00 grep ora_

实例启动时,首先查找spfile<sid>.ora;如果不存在,查找spfile.ora;如果依然不存在,查找pfile<sid>.ora,如果依然不存在,则实例无法启动。

一般情况下,在一个参数文件中只要有一个参数db_name就可以启动实例,以下为测试:

[oracle@oracle /]$ export ORACLE_SID=julia

[oracle@oracle /]$ sqlplus / as sysdba

 

SQL*Plus: Release 10.2.0.1.0 - Productionon Fri Jun 7 17:59:00 2013

 

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

 

Connected to an idle instance.

 

SQL> startup nomount

ORA-01078: failure in processing systemparameters

LRM-00109: could not open parameter file'/u01/app/oracle/10.2.0/db01/dbs/initjulia.ora'

SQL> ! echo"db_name=julia">/$ORACLE_HOME/dbs/initjulia.ora

SQL> startup nomount

ORACLE instance started.

 

Total System Global Area  113246208 bytes

Fixed Size                  1218004 bytes

Variable Size              58722860 bytes

Database Buffers           50331648 bytes

Redo Buffers                2973696 bytes

在这种情况下,告警文件的路径也会有变化:

SQL> show parameter background_dump

 

NAME                                 TYPE        VALUE

----------------------------------------------- ------------------------------

background_dump_dest                 string      /u01/app/oracle/10.2.0/db01/rd

                                                bms/log

SQL> show parameter dump_dest

 

NAME                                TYPE        VALUE

----------------------------------------------- ------------------------------

background_dump_dest                 string      /u01/app/oracle/10.2.0/db01/rd

                                                bms/log

core_dump_dest                       string      /u01/app/oracle/10.2.0/db01/db

                                                s

user_dump_dest                       string      /u01/app/oracle/10.2.0/db01/rd

                                                 bms/log

SQL> show parameter control_files

 

NAME                                 TYPE        VALUE

----------------------------------------------- ------------------------------

control_files                        string      /u01/app/oracle/10.2.0/db01/db

                                                s/cntrljulia.dbf

当然,在进行rman操作时,如果没有参数文件依然可以启动实例。因为此时,数据库的db_name会被缺省为DUMMY;如下为测试:

[oracle@oracle dbs]$ exportORACLE_SID=meiyou

[oracle@oracle dbs]$ rman target/

 

Recovery Manager: Release 10.2.0.1.0 -Production on Fri Jun 7 18:12:36 2013

 

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

 

connected to target database (not started)

 

RMAN> startup nomount

 

startup failed: ORA-01078: failure inprocessing system parameters

LRM-00109: could not open parameter file'/u01/app/oracle/10.2.0/db01/dbs/initmeiyou.ora'

 

starting Oracle instance without parameterfile for retrival of spfile

Oracle instance started

 

Total System Global Area     159383552 bytes

 

Fixed Size                     1218268 bytes

Variable Size                 54528292 bytes

Database Buffers             100663296 bytes

Redo Buffers                   2973696 bytes

RMAN> host;

[oracle@oracle dbs]$ sqlplus / as sysdba

 

SQL*Plus: Release 10.2.0.1.0 - Productionon Fri Jun 7 18:13:25 2013

 

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

 

 

Connected to:

Oracle Database 10g Enterprise EditionRelease 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Miningoptions

 

SQL> show parameter db_name

 

NAME                                 TYPE        VALUE

----------------------------------------------- ------------------------------

db_name                              string      DUMMY

查看告警文件dn_name的值:

$ cd /u01/app/oracle/10.2.0/db01/rdbms/log

[oracle@oracle log]$ cat alert_meiyou.log

System parameters with non-default values:

 sga_target               =159383552

 compatible               =10.2.0.1.0

 _dummy_instance          = TRUE

 remote_login_passwordfile= EXCLUSIVE

 db_name                  = DUMMY

 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值