Oracle is divided into non-archive mode (NOARCHIVELOG) and archive mode (ARCHIVELOG)

Oracle is divided into non-archive mode (NOARCHIVELOG) and archive mode (ARCHIVELOG). The non-archive mode does not generate archive logs. Although it saves hard disk space, the backup scheme selection is very limited, usually only cold backup can be selected. Restoring can only restore the data at the moment of backup, and is usually only used during development (it is said to be used in data warehouses), and Oracle installation defaults to non-archive mode. In the production environment, we should use the archive mode, which will generate archive logs, and can use a variety of backup and restore schemes. It is an inevitable choice for Oracle administrators to change the mode.

To view the existing schema of the database first, use the following statement

select name,log_mode from v$database;

You can also use the following statement to
archive log list; (this method requires as sysdba)


For databases in non-archive mode, which should be in archive mode (mainly referring to Oracle 10g), use the following steps:

1. SQL> alter system set log_archive_dest_1='location=/oracle/oracle10g/log/archive_log';

The meaning of this statement is to determine the path of the archived log. In fact, Oracle 10g can generate multiple copies of the same log and save it in multiple locations. In case of accident,
for example, to add another log location, the following statement can be used

SQL>alter system set log_archive_dest_2='location=/oracle/oracle10g/log2/archive_log';

2. Shut down the database
SQL> shutdown immediate

3. Startup data mount status:
SQL> startup mount;

4. Modify the database to archive mode:
SQL> alter database archivelog;

5. Open the database and query:
SQL> alter database open;

Modify the log file naming format:
SQL> alter system set log_archive_max_processes = 5;
SQL> alter system set log_archive_format = "archive_%t_%s_%r.log" scope=spfile;

After the modification is completed, you can check whether the log mode is modified successfully!
It is particularly pointed out that in Oracle 9i, the parameter alter system set log_archive_start = true must be modified to take effect. This parameter has been abolished in oracle 10g, so it is not necessary to set this parameter.

Guess you like

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