ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle的启动过程

oracle的启动过程

原创 Linux操作系统 作者:haha牛 时间:2012-05-21 17:45:54 0 删除 编辑

数据库的启动过程包括3步:(nomountmountopen

1、  nomountoracle首先寻找参数文件(pfile/spfile),然后根据参数文件中的设置,创建实例,分配内存,启动后台进程。启动过程如下:

SQL> startup nomount;

ORACLE instance started.—启动了instance

Total System Global Area  255852544 bytes   --分配了内存

Fixed Size              1218820 bytes

Variable Size                 75499260 bytes

Database Buffers      176160768 bytes

Redo Buffers                 2973696 bytes

[root@dbp ~]# ps -ef|grep ora_            --启动了后台进程

oracle    6977     1  0 10:34 ?        00:00:00 ora_pmon_db

oracle    6979     1  0 10:34 ?        00:00:00 ora_psp0_db

oracle    6981     1  0 10:34 ?        00:00:00 ora_mman_db

oracle    6983     1  0 10:34 ?        00:00:00 ora_dbw0_db

oracle    6985     1  0 10:34 ?        00:00:00 ora_lgwr_db

oracle    6987     1  0 10:34 ?        00:00:00 ora_ckpt_db

oracle    6989     1  0 10:34 ?        00:00:00 ora_smon_db

oracle    6991     1  0 10:34 ?        00:00:00 ora_reco_db

oracle    6993     1  0 10:34 ?        00:00:00 ora_cjq0_db

oracle    6995     1  0 10:34 ?        00:00:00 ora_mmon_db

oracle    6997     1  0 10:34 ?        00:00:00 ora_mmnl_db

oracle    6999     1  0 10:34 ?        00:00:00 ora_d000_db

oracle    7001     1  0 10:34 ?        00:00:00 ora_s000_db

oracle    7003     1  0 10:34 ?        00:00:00 ora_s001_db

观察alert文件:

Starting ORACLE instance (normal)

LD_LIBRARY_PATH is not set!

LICENSE_MAX_SESSION = 0

LICENSE_SESSIONS_WARNING = 0

Picked latch-free SCN scheme 2

WARNING: db_recovery_file_dest is same as db_create_file_dest

Autotune of undo retention is turned on.

IMODE=BR

ILAT =18

LICENSE_MAX_USERS = 0

SYS auditing is disabled

ksdpec: called for event 13740 prior to event group initialization

Starting up ORACLE RDBMS Version: 10.2.0.1.0.

System parameters with non-default values:              ---非默认的初始化参数

  processes                = 150

  __shared_pool_size       = 67108864

  __large_pool_size        = 4194304

  __java_pool_size         = 4194304

  __streams_pool_size      = 0

  sga_target               = 255852544

  control_files            = +FLA/db/controlfile/current.261.765114091, +FLA/db/controlfile/current.260.765114091

  db_block_size            = 8192

  __db_cache_size          = 176160768

  compatible               = 10.2.0.1.0

  log_archive_config       = DG_CONFIG=(dbp,dbs)

  log_archive_dest_1       = LOCATION=+DATA/db/

  log_archive_dest_2       = service=dbs arch valid_for=(online_logfiles,primary_role) db_unique_name=dbs

  log_archive_dest_state_2 = defer

  log_archive_format       = %t_%s_%r.dbf

  fal_client               = dbp

  fal_server               = dbs

  db_file_multiblock_read_count= 16

  db_create_file_dest      = +FLA

  db_recovery_file_dest    = +FLA

  db_recovery_file_dest_size= 2147483648

  standby_file_management  = auto

  undo_management          = AUTO

  undo_tablespace          = UNDOTBS1

  remote_login_passwordfile= EXCLUSIVE

  db_domain                =

  dispatchers              = (PROTOCOL=TCP) (SERVICE=dbXDB)

  shared_servers           = 2

  job_queue_processes      = 10

  background_dump_dest     = /u01/admin/db/bdump

  user_dump_dest           = /u01/admin/db/udump

  core_dump_dest           = /u01/admin/db/cdump

  audit_file_dest          = /u01/admin/db/adump

  db_name                  = db

  db_unique_name           = dbp

  open_cursors             = 300

  pga_aggregate_target     = 83886080

PMON started with pid=2, OS id=7155         -------------------------后台进程一次启动

PSP0 started with pid=3, OS id=7157

MMAN started with pid=4, OS id=7159

DBW0 started with pid=5, OS id=7161

LGWR started with pid=6, OS id=7163

SMON started with pid=8, OS id=7167

CKPT started with pid=7, OS id=7165

RECO started with pid=9, OS id=7169

MMON started with pid=11, OS id=7173

CJQ0 started with pid=10, OS id=7171

Thu Feb 16 10:50:59 2012

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

MMNL started with pid=12, OS id=7175

Thu Feb 16 10:50:59 2012

starting up 2 shared server(s) ...          

启动过程中初始化参数文件的选择顺序如下:spfile.ora  spfile.ora  init.ora

2、  mount状态

启动到nomount状态之后,oracle就可以从参数文件中获得控制文件的位置信息。

SQL> show parameter control

 

NAME                                         TYPE       VALUE

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

control_file_record_keep_time             integer   7

control_files                              string     +FLA/db/controlfile/current.26

                                                 1.765114091, +FLA/db/controlfi

                                                 le/current.260.765114091

nomount状态,可以查询v$parameter视图,获得控制文件信息,这部分信息来自自动的参数文件。当数据库mount后,就可以查询v$controlfile视图获得关于控制文件的信息。在mount数据库的过程中oracle需要找到控制文件并锁定控制文件,如果控制文件丢失就会报错误ORA-00205.

SQL> alter database mount;

Database altered.

日志文件信息如下:

alter database mount

Thu Feb 16 11:10:33 2012

Starting background process ASMB

ASMB started with pid=17, OS id=7331

Starting background process RBAL

RBAL started with pid=18, OS id=7335

Loaded ASM Library - Generic Linux, version 2.0.4 (KABI_V2) library for asmlib interface

Thu Feb 16 11:10:37 2012

SUCCESS: diskgroup FLA was mounted

Thu Feb 16 11:10:42 2012

Setting recovery target incarnation to 2

Thu Feb 16 11:10:42 2012

Successful mount of redo thread 1, with mount id 1539234217

Thu Feb 16 11:10:42 2012

Allocated 3981204 bytes in shared pool for flashback generation buffer

Starting background process RVWR

RVWR started with pid=21, OS id=7343

Thu Feb 16 11:10:42 2012

Database mounted in Exclusive Mode

Completed: alter database mount

在这一部中,数据库需要计算mount id并将它记录在控制文件中,然后开始启动heartbeat(心跳),每3秒更新一次控制文件。

可以通过内部表查询当前的heartbeat值:

SQL> select cphbt from x$kcccp;

     CPHBT

----------

 775374303

9i开始oracle在数据库内部通过等待时间control file heartbeat来记录这个时间的相关等待:

SQL> select event#,name

  2  from v$event_name where name like '%heart%';

    EVENT# NAME

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

       278 ASM mount : wait for heartbeat

       419 control file heartbeat

启动到mount状态数据库还必须具备口令文件,该文件位于$ORACLE_SID/dbs目录下,缺省的名称是orapw。口令文件中存放sysdba/sysoper用户的用户名及口令:

[oracle@dbp dbs]$ strings orapwdb

]\[Z

ORACLE Remote Password file

INTERNAL

AFE66C9DE7E521AD

FC4215421720DC3B

[oracle@dbp dbs]$

在数据库启动之前,数据库内建用户是无法通过数据库本身来验证身份的,通过口令文件,oracle可以实现对用户的身份认证,在数据库未启动之前登陆,进而启动数据库。

口令文件可以重建:例子 orapwd file=orapwzhou password=123456 entries=5

3、  open阶段

由于控制文件记录了数据库中数据文件、日志文件、检查点信息等重要信息,所以在数据库的open阶段,oracle可以根据控制文件中记录的这些信息找到这新文件然后进行检查点及完整性检查。

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23655288/viewspace-730513/,如需转载,请注明出处,否则将追究法律责任。

上一篇: autotrace用法总结
请登录后发表评论 登录
全部评论

注册时间:2010-04-04

  • 博文量
    102
  • 访问量
    299296