why we have to backup archive log after backup full DB - oracle

i am learning about backup recovery on oracle. i see the script to backup for both DB and archive log. but i think backup archive log maybe can not use when recovering database. all data change in archive log, which was already backup, it in the backup up DB also.
for exmaple:
i backup DB at 1h00, finish at 2h00
at 2h00, i backup archive log. finish at 2h10
at 4h,DB corrupted, i have to recover DB from DB backup. i think archive log when i backup at 2h00 is not use in that case.
if i incorrect, please correct me. what perpose when we do backup archive log.

An archived redo log file is a copy of one of the filled members of a redo log group. and it must be emptied to create space for the new changes that are constantly happening in your DB. But, If your database is started with archive log mode than before emptying any redo logs it is moved to one of the offline destination files, which is called the archive log.
Archived redo logs are used in case you lost your data due to any situation: DB crashed, data corruption, or any. In such a situation archive logs (from the last backup taken to a time when DB is corrupted) are used. It is described as following with your own example:
DB backup was taken at 2h00
DB corrupted at 4h00
You can use the Good backup that was taken at 2h00 and then use redo logs from archive logs to make all the changes that were happened during 2h00 to 4h00
Your answer: You should take the backup of the archive logs created after the last good backup. All archive logs backup is not needed. and archive log backups should be taken frequently and store it in other than the DB server machine. All the old Archive log backups will be not needed once you take the full DB backup. (You can delete old archive log backup once full DB backup is taken)
You can find more details about the complete recovery of data where archive redo logs are needed from oracle documentation.

Related

Recover oracle database using archived logs created after the backup

I take a daily backup of my Oracle production database. The backup is created using RMAN and includes control files and archived logs up to the point the backup was taken. For disaster recovery purposes, I want to test the restore of the backup to a new server. (The production database will remain fully operational throughout.)
My question is: when I restore the backup and recover the database on the new server, is it possible to further recover it beyond the archived logs contained in the backup, by using additional archived logs that have been created on the production database since the backup was taken? If so, how would I go about this?

How do I get rid of Oracle Archive (.arc) files?

Oracle archive files are about to bring my production dbase to a grinding halt. The application is depositing one ~100MB .ARC files daily.
How can I compress these .arc files or delete them?
I'm running running Oracle 10.2 with admin privileges.
I work in SQL Server so am out of my comfort zone here.
The backup process will handle your archived log files.
The best tool for the job is RMAN - Oracle Recovery Manager.
This will make your *.arc files go away:
On your host:
$rman target /
# datafiles and archived log files
RMAN>backup database pluss archivelog delete input;
# archivelog files only
RMAN>backup archivelog all delete input;
RMAN>show all; -- inspect the configuration. (Where the backup default is going)
These are redolog file backups, needed to recover the database in case of disk or media failure. You can learn more here:
http://docs.oracle.com/cd/B19306_01/server.102/b14231/archredo.htm
You mention this is a production database, so I assume you generate backups at least once a day. If you use RMAN for your backups, you can use RMAN to purge old or obsolete redolog files, and even set a retention policy to automatically delete obsolete redolog files after some time. You can learn how here:
http://docs.oracle.com/cd/B19306_01/backup.102/b14192/maint003.htm#i1006294

oracle rman simple backup

I would like to backup an Oracle 10G as simple as possible.
It is in NOARCHIVELOG mode and I can shut down for backup (it is only a development server).
After reading tons of documentation abour rman I tried this way in rman:
shutdown immediate;
startup mount
backup database;
sql 'alter database open';
As I see it works fine, list backup shows backups.
Than I made some modifications (droping some tables, adding data) and I tried to restore backup:
shutdown immediate;
startup mount
restore database;
recover database;
sql 'alter database open';
It also seems to work fine but I can't get back the previous state of the database. I don't understand why. I also don't understand why need to use recover.
Thanks
Hubidubi
The "restore database;" command will read the backup from the backup media media so that your database files are exactly like they were when the last backup was taken. It does not restore control files.
The "recover database;" command will apply incremental backups (not applicable - your example only has a full backup) and apply archive logs (also not applicable, you're in "NOARCHIVELOG" mode.) It may also write to the control files - if it does, you can see why it's required.
After the restore/recover/open commands you issued in your question your database is as it was at the time of the backup. Any transactions committed after the backup are lost and can't be recovered because you're in "NOARCHIVELOG" mode. You need to be in "ARCHIVELOG" mode to do a complete "point in time" recovery.
byw, what files, if any did you delete, rename or move to really simulate a true media failure? I'll bet you didn't delete one of your control files. You need to practice that scenario.

How does Oracle manage Redo logs?

Can any body give me an idea about Redo logs? An example would be most appreciated.
As Oracle changes data in a datafile, it writes out information to the redo log. In the event of a database failure, you can use this information to get the database back to the point it was before the database failure.
In a disaster recovery scenario, you could restore your last full database backup, and then apply the redo logs taken since that last backup to get the database recovered. Without those redo logs, you could only recover to the last full backup, and changes made since then would be lost.
In Oracle, you can also run in "no archive log mode", which basically means, "redo logs can be overwritten without being saved". This is generally only acceptable for a development database where you don't care about losing data since the last backup. You wouldn't typically run in this mode in a production environment, as it could be disastrous.
Here's a reference link with more info, and also an example of how you can find out the amount of generated redo.
http://www.adp-gmbh.ch/ora/concepts/redo_log.html
A definitive answer from the documentation: http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/onlineredo.htm#sthref850
To expand on #dcp's answer: Technically, #dcp is referring to archived redo logs. These are optional, and as stated are only produced when running the database in archivelog mode. Every Oracle database has at least two mandatory online redo log files. These track all changes to the database. They are essential for recovery if the database crashes unexpectedly, whereas archived logs are not. Oracle uses the online redo log files to transparently bring the database back to the most recently committed state in the event of a system crash. Archived logs are used during recovery from a backup - the backup is restored, then archived logs are applied to the backup to bring the database back to it's current state or some prior point in time.
The online logs are written to in circular fashion - as one fills the next one is "swtiched" to. If archive log mode is set, then these older logs are written to the archive log destination(s). If not, they are overwritten as needed, once the changes they track are written to the datafiles.
This overview of backup and recovery at Oracle's site is pretty good to give one an idea of how the whole thing is put together.

Rolling forward the archivelog and online redo logs to the restored database

I'm currently using Oracle db11g on Red Hat Enterprise Linux 5.0.
I make an incremental level 0 one time a week and incremental level 1 everyday.
I can restore this backup on my new Linux server without any problems because I have all archive logs generated after level 1 backup.
However, if online redo log is not yet filled (I mean that I have some redo info in the online log), how can I use this online log to roll forward to my restored database on the new Linux server?
I don't want to lose the valuable information that is not yet archived.
Best regards,
Sarith
Restore your backed up files.
Copy your current online redo log files (from the "damaged" production instance) to the new server.
RECOVER DATABASE;
This scenario assumes you have total continuity with archived logs and online logs. In doing the recovery, Oracle will apply necessary archived redo, then move to the online redo logs to recover to the point of failure. Important! Don't restore online redo logs from the backup you have! Use the current online logs from your crashed instance.
Finally, don't believe anything you read without practicing it for yourself!
Yes you can use the unarchived logs - if you applying the archive logs via "recover database using backup controlfile", just supply the redo log name instead of the suggested archive log name that the recovery process provides when it comes to that point (i.e. "runs out" of archive logs).
So you mean you duplicate the database to another server using RMAN?
Online redo logs are only used for disaster recovery. For instance : you lose a datafile, restore the datafile from your latest backup, and apply archivelogs and finaly the online redo logs. This makes the restored datafile have the same SCN (System change number) as the controlfile (and other datafiles). Distaster recovery complete.
When you use your backups to duplicate the database on another server you can only roll forward using your archived logs. It does a incomplete recovery by defenition (creates a new controlfile and redologs).
Do a
SQL> Alter system switch logfile
before backup?
But no matter what restore is behind the source database if it stays open. I don't now your business case exactly but DataGuard might be an option for you.
Rob

Resources