Oracle Switch Archive mode __oracle

Source: Internet
Author: User
Tags oracle database
1.select Name,log_mode from V$database; NAME log_mode------------------------------------------QUERY noarchivelog 2. Using the archive Log LIST command Database log Mode No Archive Mode Automatic archival Disabled Archive destination/data/oracle/product/10.2.0/db_1//dbs/arch Olde St Online log sequence 739 current log sequence 741 edit this section what is Oracle Archive modeThe Oracle database has an online redo log that records changes made to the database, such as inserts, deletes, updates, and so on, which are recorded in the online redo log. A general database must have at least 2 online redo log groups.   When an online redo log group is full, there will be log switching, when the online redo log Group 2 become the current use of the log, when the online redo log Group 2 full time, log switching will occur, to write online redo log Group 1, so repeated. If the database is in a non-archived mode, the online logs are discarded when you switch. In archive mode, when a log switch occurs, the log that is switched is archived. For example, when using online redo log 1, when 1 is full, log switching occurs, start writing online redo log 2, and the contents of online redo log 1 are copied to another specified directory.   This directory is called the Archive directory, and the copied file is called the archive redo log.   A database is run with an archive to make a catastrophic recovery.   1. Differences between archived log mode and non-archived log mode non-archive mode can only do cold backups, and only full backups can be made when restoring. Data cannot be recovered during the most recent full backup to system error.   Archive mode can do hot backup, and can do incremental backup, can do partial recovery. Use the archive LOG LIST to see if the current mode state is in either archive or non archive mode. Edit Archive mode for this section configuration database   1. Change non-archive mode to archive mode: 1 sql> conn/as sysdba (dba connection database) 2 sql> shutdown immediate; (Close database immediately) 3) sql> startup mount (start the instance and load the database but not open) 4) sql> ALTER DATABASE archivelog; (Change database to archive mode) 5) sql> ALTER DATABASE open; (Open database) 6) sql> alter system archive log start;   (Enable AutoArchive) 7) sql> exit (exit) for a full backup, because the backup log generated in the non-archived log mode is not available for archive mode. This step is not very important!   2. Change archive mode to non-archive mode: 1 Sql>shutdown normal/immediate;   2) Sql>startup MOUNT;   3) Sql>alter DATABASE Noarchivelog;   4) Sql>alter DATABASE OPEN;   3. Enable automatic archiving: in Log_archive_start=true archive mode, the log file group is not allowed to be overwritten (overridden), and if no manual archiving is done, the system hangs until the archive is complete.   You can only read and not write at this time. Shutdown and restart the archive log process during run sql>archive log STOP sql>archive log START 4. Manual archiving: Log_archive_start=false Archive The current log file SQL&G T   ALTER SYSTEM ARCHIVE LOG current;   Archive log file with serial number 052 Sql>alter SYSTEM ARCHIVE log SEQUENCE 052;   Archive all log files Sql>alter SYSTEM ARCHIVE log all;   Change the archive log target Sql>alter SYSTEM ARCHIVE log to ' &path '; 5. Conversion of archive mode and non-archive mode the reverse of the 4th stepProcess. 6. Configure multiple Archive processes Q: When do I need to use multiple archive processes?   A: If the archive process consumes a lot of time, you can start multiple archive processes, a dynamic parameter that can be modified dynamically with alter system.   Sql>alter SYSTEM SET log_archive_max_processes=10; The oracle9i can specify up to 10 archive processes related to the dynamic performance view of the archive process v$bgprocess,v$archive_processes 7. Configure archive targets, multiple archive targets, remote archive targets, archive log format archive targets Log_archiv   E_dest_n Local archive target: sql>log_archive_dest_1 = "Location=d:oraclearchivedlog";   Remote Archive target: sql>log_archive_dest_2 = "SERVICE=STANDBY_DB1"; Mandatory archive target, if error, retry after 600 seconds: sql>alter SYSTEM SET log_archive_dest_4 = "Location=e:oraclearchivedlog mandatory reopen=600"   ;   Optional archive target, if error, discard archive: sql>alter SYSTEM SET log_archive_dest_3 = "Location=e:oraclearchivedlog OPTIONAL"; Archive target status: Close archive target and open archive target close archive target 1 sql>alter system SET Log_archive_dest_state_1 = DEFER Open Archive Target 2 sql>alter system SET log_archive_dest_state_2 = ENABLE Archive log format Log_archive_format 8. Get archived log information V$archived_log v$archive_dest V$log _history v$database v$archive_processes ARCHIVE LOG LIST;

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.