oracle arvhivelog、noarchivelog与mount的关系

来源:互联网 发布:普通话水平测试的软件 编辑:程序博客网 时间:2024/06/06 03:36

这里仅仅想解释下,为什么alter database archivelog 与alter database noarchivelog需要在mount状态下执行。


我们来分步骤看看oracle的启动过程日志:


SQL> startup pfile='$ORACLE_HOME/dbs/pfileorcl.ora'  mount;
ORA-32006: LOG_ARCHIVE_START initialization parameter has been deprecated
ORA-32006: REMOTE_OS_AUTHENT initialization parameter has been deprecated
ORACLE instance started.


Total System Global Area  480182272 bytes
Fixed Size    2254424 bytes
Variable Size  352324008 bytes
Database Buffers  117440512 bytes
Redo Buffers    8163328 bytes
Database mounted.
SQL> 

SQL> show parameter log_archive_start


NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_start     booleanFALSE
SQL> archive log list
Database log mode       No Archive Mode
Automatic archival       Disabled
Archive destination       /home/oracle/app/oracle/product/11.2.0/dbhome_1/log/archive
Oldest online log sequence     65
Current log sequence       67
SQL> select name ,log_mode from v$database;


NAME  LOG_MODE
--------- ------------
ORCL  NOARCHIVELOG


SQL> 

看看alert_${ORACLE_SID}.log中记录的启动日志

Sat May 28 00:54:04 2016
Adjusting the default value of parameter parallel_max_servers
from 160 to 120 due to the value of parameter processes (150)
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Initial number of CPU is 4
Number of processor cores in the system is 4
Number of processor sockets in the system is 4
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 3
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 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options.
ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1
System name: Linux
Node name: localhost.localdomain
Release: 3.10.0-229.el7.x86_64
Version: #1 SMP Fri Mar 6 11:36:42 UTC 2015
Machine: x86_64
VM name: VMWare Version: 6
Using parameter settings in client-side pfile /home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/pfileorcl.ora on machine localhost.localdomain
System parameters with non-default values:
  processes                = 150
  memory_target            = 460M
  control_files            = "/home/oracle/app/oracle/oradata/orcl/control01.ctl"
  control_files            = "/home/oracle/app/oracle/fast_recovery_area/orcl/control02.ctl"
  db_block_size            = 8192
  compatible               = "11.2.0.4.0"
  log_archive_dest_1       = "location=/home/oracle/app/oracle/product/11.2.0/dbhome_1/log/archive"
  log_archive_start        = FALSE
  db_recovery_file_dest    = "/home/oracle/app/oracle/fast_recovery_area"
  db_recovery_file_dest_size= 4182M
  undo_tablespace          = "UNDOTBS1"
  resumable_timeout        = 2
  remote_os_authent        = TRUE
  remote_login_passwordfile= "EXCLUSIVE"
  db_domain                = ""
  instance_name            = "orclwf"
  dispatchers              = "(PROTOCOL=TCP)(SERVICE=orclXDB)(DISPATCHERS=3)"
  shared_servers           = 3
  local_listener           = ""
  audit_file_dest          = "/home/oracle/app/oracle/admin/orcl/adump"
  audit_trail              = "DB"
  db_name                  = "orcl"
  db_unique_name           = "orcluni"
  open_cursors             = 300
  diagnostic_dest          = "/home/oracle/app/oracle"
Deprecated system parameters with specified values:
  log_archive_start        
  remote_os_authent        
End of deprecated system parameter listing
Sat May 28 00:54:05 2016
PMON started with pid=2, OS id=16377 
Sat May 28 00:54:05 2016
PSP0 started with pid=3, OS id=16379 
Sat May 28 00:54:06 2016
VKTM started with pid=4, OS id=16381 at elevated priority
VKTM running at (1)millisec precision with DBRM quantum (100)ms
Sat May 28 00:54:06 2016
GEN0 started with pid=5, OS id=16385 
Sat May 28 00:54:06 2016
DIAG started with pid=6, OS id=16387 
Sat May 28 00:54:06 2016
DBRM started with pid=7, OS id=16389 
Sat May 28 00:54:06 2016
DIA0 started with pid=8, OS id=16391 
Sat May 28 00:54:06 2016
MMAN started with pid=9, OS id=16393 
Sat May 28 00:54:06 2016
DBW0 started with pid=10, OS id=16395 
Sat May 28 00:54:06 2016
LGWR started with pid=11, OS id=16397 
Sat May 28 00:54:06 2016
CKPT started with pid=12, OS id=16399 
Sat May 28 00:54:06 2016
SMON started with pid=13, OS id=16401 
Sat May 28 00:54:06 2016
RECO started with pid=14, OS id=16403 
Sat May 28 00:54:06 2016
MMON started with pid=15, OS id=16405 
Sat May 28 00:54:06 2016
MMNL started with pid=16, OS id=16407 
starting up 3 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
starting up 3 shared server(s) ...
ORACLE_BASE from environment = /home/oracle/app/oracle
Sat May 28 00:54:06 2016
ALTER DATABASE   MOUNT
Successful mount of redo thread 1, with mount id 1440771246
Database mounted in Exclusive Mode
Lost write protection disabled
Completed: ALTER DATABASE   MOUNT



再来open数据库

SQL> alter database open;


Database altered.


SQL> 

启动日志:Sat May 28 01:00:47 2016
alter database open
Sat May 28 01:00:47 2016
Thread 1 opened at log sequence 67
  Current log# 1 seq# 67 mem# 0: /home/oracle/app/oracle/oradata/orcl/redo01.log
Successful open of redo thread 1
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Sat May 28 01:00:47 2016
SMON: enabling cache recovery
[16425] Successfully onlined Undo Tablespace 2.
Undo initialization finished serial:0 start:29501794 end:29501824 diff:30 (0 seconds)
Verifying file header compatibility for 11g tablespace encryption..
Verifying 11g file header compatibility for tablespace encryption completed
SMON: enabling tx recovery
*********************************************************************
WARNING: The following temporary tablespaces contain no files.
         This condition can occur when a backup controlfile has
         been restored.  It may be necessary to add files to these
         tablespaces.  That can be done using the SQL statement:
 
         ALTER TABLESPACE <tablespace_name> ADD TEMPFILE
 
         Alternatively, if these temporary tablespaces are no longer
         needed, then they can be dropped.
           Empty temporary tablespace: TEMPTS1
*********************************************************************
Database Characterset is AL32UTF8
No Resource Manager plan active
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
Sat May 28 01:00:47 2016
QMNC started with pid=24, OS id=16585 
Completed: alter database open
Sat May 28 01:00:48 2016
db_recovery_file_dest_size of 4182 MB is 0.00% 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.
Sat May 28 01:00:48 2016
Starting background process CJQ0
Sat May 28 01:00:48 2016
CJQ0 started with pid=27, OS id=16609 



我们再来以重新启动数据库,并以归档模式打开,

abase closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup pfile=startup pfile='$ORACLE_HOME/dbs/pfileorcl.ora'  mount;
SP2-0714: invalid combination of STARTUP options
SQL> startup pfile='$ORACLE_HOME/dbs/pfileorcl.ora'  mount;
ORA-32006: LOG_ARCHIVE_START initialization parameter has been deprecated
ORA-32006: REMOTE_OS_AUTHENT initialization parameter has been deprecated
ORACLE instance started.


Total System Global Area  480182272 bytes
Fixed Size    2254424 bytes
Variable Size  352324008 bytes
Database Buffers  117440512 bytes
Redo Buffers    8163328 bytes
Database mounted.


启动日志:

Shutting down instance (immediate)
Shutting down instance: further logons disabled
Stopping background process QMNC
Sat May 28 01:03:13 2016
Stopping background process CJQ0
Stopping background process MMNL
Stopping background process MMON
License high water mark = 5
All dispatchers and shared servers shutdown
ALTER DATABASE CLOSE NORMAL
Sat May 28 01:03:17 2016
SMON: disabling tx recovery
SMON: disabling cache recovery
Sat May 28 01:03:17 2016
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
Thread 1 closed at log sequence 67
Successful close of redo thread 1
Completed: ALTER DATABASE CLOSE NORMAL
ALTER DATABASE DISMOUNT
Shutting down archive processes
Archiving is disabled
Completed: ALTER DATABASE DISMOUNT
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Sat May 28 01:03:18 2016
Stopping background process VKTM
Archiving is disabled
Sat May 28 01:03:20 2016
Instance shutdown complete
Sat May 28 01:03:49 2016
Adjusting the default value of parameter parallel_max_servers
from 160 to 120 due to the value of parameter processes (150)
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Initial number of CPU is 4
Number of processor cores in the system is 4
Number of processor sockets in the system is 4
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 3
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 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options.
ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1
System name: Linux
Node name: localhost.localdomain
Release: 3.10.0-229.el7.x86_64
Version: #1 SMP Fri Mar 6 11:36:42 UTC 2015
Machine: x86_64
VM name: VMWare Version: 6
Using parameter settings in client-side pfile /home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/pfileorcl.ora on machine localhost.localdomain
System parameters with non-default values:
  processes                = 150
  memory_target            = 460M
  control_files            = "/home/oracle/app/oracle/oradata/orcl/control01.ctl"
  control_files            = "/home/oracle/app/oracle/fast_recovery_area/orcl/control02.ctl"
  db_block_size            = 8192
  compatible               = "11.2.0.4.0"
  log_archive_dest_1       = "location=/home/oracle/app/oracle/product/11.2.0/dbhome_1/log/archive"
  log_archive_start        = FALSE
  db_recovery_file_dest    = "/home/oracle/app/oracle/fast_recovery_area"
  db_recovery_file_dest_size= 4182M
  undo_tablespace          = "UNDOTBS1"
  resumable_timeout        = 2
  remote_os_authent        = TRUE
  remote_login_passwordfile= "EXCLUSIVE"
  db_domain                = ""
  instance_name            = "orclwf"
  dispatchers              = "(PROTOCOL=TCP)(SERVICE=orclXDB)(DISPATCHERS=3)"
  shared_servers           = 3
  local_listener           = ""
  audit_file_dest          = "/home/oracle/app/oracle/admin/orcl/adump"
  audit_trail              = "DB"
  db_name                  = "orcl"
  db_unique_name           = "orcluni"
  open_cursors             = 300
  diagnostic_dest          = "/home/oracle/app/oracle"
Deprecated system parameters with specified values:
  log_archive_start        
  remote_os_authent        
End of deprecated system parameter listing
Sat May 28 01:03:49 2016
PMON started with pid=2, OS id=16781 
Sat May 28 01:03:49 2016
PSP0 started with pid=3, OS id=16783 
Sat May 28 01:03:50 2016
VKTM started with pid=4, OS id=16785 at elevated priority
VKTM running at (1)millisec precision with DBRM quantum (100)ms
Sat May 28 01:03:50 2016
GEN0 started with pid=5, OS id=16789 
Sat May 28 01:03:50 2016
DIAG started with pid=6, OS id=16791 
Sat May 28 01:03:50 2016
DBRM started with pid=7, OS id=16793 
Sat May 28 01:03:50 2016
DIA0 started with pid=8, OS id=16795 
Sat May 28 01:03:50 2016
MMAN started with pid=9, OS id=16797 
Sat May 28 01:03:50 2016
DBW0 started with pid=10, OS id=16799 
Sat May 28 01:03:50 2016
LGWR started with pid=11, OS id=16801 
Sat May 28 01:03:50 2016
CKPT started with pid=12, OS id=16803 
Sat May 28 01:03:50 2016
SMON started with pid=13, OS id=16805 
Sat May 28 01:03:50 2016
RECO started with pid=14, OS id=16807 
Sat May 28 01:03:50 2016
MMON started with pid=15, OS id=16809 
Sat May 28 01:03:50 2016
MMNL started with pid=16, OS id=16811 
starting up 3 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
starting up 3 shared server(s) ...
ORACLE_BASE from environment = /home/oracle/app/oracle
Sat May 28 01:03:50 2016
ALTER DATABASE   MOUNT
Successful mount of redo thread 1, with mount id 1440763894
Database mounted in Exclusive Mode
Lost write protection disabled
Completed: ALTER DATABASE   MOUNT


修改归档模式,打开归档,并open数据库

SQL> alter database archivelog;


Database altered.

SQL> select name,log_mode from v$database;    


NAME  LOG_MODE
--------- ------------
ORCL  ARCHIVELOG


SQL> archive log list
Database log mode       Archive Mode
Automatic archival       Enabled
Archive destination       /home/oracle/app/oracle/product/11.2.0/dbhome_1/log/archive
Oldest online log sequence     65
Next log sequence to archive   67
Current log sequence       67
SQL> alter database open
  2  ;


Database altered.


SQL> 

再看启动日志:

Sat May 28 01:04:21 2016
alter database archivelog
Completed: alter database archivelog
Sat May 28 01:12:03 2016
alter database open
Sat May 28 01:12:03 2016
LGWR: STARTING ARCH PROCESSES
Sat May 28 01:12:03 2016
ARC0 started with pid=24, OS id=16984 
ARC0: Archival started
LGWR: STARTING ARCH PROCESSES COMPLETE
ARC0: STARTING ARCH PROCESSES
Sat May 28 01:12:04 2016
ARC1 started with pid=25, OS id=16986 
Thread 1 opened at log sequence 67
  Current log# 1 seq# 67 mem# 0: /home/oracle/app/oracle/oradata/orcl/redo01.log
Successful open of redo thread 1
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Sat May 28 01:12:04 2016
SMON: enabling cache recovery
Sat May 28 01:12:04 2016
ARC2 started with pid=26, OS id=16988 
Sat May 28 01:12:04 2016
ARC3 started with pid=27, OS id=16990 
ARC1: Archival started
ARC2: Archival started
ARC1: Becoming the 'no FAL' ARCH
ARC1: Becoming the 'no SRL' ARCH
ARC2: Becoming the heartbeat ARCH
[16829] Successfully onlined Undo Tablespace 2.
Undo initialization finished serial:0 start:30178264 end:30178284 diff:20 (0 seconds)
Verifying file header compatibility for 11g tablespace encryption..
Verifying 11g file header compatibility for tablespace encryption completed
SMON: enabling tx recovery
*********************************************************************
WARNING: The following temporary tablespaces contain no files.
         This condition can occur when a backup controlfile has
         been restored.  It may be necessary to add files to these
         tablespaces.  That can be done using the SQL statement:
 
         ALTER TABLESPACE <tablespace_name> ADD TEMPFILE
 
         Alternatively, if these temporary tablespaces are no longer
         needed, then they can be dropped.
           Empty temporary tablespace: TEMPTS1
*********************************************************************
Database Characterset is AL32UTF8
No Resource Manager plan active
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
Sat May 28 01:12:04 2016
QMNC started with pid=28, OS id=16992 
Completed: alter database open
Sat May 28 01:12:04 2016
db_recovery_file_dest_size of 4182 MB is 0.00% 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.
Sat May 28 01:12:04 2016
Starting background process CJQ0
Sat May 28 01:12:04 2016
CJQ0 started with pid=30, OS id=17006 
ARC3: Archival started
ARC0: STARTING ARCH PROCESSES COMPLETE



比较非归档模式与归档模式下的启动日志,发现了什么?没错,在open阶段,归档模式下,多了启动arch process步骤,看这句  LGWR: STARTING ARCH PROCESSES。LGWR进程触发了arch进程的启动。但是在非归档模式下,arch进程是不启动的。


这也解释了为什么必须在mount阶段设置数据库的归档与非归档模式。因为,在mount阶段设置,在open阶段启动。

0 0
原创粉丝点击