当前位置:网站首页>Talking about the startup of Oracle Database

Talking about the startup of Oracle Database

2022-07-06 12:18:00 wx5caecf2ed0645


Oracle The database startup process actually includes three stages : NOMOUNT -> MOUNT -> OPEN

One 、 Start database to NOMOUNT state

NOMOUNT The process is to start Oracle Process of database instance . At this stage Oracle First, I will look for the parameter file (pfile perhaps spfile), Then according to the settings in the parameter file , Create a database instance ( Allocate memory , Create background process ).

[[email protected] ~]$ sqlplus nolog

SQL*Plus: Release 11.2.0.4.0 Production on Sun Nov 9 05:00:30 2014

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

Enter password:

[[email protected] ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Sun Nov 9 05:00:49 2014

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

SQL> conn / as sysdba   

Connected to an idle instance.

SQL> startup nomount;

ORACLE instance started.

Total System Global Area  313860096 bytes

Fixed Size                  1364340 bytes

Variable Size             155192972 bytes

Database Buffers          150994944 bytes

Redo Buffers                6307840 bytes

SQL> select status from v$instance;

STATUS

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

STARTED

SQL>

Look at the warning log (Alert Log), Let's see. Oracle What action are you actually doing backstage . First find alert log Where it is .

SQL> show parameter background_dump_dest

NAME                                 TYPE        VALUE

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

background_dump_dest                 string      /u01/app/oracle/diag/rdbms/orcl/ORCL/trace

SQL> 

What is a warning log (Alert Log)?

The alert log file (also referred to as the ALERT.LOG) is a chronological log of messages and errors written out by an Oracle Database. Typical messages found in this file is: database startup, shutdown, log switches, space errors, etc. This file should constantly be monitored to detect unexpected messages and corruptions.Oracle will automatically create a new alert log file whenever the old one is deleted. (Source:Link)

By using tail -f The command tracks the changes of the warning log in real time .

[[email protected] trace]$ tail -f alert_ORCL.log 

Sun Nov 09 05:22:34 2014

Starting ORACLE instance (normal)

************************ Large Pages Information *******************

Per process system memlock (soft) limit = 64 KB

Total Shared Global Region in Large Pages = 0 KB (0%)

Large Pages used by this instance: 0 (0 KB)

Large Pages unused system wide = 0 (0 KB)

Large Pages configured system wide = 0 (0 KB)

Large Page size = 2048 KB

RECOMMENDATION:

  Total System Global Area size is 302 MB. For optimal performance,

  prior to the next instance restart:

  1. Increase the number of unused large pages by

at least 151 (page size 2048 KB, total size 302 MB) system wide to

  get 100% of the System Global Area allocated with large pages

  2. Large pages are automatically locked into physical memory.

Increase the per process memlock (soft) limit to at least 310 MB to lock

100% System Global Area's large pages into physical memory

********************************************************************

LICENSE_MAX_SESSION = 0

LICENSE_SESSIONS_WARNING = 0

Initial number of CPU is 1

CELL communication is configured to use 0 interface(s):

CELL IP affinity details:

    NUMA status: non-NUMA system

    cellaffinity.ora status: N/A

CELL communication will use 1 IP group(s):

    Grp 0:

Picked latch-free SCN scheme 2

Using LOG_ARCHIVE_DEST_1 parameter default value as USE_DB_RECOVERY_FILE_DEST

Autotune of undo retention is turned on.

IMODE=BR

ILAT =27

LICENSE_MAX_USERS = 0

SYS auditing is disabled

Starting up:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production

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

ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1

System name:    Linux

Node name:      mydb

Release:        2.6.39-400.17.1.el6uek.i686

Version:        #1 SMP Fri Feb 22 18:17:46 PST 2013

Machine:        i686

Using parameter settings in server-side pfile /u01/app/oracle/product/11.2.0/db_1/dbs/initORCL.ora

System parameters with non-default values:

  processes                = 150

  sga_target               = 300M

  control_files            = "/u01/oradata/control01.ctl"

  db_block_size            = 8192

  compatible               = "11.2.0.4.0"

  db_create_file_dest      = "/u01/oradata/"

  db_recovery_file_dest    = "/u01/app/oracle/fast_recovery_area"

  db_recovery_file_dest_size= 4152M

  undo_tablespace          = "UNDOTBS1"

  remote_login_passwordfile= "EXCLUSIVE"

  db_domain                = ""

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

  audit_file_dest          = "/u01/app/oracle/admin/ORCL/adump"

  audit_trail              = "DB"

  db_name                  = "ORCL"

  open_cursors             = 300

  pga_aggregate_target     = 100M

  diagnostic_dest          = "/u01/app/oracle"

Sun Nov 09 05:22:35 2014

PMON started with pid=2, OS id=1855

Sun Nov 09 05:22:35 2014

PSP0 started with pid=3, OS id=1857

Sun Nov 09 05:22:36 2014

VKTM started with pid=4, OS id=1859 at elevated priority

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

Sun Nov 09 05:22:36 2014

GEN0 started with pid=5, OS id=1863

Sun Nov 09 05:22:36 2014

DIAG started with pid=6, OS id=1865

Sun Nov 09 05:22:36 2014

DBRM started with pid=7, OS id=1867

Sun Nov 09 05:22:36 2014

DIA0 started with pid=8, OS id=1869

Sun Nov 09 05:22:36 2014

MMAN started with pid=9, OS id=1871

Sun Nov 09 05:22:36 2014

DBW0 started with pid=10, OS id=1873

Sun Nov 09 05:22:36 2014

LGWR started with pid=11, OS id=1875

Sun Nov 09 05:22:36 2014

CKPT started with pid=12, OS id=1877

Sun Nov 09 05:22:36 2014

SMON started with pid=13, OS id=1879

Sun Nov 09 05:22:36 2014

RECO started with pid=14, OS id=1881

Sun Nov 09 05:22:36 2014

MMON started with pid=15, OS id=1883

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

Sun Nov 09 05:22:36 2014

MMNL started with pid=16, OS id=1885

starting up 1 shared server(s) ...

ORACLE_BASE from environment = /u01/app/oracle

From the log information above , What can we see ,

1、Oracle An instance is composed of a set of memory and a set of background processes , The parameters of memory and process are written in the parameter file ,NOMOUNT The stage reads these parameter values , Construct database instance environment .

sga_target               = 300M

pga_aggregate_target     = 100M

2、 Background processes are started one by one in a certain order ,PMON First start .

PMON started with pid=2, OS id=1855 

...

DBW0 started with pid=10, OS id=1873 

...

LGWR started with pid=11, OS id=1875 

...

CKPT started with pid=12, OS id=1877 

...

SMON started with pid=13, OS id=1879 

pid Indicates the identification number of the process in the database ;OS id Indicates the process number of the process on the operating system .

The problem is coming. , Boot to NOMOUNT Stage ,Oracle Where to read the parameter file to construct Oracle Example of ?

because NOMOUNT Is the first stage , The database has not been started , So it's definitely not read from the database , It should be a local file reading parameters . This is it. SPFILE perhaps PFILE.Oracle The preferred spfile<sid>.ora File as startup parameter file ; If the file does not exist ,oracle Will choose spfile.ora file ; If neither of the first two exists ,Oracle Will choose init<sid>.ora file . If none of these three files exist ,Oracle Will not be able to create instance. In the log above , There is such a :

Using parameter settings in server-side pfile /u01/app/oracle/product/11.2.0/db_1/dbs/initORCL.ora

Illustrates the Oracle Startup time , I didn't find the first two SPFILE, The final read is PFILE Parameter file :initORCL.ora

Boot to NOMOUNT Which dynamic views can be queried ?

Only these three dynamic views :V$PARAMETER, V$SESSION, V$INSTANCE, These dynamic view information has been loaded into SGA It's in memory .

V$DATABASE, V$DATAFILE ,V$LOGFILE It's from Control file Read the , So you must wait until the database starts MOUNT Next , These dynamic views can be accessed .

The data dictionary has to wait until the database is switched to OPEN state , To access .

Two 、 Start database to MOUNT state

Start on top to NOMOUNT In the log of the stage , You can see one :

control_files            = "/u01/oradata/control01.ctl"

Boot to NOMOUNT Post state ,Oracle You can start from SPFILE or PFILE I got Control File Location information for , Find the control file , And read the control file . So what does the control file record ? The control file is a binary file , The following information is recorded :

Database name

Timestamp of database creation

Names and locations of Data Files

Names and locations of Redo Log files

The current log sequence number

Checkpoint information

Recent RMAN backups taken

Etc. 

Be careful , stay MOUNT Stage , Although data files and log files can be found through control files , But at this stage , Didn't open them .

from NOMOUNT To MOUNT:

SQL> alter database mount;

Database altered.

SQL> select status from v$instance;

STATUS

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

MOUNTED

Alert Log:

Sun Nov 09 06:25:28 2014

alter database mount

Sun Nov 09 06:25:32 2014

Successful mount of redo thread 1, with mount id 1390902744

Database mounted in Exclusive Mode

Lost write protection disabled

Completed: alter database mount

MOUNT After database , The background process can verify whether the data file exists according to the data file information recorded in the control file .

SQL> select name from v$datafile;

NAME

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

/u01/oradata/system01.dbf

/u01/oradata/sysaux01.dbf

/u01/oradata/undotbs01.dbf

/u01/oradata/users01.dbf

/u01/oradata/example01.dbf

/u01/oradata/test_tbs01.dbf

6 rows selected.

3、 ... and 、 Start database to OPEN state

At this stage , First, each data file will be checked , Check the checkpoint count in the header of the data file (Checkpoint CNT) Whether it is consistent with the checkpoint count in the control file , Then open the database , Lock the data file .

from MOUNT To OPEN:

SQL> alter database open; 

Database altered.

SQL> select status from v$instance;

STATUS

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

OPEN

This stage is complete Alert Log:

Sun Nov 09 06:28:33 2014

alter database open

Beginning crash recovery of 1 threads

Started redo scan

Completed redo scan

read 132 KB redo, 47 data blocks need recovery

Started redo application at

Thread 1: logseq 3, block 18925

Recovery of Online Redo Log: Thread 1 Group 3 Seq 3 Reading mem 0

  Mem# 0: /u01/oradata/redo03.log

  Mem# 1: /u01/oradata/redo03_2.log

Completed redo application of 0.04MB

Completed crash recovery at

Thread 1: logseq 3, block 19190, scn 1146502

47 data blocks read, 47 data blocks written, 132 redo k-bytes read

Sun Nov 09 06:28:34 2014

LGWR: STARTING ARCH PROCESSES

Sun Nov 09 06:28:34 2014

ARC0 started with pid=20, OS id=2279

ARC0: Archival started

LGWR: STARTING ARCH PROCESSES COMPLETE

ARC0: STARTING ARCH PROCESSES

Sun Nov 09 06:28:35 2014

ARC1 started with pid=21, OS id=2281

Sun Nov 09 06:28:35 2014

ARC2 started with pid=22, OS id=2283

ARC1: Archival started

ARC2: Archival started

ARC1: Becoming the 'no FAL' ARCH

ARC1: Becoming the 'no SRL' ARCH

ARC2: Becoming the heartbeat ARCH

Sun Nov 09 06:28:35 2014

ARC3 started with pid=23, OS id=2285

Thread 1 advanced to log sequence 4 (thread open)

Thread 1 opened at log sequence 4

  Current log# 4 seq# 4 mem# 0: /u01/oradata/redo04.log

  Current log# 4 seq# 4 mem# 1: /u01/oradata/redo04_2.log

Successful open of redo thread 1

MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set

Sun Nov 09 06:28:35 2014

SMON: enabling cache recovery

ARC3: Archival started

ARC0: STARTING ARCH PROCESSES COMPLETE

Archived Log entry 28 added for thread 1 sequence 3 ID 0x52e6dc5b dest 1:

[1890] Successfully onlined Undo Tablespace 2.

Undo initialization finished serial:0 start:4464354 end:4464934 diff:580 (5 seconds)

Verifying file header compatibility for 11g tablespace encryption..

Verifying 11g file header compatibility for tablespace encryption completed

SMON: enabling tx recovery

Cannot re-create tempfile /u01/app/oracle/oradata/ORCL/temp01.dbf, the same name file exists

Sun Nov 09 06:28:37 2014

Errors in file /u01/app/oracle/diag/rdbms/orcl/ORCL/trace/ORCL_dbw0_1873.trc:

ORA-01157: cannot identify/lock data file 201 - see DBWR trace file

ORA-01110: data file 201: '/u01/app/oracle/oradata/ORCL/temp01.dbf'

ORA-27037: unable to obtain file status

Linux Error: 2: No such file or directory

Additional information: 3

Database Characterset is AL32UTF8

No Resource Manager plan active

replication_dependency_tracking turned off (no async multimaster replication found)

Starting background process QMNC

Sun Nov 09 06:28:40 2014

QMNC started with pid=24, OS id=2287

Sun Nov 09 06:28:46 2014

Completed: alter database open

Sun Nov 09 06:28:46 2014

Starting background process CJQ0

Sun Nov 09 06:28:46 2014

CJQ0 started with pid=29, OS id=2303

Sun Nov 09 06:28:46 2014

db_recovery_file_dest_size of 4152 MB is 1.44% used. This is a

user-specified limit on the amount of space that will be used by this

database for recovery-related files, and does not reflect the amount of

space available in the underlying filesystem or ASM diskgroup.

Sun Nov 09 06:28:47 2014

Errors in file /u01/app/oracle/diag/rdbms/orcl/ORCL/trace/ORCL_m001_2301.trc:

ORA-01157: cannot identify/lock data file 201 - see DBWR trace file

ORA-01110: data file 201: '/u01/app/oracle/oradata/ORCL/temp01.dbf'

Setting Resource Manager plan SCHEDULER[0x32DF]:DEFAULT_MAINTENANCE_PLAN via scheduler window

Setting Resource Manager plan DEFAULT_MAINTENANCE_PLAN via parameter

Sun Nov 09 06:28:49 2014

Starting background process VKRM

Sun Nov 09 06:28:49 2014

VKRM started with pid=25, OS id=2305 


原网站

版权声明
本文为[wx5caecf2ed0645]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131547076814.html