`
wsql
  • 浏览: 11788246 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

alter system switch logfile和alter system archive log current 的区别

 
阅读更多

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.

分享到:
评论

相关推荐

    oracle常用命令

    sql> alter system switch logfile; 2.forcing checkpoints sql> alter system checkpoint; 3.adding online redo log groups sql> alter database add logfile [group 4] sql> ('/disk3/log4a.rdo','/disk4/...

    ORACLE日志丢失的恢复

    alter system switch logfile; alter system switch logfile; 2.删除旧的日志组 alter database drop logfile group 1; alter database drop logfile group 2; alter database drop logfile group 3; 3.日志...

    oracle归档日志步骤+RMAN步骤

    oracle归档日志步骤+RMAN步骤 ...SQL〉alter system switch logfile; show all; configure controlfile autobackup on; 启动控制文件自动备份 configure retention policy to redundancy 4; 备份策略,4个版本

    ORACLE 常用命令

    第一章:日志管理 1.forcing log switches sql> alter system switch logfile; 2.forcing checkpoints sql> alter system checkpoint;

    sql plus 命令大全

    sql plus 命令大全 第一章:日志管理 1.forcing log switches sql> alter system switch logfile; 2.forcing checkpoints sql> alter system checkpoint;

    Oracle常用命令大汇总.doc

    sql> alter system switch logfile; 2.forcing checkpoints sql> alter system checkpoint; 3.adding online redo log groups sql> alter database add logfile [group 4] sql> ('/disk3/log4a.rdo','/...

    Oracle常用命令大汇总

    sql> alter system switch logfile; 2.forcing checkpoints sql> alter system checkpoint; 3.adding online redo log groups sql> alter database add logfile [group 4] sql> ('/disk3/log4a.rdo','/...

    Oracle数据库管理员的常用命令

    sql> alter system switch logfile; 2.forcing checkpoints sql> alter system checkpoint; 3.adding online redo log groups sql> alter database add logfile [group 4] sql> ('/disk3/log4a.rdo','/disk4/log4b...

    Oracle常用命令大全集

     sql> alter system switch logfile;  2.forcing checkpoints  sql> alter system checkpoint;  3.adding online redo log groups  sql> alter database add logfile [group 4]  sql> (‘/disk3/log4a....

    关于归档日志三个参数的说明.txt

    归档日志路径三个参数DB_RECOVERY_FILE_DEST和LOG_ARCHIVE...如果想要归档日志继续存放在DB_RECOVERY_FILE_DEST中,可以通过如下命令:alter system set log_archive_dest_1=’location=USE_DB_RECOVERY_FILE_DEST’;

    Oracle RAC Standby实施手册

    2 Active DataGuard实施条件 实施Active DataGuard的前提条件如下: 1. 主数据库主机和备数据库主机硬件平台一致,如都为Linux 主机; 2. 主数据库和备数据库软件版本一致且...SQL> alter system archive log current;

    oracle - answer

    习题 Ch3 (1) CREATE SPFILE FROM PFILE=path (2) CREATE PFILE FROM SPFILE (3) SELECT NAME,VALUE FROM V$PARAMETER (4) ALTET SESSION SET NLS_DATE_FORMAT=’YYYY-...ALTER SYSTEM ARCHIVE LOG START ……

    oracle日志alter.log每天切割脚本

    oracle 的alter日志切割脚本,有需要的可自行改造

    Oracle数据库的十种重新启动步骤

    在独占的系统用户下,手工切换重作日志文件,确保当前已修改过的数据存入文件: SQL>alter system switch logfile; 5. 在独占的系统用户下,运行下面SQL语句,生成杀数据库用户连接的kill_all_session.sql文件: set ...

    hana log日志空间占满处理.pdf

    HANA在线日志清理方法,不能直接进入/hana/log日志目录下进行删除操作,此种操作会给系统带来极大的灾难,需要根据SAP给出的方法来进行处理

    对分区表进行alter-switch时遇到的错误

    将一个表的数据加入分区表中,可以通过如下步骤进行

    Rman备份与恢复

    rman的备份与恢复 , 常见操作 1、切换服务器归档模式,如果已经是归档模式可跳过此步: %sqlplus /nolog (启动sqlplus) ...SQL> alter system archive log start; (启用自动归档) SQL> exit (退出) 2、连接:

    最全的oracle常用命令大全.txt

    su - oracle -c "exp system/manager full=y inctype=complete file=/oracle/export/db_comp$rq.dmp" 累计备份的SH文件:exp_cumu.sh rq=` date +"%m%d" ` su - oracle -c "exp system/manager full=y inctype=...

    TVTools+AlterID+2.0.rar

    TVTools AlterID 是一款解决TeamViewer被检测为商业用途的无限换ID工具,使用TeamViewer远程控制软件的朋友都知道,TeamViewer不管是什么所谓的破解版还是TeamViewer免费版使用过程都会出现一些TeamViewer被检测为...

Global site tag (gtag.js) - Google Analytics