To restore the database on a new host-restore the databases to a newer host

Source: Internet
Author: User

To Restore the database on a new host:
1. Ensure that the backups of the target database is accessible on the new host.
2. Configure the Oracle_sid on HostB.
3. Start RMAN on HostB and connect to the target database without connecting to the recovery catalog.
For example, enter the following command:
% Rman Nocatalog
Rman> CONNECT TARGET
/
4. Set the DBID and start the database instance without mounting the database.For example, run set DBID to set the DBID and then run STARTUP nomount:
SET DBID 1340752057;
STARTUP Nomount
RMAN fails to find the server parameter file, which have not yet been restored, but starts the instance with a "dummy" File.Sample output follows:
Startup failed:ora-01078:failure in processing system parameters lrm-00109:could not open parameter file '/net/hostb/or Acle/dbs/inittrgta.ora ' trying to start the Oracle instance without parameter files ...
Oracle instance started
5. Restore and edit the server parameter file.--Recover parameter files from automatic backup files
Allocate a channel to the media manager and thenrestore the server parameter file as a client-side parameter fileand use the SET command to indicate the location of the autobackup (in this example, the Autobackup is in/tmp):
RUN
{
ALLOCATE CHANNEL C1 DEVICE TYPE sbt PARMS ' ... ';
SET controlfile autobackup FORMAT for DEVICE TYPE DISK to '/tmp/%f '; RESTORE SPFILE
To PFILE '?/oradata/test/inittrgta.ora '
From Autobackup;
SHUTDOWN ABORT;
}

6. Edit The restored initialization parameter file.--Modify the recovered parameter file
Change any location-specific parameters, for example, those ending on _dest, to reflect the new directory structure. For example, edit the following parameters:
-IFILE
-Log_archive_dest_1
-Control_files
7. Restart the instance with the edited initialization parameter file. --Restart the database with a modified parameter file
For example, enter the following command:
STARTUP force Nomount pfile= '?/oradata/test/inittrgta.ora ';
8. Restore the control file from a autobackup and then mount the database.--Recover the control file from the automatic backup file to control_files parameter.
For example, enter the following command:
RUN
{
ALLOCATE CHANNEL C1 DEVICE TYPE sbt PARMS ' ... ';
RESTORE controlfile from Autobackup;
ALTER DATABASE MOUNT;
}
RMAN restores the control file to whatever locations your specified in the Control_files initialization parameter.
9. Catalog The data file copies this copied in "Restoring Disk Backups to a New Host", using their new file names or CATALOG START with (if you know all the files is in directories with a common prefix easi Ly addressed with a CATALOG START with command). For example, run:
CATALOG START with '/oracle/oradata/trgt/';
If you want to specify files individually and then you can execute a CATALOG command as follows:
CATALOG datafilecopy
'/oracle/oradata/trgt/system01.dbf ', '/oracle/oradata/trgt/undotbs01.dbf ', '/oracle/oradata/trgt/cwmlite01.dbf ', '/oracle/oradata/trgt/drsys01.dbf ', '/oracle/oradata/trgt/
Example01.dbf ', '/oracle/oradata/trgt/indx01.dbf ', '/oracle/oradata/trgt/tools01.dbf ', '/oracle/oradata/trgt/ USERS01.DBF ';
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$-obtain this information.
Run the following query in Sql*plus:

COLUMN NAME FORMAT A60
SPOOL LOG '/tmp/db_filenames.out '
Select file# as "file/grp#", NAME
From V$datafile
UNION
SELECT Group#,member
From V$logfile;
SPOOL OFF
EXIT

Write The RMAN Restore and recovery script. The script must include the following steps:
A. for each data file on the destination host, 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 is set up to having the same paths as the source host, then does the use set NE Wname for those files restored to the same path as on the source host.

B.For each online redo log, which is-created at a different location than it had on the source host, useSQL ALTER DATABASE RENAME FILECommands to specify the path name is on the destination host. If the file systems on the destination system is set up to having the same paths as the source host, then does the use ALTER DATABASE RENAME FILE For those files restored to the same path as on the source host.
c.Perform a SET UNTIL operation to limit recovery to the end of the archived redo logs. The recovery stops with a error if no SET UNTIL command is specified.
d.Restore and recover the database.
E.Run theSWITCH datafile Allcommand so, 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:
RUN
{
# Allocate a channel to the tape device
ALLOCATE CHANNEL C1 DEVICE TYPE sbt PARMS ' ... ';
# Rename the data files and online redo logs
SET NEWNAME for datafile 1 to '?/ORADATA/TEST/SYSTEM01.DBF '; SET NEWNAME for datafile 2 to '?/ORADATA/TEST/UNDOTBS01.DBF '; SET NEWNAME
For datafile 3 to '?/ORADATA/TEST/CWMLITE01.DBF '; SET NEWNAME for datafile 4 to '?/ORADATA/TEST/DRSYS01.DBF '; SET NEWNAME for DataFile 5 to
'?/ORADATA/TEST/EXAMPLE01.DBF '; SET NEWNAME for datafile 6 to '?/ORADATA/TEST/INDX01.DBF '; SET NEWNAME for datafile 7 to '?/oradata/test/
TOOLS01.DBF '; SET NEWNAME for datafile 8 to '?/ORADATA/TEST/USERS01.DBF '; SQL "ALTER DATABASE RENAME FILE"/dev3/oracle/dbs/redo01.log "to"?
Oradata/test/redo01.log ' ";
SQL "ALTER DATABASE RENAME FILE"/dev3/oracle/dbs/redo02.log "to"?/oradata/test/redo02.log ";
# do a set UNTIL to prevent recovery of the online logs SET UNTIL SCN 123456;
# Restore the database and switch the data file names restore database;
SWITCH datafile All;
# Recover the database
RECOVER DATABASE;
}
EXIT
Execute The script created in the previous step.
For example, start RMAN to connect to the target database and run the @ command:
% Rman Target/nocatalog
Rman> @reco_test. Rman
Open The restored database with the Resetlogs option.From the RMAN prompt, open the database with the Resetlogs option:
ALTER DATABASE OPEN resetlogs;
Caution:
re-open your database in the next step, does 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 is replaced by the new file names specified in the script.
Optionally, delete the test database with any of its files.
Note:
If you used a ASM disk group, then the DROP DATABASE command was the only-to safely remove the files of the the test Datab Ase. 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:
STARTUP force Nomount pfile= '?/oradata/test/inittrgta.ora '; DROP DATABASE;
Because you didn't perform the restore and recovery operation when connected to the recovery catalog, the recovery Catalo G 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.

To restore the database on a new host-restore the databases to a newer host

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.