ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle归档模式的命令及参数说明

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

原创 Linux操作系统 作者:vonbock 时间:2012-04-13 10:24:31 0 删除 编辑
参考LINK:http://database.51cto.com/art/200611/35422.htm

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

检查归档模式命令:
SQL> SHOW USER;
USER is "SYS"
SQL>  archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     2
Current log sequence           4

设置归档模式:
SQL> SHUTDOWN IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> STARTUP MOUNT
ORACLE instance started.
Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size             100664912 bytes
Database Buffers          180355072 bytes
Redo Buffers                2973696 bytes
Database mounted.

SQL> ALTER DATABASE ARCHIVELOG;
Database altered.

SQL> ALTER DATABASE OPEN;
Database altered.

SQL> ARCHIVE LOG LIST
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     2
Next log sequence to archive   4
Current log sequence           4

如果需要停止归档模式,使用:alter database noarchivelog 命令。Oracle10g之前,你还需要修改初始化参数使数据库处于自动归档模式。在pfile/spfile中设置如下参数:
log_archive_start = true
SQL> SHOW PARAMETER log_archive_start;
NAME                 TYPE                VALUE
-------              ----------          -----------------
log_archive_start    boolean             FALSE


SQL> ALTER SYSTEM SET log_archive_start=true SCOPE=spfile;
System altered.

SQL> SHOW PARAMETER log_archive_start;
NAME                         TYPE        VALUE
---------------     ----------- ------------------------------
log_archive_start     boolean     FALSE
重启生效

SQL> SHUTDOWN IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size             100664912 bytes
Database Buffers          180355072 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.

SQL> SHOW PARAMETER log_archive_start;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_start                    boolean     TRUE

ORACLE10G在修改此参数后全报ORA-32004错误,修改方法参考本blog的另一篇文章.
SQL> STARTUP
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size             100664912 bytes
Database Buffers          180355072 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.

重启数据库此参数生效,此时数据库处于自动归档模式。也可以在数据库启动过程中,手工执行:
archive log start
使数据库启用自动归档,但是重启后数据库仍然处于手工归档模式。10g使用db_recovery_file_dest来作为归档日志的存放地。
SQL>  show parameter db_recovery
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /u01/flash_recovery_area
db_recovery_file_dest_size           big integer 2G

可以修改db_recovery_file_dest_size参数的大小
alter system set db_recovery_file_dest_size=21474836480



非归档模式:
SQL> STARTUP MOUNT
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size             100664912 bytes
Database Buffers          180355072 bytes
Redo Buffers                2973696 bytes
Database mounted.

SQL> ALTER DATABASE NOARCHIVELOG;
Database altered.

SQL> ALTER DATABASE OPEN;
Database altered.

SQL> ARCHIVE LOG LIST;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     4
Current log sequence           6





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

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2012-04-12

  • 博文量
    6
  • 访问量
    12633