Академический Документы
Профессиональный Документы
Культура Документы
Let's create a table called tapes in the tablespace test, insert the value "DLT"
into it, and force a checkpoint:
SQL> create table tapes (name varchar2(32)) tablespace test;
Table created
SQL> insert into tapes values ('DLT');
1 row created
SQL> commit;
Commit complete.
SQL> alter system checkpoint;
System altered.
Now we ask Oracle what block number contains the new value:
SQL> select dbms_rowid.rowid_block_number(rowid) blk, name from
tapes;
BLK NAME
------- ----------------
3 DLT
The value "DLT" is recorded in the third data block. Allowing nine blocks
for the datafile headers, we can read the third block of data with dd and run
strings on it to actually see that the value is there:
The existence of archive logs does all this without adding significant
overhead to the entire process. The only difference between having
archiving on or off is whether or not Oracle copies the current redolog out to
disk when it "switches" from one redolog to the next, because even with
archiving off, it still logs every transaction in the online redologs. This
means that the only overhead associated with archiving is the overhead
associated with copying the online file to the archive location, which is why
there may be only a 1-3 percent performance hit in an environment with
many transactions (if there is one at all). Feel free to experiment, but it is
very difficult to justify turning off archiving on any production database.
(See sidebar.)
In my opinion, there are only two environments in which turning off
archiving is acceptable. The first is an environment in which the data does
not matter. What type of environment would that be? The only one is a true
test environment that is using fake data or data restored from production
volumes. No structure changes are being made to this database, and any
changes made to the data will be discarded. This database does not need
archiving and probably doesn't even need to be backed up at all. If you're
doing any type of benchmarking of a database that will go into production,
backup and archiving should be running. The test will be more realistic,
even if all the archive logs are deleted as soon as they are made.
Development databases do not fall into this category because, although the
data in a development database may be unimportant, the structure of the
database often is highly important. If archiving is off, a DBA cannot restore
any development work that he has done since the last backup. That creates
the opportunity to lose hours' or even days' worth of work, just so a
development database can be 1-3 percent faster. That is a big risk for such a
small gain.
The second type of database that doesn't need archive logs is a completely
read-only database or a "partially read-only" database where an archive log
restore would be slower than a reload of the original data. The emergence of
the data-warehouse has created this scenario. There are now some databases
that have completely read-only tablespaces and never have data loaded into
them. This type of database can be backed up once and then left alone until
it changes again. A partially read-only database is one that stays read only
for long periods of time and is updated by a batch process that runs nightly,
weekly, or even as needed. The idea is that instead of saving hundreds of
redologs, the database would be restored from a backup that was taken
before the load. The DBA then could redo the load.
There are two choices in this scenario. The first is to turn off archiving,
making sure that there is a good cold backup after each database load. If the
load aborted or a disk crashed after the load but before the next backup, you
could simply load the older backup and then redo the load. The cold backup
will cost some downtime, but having archiving off will speed up the loads
somewhat. The other option would be to turn on archiving. That allows
taking a hot backup anytime and creates the option of using the redologs to
reload the data instead of doing an actual data reload. This method allows
for greater backup flexibility. However, depending on the database and the
type of data, an archive log restore could take longer than a reload of the
original data, especially if it is a multithreaded load. It is a tradeoff of
performance for recoverability. Test both ways to see which one works best
for you.
Summary
For those of you with commercial backup and recovery products that have
been complaining that your Oracle database files are changing during your
hot backup, you now know why. I hope you get some value out of the
discussion about the importance of archiving, and managing your archived
redo logs.
The last two editions of lost+found have been excerpts from Chapter 15 of
Unix Backup & Recovery.
W. Curtis Preston has specialized in storage for over eight years, and has
designed and implemented storage systems for several Fortune 100
companies. He is the owner of Storage Designs, the Webmaster of Backup
Central (http://www.backupcentral.com), and the author of two books on
storage. He may be reached at curtis@backupcentral.com. (Portions of
some articles may be excerpted from Curtis's books.)