alter system switch logfile 和alter system archive log current
2016-04-07 09:22
465 查看
alter system switch logfile和alter system archive log current的区别
我的理解:
1、alter system switch logfile 是强制日志切换,不一定就归档当前的重做日志文件(若自动归档打开,就归档当前的重做日志,若自动归档没有打开,就不归档当前重做日志。)
【感悟】 切换日志文件,但未必对其进行归档。主要还看自动归档是否打开!
2、alter system archive log current 是归档当前的重做日志文件,不管自动归档有没有打都归档。
【感悟】 既切换日志文件,又对其进行归档!
3、主要的区别在于: 【重要】
ALTER SYSTEM SWITCH LOGFILE对单实例数据库或RAC中的当前实例执行日志切换;
而ALTER SYSTEM ARCHIVE LOG CURRENT会对数据库中的所有实例执行日志切换。
为什么执行热备后要执行alter system archive log current 这个语句,看到很多脚本都是这样写的。
是不是必须的?
一般的RMAN脚本都是这样写的,因为RMAN是可以备份归档日志的。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 database open.
SWITCH LOGFILE 条款明确地指出强制oracle开始写入新的一个重做日志组,不管当前的重做日志文件是否写满了。当你强制切换重做日志时,oracle开始执行检查点并且立即返还管理权给你而不是等到检查点完成才返还你控制权。要是该条款生效,您的实例必须处于打开状态。
ALTER SYSTEM ARCHIVE LOG CURRENT ;
CURRENT Clause
Specify CURRENT to manually archive the current redo log file group of the specified thread(instance), forcing a log switch. If you omit the THREAD parameter, then Oracle archives all redo log file groups from all enabled
9c76
threads(instances), including logs
previous to current logs. You can specify CURRENT only when the database is open.
指定CURRENT参数来手动归档当前重做日志组并指定线程(实例),强制切换日志。如果你忽略THREAD参数,那么oracle将归档所有可用线程(实例)的所有重做日志组,包括当前重做日志以前的所有日志。你也可以只指定当前打开的数据库。
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.
我的理解:
1、alter system switch logfile 是强制日志切换,不一定就归档当前的重做日志文件(若自动归档打开,就归档当前的重做日志,若自动归档没有打开,就不归档当前重做日志。)
【感悟】 切换日志文件,但未必对其进行归档。主要还看自动归档是否打开!
2、alter system archive log current 是归档当前的重做日志文件,不管自动归档有没有打都归档。
【感悟】 既切换日志文件,又对其进行归档!
3、主要的区别在于: 【重要】
ALTER SYSTEM SWITCH LOGFILE对单实例数据库或RAC中的当前实例执行日志切换;
而ALTER SYSTEM ARCHIVE LOG CURRENT会对数据库中的所有实例执行日志切换。
为什么执行热备后要执行alter system archive log current 这个语句,看到很多脚本都是这样写的。
是不是必须的?
一般的RMAN脚本都是这样写的,因为RMAN是可以备份归档日志的。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 database open.
SWITCH LOGFILE 条款明确地指出强制oracle开始写入新的一个重做日志组,不管当前的重做日志文件是否写满了。当你强制切换重做日志时,oracle开始执行检查点并且立即返还管理权给你而不是等到检查点完成才返还你控制权。要是该条款生效,您的实例必须处于打开状态。
ALTER SYSTEM ARCHIVE LOG CURRENT ;
CURRENT Clause
Specify CURRENT to manually archive the current redo log file group of the specified thread(instance), forcing a log switch. If you omit the THREAD parameter, then Oracle archives all redo log file groups from all enabled
9c76
threads(instances), including logs
previous to current logs. You can specify CURRENT only when the database is open.
指定CURRENT参数来手动归档当前重做日志组并指定线程(实例),强制切换日志。如果你忽略THREAD参数,那么oracle将归档所有可用线程(实例)的所有重做日志组,包括当前重做日志以前的所有日志。你也可以只指定当前打开的数据库。
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.
相关文章推荐
- GLSurfaceView布局内使用报空指针问题
- 3.1.12 位运算
- 处理百万级以上的数据提高查询速度的方法
- android应用Theme(二)
- 第六周上机实践项目 项目2- 带武器的游戏角色
- Spring基于注解TestContext 测试框架使用详解
- hibernate批处理
- YTU 2991: 链表节点逆置(线性表)
- 苹果企业账号打包发布APP流程详解
- 水晶报表公式字段应用处理null方法
- 转载自:www.cnblogs.com/iwtwiioi
- JQuery 中的AJAX事件
- 3.1.11 offsetof宏
- C++作业3
- Eclipse反编译插件jad安装
- Uncaught SecurityError: Failed to execute 'replaceState' on 'History':解决方案
- 第五周项目:长方柱类
- 核电站问题转载自saltless原创
- [LintCode] 落单的数II Single Number II
- 第三次上机试验-1