ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 转载eygle的开启oracle的归档模式

转载eygle的开启oracle的归档模式

原创 Linux操作系统 作者:jerryhui 时间:2009-04-01 16:47:29 0 删除 编辑

如何启动或关闭数据库的归档(ARCHIVELOG)模式

http://www.eygle.com/archives/2004/10/oracle_howtoeci.html

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

本文简单介绍如何启用和关闭数据库的归档模式。

1.shutdown normal
shutdown immediate关闭数据库

[oracle@jumper oracle]$ sqlplus "/ as sysdba"

 

SQL*Plus: Release 9.2.0.4.0 - Production on Sat Oct 15 15:48:36 2005

 

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

 

 

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production

With the Partitioning option

JServer Release 9.2.0.4.0 - Production

 

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

 


2.
启动数据库到mount状态

SQL> startup mount;

ORACLE instance started.

 

Total System Global Area  101782828 bytes

Fixed Size                   451884 bytes

Variable Size              37748736 bytes

Database Buffers           62914560 bytes

Redo Buffers                 667648 bytes

Database mounted.


3.
启用或停止归档模式
如果要启用归档模式,此处使用
alter database archivelog
命令。

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            /opt/oracle/oradata/conner/archive

Oldest online log sequence     148

Next log sequence to archive   151

Current log sequence           151


如果需要停止归档模式,此处使用:
alter database noarchivelog 命令。

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount;

ORACLE instance started.

 

Total System Global Area  101782828 bytes

Fixed Size                   451884 bytes

Variable Size              37748736 bytes

Database Buffers           62914560 bytes

Redo Buffers                 667648 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             Enabled

Archive destination            /opt/oracle/oradata/conner/archive

Oldest online log sequence     149

Current log sequence           152


4.
修改相应的初始化参数
Oracle10g
之前,你还需要修改初始化参数使数据库处于自动归档模式。
pfile/spfile中设置如下参数:

log_archive_start = true

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

archive log start

使数据库启用自动归档,但是重启后数据库仍然处于手工归档模式。

Oracle10g开始,log_archive_start参数已经废除,请参考:Oracle10g已经废弃log_archive_start参数.

Oracle10g已经废弃log_archive_start参数

http://www.eygle.com/archives/2005/04/oracle10gonieul.html

Oracle10g中,log_archive_start参数已经被废弃,只要启动数据库的归档模式,Oracle就会启用自动归档,从而避免了10g以前由于用户疏忽所带来的一系列问题。

$ sqlplus "/ as sysdba"

 

SQL*Plus: Release 10.1.0.3.0 - Production on Wed Apr 13 09:53:25 2005

 

Copyright (c) 1982, 2004, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - 64bit Production

With the Partitioning and Data Mining options

 

SQL> archive log list;

Database log mode              No Archive Mode

Automatic archival             Disabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     25

Current log sequence           27

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 mount;

ORACLE instance started.

 

Total System Global Area 3204448256 bytes

Fixed Size                  1304912 bytes

Variable Size             651957936 bytes

Database Buffers         2550136832 bytes

Redo Buffers                1048576 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     25

Next log sequence to archive   27

Current log sequence           27

SQL>

 


 

 

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

请登录后发表评论 登录
全部评论

注册时间:2009-03-12

  • 博文量
    18
  • 访问量
    61648