683. Your production database it f unctional on the SHOST1 host. Y ou are backing up the production
database by using Recovery Manager (RMAN) with the recovery catalog. You want to replicate the
production database to anther host , SHOST2, for testing new applications.
After you ensured that the backups of the target database are accessible on the new host, what must you
do to restore and recover the backup for the test environment?
A.Restoring the control file from the backup by using the NOCATAL OG option to restore, and recovering the data files
B.Restoring the data files by us ing the NOCATALOG option and us ing the SET NEWNAME command to change the location
C.Restoring the server parameter file from the backup by using the recovery catalog to restore, and recovering the data files
D.Restoring the data files from the backup by using the recovery catalog to recover the files, and using the SWITCH command to change the location.
Answer: D
答案解析:
参考:http://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmadvre.htm#BRADV370
正确答案选A
你的生产库在SHOST1,你使用rman的恢复目录来备份生产库。你想复制生产库到另一台主机上SHOST2作为测试用
之后你确定在新的主机上你的目标数据库的备份能够被访问,什么是你必须要在测试环境还原和恢复的?
Start RMAN on hostb
and connect to the target database without connecting to the recovery catalog. C错D错
If the file systems on the destination system are set up to have the same paths as the source host, then do not use SET NEWNAME
for those files restored to the same path as on the source host. B错误
This scenario assumes that you want to test whether you can restore your database to a new host. In this scenario, you have two networked Linux hosts,hosta
and hostb
. A target database named trgta
is on hosta
and is registered in recovery catalog catdb
. You want to test the restore and recovery of trgta
onhostb
, while keeping database trgta
up and running on hosta
.
Now, assume that the directory structure of hostb
is different from hosta
. The target database is located in /net/hosta/dev3/oracle/dbs
, but you want to restore the database to /net/hostb/oracle/oradata/test
. You have tape backups of data files, control files, archived redo logs, and the server parameter file on a media manager accessible by both hosts. The ORACLE_SID
for the trgta
database is trgta
and does not change for the restored database.
Caution:
If you are restoring the database for test purposes, then never connect RMAN to the test database and the recovery catalog.To restore the database on a new host:
Ensure that the backups of the target database are accessible on the new host.
To test disaster recovery, you must have a recoverable backup of the target database. When preparing your disaster recovery strategy, ensure that the backups of the data files, control files, and server parameter file are restorable on hostb
. Thus, you must configure the media management software so that hostb
is a media manager client and can read the backup sets created on hosta
. Consult the media management vendor for support on this issue.
Configure the ORACLE_SID
on hostb
.
This scenario assumes that you want to start the RMAN client on hostb
and authenticate yourself through the operating system. However, you must be connected to hostb
either locally or through a net service name.
After logging in to hostb
with administrator privileges, edit the /etc/group
file so that you are included in the DBA group:
Set the ORACLE_SID
environment variable on hostb
to the same value used on hosta
:
Start RMAN on hostb
and connect to the target database without connecting to the recovery catalog. C错
For example, enter the following command:
Set the DBID and start the database instance without mounting the database.
For example, run SET
DBID
to set the DBID, then run STARTUP
NOMOUNT
:
RMAN fails to find the server parameter file, which has not yet been restored, but starts the instance with a "dummy" file. Sample output follows:
Restore and edit the server parameter file.
Because you enabled the control file autobackup feature when making your backups, the server parameter file is included in the backup. If you are restoring an autobackup that has a nondefault format, then use the SET CONTROLFILE AUTOBACKUP FORMAT
command to indicate the format.
Allocate a channel to the media manager, then restore the server parameter file as a client-side parameter file and use the SET
command to indicate the location of the autobackup (in this example, the autobackup is in /tmp
):
Edit the restored initialization parameter file.
Change any location-specific parameters, for example, those ending in _DEST
, to reflect the new directory structure. For example, edit the following parameters:
Restart the instance with the edited initialization parameter file.
For example, enter the following command:
Restore the control file from an autobackup and then mount the database.
For example, enter the following command:
RMAN restores the control file to whatever locations you specified in the CONTROL_FILES
initialization parameter.
Catalog the data file copies that you copied in "Restoring Disk Backups to a New Host", using their new file names or CATALOG START
WITH
(if you know all the files are in directories with a common prefix easily addressed with a CATALOG START WITH
command). For example, run:
If you want to specify files individually, then you can execute a CATALOG
command as follows:
Start a SQL*Plus session on the new database and query the database file names recorded in the control file.
Because the control file is from the trgta
database, the recorded file names use the original hosta
file names. You can query V$
views to obtain this information. Run the following query in SQL*Plus:
Write the RMAN restore and recovery script. The script must include the following steps:
For each data file on the destination host that is restored to a different path than it had on the source host, use a SET
NEWNAME
command to specify the new path on the destination host. If the file systems on the destination system are set up to have the same paths as the source host, then do not use SET NEWNAME
for those files restored to the same path as on the source host. B错误
For each online redo log that is to be created at a different location than it had on the source host, use SQL ALTER
DATABASE
RENAME
FILE
commands to specify the path name on the destination host. If the file systems on the destination system are set up to have the same paths as the source host, then do not use ALTER DATABASE RENAME FILE
for those files restored to the same path as on the source host.
Perform a SET UNTIL
operation to limit recovery to the end of the archived redo logs. The recovery stops with an error if no SET UNTIL
command is specified.
Restore and recover the database.
Run the SWITCH DATAFILE ALL
command so that the control file recognizes the new path names as the official new names of the data files.
Example 20-3 shows the RMAN script reco_test.rman
that can perform the restore and recovery operation.
Example 20-3 Restoring a Database on a New Host
Execute the script created in the previous step.
For example, start RMAN to connect to the target database and run the @
command:
Open the restored database with the RESETLOGS
option.
From the RMAN prompt, open the database with the RESETLOGS
option:
Caution:
When you re-open your database in the next step, do not connect to the recovery catalog. Otherwise, the new database incarnation created is registered automatically in the recovery catalog, and the file names of the production database are replaced by the new file names specified in the script.Optionally, delete the test database with all of its files.
Note:
If you used an ASM disk group, then theDROP DATABASE
command is the only way to safely remove the files of the test database. If you restored to non-ASM storage then you can also use operating system commands to remove the database.
Use the DROP DATABASE
command to delete all files associated with the database automatically. The following example deletes the database files:
Because you did not perform the restore and recovery operation when connected to the recovery catalog, the recovery catalog contains no records for any of the restored files or the procedures performed during the test. Likewise, the control file of the trgta
database is completely unaffected by the test.