My question is regarding alter sysem switch log file.
Assuming that I will put my 5 tablespaces in backup mode.
Then I do an OS copy of the datafiles to second location.
I take out the tablespaces out of Backup mode.
To generate the archived log files i connect internal and the do alter system switch log file.
If I have 5 datafiles, do i have to do alter system switch log file 5 times ?
Does it depend on the # of datafiles or i can just do it a couple of times ?How many times have to repeat that?
Thanks in advance
One word of advice is don't take all the tablespaces off line in one shot. The log switch would talke place in when the logfile is full, or when the check point is to occour. The alter system switch log file, would force a log switch and that would enable you to archive that log file. It would be better if you are going to do a force switch between every tablespace backup. Other wise, you can do this logswitch once at the end, to make sure that your next set of transactions would use the new log file.
So the choice is now yours. Did you ever had a chance to take a look into Oracle's RMAN backup, if you had not, I would suggest that you check that out. Using RMAN, you are not in a state to take the tablespace offline to do a hot backup.
Sambavan, why are you mentioning "taking tablespace offline" for hot backups? You don't need to take tablespaces offline while doing hot backup. You just have to put tablespace in "backup mode", which is something totaly different from taking it offline (and using RMAN or do it manually plays no role here).
As for original question:
The number of db files have no influence on the number of log switches you have to perform hot backup. Hot backup is valid if you backup all the archived logs holding database changes that took place during the time any of your tablespaces was in backup mode. So you have to remember the log sequence immediately before you start your backup and the log sequence at the moment you put your last tablespace out of backup mode and you have to backup all the archlogs between those two sequences. So usually it is necessary to perform a log switch only immediately after the end of your backup session to force the archiver to archive this last redo log. IMHO it is a good practice to perform a log switch also at the very begining of your backup session so that your backup set starts with a "clean" first archived log (that is, the first archlog will not contain any changes that are not relevant for this backup set).
Switching redo logs after putting each tablespace out of backup mode is simply unnecessary, it serves no purpose at all.
Jurij, thanx for pointing that out. I think I was brain dead :o when I had posted the message. For instance, when you use some of the third party tools, they tend to take the table space off line during the period of backup. But as far as this question is concerned, I was wrong in my answer.
If Switching redo logs after putting each tablespace out of backup mode is simply unnecessary, where does switching log files play a role ?
Thanks a lot guys
You should switch log at the end of backup so that you have all the redologs generated for the duration of the entire backup. If you want to use this backup for recovery purposes then you need the datafiles and all the redo logs to come to a consistent state.
I guess i will switch log at the end of backup so that i can always use it for recovery purposes rite?