Steps for switching Oracle archive Mode

Source: Internet
Author: User

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)

 
 
  1. SVRMGR> archive log list  
  2. Database log mode Archive Mode  
  3. Automatic archival Enabled  
  4. Archive destination/backup/archivelog  
  5. Oldest online log sequence 2131  
  6. Next log sequence to archive  2133  
  7. 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)

 
 
  1. SVRMGR> archive log list  
  2. Database log mode No Archive Mode  
  3. Automatic archival Disabled  
  4. Archive destination/u01/app/Oracle/product/8.0.5/dbs/arch  
  5. Oldest online log sequence 194  
  6. 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:

 
 
  1. SVRMGR> Select * from V$DATABASE  
  2. NAME CREATEDLOG_MODE CHECKPOINT ARCHIVE_CH  
  3. ---- ----------------- ------------ ---------- ----------  
  4. ORCL 05/21/97 17:55:06 NOARCHIVELOG 172185 170808  

The steps and operations are as follows:

1. Shut down the running database instance

 
 
  1. 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.

 
 
  1. 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.

 
 
  1. SVRMGRL> alter database archivelog; 

(Set the database to archive log Mode)

Or

 
 
  1. SVRMGRL> alter database noarchivelog; 

(Set the database to archive log Mode)

5. Open the database

 
 
  1. SVRMGRL> alter database open;  

The above content describes the Oracle archive mode switch, hoping to help you in this regard.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.