Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Configure the database to archive mode

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Archiving mode is a very important means to protect and recover data in oracle database.

The simple operation of opening archiving is very simple, but it is best to open archiving in a standardized way.

To change the database archiving mode, you need to use the alter database archivelog | noarchivelog statement, and the permission of the link user must be as sysdba.

1. Check to see if the database is in archive mode

SQL > archive log list

Database log mode No Archive Mode

Automatic archival Disabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 56

Current log sequence 58

USE_DB_RECOVERY_FILE_DEST explains that a quick recovery area is used

two。 Close the database instance

Shutdown immediate

The database must be shut down before changing the archiving mode. If there are data files that need media recovery, the archiving mode cannot be changed.

3. Backup database

It is best to back up the database before making any major changes to the database. Because there are not always no problems when changing the database, the job of a dba is to make a good backup and protect the data security, which is the most easy to ignore and the most important step.

4. Edit the parameter file to specify the path to the archive log (you can also change it using the command)

The quick recovery area is used by default

SQL > show parameter recover

NAME TYPE VALUE

-

Db_recovery_file_dest string / u01/app/oracle/fast_recovery_

Area

Db_recovery_file_dest_size big integer 8G

Db_unrecoverable_scn_tracking boolean TRUE

Recovery_parallelism integer 0

SQL >

In addition to the fast recovery area, versions 10g and above provide LOG_ARCHIVE_DEST_n parameters (1-31 paths) that can use multiple paths and can be backed up to other disks. If you use DB_RECOVERY_FILE_DEST,DB_RECOVERY_FILE_DEST_SIZE to enable the fast recovery area, you cannot enable other archive paths. Unlike the quick recovery area, you don't have to set the size for LOG_ARCHIVE_DEST_n

SQL > show parameter log_archive

NAME TYPE VALUE

-

Log_archive_config string

Log_archive_dest string

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

...

Default name of the archive log

SQL > show parameter format

NAME TYPE VALUE

-

Log_archive_format string t_%s_%r.dbf

% t: process number (thread)

% s: log serial number (sequence)

% r:resetlogs ID

5. Start the instance to the mount phase

SQL > startup mount

ORACLE instance started.

Total System Global Area 1048059904 bytes

Fixed Size 2235000 bytes

Variable Size 310379912 bytes

Database Buffers 729808896 bytes

Redo Buffers 5636096 bytes

Database mounted.

6. Change the database

SQL > alter database archivelog

2 /

Database altered.

SQL > archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 56

Next log sequence to archive 58

Current log sequence 58

Archive mode is enabled

Change the path (optional)

SQL > alter system set log_archive_dest_1='location=/home/oracle' scope=both

System altered.

7. Shut down the database

8. Backup database

Change database archiving updates the control file, and all database files and control files must be backed up after changing the database archiving mode. Previous noarchivelog mode backups are no longer used.

9. Open the database and check the configuration

SQL > archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination / home/oracle

Oldest online log sequence 58

Next log sequence to archive 60

Current log sequence 60

SQL > alter system switch logfile

System altered.

SQL > select name from v$archived_log

NAME

/ u01/app/oracle/product/11.2/dbs/arch2_58_947085344.dbf-Test done (if the quick recovery area is not used and the log_archive_dest_n is not set, the archive log will be here)

/ home/oracle/1_59_947085344.dbf

The quick recovery area is no longer enabled, using the specified path of log_archive_dest_1

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report