oracle修改归档日志路径

一:先查询数据库是否开启归档模式:

SQL> archive log list;                                                                    ----已经开启归档模式
Database log mode        Archive Mode
Automatic archival        Enabled
Archive destination        USE_DB_RECOVERY_FILE_DEST----修改此归档路径
Oldest online log sequence     3
Next log sequence to archive   5
Current log sequence        5

二:创建归档目录:

[root@athena ~]# mkdir -p /oracle/archive1
[root@athena ~]# mkdri -p /oracle/archive2

三:设置数据库归档日志目标:

SQL> alter system set log_archive_dest_1=‘location=/oracle/archive1/‘scope=spfile;

System altered.

SQL> alter system set log_archive_dest_1=‘location=/oracle/archive2/‘scope=spfile;

System altered.

SQL> alter system set log_archive_format=‘arch_%d_%t_%r_%s.log‘scope=spfile;

System altered.

四:重启数据库:

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area  835104768 bytes
Fixed Size      2232960 bytes
Variable Size    633343360 bytes
Database Buffers   197132288 bytes
Redo Buffers      2396160 bytes
Database mounted.
SQL> alter database archivelog;---------如果之前没有开启归档的,应该在Mount状态下开启归档模式

Database altered.

SQL> alter database open;

Database altered.

五:确认数据库为归档日志模式,并用下列两个查询运行归档器:

SQL> select log_mode from v$database;

LOG_MODE
------------
ARCHIVELOG

SQL> select archiver from v$instance;

ARCHIVE
-------
STARTED

六:强制日志切换:

SQL> alter system switch logfile;

System altered.

SQL> select name from v$archived_log;

NAME
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/s01/oracle/fast_recovery_area/ATHENA/archivelog/2014_03_02/o1_mf_1_22_9k57ms6o_.arc
/s01/oracle/fast_recovery_area/ATHENA/archivelog/2014_03_02/o1_mf_1_23_9k57mswx_.arc
/s01/oracle/fast_recovery_area/ATHENA/archivelog/2014_03_02/o1_mf_1_21_9k57mvl6_.arc
/s01/oracle/fast_recovery_area/ATHENA/archivelog/2014_03_23/o1_mf_1_1_9lxm5kto_.arc
/s01/oracle/fast_recovery_area/ATHENA/archivelog/2014_06_18/o1_mf_1_2_9t35pvw9_.arc
/s01/oracle/fast_recovery_area/ATHENA/archivelog/2014_06_18/o1_mf_1_3_9t36mqn3_.arc
/s01/oracle/fast_recovery_area/ATHENA/archivelog/2014_06_20/o1_mf_1_4_9t8d0003_.arc

7 rows selected.

----------发现没有发生归档日志

问题排查:

一:进数据库后台查询日志报告:

ORA-16014: log 2 sequence# 5 not archived, no available destinations
ORA-00312: online log 2 thread 1: ‘/s01/oracle/oradata/athena/redo02.log‘
Mon Jun 23 22:49:18 2014
ARC2: Error 19504 Creating archive log file to ‘/oracle/archive2/arch_4e31002f_1_841143545_5.log‘
ARCH: Archival stopped, error occurred. Will continue retrying
ORACLE Instance athena - Archival Error
ORA-16038: log 2 sequence# 5 cannot be archived
ORA-19504: failed to create file ""
ORA-00312: online log 2 thread 1: ‘/s01/oracle/oradata/athena/redo02.log‘
Mon Jun 23 22:49:18 2014

 

经过查询是权限不对,因为在root下创建的目录,oracle并没有权限:

[root@athena oracle]# chown oracle:oinstall archive1
[root@athena oracle]# chown oracle:oinstall archive2

 

继续查询:

SQL> select name from v$archived_log;

NAME
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/s01/oracle/fast_recovery_area/ATHENA/archivelog/2014_03_02/o1_mf_1_22_9k57ms6o_.arc
/s01/oracle/fast_recovery_area/ATHENA/archivelog/2014_03_02/o1_mf_1_23_9k57mswx_.arc
/s01/oracle/fast_recovery_area/ATHENA/archivelog/2014_03_02/o1_mf_1_21_9k57mvl6_.arc
/s01/oracle/fast_recovery_area/ATHENA/archivelog/2014_03_23/o1_mf_1_1_9lxm5kto_.arc
/s01/oracle/fast_recovery_area/ATHENA/archivelog/2014_06_18/o1_mf_1_2_9t35pvw9_.arc
/s01/oracle/fast_recovery_area/ATHENA/archivelog/2014_06_18/o1_mf_1_3_9t36mqn3_.arc
/s01/oracle/fast_recovery_area/ATHENA/archivelog/2014_06_20/o1_mf_1_4_9t8d0003_.arc
/oracle/archive2/arch_4e31002f_1_841143545_5.log
/oracle/archive2/arch_4e31002f_1_841143545_6.log
/oracle/archive2/arch_4e31002f_1_841143545_7.log
/oracle/archive2/arch_4e31002f_1_841143545_8.log

问题解决!!!

本文出自 “一凡” 博客,请务必保留此出处http://1336014.blog.51cto.com/1326014/1429427

oracle修改归档日志路径,布布扣,bubuko.com

oracle修改归档日志路径

上一篇:sql sever 字符串函数


下一篇:【原创】TP-LINK +ASUS(Tomato) 双无线路由设置WDS