透过alert日志看Oracle Startup的三个阶段

        alert日志记录oracle实例生命周期中发生的重要事件,例如数据库启动、关闭、日志切换等,方便程序员和管理员发现问题。其中,数据库启动分为3个阶段,即nomount,mount和open。那么,在这三个阶段alert日志会记录哪些信息呢。下面我们就按照 nomount,mount和open的顺序逐步启动数据库。

nomount

通过startup nomount命令将数据库启动到nomount状态,此时,数据库实例的状态是STARTED。如下所示:

点击(此处)折叠或打开

  1. SQL>
  2. SQL> startup nomount
  3. ORACLE instance started.

  4. Total System Global Area 941600768 bytes
  5. Fixed Size 1348860 bytes
  6. Variable Size 515902212 bytes
  7. Database Buffers 419430400 bytes
  8. Redo Buffers 4919296 bytes
  9. SQL>
  10. SQL> select status from v$instance;

  11. STATUS
  12. ------------
  13. STARTED

  14. SQL>
接下来,查看alert日志的输出内容如下:

点击(此处)折叠或打开

  1. Sat May 09 22:14:16 2015
  2. Starting ORACLE instance (normal)
  3. LICENSE_MAX_SESSION = 0
  4. LICENSE_SESSIONS_WARNING = 0
  5. Picked latch-free SCN scheme 2
  6. Using LOG_ARCHIVE_DEST_1 parameter default value as /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch
  7. Autotune of undo retention is turned on.
  8. IMODE=BR
  9. ILAT =27
  10. LICENSE_MAX_USERS = 0
  11. SYS auditing is disabled
  12. Starting up:
  13. Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
  14. With the Partitioning, OLAP, Data Mining and Real Application Testing options.
  15. ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1
  16. System name:    Linux
  17. Node name:    enmoedu1.example.com
  18. Release:    2.6.18-164.el5PAE
  19. Version:    #1 SMP Thu Sep 3 02:28:20 EDT 2009
  20. Machine:    i686
  21. VM name:    VMWare Version: 6
  22. Using parameter settings in server-side spfile /u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfileHOEGH.ora
  23. System parameters with non-default values:
  24.   processes = 150
  25.   memory_target = 900M
  26.   memory_max_target = 900M
  27.   control_files = \"/u01/app/oracle/oradata/HOEGH/control01.ctl\"
  28.   control_files = \"/u01/app/oracle/oradata/HOEGH/control02.ctl\"
  29.   db_block_size = 8192
  30.   compatible = \"11.2.0.0.0\"
  31.   undo_tablespace = \"UNDOTBS1\"
  32.   remote_login_passwordfile= \"EXCLUSIVE\"
  33.   db_domain = \"\"
  34.   dispatchers = \"(PROTOCOL=TCP) (SERVICE=HOEGHXDB)\"
  35.   audit_file_dest = \"/u01/app/oracle/admin/HOEGH/adump\"
  36.   audit_trail = \"DB\"
  37.   db_name = \"HOEGH\"
  38.   open_cursors = 300
  39.   diagnostic_dest = \"/u01/app/oracle\"
  40. Sat May 09 22:14:16 2015
  41. PMON started with pid=2, OS id=5054
  42. Sat May 09 22:14:16 2015
  43. PSP0 started with pid=3, OS id=5056
  44. Sat May 09 22:14:17 2015
  45. VKTM started with pid=4, OS id=5063 at elevated priority
  46. VKTM running at (1)millisec precision with DBRM quantum (100)ms
  47. Sat May 09 22:14:17 2015
  48. GEN0 started with pid=5, OS id=5067
  49. Sat May 09 22:14:17 2015
  50. DIAG started with pid=6, OS id=5069
  51. Sat May 09 22:14:17 2015
  52. DBRM started with pid=7, OS id=5071
  53. Sat May 09 22:14:17 2015
  54. DIA0 started with pid=8, OS id=5073
  55. Sat May 09 22:14:17 2015
  56. MMAN started with pid=9, OS id=5075
  57. Sat May 09 22:14:17 2015
  58. DBW0 started with pid=10, OS id=5077
  59. Sat May 09 22:14:17 2015
  60. LGWR started with pid=11, OS id=5079
  61. Sat May 09 22:14:17 2015
  62. CKPT started with pid=12, OS id=5081
  63. Sat May 09 22:14:17 2015
  64. SMON started with pid=13, OS id=5083
  65. Sat May 09 22:14:17 2015
  66. RECO started with pid=14, OS id=5085
  67. Sat May 09 22:14:17 2015
  68. MMON started with pid=15, OS id=5087
  69. Sat May 09 22:14:17 2015
  70. MMNL started with pid=16, OS id=5089
  71. starting up 1 dispatcher(s) for network address \'(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))\'...
  72. starting up 1 shared server(s) ...
  73. ORACLE_BASE from environment = /u01/app/oracle
由上可以看出,在nomount阶段,Oracle首先寻找参数文件(pfile/spfile),然后根据参数文件中的设置(如内存分配等设置),创建实例(INSTANCE),分配内存,启动后台进程。Nomount的过程也就是启动数据库实例的过程。这个过程在后台是启动Oracle可执行程序的过程,Windows上是oracle.exe文件的初始化,在Unix/Linux上是oracle可执行文件的初始化。

mount

接下来,通过alter database mount;命令将数据库启动到mount状态,此时,数据库实例的状态是 MOUNTED 如下所示:

点击(此处)折叠或打开

  1. SQL>
  2. SQL> alter database mount;

  3. Database altered.

  4. SQL>
  5. SQL> select status from v$instance;

  6. STATUS
  7. ------------
  8. MOUNTED

  9. SQL>
查看alert日志的输出内容如下:

点击(此处)折叠或打开

  1. Sat May 09 22:15:30 2015
  2. alter database mount
  3. Sat May 09 22:15:34 2015
  4. Successful mount of redo thread 1, with mount id 2100626370
  5. Database mounted in Exclusive Mode
  6. Lost write protection disabled
  7. Completed: alter database mount
mount数据库的过程是读参数文件中描述的控制文件,校验控制文件的正确性,将控制文件的内容读入到内存,mount是挂接的意思,是操作系统中的概念。一旦mount之后,就是将一个没有意义的实例和一个数据库发生了联系。

open

通过alter database open;命令将数据库启动到open状态,此时,数据库实例的状态是OPEN。如下所示:

点击(此处)折叠或打开

  1. SQL>
  2. SQL> alter database open;

  3. Database altered.

  4. SQL>
  5. SQL> select status from v$instance;

  6. STATUS
  7. ------------
  8. OPEN

  9. SQL>
查看alert日志的输出内容如下:

点击(此处)折叠或打开

  1. Sat May 09 22:16:34 2015
  2. alter database open
  3. Beginning crash recovery of 1 threads
  4.  parallel recovery started with 2 processes
  5. Started redo scan
  6. Completed redo scan
  7.  read 12 KB redo, 9 data blocks need recovery
  8. Started redo application at
  9.  Thread 1: logseq 7, block 118
  10. Recovery of Online Redo Log: Thread 1 Group 1 Seq 7 Reading mem 0
  11.   Mem# 0: /u01/app/oracle/oradata/HOEGH/redo01.log
  12. Completed redo application of 0.00MB
  13. Completed crash recovery at
  14.  Thread 1: logseq 7, block 143, scn 918639
  15.  9 data blocks read, 9 data blocks written, 12 redo k-bytes read
  16. Sat May 09 22:16:34 2015
  17. Thread 1 advanced to log sequence 8 (thread open)
  18. Thread 1 opened at log sequence 8
  19.   Current log# 2 seq# 8 mem# 0: /u01/app/oracle/oradata/HOEGH/redo02.log
  20. Successful open of redo thread 1
  21. MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
  22. Sat May 09 22:16:35 2015
  23. SMON: enabling cache recovery
  24. [5095] Successfully onlined Undo Tablespace 2.
  25. Undo initialization finished serial:0 start:4294562150 end:4294562220 diff:70 (0 seconds)
  26. Verifying file header compatibility for 11g tablespace encryption..
  27. Verifying 11g file header compatibility for tablespace encryption completed
  28. SMON: enabling tx recovery
  29. Database Characterset is AL32UTF8
  30. No Resource Manager plan active
  31. replication_dependency_tracking turned off (no async multimaster replication found)
  32. Starting background process QMNC
  33. Sat May 09 22:16:35 2015
  34. QMNC started with pid=22, OS id=5274
  35. Completed: alter database open
  36. Sat May 09 22:16:36 2015
  37. Starting background process CJQ0
  38. Sat May 09 22:16:36 2015
  39. CJQ0 started with pid=24, OS id=5296
这一阶段数据库读取 控制文件中描述的数据文件 验证数据文件的一致性,如果不一致,使用日志文件将数据库文件恢复到一致的状态。 数据库open后,普通用户才可以访问数据库。

~~~~~~~ the end~~~~~~~~~
hoegh
2015.05.09
      

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

转载于:http://blog.itpub.net/30162081/viewspace-1631808/

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值