Change the ORACLE archive path and archive mode

Change the ORACLE archive path and archive mode
http://blog.itpub.net/163177/viewspace-756354/

In ORACLE 10g and 11g versions, the default log archive path for ORACLE is the flash recovery area ($ORACLE_BASE/flash_recovery_area).
For this path, ORACLE has a limitation, that is, the default space is only 2G, and it is not only the default path of the archive log,
but also the default address of the backup file and flashback log. In this case, the space used by the archive log lock will not reach 2G.
If the path size is not set properly, many systems have encountered the problem that the archive log is full and cannot be archived, causing the database to stagnate.
You can use the following SQL statement to view the archive information.

SQL> archive log list
Database log mode non-archive mode
AutoArchive is disabled
Archive End USE_DB_RECOVERY_FILE_DEST
Earliest online log sequence 321
Current log sequence 326 .

 The above archive endpoint USE_DB_RECOVERY_FILE_DEST is the flash recovery area ($ORACLE_BASE/flash_recovery_area) by default.
You can view the information of the flash recovery area through the following SQL.

SQL> show parameter db_recover
NAME                        TYPE         VALUE
--------------------------  ----------- ----------------------------
db_recovery_file_dest       string      D:\oracle\flash_recovery_area
db_recovery_file_dest_size  big integer   2G

 From the above SQL results, we can see that the flash recovery area is D:\oracle\flash_recovery_area, and the size is 2G.
You can also query the v$recovery_file_dest view to view the limit information of flashback recovery.

SQL> select name,SPACE_LIMIT,SPACE_USED from v$recovery_file_dest;
NAME                           SPACE_LIMIT SPACE_USED
------------------------------ ----------- ----------
D:\oracle\flash_recovery_area   2147483648   21225472

 By default, the archive log will be stored in the flash recovery area (D:\oracle\flash_recovery_area).
If the flash recovery area has been used to 2G, the archive log may not be able to continue to be archived, and the database will be stagnant. The
usual solution It is to increase the flash recovery area, which can be achieved with the following SQL.

SQL> alter system set db_recovery_file_dest_size=3G;
System has changed.

 Even if this method is used to solve the current urgent need, although the flashback recovery area ORACLE will automatically manage,
if the flashback recovery area is insufficient, the useless data will be cleaned up, but if the backup strategy is not perfect, the
database is very busy. , it is also possible to encounter this situation, usually you need to modify the path of
the archived log, put the archived log in other unrestricted paths to solve this problem, you can modify the storage path of the archived log through the following SQL.

SQL> alter system set log_archive_dest_1='location=D:\arch';
System has changed.

 Then start the database to the MOUNT state, modify the database to archive mode, and then build the database and start it to the OPEN state.

SQL> shutdown immediate
The database has been closed.
The database has been unloaded.
The ORACLE routine has been shut down.
SQL> startup mount
The ORACLE routine has been started.
The database is loaded.
SQL> alter database archivelog;
The database has changed.
SQL> alter database open;
The database has changed.

 Check the archive of the database again

SQL> archive log list
database log mode archive mode
AutoArchive enabled
Archive destination D:\arch
Earliest online log sequence 321
next archive log sequence 326
Current log sequence 326

 You can switch the log and check whether the archive log is generated under the archive path to verify whether the archive path is set correctly.
You can use the following command to switch the log.

SQL> alter system switch logfile;
System has changed.

 Check whether an archive path is generated under the archive path (D:\arch).

D:\arch>dir/b
ARC0000000326_0764368160.0001

 

It can be seen that the archive log has been generated in the D:\arch path. The name of the archive log is limited by the log_archive_format parameter, which
can be viewed by the following command.

SQL> show parameter log_archive_format
NAME                   TYPE         VALUE
---------------------- ------------ ------------
log_archive_format     string       ARC%S_%R.%T

 The name of the archive file generated above is ARC0000000326_0764368160.0001, %S is 0000000326 is the log switch number,
which is the current log sequence in the archive log list above, %R is the scene number, %T is the thread number, which can be understood as Node number,
if it is not a RAC environment, %T is 1. You can also add %D to the log_archive_format parameter value. %D is the DBID of the hexadecimal identification,
as shown below:

SQL> alter system set log_archive_format='ARC%S_%R.%T_%D.log' scope=spfile;
System has changed.
SQL> shutdown immediate
The database has been closed.
The database has been unloaded.
The ORACLE routine has been shut down.
SQL> startup
The ORACLE routine has been started.
The database is loaded.
The database is already open.
SQL> alter system switch logfile;
System has changed.

 Check the name of the archived log, 5AA14A62 is the hexadecimal DBID.
D:\arch>dir/b
ARC0000000326_0764368160.0001
ARC0000000327_0764368160.0001_5AA14A62.LOG

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326608073&siteId=291194637