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

Oracle11g sets archiving mode and non-archiving mode

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

1. First check whether the current database is in archive mode.

You can view 1.1 select name, log_mode from v$database in the following two ways

The value of log_mode is NOARCHIVELOG, which indicates that the database is in non-archive mode

The value of log_mode is ARCHIVELOG, which indicates that the database is in archive mode

1.2 archive log list; (this method requires as sysdba)

The value of Database log mode is No Archive Mode Automatic archival, and the value of Disabled indicates that the current database is in non-archive mode.

The value of Database log mode is Archive Mode Automatic archival, and the value of Enabled indicates that the database has enabled archive mode.

2. Change the database from non-archive mode to archive mode.

Changing the database from non-archived mode to archived mode requires the database to be in the mount state. The following actions apply to oracle10g and above, but not to oracle8i and 9i. 2.1 shut down the database shutdown immediate

2.2 start the database to mount status startup mount

2.3 modify the database to archive mode alter database archivelog

2.4 Open the database alter database open

2.5 query whether the database is in archive mode archive log list

The database has been changed from non-archiving mode to archiving mode

2.6 modify log file naming format alter system set log_archive_max_processes = 5

Alter system set log_archive_format = "archive_%t_%s_%r.log" scope=spfile

If you restart after modification here, the format of the archived log file will be changed to archive_%t_%s_%r.log format after restart, otherwise it will remain the default format.

2.7 change log file path alter system set log_archive_dest_1='location=/data/archivelog/orcl'

At this point, the value of Archive destination is changed to / data/archivelog/orcl. The meaning of this statement is to determine the path of archived logs. In fact, Oracle 10g can generate multiple copies of the same log and save multiple locations in case of accidents.

For example, to add another log location, use the following statement

SQL > alter system set log_archive_dest_2='location=/bak/orcl/archive_log'

2.8Archive the current redo log select name from vault archived log; alter system archive log current

You can see that after archiving the current redo log, the current archived redo log can be found in v$archived_log. Since the database is not restarted, the file format of the archived log is still the default format. Note:

< alter system switch logfile 是强制日志切换,不一定就归档当前的重做日志文件(若自动归档打开,就归档前的重做日志,若自动归档没有打开,就不归档当前重做日志。) alter system archive log current 是归档当前的重做日志文件,不管自动归档有没有打都归档。 主要的区别在于: alter system switch logfile 对单实例数据库或RAC中的当前实例执行日志切换; alter system archive log current 会对数据库中的所有实例执行日志切换。 >

2.9 restart database shutdown immediate; startup

2.10 query archive information archive log list

Database changed from non-archiving mode to archiving mode

3. Change the database from archive mode to non-archive mode.

Changing the database from non-archived mode to archived mode requires the database to be in the mount state. The following actions apply to oracle10g and above, but not to oracle8i and 9i. 3.1 close the database if the database is open, you need to close the database first, and if the database is closed, you can directly perform step 3.2. Archive the current redo log alter system archive log current before closing the database

Shutdown immediate

3.2Boot database to mount status startup mount

3.3.The archiving information of the viewed database: archive log list; or select name, log_mode from v$database

3.4 change archive mode to non-archive mode alter database noarchivelog

3.4 Archive information of the database viewed: archive log list; or select name, log_mode from v$database

3.5 Open the database alter database open

The database has been changed from archive mode to non-archive mode

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