oracle启动到nomount状态,数据库的nomount启动阶段

Oracle数据库启动步骤:

Oracle数据库从shutdown至open分为四个阶段,如图(1-1):

48c0fc5825690c1e1331b320dc0145fd.png

shutdown→nomountSQL> startup nomount;

ORACLE instance started.

Total System Global Area 6680915968 bytes

Fixed Size                  2213936 bytes

Variable Size            3556771792 bytes

Database Buffers         3087007744 bytes

Redo Buffers               34922496 bytes

而该阶段出现的问题多半与配置文件有关

查看启动日志:Tue Dec 16 14:30:04 2014

Starting ORACLE instance (normal)

LICENSE_MAX_SESSION = 0

LICENSE_SESSIONS_WARNING = 0

Picked latch-free SCN scheme 3

Using LOG_ARCHIVE_DEST_1 parameter default value as USE_DB_RECOVERY_FILE_DEST  #这里读取归档的路径即db_recovery_file_dest参数

Autotune of undo retention is turned on.

IMODE=BR

ILAT =27

LICENSE_MAX_USERS = 0

SYS auditing is disabled   #SYS审计没有开启

Starting up:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options.

Using parameter settings in server-side spfile /DBBK/oracle/product/11.2.0.1.0/dbs/spfileorcl.ora #告知spfile的路径

System parameters with non-default values: #参数文件中非默认值的参数

processes                = 150

memory_target            = 6400M

control_files            = "/DBBK/oracle/oradata/orcl/control01.ctl"

control_files            = "/DBBK/oracle/flash_recovery_area/orcl/control02.ctl"

db_block_size            = 8192

compatible               = "11.2.0.0.0"

db_recovery_file_dest    = "/DBBK/oracle/flash_recovery_area"

db_recovery_file_dest_size= 3882M

undo_tablespace          = "UNDOTBS1"

remote_login_passwordfile= "EXCLUSIVE"

db_domain                = ""

dispatchers              = "(PROTOCOL=TCP) (SERVICE=orclXDB)"

audit_file_dest          = "/DBBK/oracle/admin/orcl/adump"

audit_trail              = "DB"

db_name                  = "orcl"

open_cursors             = 300

diagnostic_dest          = "/DBBK/oracle"

Tue Dec 16 14:30:06 2014   # 从这里开始均为数据库启动时加载的进程

PMON started with pid=2, OS id=20524

Tue Dec 16 14:30:06 2014

VKTM started with pid=3, OS id=20526 at elevated priority

VKTM running at (10)millisec precision with DBRM quantum (100)ms

Tue Dec 16 14:30:06 2014

GEN0 started with pid=4, OS id=20530

Tue Dec 16 14:30:06 2014

DIAG started with pid=5, OS id=20532

Tue Dec 16 14:30:06 2014

DBRM started with pid=6, OS id=20534

Tue Dec 16 14:30:06 2014

PSP0 started with pid=7, OS id=20536

Tue Dec 16 14:30:06 2014

DIA0 started with pid=8, OS id=20538

Tue Dec 16 14:30:06 2014

MMAN started with pid=9, OS id=20540

Tue Dec 16 14:30:06 2014

DBW0 started with pid=10, OS id=20542

Tue Dec 16 14:30:06 2014

LGWR started with pid=11, OS id=20544

Tue Dec 16 14:30:06 2014

CKPT started with pid=12, OS id=20546

Tue Dec 16 14:30:06 2014

SMON started with pid=13, OS id=20548

Tue Dec 16 14:30:06 2014

RECO started with pid=14, OS id=20550

Tue Dec 16 14:30:06 2014

MMON started with pid=15, OS id=20552

starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...

Tue Dec 16 14:30:06 2014

MMNL started with pid=16, OS id=20554

starting up 1 shared server(s) ...

ORACLE_BASE from environment = /DBBK/oracle

日志归档的路径默认路径:SQL> show parameters 'db_recovery';

NAME                    TYPE            VALUE

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

db_recovery_file_dest   string          /DBBK/oracle/flash_recovery_area

查看一下参数文件所在的位置:NAME      TYPE     VALUE

--------- -------- -------------------------------------------------spfile    string   /DBBK/oracle/product/11.2.0.1.0/dbs/spfileorcl.ora

当数据库启动的时候,是去加载该配置的文件的

关闭数据库,以下是关闭时的日志输出:Shutting down instance (immediate)

Shutting down instance: further logons disabled

Stopping background process MMNL

Stopping background process MMON

License high water mark = 2

All dispatchers and shared servers shutdown

这里我关闭的时遇到问题,日志上提示服务已经关闭,但进程还在,而且通过sqlplus登录后启动提示ORA-01012: not logged on报错

通过网上查看原因是应用异常连接没有释放导致的,回想一下刚才shutdown的时候,确实客户进程一直挂住的,通过kill进程的方式也没有解决问题,通过shutdown abort的方式关闭异常进程后发现确实登录后的一些不同点:[oracle@021Y-SH-BKAP ~]$ sqlplus / as sysdba #问题连接可以看到并没有连接实例

SQL*Plus: Release 11.2.0.1.0 Production on Tue Dec 16 15:58:51 2014

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

Connected.

SQL> startup nomount;

ORA-01012: not logged on

[oracle@021Y-SH-BKAP ~]$ sqlplus / as sysdba #正常的显示连接空闲实例

SQL*Plus: Release 11.2.0.1.0 Production on Tue Dec 16 16:00:57 2014

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

Connected to an idle instance.

SQL>

这里不在细说了,shutdown abort后可以看到日志中说明实例终断了。USER (ospid: 32205): terminating the instance

Instance terminated by USER, pid = 32205

这里我继续启动部分的内容,尝试修改该参数文件,看看会发生说明情况?[oracle@021Y-SH-BKAP dbs]$ mv spfileorcl.ora spfileorcl.ora.bak

SQL> startup nomount;

ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file '/DBBK/oracle/product/11.2.0.1.0/dbs/initorcl.ora'

可以看到报错表示加载系统参数报错,表示找不到数据库的参数文件。并且数据库默认去读取名称为initorcl.ora的文件。

这里我修改spfile的,重新nomount数据库后,手工创建pfile文件,可以看到上面的文件被创建出来了SQL> create pfile from spfile;

-rw-r--r-- 1 oracle oinstall  892 Dec 16 16:20 initorcl.ora

这次我再次重复修改参数文件,并启动数据库,可以看到日志中提示服务启动时加载的参数文件改变了Starting up:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options.

Using parameter settings in server-side pfile /DBBK/oracle/product/11.2.0.1.0/dbs/initorcl.ora

查看数据库中的参数文件,表示没有加载spfile文件SQL> show parameter spfile;

NAME              TYPE           VALUE

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

spfile            string

查看一下spfile与pfile文件的类型[oracle@021Y-SH-BKAP dbs]$ file spfileorcl.ora.bak

spfileorcl.ora.bak: data

[oracle@021Y-SH-BKAP dbs]$ file initorcl.ora

initorcl.ora: ASCII text

那么得到的结论即:数据启动时首先加载spfile(动态的参数文件),当找到不到该参数文件时,则加载pfile(静态参数文件),pfile为文本形式的参数文件,可以再文本编辑器中进行编辑修改启动参数,而spfile则需要在实例状态下进行修改,或则通过修改好的pfile来生产spfile。

参考官方文档中提到数据启时的最基本参数为DB_NAME。那么尝试仅适用该参数看能否启动数据呢?

修改SID,可以看到启动时需要参数文件,这里可以判断出,数据库启动时在代码中应该写的是$ORACLE_HOME/dbs/spfile+$ORACLE_SID.ora, 如果不存在则$ORACLE_HOME/dbs/init+$ORACLE_SID.ora。[oracle@021Y-SH-BKAP ~]$ export ORACLE_SID=joshua;

[oracle@021Y-SH-BKAP ~]$ echo $ORACLE_SID

joshua

[oracle@021Y-SH-BKAP ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Dec 16 16:51:16 2014

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

Connected to an idle instance.

SQL> startup nomount;

ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file '/DBBK/oracle/product/11.2.0.1.0/dbs/initjoshua.ora'

修该pfile,仅保留db_name,nomount数据库SQL>!echo "db_name=joshua" > /DBBK/oracle/product/11.2.0.1.0/dbs/initjoshua.ora #这里的!表示调用系统命令,输入!等于host

*.db_name='joshua'

[oracle@021Y-SH-BKAP ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Dec 16 17:01:13 2014

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

Connected to an idle instance.

SQL> startup nomount;

ORACLE instance started.

Total System Global Area  217157632 bytes

Fixed Size                  2211928 bytes

Variable Size             159387560 bytes

Database Buffers           50331648 bytes

Redo Buffers                5226496 bytes

可以看到启动日志的内容如下:[root@021Y-SH-BKAP joshua]# cd /DBBK/oracle/diag/rdbms/joshua/joshua/trace/

[root@021Y-SH-BKAP trace]# tail -200 alert_joshua.log

Tue Dec 16 17:01:18 2014

Starting ORACLE instance (normal)

……

Shared memory segment for instance monitoring created

Picked latch-free SCN scheme 3

Using LOG_ARCHIVE_DEST_1 parameter default value as /DBBK/oracle/product/11.2.0.1.0/dbs/arch

Autotune of undo retention is turned on.

IMODE=BR

ILAT =19

……

Starting up:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options.

Using parameter settings in server-side pfile /DBBK/oracle/product/11.2.0.1.0/dbs/initjoshua.ora

System parameters with non-default values:

db_name                  = "joshua"

可以看到日志的路径指向了新的路径,查看部分参数,发现数据库已经默认将路径指向了对应的目录下:NAME                                 TYPE                              VALUE

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

background_dump_dest                 string                            /DBBK/oracle/diag/rdbms/joshua

/joshua/trace

core_dump_dest                       string                            /DBBK/oracle/diag/rdbms/joshua

/joshua/cdump

user_dump_dest                       string                            /DBBK/oracle/diag/rdbms/joshua

/joshua/trace

还有个有趣的现象:当通过RMAN进行数据库启动时,即使没有参数文件,数据库也可以启动RMAN> startup nomount;

connected to target database (not started)

startup failed: ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file '/DBBK/oracle/product/11.2.0.1.0/dbs/initorcl.ora'

starting Oracle instance without parameter file for retrieval of spfile

Oracle instance started

Total System Global Area     158662656 bytes

Fixed Size                     2211448 bytes

Variable Size                 92275080 bytes

Database Buffers              58720256 bytes

Redo Buffers                   5455872 bytes

查看数据库名称发现为DUMMY

SQL> show parameters db_name

NAME                                 TYPE        VALUE

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

db_name                              string      DUMMY告警日志的提示内容:

Starting ORACLE instance (restrict)

LICENSE_MAX_SESSION = 0

LICENSE_SESSIONS_WARNING = 0

Picked latch-free SCN scheme 3

Using LOG_ARCHIVE_DEST_1 parameter default value as /DBBK/oracle/product/11.2.0.1.0/dbs/arch

Autotune of undo retention is turned on.

IMODE=BR

ILAT =19

LICENSE_MAX_USERS = 0

SYS auditing is disabled

Starting up:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options.

Using parameter settings in client-side pfile /tmp/ora_tfilXbHu21 on machine 021Y-SH-BKAP

System parameters with non-default values:

sga_target               = 152M

compatible               = "11.2.0.1.0"

_dummy_instance          = TRUE

remote_login_passwordfile= "EXCLUSIVE"

db_name                  = "DUMMY"

Wed Dec 17 12:11:55 2014

PMON started with pid=2, OS id=9619

Wed Dec 17 12:11:55 2014

VKTM started with pid=3, OS id=9621 at elevated priority

VKTM running at (10)millisec precision with DBRM quantum (100)ms

Wed Dec 17 12:11:55 2014

GEN0 started with pid=4, OS id=9625

Wed Dec 17 12:11:55 2014

DIAG started with pid=5, OS id=9627

Wed Dec 17 12:11:55 2014

DBRM started with pid=6, OS id=9629

Wed Dec 17 12:11:55 2014

PSP0 started with pid=7, OS id=9631

Wed Dec 17 12:11:55 2014

DIA0 started with pid=8, OS id=9633

Wed Dec 17 12:11:55 2014

MMAN started with pid=9, OS id=9635

Wed Dec 17 12:11:55 2014

DBW0 started with pid=10, OS id=9637

Wed Dec 17 12:11:55 2014

LGWR started with pid=11, OS id=9639

Wed Dec 17 12:11:55 2014

CKPT started with pid=12, OS id=9641

Wed Dec 17 12:11:55 2014

SMON started with pid=13, OS id=9643

Wed Dec 17 12:11:55 2014

RECO started with pid=14, OS id=9645

Wed Dec 17 12:11:55 2014

MMON started with pid=15, OS id=9647

Wed Dec 17 12:11:55 2014

MMNL started with pid=16, OS id=9649

ORACLE_BASE from environment = /DBBK/oracle

参考:《DBA入门、进阶与诊断案例》 盖国强著

ALTER DATABASE CLOSE NORMAL

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值