In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to check whether the oracle database is archived". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to check whether the oracle database is archived"!
In the development environment and test environment of ORACLE database, the log mode and automatic archiving mode of the database are generally not set, which is conducive to the adjustment of system applications and avoids the consumption of disk space by generating a large number of archived log files. However, when the system is online and becomes a production environment, it is very important to set it to log mode and archive automatically, because this is an important measure to ensure the security of the system and effectively prevent disasters. In this way, by regularly backing up the database and the log files between the two backups, the data at any point in time can be effectively recovered, and the data loss can be recovered or reduced as much as possible.
First, in order to make the OARCLE database archive logs automatically, two things need to be done.
1. Set the database log mode (Archive Mode and No Archive Mode); 2. Set the automatic archiving mode (Automatic archival, Enabled and Disabled).
Second, how to view the current log of the database and the setting of automatic archiving mode
You can view it with the archive log list command.
The results of the database system running in automatic log archiving mode are as follows (usually in the production environment):
SQL > archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination / backup/archivelog
Oldest online log sequence 2131
Next log sequence to archive 2133
Current log sequence 2133
Database systems that do not start database log mode and automatic archiving view the results as follows (usually in the test environment):
SQL > archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination / u01/app/oracle/product/8.1.7/dbs/arch
Oldest online log sequence 194
Current log sequence 196
three。 Setting of database log mode
When you create a database, you can specify the log mode of the database in the CREATE DATABASE statement. If not specified, the default is NOARCHIVELOG mode. Since Archive Mode is specified when creating a database, the creation time will be increased by about 20%, and it will only take a few seconds to set it later when starting INSTANCE, so it is generally not set to ARCHIVE MODE when creating a database.
The steps and actions to switch the log mode settings of the database (between Archive Mode and No Archive Mode) are as follows:
1. Close the running database instance
SQL > shutdown
The running database must be shut down properly before making a log mode switch.
two。 Backup database
This backup is used for future disaster recovery along with later generated logs (it is important to change to archive log mode, without this database backup, only log files cannot be recovered from that point in time).
3. Start the database instance to the mount state, but do not open it.
SQL > startup mount
4. Toggles database log mode.
SQL > alter database archivelog; (set the database to archive log mode) or
SQL > alter database noarchivelog; (set the database to non-archive log mode)
5. Open the database
SQL > alter database open
6. Verify that the database is now in archive log mode.
SQL > archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination for example: $ORACLE_HOME/dbs/arch
Oldest on-line log sequence 275
Next log sequence 277
Current log sequence 278
7. Archive the redo logs at this point in time
SQL > archive log all
8. Verify that the newly generated log files are under the appropriate archive directory.
four。 Automatic archiving mode setting (Automatic archival, available for Enabled and Disabled).
In this mode, the database starts an arch process that is responsible for writing the redo logs to the appropriate directory of the system's archiving device. Set parameters in the parameters file of the database (usually in the $ORACLE_HOME/dbs/init*.ora file):
LOG_ARCHIVE_START=
LOG_ARCHIVE_DEST=
LOG_ARCHIVE_FORMAT=
LOG_ARCHIVE_START:
Set it to TRUE if automatic archiving is required, and FALSE if non-automatic archiving is required
LOG_ARCHIVE_DEST:
This parameter sets the path where the archive logs archive is stored.
LOG_ARCHIVE_FORMAT:
This parameter sets the naming format for archive logs. For example, if the format is: arch%s.arc
The log file will be: arch2.arc, arch3.arc, arch4.arc
These parameter settings will not take effect until the database instance is started, and if set while the database is running, the database must be restarted for it to take effect.
If the database is running and cannot be restarted immediately, to set it to automatic archive mode, do the following:
SQL > ALTER SYSTEM ARCHIVE LOG START
If you want to set it to non-automatic archiving mode (cancel automatic archiving), then:
SQL > ALTER SYSTEM ARCHIVE LOG STOP
However, if the database is restarted, the result of the statement modification is invalid, and the setting of automatic archiving is set according to the value of LOG_ARCHIVE_START in the system parameter file.
five。 Several settings:
1. Database log mode Archive Mode,Automatic archival Enabled
This is the ORACLE database log and archiving mode setting in most production environments. In this case, regular backups (with hot and cold backups) and archived log backups of the database can effectively restore the database to all points in time with archived logs.
2. Database log mode Archive Mode,Automatic archival Disabled
In this case, the database cannot be archived automatically and needs to be archived manually. If all online logs are full and cannot be manually archived in time, since LGWR has no available online logs to write, the database will hang here. Only after manual archiving, can you continue with available online logs. This should be avoided in a production environment.
The manual archiving operation is as follows:
SQL > ALTER SYSTEM ARCHIVE LOG ALL
The database will archive the online logs
3. Database log mode NO Archive Mode,Automatic archival Enabled
In some cases, the database administrator only sets LOG_ARCHIVE_START=TRUE in the database parameter files, and then after the database is up, the ARCH archiving process has started, but although ORACLE has made several log switches, it still does not archive logs. This is the case. If the database is not in ARVHIVELOG mode, redolog will not be archived.
4. Database log mode NO Archive Mode,Automatic archival Disabled
This setting is the default for the newly installed oracle database, as is most of the development environment. That is, there is no archiving.
How do I delete archive log files manually? (if you use RMNA backup, you don't have to delete it manually)
First, delete the archive log files manually
Delete the archived list information recorded in the database with RMAN
1) enter the rman of this database, enter "rman target /" in command line mode, enter rman, and check the prompt to confirm whether it is connected to this library?
2) View the status of the archive log file:
RMAN > list archivelog all
3) Delete the log files in the operating system (manually delete them at the operating system level, or it can be the first step
4) update the archive log information
RMAN > crosscheck archivelog all
RMAN > delete expired archivelog all; (type "yes" when confirming)
RMAN > exit
At this point, I believe you have a deeper understanding of "how to check whether the oracle database is archived". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.