--alter system [switch logfile]与[archive log current]的区别
------------------------------------------------------------2013/09/21
alter system switch logfile 是强制日志切换,不一定就归档当前的重做日志文件(若自动归档打开,就归档前的重做日志,若自动归档没有打开,就不归档当前重做日志。)
alter system archive log current 是归档当前的重做日志文件,不管自动归档有没有打都归档。
主要的区别在于:
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.
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 threads(instances), 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.
ALTER SYSTEM ARCHIVE LOG ALL
对数据库中的非当前未归档日志进行归档,不负责归档current日志。假设一个繁忙的系统中,有日志6个组,分别是group 1~6,当前的日志组是5,而归档进程正在操作group 3的内容,未写完,这时候group 4就是未归档的非当前日志。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 因为Apifox不支持离线,我果断选择了Apipost!
· 通过 API 将Deepseek响应流式内容输出到前端