In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you what are the differences between alter system switch logfile and alter system archive log current in the database, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Alter system switch logfile is a mandatory log switch, so it is not necessary to archive the current redo log files (if automatic archiving is enabled, redo logs before archiving are enabled; if automatic archiving is not enabled, current redo logs are not archived. )
Alter system archive log current is the archiving of the current redo log files, regardless of whether the automatic archive is typed or not.
The main differences are:
ALTER SYSTEM SWITCH LOGFILE performs log switching to the current instance in a single instance database or RAC
ALTER SYSTEM ARCHIVE LOG CURRENT, on the other hand, performs a log switch on all instances in the database.
So the latter is generally used most of the time in the RAC environment.
Why do you execute the statement alter system archive log current after the hot backup? you can see that many scripts are written in this way.
Is it necessary?
General RMAN scripts are written this way, because RMAN can back up archive logs. Alter system archive log current can then back up all the archives. This is done to ensure the integrity and consistency of the data.
ALTER SYSTEM SWITCH LOGFILE
SWITCH LOGFILE Clause
The SWITCH LOGFILE clause lets you explicitly force Oracle to begin writing to a new redo log file group, regardless of whether the files in the current redo log file group are full. When you force a log switch, Oracle begins to perform a checkpoint but returns control to you immediately rather than when the checkpoint is complete. To use this clause, your instance must have the database open.
ALTER SYSTEM ARCHIVE LOG CURRENT
CURRENT Clause
Specify CURRENT to manually archive the current redo log file group of the specified thread (instance), forcing a log switch. If you omit the THREAD parameter, then Oracle archives all redo log file groups from all enabled threads (instances), including logs previous to current logs. You can specify CURRENT only when the database is open.
ALTER SYSTEM ARCHIVE LOG CURRENT NOSWITCH
NOSWITCH
Specify NOSWITCH if you want to manually archive the current redo log file group without forcing a log switch. This setting is used primarily with standby databases to prevent data divergence when the primary database shuts down. Divergence implies the possibility of data loss in case of primary database failure.
You can use the NOSWITCH clause only when your instance has the database mounted but not open. If the database is open, then this operation closes the database automatically. You must then manually shut down the database before you can reopen it.
In addition, SWITCH LOGFILE only forcibly switches log groups, and whether the archiving feature is enabled or not has little to do with it:
If archiving is opened, switching log groups must be archived. In the case of archiving, log switching is bound to be archived.
If archiving is turned off, it certainly cannot be archived, but this function can also switch log groups, because its function is to force log groups to be switched.
Archive log means archiving. There are two commonly used parameters:
Alter system archive log current: archive the current log group, which is only used in archive mode. Since it is the current log group, log groups must be switched before archiving, so this command is accompanied by switching log groups.
Alter system archive log all: archiving log groups that have not been archived except the current log group, used only in archive mode. This command does not switch log groups.
When used in non-archive mode, the following error is reported:
Additional note: can't ARCHIVE LOG be used in non-archiving mode? The above ORA-00258 prompts you to specify the log. The relevant parameters are as follows:
ARCHIVE LOG
[INSTANCE 'instance_name']
{{SEQUENCE integer
| | CHANGE integer |
| | CURRENT [NOSWITCH] |
| | GROUP integer |
| | LOGFILE 'filename' |
[USING BACKUP CONTROLFILE]
| | NEXT |
| | ALL |
| | START |
}
[TO 'location']
| | STOP |
}
You can use this method to specify a specific log group for archiving in non-archive mode, but group n cannot be the current log group.
SQL > alter system archive log group 2 to'/ tmp'
Summary:
ALTER SYSTEM SWITCH LOGFILE: it means to switch logs, SWITCH (switch), LOGFILE (log), literally
ALTER SYSTEM ARCHIVE LOG CURRENT: archiving the current log, archiving (ARCHIVE) log (LOG) current (CURRENT), also literally
Then, in different environments (whether the archiving function is enabled for stand-alone / RAC/), due to the different starting point of the functional design, their respective effects are also different.
The above is all the contents of the article "what is the difference between alter system switch logfile and alter system archive log current in the database". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.