Configuring the Database Archiving Mode

image

归档的内容, 在 oracle10g 以后, 只需要设置以下方面内容:

1. 将数据库设置成 archivelog 模式

    startup mount -> alter database archivelog

2. 设置 archivelog 归档文件的路径

    alter system set log_archive_dest_1="location=/u01/app/oracle/archivelog" scope=both;

3. 设置 归档日志的格式

    alter system set log_archive_format=”arch%t_%s_%r.arc” scope=spfile;

至于数据库启动后, 自动启动归档日志的那个参数, 就不需要了, 因为 oracle10g 以后就会自动设置自动启动

一般都是自动归档

后面几章的备份与恢复, 是严格以来 archivelog 模式的, 如果不是archivelog 模式, 那么数据库只能恢复到上次的全备份.


- 调节成自动归档步骤(个人设定)

需要设定的参数有: (其余参数先默认就可以了) 

1. 归档的地址(本地和远程)

alter system set log_archive_dest_1="location=/u01/app/oracle/archivelog" scope=both;  -- 本地

2. 归档文件的 format

alter system set log_archive_format=”arch%s.arc” scope=spfile;

oracle 10g 以后对这个format 有了要求, 所以修改为 alter system set log_archive_format=”arch_%t_%s.”

3. 设置自动归档 alter system set log_archive_format=”arch%t_%s_%r.arc” scope=spfile;

alter system set log_archive_start=true scope=spfile; (只能下次启动生效 )

 

以上设置完这三个参数以后, 就可以自动进入归档模式

 

1. 首先要把数据库设置成归档模式(参考下边设置archivelog的细节, 要将database设置成mount状态)

    startup mount -> alter database archivelog ( 注意: 默认的就是自动的,如果你想要手动的,请参考如下)

    alter database archivelog manual;

2.   启动归档 (如果没有设置自动的话)

archive log start

3. 设置归档文件路径

    alter system set log_archive_dest_1="location=/u01/app/oracle/archivelog" scope=both;  -- 本地

注: 可以通过 archive log list ( 查看 archivelog 状态 ) 

     select log_mode from v$database;

4. 设置instance启动就立刻进入归档模式

    alter system set log_archive_start=true scope=spfile; ( 只能下次启动生效 )


 

image

All transactions are recorded in the online redo log files. This allows for automatic recovery of transactions in the event of a database failure.

If the database is configured for Noarchivelog mode, no redo history is saved to archived log files, and recovery operations are limited ( 为什么受限制 ? ) and a loss of transaction work may occur. ( 很多的 transaction 可能会丢失 ).This is the result of the automatic recycling of log files, where older log files needed for recovery are overwritten and only the most recent part of the transaction history is available. ( 个人感觉是这样,如果发生 media fault 例如磁盘损坏, 那么很可能比如一天的数据在磁盘中没有保存下来,那这样的话, 很可能需要从全备份开始来, 从全备份开始的话, 如果没有历史记录, 那么在现在的 redo log file 之前的, 并且在全备份之后的内容, 就会丢失了. 所以, 这里的全备以后要存储到别的地方, 保证不会被损坏, 另外, 所有的全备之后的 archivelog file 也要全部保存, 否则就没有意义了 )

个人推理正确 : After redo logs are overwritten, media recovery is only possible to the last full backup.

如果只是instance error, 那没有关系, 因为只需要 redo log file 就可以了, 因为每次发生 log switch 都会触发一个 check point, 这样, 数据库会同步一次, 而每次instance error发生时, 找到最近一次检查点之后进行操作恢复.

image

image

image

image

image

archivelog 只是将 redo log file 的历史保存, redo log file 自己本身还是循环使用, 也就是说, 针对 redo log file 本身来说, archivelog 和 Noarchivelog 模式 是一样的。

image

 

Archiving Requirements

The database must be in Archivelog mode.Issuing the command to put the database into Archivelog mode updates the control file. The ARCn background processes can be enabled to implement automatic archiving.

image

image

Note: After the mode has been changed from Noarchivelog mode to Archivelog, you must back up all the datafiles and the control file.

image

image

推荐使用自动方式 ( 必须的 )

image

image

image

image

image

可随意调节 ARCn processes 的数量, 比如系统忙的时候, 需要比较多的 ARCn process, 那么就可以增加几个 ARCn 进程, 而如果系统比较闲的时候, 就可以 kill 几个 ARCn .

image

image

image

image

注: 以上内容数据库已经是在 ARchivelog mode 的状态下.

image

image

image

image

image

虽然不推荐使用 manually Archiving, 但是有一项功能是好的, 如下:

In addition, you can use manual archiving when automatic archiving is enabled to re-archive an inactive group to another destination. ( 当然你要有权限 ALTER SYSTEM ARCHIVELOG )

 

image

image

image

image

image

image

image

image

image

image

image

LOG_ARCHIVE_DEST_STATE_n 这个参数是设定对应的 LOG_ARCHIVE_DEST_n 这个地址是否可用的参数

image

image

image

image

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值