设为首页 加入收藏

TOP

归档日志管理(二)
2014-11-24 00:40:46 来源: 作者: 【 】 浏览:29
Tags:归档 日志 管理
a_arc0_orcl
oracle    9166     1  0 17:12          00:00:00 ora_arc1_orcl
oracle    9168     1  0 17:12          00:00:00 ora_arc2_orcl
oracle    9170     1  0 17:12          00:00:00 ora_arc3_orcl
oracle    9198     1  0 17:16          00:00:00 ora_arc4_orcl
oracle    9200     1  0 17:16          00:00:00 ora_arc5_orcl
oracle    9202     1  0 17:16          00:00:00 ora_arc6_orcl
oracle    9204     1  0 17:16          00:00:00 ora_arc7_orcl
oracle    9206     1  0 17:16          00:00:00 ora_arc8_orcl
oracle    9208     1  0 17:16          00:00:00 ora_arc9_orcl
4 配置归档文件格式
默认格式:%t_%s_%r.arc
SQL> show parameter log_archive_format;
NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
log_archive_format		     string	 %t_%s_%r.dbf
修改归档文件格式,修改完成以后需要重启数据库才会生效
SQL> alter system set log_archive_format='%t_%s_%r.arc' scope=spfile;
System altered.
log_archive_format参数说明:
(归档文件格式必须包含以下几个参数:%s, %t and %r,否则启动数据库会报错
SQL> startup open;
ORA-19905: log_archive_format must contain %s, %t and %r
%s log sequence number

%S log sequence number, zero filled

%t thread number

%T thread number, zero filled

%a activation ID

%d database ID

%r resetlogs ID that ensures unique names are constructed for the archived log files across multiple incarnations of the database

5. 修改归档文件目录
归档日志存默认路径:受DB_RECOVERY_FILE_DEST参数控制
SQL> select dest_id,dest_name,destination from v$archive_dest;
   DEST_ID DEST_NAME		DESTINATION
---------- -------------------- --------------------------------------------------
	 1 LOG_ARCHIVE_DEST_1	USE_DB_RECOVERY_FILE_DEST
SQL> show parameter db_recovery_file_dest;

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest		     string	 /home/oracle/app/oracle/flash_
						 recovery_area
语法:alter system set log_archive_dest_n='location=文件路径' scope=spfile
说明:a.文件存放路径必须本地需要用location指定,远程需要service指定,另外重启数据库才会生效。
配置远程归档位置时,SERVICE选项需要指定远程数据库的网络服务名(在tnsnames.ora文件中配置)
           b. 初始化参数LOG_ARCHIVE_DEST_n 不能与初始化参数LOG_ARCHIVE_DEST和LOG_ARCHIVE_DUPLEX_DEST同时使用.
      (oracle官方文档说明:如果是企业,将不在推荐使用log_archive_duplex_dest参数
                 If you are using Oracle Enterprise Edition, this parameter is deprecated in favor of the LOG_ARCHIVE_DEST_n parameters.
               If Oracle Enterprise Edition is not installed or it is installed but you have not specified any LOG_ARCHIVE_DEST_n parameters, this parameter is valid)
     c.LOG_ARCHIVE_DEST_n参数       
         OPTIONAL:该选项是默认选项.使用该选项时,无论归档是否成功,都可以覆盖重做日志.
         MANDATORY:强制归档.使用该选项时,只有在归档成功之后,重做日志才能被覆盖.
         REOPEN:该属性用于指定重新归档的时间间隔,默认值为300秒,必须跟在MANDATORY后.
SQL> alter system set log_archive_dest_1='location=/home/oracle/app/oracle' scope=spfile;
System altered
SQL>  select dest_id,dest_name,destination from v$archive_dest;
   DEST_ID DEST_NAME		DESTINATION
---------- -------------------- --------------------------------------------------
	 1 LOG_ARCHIVE_DEST_1	/home/oracle/app/oracle
SQL> alter system archive log  current;
(手动强制归档)
System altered.
[oracle@localhost oracle]$ ls -ls /home/oracle/app/oracle
总计 244
208 -rw-r----- 1 oracle oinstall 207872 12-10 18:26 4bc445e1_1_102_818781763.arc
归档日志已经在相应的目录下生成
知识扩展:
ALTER SYSTEM SWITCH LOGFILE 是强制日志切换,不一定就归档当前的重做日志文件(若自动归档打开,就归档前的重做日志,若自动归
首页 上一页 1 2 3 下一页 尾页 2/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Mongodb之(初出茅庐) 下一篇ADO.NET中5大对象简介

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: