关于建立Standby时候的force logging

本文介绍了在Oracle数据库中使用ALTER DATABASE FORCE LOGGING命令的重要性,此命令确保所有更改(除临时表空间外)都被记录,避免因未记录的更改导致主备数据库数据不一致的问题。文章还特别提到了在某些特定情况下,如使用nologging定义的表或创建无日志索引时,可能引发的数据一致性问题,并强调了在这种操作后进行数据库备份的必要性。

建立Standby之前一定要在primary db上操作

SQL> ALTER DATABASE FORCE LOGGING;   主要是为了防止一些特殊的改变不能写入redo log 而导致primary db和standby 上的数据不一致 。 比如nologging 定义的table 使用 /*+append*/  时候插入的数据不会写redo log 。还有比如 create index nologging 在第一次创建索引数据时,不会生成REDO,但是会在SYS.OBJ$等系统表中插入一行表示索引存在,这个插入动作会记入日志 ( 但是最初向磁盘写索引结构的操作不会记录到日志 ) 。而以后对表的数据进行insert,update,delete时,都会生成该索引操作的REDO (这些后面的redo会导致以前的备份失去效用)。 所以一般建议nologging操作之后都要重新进行数据库备份 。

一般下命令 ALTER DATABASE FORCE LOGGING 之后数据库会一直出于force logging状态,不管是否有重新启动过。 他将记录除了temporary 外的所有数据库中的更改 ,不过如果你重建控制文件,除非你在 create controlfile 指定FORCE LOGGING,  否则数据库将恢复到没有执行force logging的状态。 

FORCE LOGGING
Use this clause to put the database into FORCE LOGGING mode. Oracle will log all changes in the database except for changes in temporary tablespaces and temporary segments. This setting takes precedence over and is independent of any NOLOGGING or FORCE LOGGING settings you specify for individual tablespaces and any NOLOGGING settings you specify for individual database objects.

FORCE LOGGING mode is persistent across instances of the database. That is, if you shut down and restart the database, the database is still in FORCE LOGGING mode. However, if you re-create the control file, Oracle will take the database out of FORCE LOGGING mode unless you specify FORCE LOGGING in the CREATE CONTROLFILE statement.

In FORCE LOGGING mode, Oracle Database logs all changes in the database except changes in temporary tablespaces and temporary segments. This setting takes precedence over and is independent of any NOLOGGING or FORCE LOGGING settings you specify for individual tablespaces and any NOLOGGING settings you specify for individual database objects.

If you specify FORCE LOGGING, Oracle Database waits for all ongoing unlogged operations to finish.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/35489/viewspace-584594/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/35489/viewspace-584594/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值