Oracle归档模式的命令及参数说明

来源:互联网 发布:ueba 网络事件 编辑:程序博客网 时间:2024/06/11 01:07
 

 

Oracle数据库可以运行在2种模式下:归档模式(archivelog)和非归档模式(noarchivelog)。归档模式可以提高Oracle数据库的可恢复性,生产数据库都应该运行在此模式下,归档模式应该和相应的备份策略相结合,只有归档模式没有相应的备份策略只会带来麻烦。

检查归档模式命令:

SQL> archive log listDatabase log mode No Archive ModeAutomatic archival DisabledArchive destination USE_DB_RECOVERY_FILE_DESTOldest online log sequence 15Current log sequence 17

设置归档模式:

SQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.SQL> startup mountORACLE instance started.Total System Global Area 1258291200 bytesFixed Size 1219160 bytesVariable Size 318768552 bytesDatabase Buffers 922746880 bytesRedo Buffers 15556608 bytesDatabase mounted.SQL> alter database archivelog;Database altered.SQL> alter database open;Database altered.SQL> archive log list;Database log mode Archive ModeAutomatic archival EnabledArchive destination USE_DB_RECOVERY_FILE_DESTOldest online log sequence 15Next log sequence to archive 17Current log sequence 17

如果需要停止归档模式,使用:alter database noarchivelog 命令。Oracle10g之前,你还需要修改初始化参数使数据库处于自动归档模式。在pfile/spfile中设置如下参数:

log_archive_start = true

重启数据库此参数生效,此时数据库处于自动归档模式。也可以在数据库启动过程中,手工执行:

archive log start

使数据库启用自动归档,但是重启后数据库仍然处于手工归档模式。10g使用db_recovery_file_dest来作为归档日志的存放地。

SQL> show parameter db_recoveryNAME TYPE VALUEdb_recovery_file_dest string /home/oracle/ora10g/flash_recovery_area/db_recovery_file_dest_size big integer 20G

可以修改db_recovery_file_dest_size参数的大小

alter system set db_recovery_file_dest_size=21474836480