Oracle Enable archive logging

Source: Internet
Author: User

1. View archived Information

SQL>log  listDatabaselog  mode           No Archive modeautomatic Archival           disabledarchive destination           log sequence     244 Current log sequence           246

The current database is not open for archiving

2. Set up archive directory

Oracle uses the Flashback recovery Area db_recovery_file_dest as the archive path by default

SQL>  show parameter db_recovery_file_destname                     TYPE     VALUE--------------- --------------------------------------------------------------db_recovery_file_dest             string     / u01/app/Oracle/flash_recovery_areadb_recovery_file_dest_size          integer 3882M

The Flashback recovery area has a limit on the size of the installation process, and if the Flashback recovery area is full, the archive log cannot be written and the database is stuck, the workaround can increase the size of the flash back area or modify the archive path

3. Modify the archive path

Modify the Log_archive_dest_1 parameter to modify the archive log path (the directory specified in the Pfile/spfile parameter db_recovery_file_dest will not be valid)

In fact, starting with Oracle 10g, you can generate multiple copies of the same log, save multiple locations, safekeeping. Multiple locations are implemented by setting different Log_archive_dest_n parameters, and the archive destination path in the archive log list output shows only the most recent modified path.

SQL>  show parameter log_archive_dest_1name                     TYPE     VALUE------------------ -----------------------------------------------------------log_archive_dest_1             stringlog_archive_ Dest_10             stringlog_archive_dest_11             stringlog_archive_dest_12             stringlog_archive_dest_13             Stringlog_archive_dest_14             stringlog_archive_dest_15             stringlog_archive_dest_16             stringlog_archive _dest_17             stringlog_archive_dest_18             stringlog_archive_dest_19             string

Modify the archive path to/u01/app/oracle/archive_log

SQL>alterset log_archive_dest_1='location=/u01/app/oracle/ Archive_log' scope=spfile; System altered.

Restart takes effect

4. Modify the Archive log format

SQL>alterset log_archive_format='arc%s_%r.%t_%d. DBF' scope=spfile; System altered.

Restart takes effect

5. Open Archive

Need to open database archive in Mount state

Reboot to Mount

Sql> shutdownImmediateDatabaseclosed.Databasedismounted. ORACLE instance shut down. SQL>Startup Mountoracle instance started. Total System Global Area1603411968bytesfixed Size2213776bytesvariable Size989857904bytesDatabaseBuffers603979776Bytesredo Buffers7360512bytesDatabaseMounted.

Open Database Archive

SQL>alterdatabase  archivelog; Database altered.

View archive Status

Sql>ArchiveLogListDatabase Logmode Archive modeautomatic archival enabledarchive destination/U01/App/Oracle/archive_logoldest OnlineLogSequence244Next LogSequence toArchive246 Current LogSequence246

ALTER DATABASE Force LOGGING;
Open Mandatory Archive

Open Database

SQL>alterdatabaseopen; Database altered.

6. Confirm that the database is an archive mode

SQL>Select from v$database; Log_mode------------archivelogsql>Select from v$instance; ARCHIVE-------STARTED

7. Forced log switching

Check the current archive Log view and archive log path First:

SQL>Select from v$archived_log;no rows selected
[[email protected] archive_log]  0

No archived logs

Perform a forced log switchover below

SQL>alter  system switch logfile; System altered.

View View again

SQL>Select from v$archived_log;name------------------------- -------------------------------------------------------/u01/apps/Oracle/ archive_log/arc0000000246_0963417259.0001_6833bc69.dbf

There are archived logs generated, validation successful

Todo

Rman Archive Log Cleanup

Oracle Enable archive logging

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.