`
ruilin215
  • 浏览: 1143371 次
  • 性别: Icon_minigender_2
  • 来自: 成都
文章分类
社区版块
存档分类
最新评论

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.


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.

分享到:
评论

相关推荐

    Archive Log Current及Archive Log路线图

    > 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 Database archives all threads. 这一...

    oracle多路归档.txt

    - 强制切换日志: `sql>alter system switch logfile;` - 在RAC环境下强制所有实例进行归档: `sql>alter system archivelog current;` ### 3. 归档日志的参数 #### 关键参数介绍 - **log_archive_dest**: 指定归档...

    数据库归档模式

    - 使用`ALTER SYSTEM SWITCH LOGFILE`命令可以显式地强制数据库开始写入新的重做日志文件组,无论当前重做日志文件组中的文件是否已满。 - 当执行此命令时,Oracle会开始执行检查点操作,并立即返回控制权,而不会...

    RedHat AS 3上的Oracle9.2.0.4 的Data Guard实现

    - 测试归档功能,通过`alter system switch logfile`命令切换日志,确认归档日志的生成。 4. **创建备用归档路径**: 创建备用归档目录`/oracle/oradata/reddb/stdby_arch`,用于在主库变为备用数据库时接收归档...

    查看oracle数据库是否归档和修改归档模式

    SQL> alter system switch logfile; SQL> alter system archive log current; ``` 8. **确认归档日志** 检查归档日志是否已成功生成于指定目录。 #### 四、自动归档模式设置 自动归档模式通过启用数据库中的`...

    RAC下的REDO和UNDO管理

    执行`ALTER SYSTEM SWITCH LOGFILE`命令时,只会影响当前节点的当前redo thread进行日志切换,而`ALTER SYSTEM ARCHIVE LOG CURRENT`命令则会作用于所有可用节点,使得所有实例的redo thread进行切换并归档到归档...

    2010年oracle命令176页完整版型

    ### Oracle数据库基本操作知识点 #### 一、表空间操作 **1.... ALTER SYSTEM SWITCH LOGFILE; ``` - **创建初始化参数文件:** ```sql CREATE PFILE='/u01/app/oracle/admin/orcl/pfile/init....

    oracle 备份与恢复基础手册

    执行 `alter system switch logfile;` 指令可以强制数据库进行日志切换,开始使用新的重做日志文件。而 `alter system archive log current;` 则是将当前活动重做日志归档。这对于管理日志文件的轮转,保证事务日志...

    oracle数据库备份与恢复

    `和`SQL> alter system switch logfile;`命令多次切换归档日志。 ##### 2.2 物理冷备份 物理冷备份是在数据库关闭状态下进行的备份,适用于不需要高可用性的场景。 **操作步骤:** 1. **关闭数据库**:使用`SQL>...

    LINUX-下ORACLE利用rman备份迁移数据库.doc

    - `sql`命令在RMAN会话中执行SQL语句,如`alter system archive log current`,用于切换当前的归档日志。 2. **数据库迁移**: - 数据库迁移通常包括备份源数据库,然后在目标系统上恢复这些备份。 - 示例中的`...

    LINUX-下ORACLE利用rman备份迁移数据库.docx

    然后设置归档日志目的地,如`alter system set log_archive_dest_1 = ‘location=+HISDATA’;`,这指定归档日志的存储位置。 5. **关闭和切换数据库**: 在迁移过程中,可能需要关闭数据库并切换配置。例如,关闭...

    Oracle DBA日常巡检最佳实践

    - **方法**:使用`ALTER DATABASE CLEAR UNARCHIVED LOGFILE GROUP n;`(其中n是日志组号)清除已损坏的日志文件。此外,可以通过查询`V$LOG`视图来检查当前的在线日志状态。 **1.3 检查Oracle表空间的状态** - **...

Global site tag (gtag.js) - Google Analytics