Database Reference
In-Depth Information
Recovering the database depends, again, on the type of data file outage you have
experienced. In the next sections, we will cover the
RECOVER DATABASE
command first.
Then we'll cover restoring the database after loss of all data files, loss of
SYSTEM
or
UNDO
tablespace data files, and loss of non-
SYSTEM
or -
UNDO
tablespace data files.
Renaming Database Files
Sometimes during a recovery you will need to restore database files to different locations.
If this is the case, you will need to indicate to Oracle where the new location is. The types
of files you are likely to move are control files, online redo logs, and database data files
If you are restoring control files to a different location, then simply change the
CONTROL_
FILES
parameter.
If the relocation involves the online redo logs or the database data files, then you will need
to use the
ALTER DATABASE RENAME FILE
command. This command works only when the
database is mounted and in some cases when it's open (like when data files to be renamed
are offline)
To rename a file, restore the files to the new location and issue the
ALTER DATABASE
RENAME FILE
command, as shown here:
alter database rename file '/ora01/oracle/oradata/orcl/system01.dbf'
To '/ora02/oracle/oradata/orcl/system01.dbf';
This will rename the file in the control file Note that it has no impact on the actual
physical file
Using the
RECOVER DATABASE
Command
The
RECOVER DATABASE
command is used in Oracle to recover the database from the SQL
prompt. When you issue the
RECOVER DATABASE
command without any parameters, Oracle
will assume a
point-of-failure recovery
or
complete recovery
. That is, it will try to recover the
database up to the last redo-log entry. This results in a complete recovery of your database
down to the last transaction. During recovery operations, Oracle will inspect the data file
headers and the control file and determine where data file recovery needs to begin for each
data file. To do this, Oracle will inspect the SCN contained in each database data file. It will
use the SCN to determine where it needs to start recovering the data file.
What is the SCN? The system change number (SCN) is a counter, and its job is to keep
track of everything going on inside the database and assign it a temporal identity. This
serves to keep transactions that occurred in a particular order in the same order later down
the road (such as during recovery). You need to preserve the order of transactions because
Search WWH ::
Custom Search