We all know that in the actual development environment and test environment of Oracle databases, the actual log mode of Oracle databases and the automatic Oracle archive mode are generally not set, the main purpose is to facilitate the adjustment of system applications, and avoid the large amount of archive log files generated to consume a large amount of disk space.
However, when the system goes online and becomes a production environment, it is very important to set it to log mode and automatically archive it, because this is an important measure to ensure the security of the system and effectively prevent disasters. In this way, the log files between the regular backup database and the two backup intervals can effectively restore the data at any point in time during this period, data loss can be recovered in many cases or minimized.
Although the log mode and automatic archiving settings of the Oracle database are not complex, some of the concepts and operation processes are confusing. Based on my experience, the analysis is as follows, the environment used is UNIX (HPUX, SOLARIES, AIX, TRU64UNIX) and Oracle8.
1. Enable the OARCLE database to automatically archive logs
You need to do two things: first, set the database log mode (Archive Mode and No Archive Mode), and then set the Automatic Oracle archival mode (Automatic archival, can be Enabled and Disabled ).
2. How to view the current log and automatic archiving Mode settings of the database:
You can use the archive log list command to view logs.
For example:
The following figure shows the results of the database system running in log automatic Oracle archiving mode: Generally, the production environment)
- SVRMGR> archive log list
- Database log mode Archive Mode
- Automatic archival Enabled
- Archive destination/backup/archivelog
- Oldest online log sequence 2131
- Next log sequence to archive 2133
- Current log sequence 2133
The following figure shows the results of a database system that does not start the Database Log mode or automatically archive. Generally, the test environment is used)
- SVRMGR> archive log list
- Database log mode No Archive Mode
- Automatic archival Disabled
- Archive destination/u01/app/Oracle/product/8.0.5/dbs/arch
- Oldest online log sequence 194
- Current log sequence 196
Three-Database Log Mode settings
When creating a DATABASE, you can specify the log mode of the DATABASE in the create database statement. If not specified, the default value is NOARCHIVELOG. If Archive Mode is specified during database creation, it will increase the creation time by about 20%, and it will take only a few seconds to set it when you start the INSTANCE later, therefore, it is generally not set to archive mode when creating a database.
To determine the log Mode settings of a system database, perform the following operations in addition to (2:
- SVRMGR> Select * from V$DATABASE
- NAME CREATEDLOG_MODE CHECKPOINT ARCHIVE_CH
- ---- ----------------- ------------ ---------- ----------
- ORCL 05/21/97 17:55:06 NOARCHIVELOG 172185 170808
The steps and operations are as follows:
1. Shut down the running database instance
- SVRMGRL> shutdown
Before switching the log mode, you must shut down the running database.
2. Back up the database
It is important to use this backup together with the logs generated in the future for disaster recovery. If you want to change to the archive log mode without this database backup, only log files cannot be recovered from this time point ).
3. Start the database instance to the mount status, but do not open it.
- SVRMGRL> startup mount
NOTE: If OPS is used, open only one database instance to switch the Oracle archive mode.
4. Switch the Database Log mode.
- SVRMGRL> alter database archivelog;
(Set the database to archive log Mode)
Or
- SVRMGRL> alter database noarchivelog;
(Set the database to archive log Mode)
5. Open the database
- SVRMGRL> alter database open;
The above content describes the Oracle archive mode switch, hoping to help you in this regard.