Operation of oracle archive log

             Oracle uses redo log files to record operations on the database. However, the redo log file group is used cyclically . When all log files are filled, the system automatically switches to the first group of log files. Of course, the database administrator can also use commands to manually switch. When the log file is recycled, the content of the log file that already exists in the log file will be overwritten.

In order to completely record all the operations of the database, orale proposes the concept of archive logs.



    Assuming the non-archive log mode, when switching the log file, the contents of the log file will be overwritten by the new contents. Assuming archive log mode, when switching log files. The system will first archive and store the log file,
and then agree to write new log content to the file. ' Oracle has two log modes,        non-archive log mode (noarchivelog) In the non-archive log mode, if a log switch occurs, the original content in the log file will be overwritten with the new content.        Archive mode (archivelog) In the archive log mode, if log switching occurs, the oracle system will save the log file to the specified place by copying, this process is called "archiving". The copied log files are called "archive logs". Only then is new log content allowed to be written to the file.
 






Setting the database mode
    When installing oracle, the database is set to execute in non-archive mode by default, which can avoid archiving the logs generated during the process of creating the database, thereby shortening the creation time of the database. After the database is successfully executed, the database administrator can change the execution mode of the database as needed.
    Suppose you want to change the execution mode of the database, you can use the following statement:
    alter database archivelog|noarchivelog; Among them
    , archivelog means archive mode, noarchivelog means non-archive mode.




The detailed operation is as follows:
SQL> connect c##scott/tiger as sysdba;
connected.
SQL> archive log list; --Query the log mode of the current database
Database log mode Non-archive mode
Self-active archiving Disable
Archive end point D:\oracle\app\Administrator\product\12.1.0\dbhome_1\RDBMS
oldest online log sequence 68
Current log sequence 71
SQL>shutdown The
database has been shut down.
The database has been unloaded.
The ORACLE routine has been shut down.
SQL> startup mount; -- start the database instance. But do not open the database
ORACLE routine has been started.
Total System Global Area 2550136832 bytes
Fixed Size 3048872 bytes
Variable Size 671091288 bytes
Database Buffers 1862270976 bytes
Redo Buffers 13725696 bytes
Database loading is complete.
SQL> alter database archivelog; //Archive mode operation The
database has been changed.


SQL> alter database open;
database has been changed.
SQL> archive log list;
database log mode Archive mode
Self-active archive Enable
Archive end point D:\oracle\app\Administrator\product\12.1.0\dbhome_1\RDBMS
oldest online log sequence 68
Next archive log sequence 71
Current log sequence 71
SQL>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324855486&siteId=291194637