Oracle是如何启动的?
Oracle的启动十分简单
1、登陆
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Aug 3 15:45:00 2019
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
2、启动
SQL> startup
ORACLE instance started.
可以了。。
下面看下具体的启动日志
SQL> startup
ORACLE instance started.
Total System Global Area 822579200 bytes
Fixed Size 2217832 bytes
Variable Size 666896536 bytes
Database Buffers 146800640 bytes
Redo Buffers 6664192 bytes
Database mounted.
Database opened.
SQL>
从日志中可以看出启动的大概步骤
1、启动实例
2、分配各种内存
3、安装数据库
4、打开数据库
下面详细介绍下oracle的启动过程
1、在执行startup命令后,oracle 会读取spfile 中的初始化参数,按照这些参数来启动数据库
/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilePROD.ora
System parameters with non-default values:
processes = 150
memory_target = 788M
control_files = "/u02/oradata/PROD/control01.ctl"
control_files = "/u01/app/oracle/flash_recovery_area/PROD/control02.ctl"
db_block_size = 8192
compatible = "11.2.0.0.0"
_use_adaptive_log_file_sync= FALSE
db_recovery_file_dest = "/u01/app/oracle/flash_recovery_area"
db_recovery_file_dest_size= 30G
undo_tablespace = "UNDOTBS1"
remote_login_passwordfile= "EXCLUSIVE"
db_domain = ""
dispatchers = "(PROTOCOL=TCP) (SERVICE=PRODXDB)"
audit_file_dest = "/u01/app/oracle/admin/PROD/adump"
audit_trail = "DB"
db_name = "PROD"
open_cursors = 300
diagnostic_dest = "/u01/app/oracle"
最先启动的是一些数据库的进程,如下
PMON started with pid=2, OS id=5680
Sat Aug 03 15:45:24 2019
VKTM started with pid=3, OS id=5682 at elevated priority
VKTM running at (10)millisec precision with DBRM quantum (100)ms
Sat Aug 03 15:45:24 2019
GEN0 started with pid=4, OS id=5686
Sat Aug 03 15:45:24 2019
DIAG started with pid=5, OS id=5688
Sat Aug 03 15:45:24 2019
DBRM started with pid=6, OS id=5690
Sat Aug 03 15:45:24 2019
PSP0 started with pid=7, OS id=5692
Sat Aug 03 15:45:25 2019
DIA0 started with pid=8, OS id=5694
Sat Aug 03 15:45:25 2019
MMAN started with pid=9, OS id=5696
Sat Aug 03 15:45:25 2019
DBW0 started with pid=10, OS id=5698
Sat Aug 03 15:45:25 2019
LGWR started with pid=11, OS id=5700
Sat Aug 03 15:45:25 2019
CKPT started with pid=12, OS id=5702
Sat Aug 03 15:45:25 2019
SMON started with pid=13, OS id=5704
Sat Aug 03 15:45:25 2019
RECO started with pid=14, OS id=5706
Sat Aug 03 15:45:25 2019
MMON started with pid=15, OS id=5708
Sat Aug 03 15:45:25 2019
MMNL started with pid=16, OS id=5710
starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
starting up 1 shared server(s) ...
然后从初始化参数中control_files找到数据库的控制文件存放的地址。读取控制文件的内容,控制文件中存储了数据库各个文件的存放地址和状态。找到了控制文件才能找到其他数据文件。根据控制文件就能实现数据库的安装
ALTER DATABASE MOUNT
Successful mount of redo thread 1, with mount id 427141013
Database mounted in Exclusive Mod
Lost write protection disabled
Completed: ALTER DATABASE MOUNT
最后一步就是数据库打开的过程
打开数据库第一步是开始故障恢复,因为上次关数据库时有些redo的数据还没来及写到数据库中,造成redo和数据库的scn实际不一致。启动后需要扫描redo文件,确定有多少数据需要进行恢复。然后将这些数据写入数据库,保持redo,control文件和数据文件的一致。
Sat Aug 03 15:45:29 2019
ALTER DATABASE OPEN
Beginning crash recovery of 1 threads
parallel recovery started with 2 processes
Started redo scan
Completed redo scan
read 1339 KB redo, 497 data blocks need recovery
Started redo application at
Thread 1: logseq 29, block 161440
Recovery of Online Redo Log: Thread 1 Group 5 Seq 29 Reading mem 0
Mem# 0: /u02/oradata/PROD/redo05.log
Completed redo application of 1.11MB
Completed crash recovery at
Thread 1: logseq 29, block 164119, scn 3959514
497 data blocks read, 497 data blocks written, 1339 redo k-bytes read
LGWR: STARTING ARCH PROCESSES
Sat Aug 03 15:45:30 2019
ARC0 started with pid=22, OS id=5757
ARC0: Archival started
LGWR: STARTING ARCH PROCESSES COMPLETE
ARC0: STARTING ARCH PROCESSES
Sat Aug 03 15:45:31 2019
ARC1 started with pid=23, OS id=5759
Sat Aug 03 15:45:31 2019
ARC2 started with pid=24, OS id=5761
Sat Aug 03 15:45:31 2019
ARC1: Archival startedARC3 started with pid=25, OS id=5763
ARC2: Archival started
ARC2: Becoming the 'no FAL' ARCH
ARC2: Becoming the 'no SRL' ARCH
ARC1: Becoming the heartbeat ARCH
这一步打开归档进程
Thread 1 advanced to log sequence 30 (thread open)
Thread 1 opened at log sequence 30
Current log# 6 seq# 30 mem# 0: /u02/oradata/PROD/redo06.log
Successful open of redo thread 1
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
SMON: enabling cache recovery
Successfully onlined Undo Tablespace 2.
Verifying file header compatibility for 11g tablespace encryption..
Verifying 11g file header compatibility for tablespace encryption completed
SMON: enabling tx recovery
Database Characterset is AL32UTF8
No Resource Manager plan active
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
Sat Aug 03 15:45:32 2019
QMNC started with pid=26, OS id=5765
ARC3: Archival started
ARC0: STARTING ARCH PROCESSES COMPLETE
Completed: ALTER DATABASE OPEN
启动成功
以上就是oracle启动的详细过程。
--2019-08-03 16:32