Enable oracle automatic archiving Mode

Source: Internet
Author: User

1. Create a directory to save the backup
Mkdir/u01/oracle/oradata/archive
Chown-R oracle/u01/oracle/oradata/archive
2. Switch to an oracle user
Sqlplus/nolog
Connect/as sysdba
3. Set the target address of the archived log

Check whether the database is in archive Mode

SQL> select log_mode from v $ database;


LOG_MODE
------------------------
NOARCHIVELOG


SQL> show parameter 'Log _ archive_dest_1'


NAME TYPE VALUE
-----------------------------------------------------------------------------
Log_archive_dest_1 string
Log_archive_dest_10 string
Log_archive_dest_11 string
Log_archive_dest_12 string
Log_archive_dest_13 string
Log_archive_dest_14 string
Log_archive_dest_15 string
Log_archive_dest_16 string
Log_archive_dest_17 string
Log_archive_dest_18 string
Log_archive_dest_19 string


SQL> alter system set log_archive_dest_1 = 'location =/u01/oracle/oradata/archive 'scope = spfile;


System altered.


SQL> show parameter log_archive_format;

NAME TYPE VALUE
-----------------------------------------------------------------------------
Log_archive_format string % t _ % s _ % r. dbf

-- Set the log file name format to take effect after the database is restarted
Alter system set log_archive_dest_1 = 'location =/u01/oracle/oradata/archive 'scope = spfile;

SQL> System altered.

 


4. Shut down the database
SQL> shutdown immediate;


5. Start and load the database
SQL> startup mount;


6. Switch the database to archive mode.
SQL> alter database archivelog;


SQL> select log_mode from v $ database;


LOG_MODE
------------------------
ARCHIVELOG


7. Open the database
SQL> alter database open;
8. Switch logs and force Archiving


SQL> alter system switch logfile;


9. SQL> select archiver from v $ instance;


ARCHIVER
--------------
STARTED


-- View the path of the generated archive file
SQL> select name from v $ archived_log;

NAME
--------------------------------------------------------------------------------
/U01/oracle/oradata/archive/arch_50d8fe87_109762534602_37.log

The author's "big-point column"

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.