alter system switch logfile 和 alter system archive-凯发app官方网站

凯发app官方网站-凯发k8官网下载客户端中心 | | 凯发app官方网站-凯发k8官网下载客户端中心
  • 博客访问: 3976744
  • 博文数量: 536
  • 博客积分: 10470
  • 博客等级: 上将
  • 技术积分: 4825
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-26 14:08
文章分类

全部博文(536)

文章存档

2024年(3)

2021年(1)

2019年(1)

2017年(1)

2016年(2)

2013年(2)

2012年(10)

2011年(43)

2010年(10)

2009年(17)

2008年(121)

2007年(252)

2006年(73)

相关博文
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·

分类: oracle

2011-05-24 11:09:43

主要区别:

alter system 对单实例或rac中的当前实例执行日志切换。
alter system archive log current 会对数据库中的所有实例执行日志切换。


详细解释:

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

我们都知道在自动归档的数据库中,这两个命令几乎产生的结果是一样的。来看看的解释:

alter system switch logfile ;
switch logfile clause
the switch logfile clause lets you explicitly force oracle to begin writing to a new redo log file group, regardless of whether the files in the current redo log file group are full. when you force a log switch, oracle begins to perform. a checkpoint but returns control to you immediately rather than when the checkpoint is complete. to use this clause, your instance must have the open.
alter system archive log current ;
current clause
specify current to manually archive the current redo log file group of the specified thread, forcing a log switch. if you omit the thread parameter, then oracle archives all redo log file groups from all enabled threads, including logs previous to current logs. you can specify current only when the database is open.
alter system archive log current noswitch;
noswitch
specify noswitch if you want to manually archive the current redo log file group without forcing a log switch. this setting is used primarily with standby databases to prevent data divergence when the primary database shuts down. divergence implies the possibility of data loss in case of primary database failure.
you can use the noswitch clause only when your instance has the database mounted but not open. if the database is open, then this operation closes the database automatically. you must then manually shut down the database before you can reopen it

我们首先要明白两个事实:
一个就是在logfile switch的时候会触发arch进程,即通知归档进程说那个日志可以归档了。
另 一个是logfile switch的时候会触发ckpt进程。而ckpt进程又会触发dbwr进程。dbwr进程会把上一个redo中保护的储藏在buffer cache中的dirty buffer全部写回磁盘。然后,ckpt进程纪录scn到controlfile中,这时会把redo log的状态由active 变成inactive。
由此我们可以看出处于inactive状态的redo log对于instance recovery是没有用处了。但是它可能对于meda recovery还有用处,因为处于inactive状态的redo log可能已经归档,也可能没有归档。
出现 checkpoint not complete,unable to allocate new redo log file的错误,是因为lgwr要覆盖一个其上检查点过程没有结束的日志文件,lgwr会dbwr完成,同时出现此错误。出现这个错误的原因,大概有几点,一个是dbwr写出速度太慢,一个是buffer cache中的脏数据太多。即事务太频繁,另一个也可能是日志太小,或日志组太少导致的。

恢复中用到的几个操作:

alter system checkpoint;
alter system archive log all;
alter system archive log current
alter system switch logfile;

1:alter system checkpoint;

specify checkpoint to explicitly force oracle to perform. a checkpoint, ensuring that all changes made by committed transactions are written to datafiles on disk. you can specify this clause only when your instance has the database open. oracle does not return control to you until the checkpoint is complete.
强迫oracle进行以次检查点,确保所有提交的事务的改变都被写到磁盘数据文件上。

2: alter system archive log all;

手工归档所有的日志文件组

3:alter system archive log current

手工归档的日志文件组。
4: alter system switch logfile;
the switch logfile clause lets you explicitly force oracle to begin writing to a new redo log file group, regardless of whether the files in the current redo log file group are full. when you force a log switch, oracle begins to perform. a checkpoint but returns control to you immediately rather than when the checkpoint is complete. to use this clause, your instance must have the database open.
开始写新的日志文件组。不管当前日志文件组是否满了。

阅读(1335) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
")); function link(t){ var href= $(t).attr('href'); href ="?url=" encodeuricomponent(location.href); $(t).attr('href',href); //setcookie("returnouturl", location.href, 60, "/"); }
网站地图