ORACLE path to the archive set Detailed

Transfer: https://blog.csdn.net/su377486/article/details/48439755

View oracle archive log path

1. Modify the format of the log archive

The default format is: "% t_% s_% r.dbf ", we will try to modify the format of "% t_% s_% r.arch" , which is a static parameter, the database needs to be restarted to take effect.
@ ora10g SYS> Show the Parameter LOG_ARCHIVE_FORMAT

NAME the TYPE of VALUE
--------------------- ----------- -------- ------------------------------
LOG_ARCHIVE_FORMAT String T_%%% r.dbf S_

SYS @ ora10g> ALTER System LOG_ARCHIVE_FORMAT = SET ' t_% s_% r.arch% 'scope = SPFILE;

. the Altered System

2. modify modify the archive log location
1) using the "archive log list" command to see what position the archive logs stored by default
sys @ ora10g> archive log list ;
Database log MODE Mode Archive
the Automatic Archival Enabled
Archive USE_DB_RECOVERY_FILE_DEST is Where do you want
to Oldest Online Sequence log 98
the Next Archive 100 to log Sequence
100 log Sequence Current

2) the above-mentioned results USE_DB_RECOVERY_FILE_DEST Archive destination, in fact, we can remove the "USE_" use "DB_RECOVERY_FILE_DEST" Parameter Description database obtained.
@ ora10g SYS> Show the Parameter DB_RECOVERY_FILE_DEST

NAME the TYPE of VALUE
--------------------- ----------- -------- ------------------------------
db_recovery_file_dest String / Oracle / App / Oracle / FLASH_RECOVERY_AREA

. 3) will be blank db_recovery_file_dest parameters
alter system set = DB_RECOVERY_FILE_DEST '' scope = SPFILE;

. 4) just in case, the parameter will be blank log_archive_dest
ALTER System sET log_archive_dest = '' scope = SPFILE;

. 5) active parameters used here is LOG_ARCHIVE_DEST_1, modified as follows. Note that the syntax
alter system set log_archive_dest_1 = 'location = / oracle / arch / ora10g' scope = spfile;

6) Restart the database, so that all of the above changes take effect.
@ ora10g SYS> the shutdown immediate;
Database Closed.
Database a dismounted.
the ORACLE instance Shut Down.
SYS @ ora10g> 
SYS @ ora10g> Startup;
. Started the ORACLE instance

the Total Free Join the System Area 2.1475E + 10 bytes
Fixed Size 2.11116 million bytes
Variable Size 2,399,144,264 bytes
Database 1.9059E + 10 bytes Buffers
Redo Buffers 14.66368 million bytes
Database Mounted.
Database the Opened.

7) confirm the successful modification
(1) The first confirmed: use the "archive log list" command attention "Archive destination" information
sys @ ora10g> archive log list ;
Database log the MODE Archive Mode
Automatic archival             Enabled
Archive destination            /oracle/arch/ora10g
Oldest online log sequence     121
Next log sequence to archive   123
Current log sequence           123

(2)第二种确认方法:手工归档一下,通过v$archived_log视图确认
sys@ora10g> alter system switch logfile;

System altered.

sys@ora10g> col NAME for a40
sys@ora10g> alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss';

Session altered.

sys@ora10g> select recid, name, first_time from v$archived_log;

     RECID NAME                                     FIRST_TIME
---------- ---------------------------------------- -------------------
         12009-06-06 01:38:39
         22009-06-06 05:50:32
... This eliminates the previous archive log information ...
       132 /oracle/arch/ora10g/1_123_688786498.arch 2009-09- 20 11:26:26

8) above modification process can also be achieved by directly modifying the purpose of the file pfile
key parameters of the contents of the column after about amending:
$ CAT $ ORACLE_HOME / dbs / initora10g.ora
other parameters omitted here do not care
*. = LOG_ARCHIVE_FORMAT 'T_%%% r.arch S_'
* .db_recovery_file_dest = ''
* .log_archive_dest = ''
* .log_archive_dest_1 = 'LOCATION = / Oracle / Arch / ora10g'

3. modification procedure introduction, we discuss several together interesting phenomenon.
1) interesting phenomenon: the use of log_archive_dest parameter is not used log_archive_dest_1 parameters mentioned above can still modify the archive path to achieve the purpose of
streamlining the style out about this change process:
(1) modify the archive file format
System LOG_ARCHIVE_FORMAT = SET ALTER 'T_%%% r.arch S_' scope = SPFILE; 
(2) the blanking db_recovery_file_dest
ALTER System SET db_recovery_file_dest = '' scope = SPFILE;
(. 3) the blanking log_archive_dest_1
alter system set log_archive_dest_1 = ' 'scope = SPFILE;
(. 4) to enable log_archive_dest parameters
ALTER System SET log_archive_dest =' / Oracle / Arch / ora10g 'scope = SPFILE;
(. 5) to restart the database so that all of the above parameters take effect
the shutdown immediate;
Startup;
(. 6) of course, the above the same procedure may be accomplished by a method of modifying pfile
pfile modified content key parameters are as follows:
* = .log_archive_format 'T_%%% r.arch S_'
* .db_recovery_file_dest = ''
* .log_archive_dest = '/ Oracle / Arch / ora10g '
* .log_archive_dest_1 =' '

The above method can achieve the same purpose to modify the archive path, but not recommended log_archive_dest this parameter, in 10g, we recommend that you use log_archive_dest_n parameters finish.

2) two interesting observation: If two parameters simultaneously log_archive_dest db_recovery_file_dest and setting, log file generated simultaneously in both directories
(1) modified pfile, experiments can be performed using the following parameters
* .log_archive_format = '% t_% s_ % r . Arch '
* .db_recovery_file_dest =' / Oracle / App / Oracle / FLASH_RECOVERY_AREA '
* .log_archive_dest =' / Oracle / Arch / ora10g '
* .log_archive_dest_1 =' '

(2) to restart the database using pfile
sys @ ora10g> shutdown immediate;
@ ora10g SYS> the Startup pfile = '/oracle/app/oracle/product/10.2.0/db_1/dbs/initora10g.ora';

(3) "interesting" phenomenon appeared
SYS @ ora10g> System Switch the ALTER logfile;
SYS @ ora10g> ALTER System Switch logfile;
SYS @ ora10g> COL NAME for A40
sys@ora10g> alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss';
sys@ora10g> select recid, name, first_time from v$archived_log;

     RECID NAME                                     FIRST_TIME
---------- ---------------------------------------- -------------------
       137 /oracle/arch/ora10g/1_128_688786498.arch 2009-09-20 12:09:29
       138 /oracle/arch/ora10g/1_129_688786498.arch 2009-09-20 12:09:29
       139 /oracle/arch/ora10g/1_130_688786498.arch 2009-09-20 12:09:30
       140 /oracle/app/oracle/flash_recovery_area/O 2009-09-20 12:09:30
           RA10G/archivelog/2009_09_20/o1_mf_1_130_
           5ccccmw6_.arc

       141 /oracle/arch/ora10g/1_131_688786498.arch 2009-09-20 12:20:03
       142 / Oracle / App / Oracle / FLASH_RECOVERY_AREA / O 2009-09-20 12:20:03
           RA10G / ARCHIVELOG / 2009_09_20 / o1_mf_1_131_
           5cccd5kt_.arc

(. 4) CONCLUSION
two directories are generated log file, the content is the same;
/ Oracle generated under / app / oracle / flash_recovery_area directory format archive file is not affected log_archive_format parameters, that is to say: log_archive_format parameter only takes effect on log_archive_dest and log_archive_dest_n.

3) three interesting observation: When db_recovery_file_dest log_archive_dest_n and simultaneously setting, only log_archive_dest_n directory have a log
(1) modified pfile, experiments can be performed using the following parameters
* .log_archive_format = 'T_%%% r.arch S_'
* = .db_recovery_file_dest ' / Oracle / App / Oracle / FLASH_RECOVERY_AREA '
* .log_archive_dest =' '
* .log_archive_dest_1 =' LOCATION = / Oracle / Arch / ora10g '

(2) to restart the database using pfile
sys @ ora10g> shutdown immediate;
sys@ora10g> startup pfile = '/oracle/app/oracle/product/10.2.0/db_1/dbs/initora10g.ora';

(3)实验结果如下
sys@ora10g> alter system switch logfile;
sys@ora10g> alter system switch logfile;
sys@ora10g> col NAME for a40
sys@ora10g> alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss';
sys@ora10g> select recid, name, first_time from v$archived_log;

     RECID NAME                                     FIRST_TIME
---------- ---------------------------------------- -------------------
       138 /oracle/arch/ora10g/1_129_688786498.arch 2009-09-20 12:09:29
       139 /oracle/arch/ora10g/1_130_688786498.arch 2009-09-20 12:09:30
       140 /oracle/app/oracle/flash_recovery_area/O 2009-09-20 12:09:30
           RA10G / ARCHIVELOG / 2009_09_20 / o1_mf_1_130_
           5ccccmw6_.arc

       141 is /oracle/arch/ora10g/1_131_688786498.arch 2009-09-20 12:20:03
       142 / Oracle / App / Oracle / FLASH_RECOVERY_AREA / O 2009-09-20 12:20 : 03
           RA10G / ARCHIVELOG / 2009_09_20 / o1_mf_1_131_
           5cccd5kt_.arc

       143 /oracle/arch/ora10g/1_132_688786498.arch 2009-09-20 12:20:21
       144 12 is /oracle/arch/ora10g/1_133_688786498.arch 2009-09-20 : 32: 58


(4) Conclusion
cf "interesting phenomenon II" conclusion, see here only archive path log_archive_dest_1 parameter settings take effect.

3) four interesting phenomenon: log_archive_dest and log_archive_dest_1 parameters can not set
(1) modify the pfile, experiments can be carried out using the following parameters, db_recovery_file_dest parameters or not will not affect our results
* .log_archive_format = '% t_% s_ % r .arch '
.db_recovery_file_dest = * '/ Oracle / App / Oracle / FLASH_RECOVERY_AREA'
* .log_archive_dest = '/ Oracle / Arch / ora10g'
* .log_archive_dest_1 = 'LOCATION = / Oracle / Arch / ora10g'

(2) to restart the database using pfile being given, this can not be set
SYS @ ora10g> the shutdown immediate;
SYS @ ora10g> Startup pfile = '/oracle/app/oracle/product/10.2.0/db_1/dbs/initora10g.ora';
ORA-16019: not use cAN with the lOG_ARCHIVE_DEST or LOG_ARCHIVE_DUPLEX_DEST LOG_ARCHIVE_DEST_1

(4) Conclusion
log_archive_dest and log_archive_dest_1 you can not set parameters, that is, if the parameter is enabled log_archive_dest_1 not be used log_archive_dest parameter repeat set.
Through this experiment, you can get a conclusion: log_archive_dest This parameter exists only for backward compatibility, so in later versions of Oracle 9i, if you need to modify the archive generated path, then it is recommended that you use log_archive_dest_n parameters.

4. Summary
believe that if you can read the meditation, this time, you must have mastered the techniques to modify the archive log generation path and archive log generation formats.

At the same time, through these interesting phenomena found, we have seen a number of differences in the details of Oracle. Gradually discover ing.

Tips: any modification operation on the production environment must be careful! Please test after fully implemented, to prevent the "interesting phenomenon" occurs similar to those in this experiment.

Published 35 original articles · won praise 61 · views 160 000 +

Guess you like

Origin blog.csdn.net/woailyoo0000/article/details/100834417