Sie sind auf Seite 1von 8

This document will detail the steps to restore a database on a new host using RMAN.

For this demonstration we will be using Oracle Database 11gR2 on Linux and disk based
backup.

One of the first things we want to do is get the Database ID (DBID) from the database in which we will be restoring its backup. You can find the DBID by connecting to the database
with RMAN as shown below.

1
[oracle@ora1 ~]$ rman
2
3 Recovery Manager: Release 11.2.0.1.0 - Production on Tue Apr 27 09:40:34 2010
4
5 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
6
7 RMAN> connect target /
8
9 connected to target database: ORCL (DBID=1239150297)
10
RMAN>
11

If you are unable to connect to the database you can also find the DBID by inspecting the file name of the control file autobackup. For example, c-1239150297-20100427-00, is a
control file autobackup. The first group of numbers appearing after the c-, 123915029, is the DBID.

When we restore the database we are not going to have the active redo logs from the original database so we want to stop the recovery at the last SCN in the archive logs. We can
find the last SCN by querying V$ARCHIVED_LOG.

1 SQL> selectmax(next_change#)
2
2 fromv$archived_log
3
3 wherearchived = 'YES'
4
4 groupbythread#;
5
6 MAX(NEXT_CHANGE#)
7 -----------------
8 1375117
9
10SQL>

Here we see that the archive logs contain log information up to SCN 1375117. That is our stopping SCN. We can also find the last SCN in our archive logs through RMAN using LIST
BACKUP OF ARCHIVELOG ALL.

1
2
3
4 RMAN> list backup of archivelog all;
5
6
7 List of Backup Sets
8 ===================
9
10
11BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
1254 2.09M DISK 00:00:01 27-APR-10
13 BP Key: 54 Status: AVAILABLE Compressed: NO Tag: TAG20100427T094350
14 Piece Name: /u03/app/oracle/oradata/orcl/backup/1vlc5nqn_1_1
15
16 List of Archived Logs in backup set 54
Thrd Seq Low SCN Low Time Next SCN Next Time
17 ---- ------- ---------- --------- ---------- ---------
18 1 12 1359005 26-APR-10 1359528 26-APR-10
19 1 13 1359528 26-APR-10 1359609 26-APR-10
20 1 14 1359609 26-APR-10 1362018 26-APR-10
21
BS Key Size Device Type Elapsed Time Completion Time
22------- ---------- ----------- ------------ ---------------
2355 13.82M DISK 00:00:02 27-APR-10
24 BP Key: 55 Status: AVAILABLE Compressed: NO Tag: TAG20100427T094350
25 Piece Name: /u03/app/oracle/oradata/orcl/backup/20lc5nqr_1_1

26
List of Archived Logs in backup set 55
27 Thrd Seq Low SCN Low Time Next SCN Next Time
28 ---- ------- ---------- --------- ---------- ---------
29 1 1 1362019 26-APR-10 1374991 27-APR-10
30
31BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
3260 136.00K DISK 00:00:00 27-APR-10
33 BP Key: 60 Status: AVAILABLE Compressed: NO Tag: TAG20100427T094652
34 Piece Name: /u03/app/oracle/oradata/orcl/backup/24lc5o0c_1_1
35
36 List of Archived Logs in backup set 60
37 Thrd Seq Low SCN Low Time Next SCN Next Time
38 ---- ------- ---------- --------- ---------- ---------
1 2 1374991 27-APR-10 1375117 27-APR-10
39
40RMAN>
41
42
43

Looking through the output above we see that highest Next SCN is 1375117 which is part of backup set 60.

Next we need to make the backup available to the new host. If the backups reside on a shared file system that the new host has access to then there is nothing more to do. If the
backups are on local storage we will need to transfer the backups to the new host.

1
2
3 [oracle@ora1 backup]$ sftp oracle@ora2
4 Connecting to ora2...
5 oracle@ora2's password:
sftp> cd /u01/app/oracle/oradata/orcl/backup
6 sftp> mput *
7 Uploading 1vlc5nqn_1_1 to /u01/app/oracle/oradata/orcl/backup/1vlc5nqn_1_1
8 1vlc5nqn_1_1 100% 2142KB 2.1MB/s 00:00
9 Uploading 20lc5nqr_1_1 to /u01/app/oracle/oradata/orcl/backup/20lc5nqr_1_1
20lc5nqr_1_1 100% 14MB 13.8MB/s 00:01
10Uploading 21lc5nqv_1_1 to /u01/app/oracle/oradata/orcl/backup/21lc5nqv_1_1
1121lc5nqv_1_1 100% 1009MB 13.3MB/s 01:16
12Uploading 22lc5nqv_1_1 to /u01/app/oracle/oradata/orcl/backup/22lc5nqv_1_1
1322lc5nqv_1_1 100% 80MB 13.4MB/s 00:06
Uploading 23lc5ns4_1_1 to /u01/app/oracle/oradata/orcl/backup/23lc5ns4_1_1
1423lc5ns4_1_1 100% 33MB 16.6MB/s 00:02
15Uploading 24lc5o0c_1_1 to /u01/app/oracle/oradata/orcl/backup/24lc5o0c_1_1
1624lc5o0c_1_1 100% 137KB 136.5KB/s 00:00
17Uploading c-1239150297-20100426-00 to /u01/app/oracle/oradata/orcl/backup/c-1239150297-20100426-00
c-1239150297-20100426-00 100% 9600KB 9.4MB/s 00:01
18Uploading c-1239150297-20100427-00 to /u01/app/oracle/oradata/orcl/backup/c-1239150297-20100427-00
19c-1239150297-20100427-00 100% 9632KB 9.4MB/s 00:01
20sftp> exit
21[oracle@ora1 backup]$
22
23

All of the rest of the steps will take place on the new host.

Set the ORACLE_SIDto the SID of the database that made the backup and start up RMAN and connect to the target.

1
[oracle@ora2 backup]$ export ORACLE_SID=orcl
2 [oracle@ora2 backup]$ rman
3
4 Recovery Manager: Release 11.2.0.1.0 - Production on Tue Apr 27 11:27:23 2010
5
6 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
7
8 RMAN> connect target /
9
connected to target database (not started)
10
11RMAN>
12

We now need to set the DBID and bring the database in mount mode. When we bring the database up in mount mode we will receive errors because the parameter file is not found.
This is to be expected as we are restoring to a new host. Oracle will use a “dummy” parameter file for the time being.

1
2 RMAN> set dbid 1239150297
3
4 executing command: SET DBID
5
RMAN> startup nomount
6
7 startup failed: ORA-01078: failure in processing system parameters
8 LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl.ora'
9
10starting Oracle instance without parameter file for retrieval of spfile
11Oracle instance started
12
Total System Global Area 159019008 bytes
13
14Fixed Size 1335192 bytes
15Variable Size 75497576 bytes
16Database Buffers 79691776 bytes
17Redo Buffers 2494464 bytes
18
19RMAN>
20

Now with the database in mount mode we need to restore the SPFILE. We are going to need to make some changes to the SPFILE so we will restore SPFILE to a PFILE. The
SPFILE is stored in the control file autobackup. All of the RMAN configuration parameters values are at their defaults so we will need to set the location for the control file
autobackup.

1RMAN> show controlfile autobackup format;


2
3RMAN configuration parameters for database with db_unique_name DUMMY are:
4CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
5
6RMAN>

Below we will set the location for the control file autobackup and restore the SPFILE to a PFILE and then we shutdown the database.

1
2
RMAN> set controlfile autobackup format for device type disk to '/u01/app/oracle/oradata/orcl/backup/%F';
3
4 executing command: SET CONTROLFILE AUTOBACKUP FORMAT
5
6 RMAN> restore spfile
7 2> to pfile '/u01/app/oracle/oradata/orcl/initorcl.ora'
8 3> from autobackup;

9
Starting restore at 27-APR-10
10allocated channel: ORA_DISK_1
11channel ORA_DISK_1: SID=19 device type=DISK
12
13channel ORA_DISK_1: looking for AUTOBACKUP on day: 20100427
14channel ORA_DISK_1: AUTOBACKUP found: /u01/app/oracle/oradata/orcl/backup/c-1239150297-20100427-00
channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/app/oracle/oradata/orcl/backup/c-1239150297-20100427-00
15channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
16Finished restore at 27-APR-10
17
18RMAN> shutdown abort;
19
20Oracle instance shut down
21
RMAN>
22
23

Now that we have the SPFILE we need to edit the some of the parameter to reflect the new host’s file system were appropriate. Below is a list of the some of the parameter you
might need to change in your environment. These directories must exist on the new host.

1*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
2*.control_files='/u02/app/oracle/oradata/orcl/ctl/control01.ctl','/u01/app/oracle/flash_recovery_area/orcl/control02.ctl','/u03/app/oracle/orada
3Controlfile
*.db_recovery_file_dest_size=4039114752
4*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
5*.diagnostic_dest='/u01/app/oracle'
6*.log_archive_dest_1='LOCATION=/u02/app/oracle/oradata/orcl/arch'
7*.local_listener='LISTENER_ORCL'

Note: If you are using 11g you to ensure your kernel parameters are set appropriately to avoid a possible ORA-00845.

1[oracle@ora2 orcl]$ oerr ora 00845


200845, 00000, "MEMORY_TARGET not supported on this system"
// *Cause: The MEMORY_TARGET parameter was not supported on this operating system or /dev/shm was not sized correctly on Linux.
3// *Action: Refer to documentation for a list of supported operating systems. Or, size /dev/shm to be at least the SGA_MAX_SIZE on each
4Oracle instance running on the system.
5[oracle@ora2 orcl]$

After making the necessary changes to the PFILE we now will bring the database back up in NOMOUNT mode so we can restore the control files. When bringing the database up in
NOMOUNT mode we will use the PFILE we edited earlier.

1
2 RMAN> startup nomount pfile='/u01/app/oracle/oradata/orcl/initorcl.ora';
3
connected to target database (not started)
4 Oracle instance started
5
6 Total System Global Area 849530880 bytes
7
8 Fixed Size 1339824 bytes
9 Variable Size 528485968 bytes
Database Buffers 314572800 bytes
10Redo Buffers 5132288 bytes
11
12RMAN>
13

Just like the SPFILE we will use the autobackup to restore the control file after setting the control file autobackup format. After restoring the control files we mount the database.

1
2
3 RMAN> set controlfile autobackup format for device type disk to '/u01/app/oracle/oradata/orcl/backup/%F';
4
5 executing command: SET CONTROLFILE AUTOBACKUP FORMAT
6
RMAN> restore controlfile from autobackup;
7
8 Starting restore at 27-APR-10
9 allocated channel: ORA_DISK_1
10channel ORA_DISK_1: SID=19 device type=DISK
11
12recovery area destination: /u01/app/oracle/flash_recovery_area
database name (or database unique name) used for search: ORCL
13channel ORA_DISK_1: no AUTOBACKUPS found in the recovery area
14channel ORA_DISK_1: looking for AUTOBACKUP on day: 20100427
15channel ORA_DISK_1: AUTOBACKUP found: /u01/app/oracle/oradata/orcl/backup/c-1239150297-20100427-00
16channel ORA_DISK_1: restoring control file from AUTOBACKUP /u01/app/oracle/oradata/orcl/backup/c-1239150297-20100427-00
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
17output file name=/u02/oradata/orcl/ctl/control01.ctl
18output file name=/u01/app/oracle/flash_recovery_area/orcl/control02.ctl
19output file name=/u03/app/oracle/oradata/orcl/ctl/control03.ctl
20Finished restore at 27-APR-10
21
RMAN> alter database mount;
22
23database mounted
24released channel: ORA_DISK_1
25
26RMAN>
27
28

Now that the control files have been restored and mounted, all of the RMAN configuration parameters have been set. You should verify the paths to make sure they are appropriate
for this host.

1
2
3 RMAN> show all;
4
RMAN configuration parameters for database with db_unique_name ORCL are:
5 CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
6 CONFIGURE BACKUP OPTIMIZATION OFF; # default
7 CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
8 CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u03/app/oracle/oradata/orcl/backup/%F';
9 CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
10CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
11CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
12CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u03/app/oracle/oradata/orcl/backup/%U' MAXPIECESIZE 2 G;
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
13CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
14CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
15CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
16CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO 'SBT_TAPE';
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f'; # default
17
18RMAN>
19
20

Given the current settings RMAN is going to look in /u03/app/oracle/oradata/orcl/backupfor both the control file autobackups and database/archive log backups. The
backup we copied over is located in /u01/app/oracle/oradata/orcl/backup. There are two ways to resolve this issue. Either move the backup to the location were RMAN is
configured or change the configuration. It may be that moving the backups may not be an option so we document what needs to be done next.

RMAN has record of a backup in /u03/app/oracle/oradata/orcl/backupbut has no record of the backup we have in /u01/app/oracle/oradata/orcl/backup/. We
need remove the record of the old location and the backup of the new location.

In order to let RMAN know about the backup in /u01/app/oracle/oradata/orcl/backupwe use the CATALOG command.

1
2
3
4
5 RMAN> catalog start with '/u01/app/oracle/oradata/orcl/backup';
6
Starting implicit crosscheck backup at 27-APR-10
7 allocated channel: ORA_DISK_1
8 channel ORA_DISK_1: SID=19 device type=DISK
9 allocated channel: ORA_DISK_2
10channel ORA_DISK_2: SID=20 device type=DISK
Crosschecked 32 objects
11Finished implicit crosscheck backup at 27-APR-10
12
13Starting implicit crosscheck copy at 27-APR-10
14using channel ORA_DISK_1
15using channel ORA_DISK_2
Finished implicit crosscheck copy at 27-APR-10
16
17searching for all files in the recovery area
18cataloging files...
19no files cataloged
20
21searching for all files that match the pattern /u01/app/oracle/oradata/orcl/backup
22
List of Files Unknown to the Database
23=====================================
24File Name: /u01/app/oracle/oradata/orcl/backup/20lc5nqr_1_1
25File Name: /u01/app/oracle/oradata/orcl/backup/23lc5ns4_1_1
26File Name: /u01/app/oracle/oradata/orcl/backup/c-1239150297-20100427-00
File Name: /u01/app/oracle/oradata/orcl/backup/c-1239150297-20100426-00
27File Name: /u01/app/oracle/oradata/orcl/backup/21lc5nqv_1_1
28File Name: /u01/app/oracle/oradata/orcl/backup/1vlc5nqn_1_1
29File Name: /u01/app/oracle/oradata/orcl/backup/24lc5o0c_1_1
30File Name: /u01/app/oracle/oradata/orcl/backup/22lc5nqv_1_1
31
Do you really want to catalog the above files (enter YES or NO)? yes
32cataloging files...
33cataloging done
34
35List of Cataloged Files
36=======================
File Name: /u01/app/oracle/oradata/orcl/backup/20lc5nqr_1_1
37File Name: /u01/app/oracle/oradata/orcl/backup/23lc5ns4_1_1
38File Name: /u01/app/oracle/oradata/orcl/backup/c-1239150297-20100427-00
39File Name: /u01/app/oracle/oradata/orcl/backup/c-1239150297-20100426-00
40File Name: /u01/app/oracle/oradata/orcl/backup/21lc5nqv_1_1
File Name: /u01/app/oracle/oradata/orcl/backup/1vlc5nqn_1_1
41File Name: /u01/app/oracle/oradata/orcl/backup/24lc5o0c_1_1
42File Name: /u01/app/oracle/oradata/orcl/backup/22lc5nqv_1_1
43
44RMAN>
45
46
47
48

As a result of the CATALOG command RMAN performed a CROSSCHECK. The backup registered at /u03/app/oracle/oradata/orcl/backup/was marked expired as a result
of the CROSSCHECK because they were not present.

We are almost ready to restore the database the last thing to be done is to build the restore script. During the restore we can change the location of the data files by using SET
NEWNAME FOR DATAFILE. The data files in the backup are on various locations but we would like to restore them to only one.

Also we would like to change the location of the redo logs as well. In order to change the redo log locations the ALTER DATABASE RENAME FILEcommand has to be issued. Below
are examples of both.

1
2
3 SET NEWNAME FOR DATAFILE 1 TO '/u01/app/oracle/oradata/orcl/system01.dbf';
4 SET NEWNAME FOR DATAFILE 2 TO '/u01/app/oracle/oradata/orcl/sysaux01.dbf';
5 SET NEWNAME FOR DATAFILE 3 TO '/u01/app/oracle/oradata/orcl/undotbs01.dbf';
SET NEWNAME FOR DATAFILE 4 TO '/u01/app/oracle/oradata/orcl/users01.dbf';
6 SET NEWNAME FOR DATAFILE 5 TO '/u01/app/oracle/oradata/orcl/example01.dbf';
7 SET NEWNAME FOR DATAFILE 6 TO '/u01/app/oracle/oradata/orcl/test.dbf';
8 SET NEWNAME FOR DATAFILE 7 TO '/u01/app/oracle/oradata/orcl/dbfs01.dbf';
9
10SQL "ALTER DATABASE RENAME FILE ''/u02/app/oracle/oradata/orcl/redo/redo01.log''
TO ''/u01/app/oracle/oradata/orcl/redo/redo01.log'' ";
11SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/red01_b.log''
12 TO ''/u02/app/oracle/oradata/orcl/redo/red01_b.log'' ";
13SQL "ALTER DATABASE RENAME FILE ''/u02/app/oracle/oradata/orcl/redo/redo02.log''
14 TO ''/u01/app/oracle/oradata/orcl/redo/redo02.log'' ";
SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo02_b.log''
15 TO ''/u02/app/oracle/oradata/orcl/redo/redo02_b.log'' ";
16SQL "ALTER DATABASE RENAME FILE ''/u02/app/oracle/oradata/orcl/redo/redo03.log''
17 TO ''/u01/app/oracle/oradata/orcl/redo/redo03.log'' ";
18SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo03_b.log''
TO ''/u02/app/oracle/oradata/orcl/redo/redo03_b.log'' ";
19SQL "ALTER DATABASE RENAME FILE ''/u02/app/oracle/oradata/orcl/redo/redo04.log''
20 TO ''/u01/app/oracle/oradata/orcl/redo/redo04.log'' ";
21SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo04_b.log''
22 TO ''/u02/app/oracle/oradata/orcl/redo/redo04_b.log'' ";
23
24
If you remember we stated that we wanted the restore to stop at SCN 1375117 because that was the latest SCN in which we have archive logs. In order to stop at a specific SCN
we will use the SET UNTIL SCN 1375117.

After all of that we just need to restore the database, switch the data files so the control files have the new path and recover the database. Not much at all.

Below is the entire script to do just that.

1
2
3
4 RUN {
SET NEWNAME FOR DATAFILE 1 TO '/u01/app/oracle/oradata/orcl/system01.dbf';
5 SET NEWNAME FOR DATAFILE 2 TO '/u01/app/oracle/oradata/orcl/sysaux01.dbf';
6 SET NEWNAME FOR DATAFILE 3 TO '/u01/app/oracle/oradata/orcl/undotbs01.dbf';
7 SET NEWNAME FOR DATAFILE 4 TO '/u01/app/oracle/oradata/orcl/users01.dbf';
8 SET NEWNAME FOR DATAFILE 5 TO '/u01/app/oracle/oradata/orcl/example01.dbf';
SET NEWNAME FOR DATAFILE 6 TO '/u01/app/oracle/oradata/orcl/test.dbf';
9 SET NEWNAME FOR DATAFILE 7 TO '/u01/app/oracle/oradata/orcl/dbfs01.dbf';
10
11
12 SQL "ALTER DATABASE RENAME FILE ''/u02/app/oracle/oradata/orcl/redo/redo01.log''
13 TO ''/u01/app/oracle/oradata/orcl/redo/redo01.log'' ";
14 SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/red01_b.log''
TO ''/u02/app/oracle/oradata/orcl/redo/red01_b.log'' ";
15 SQL "ALTER DATABASE RENAME FILE ''/u02/app/oracle/oradata/orcl/redo/redo02.log''
16 TO ''/u01/app/oracle/oradata/orcl/redo/redo02.log'' ";
17 SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo02_b.log''
18 TO ''/u02/app/oracle/oradata/orcl/redo/redo02_b.log'' ";
SQL "ALTER DATABASE RENAME FILE ''/u02/app/oracle/oradata/orcl/redo/redo03.log''
19 TO ''/u01/app/oracle/oradata/orcl/redo/redo03.log'' ";
20 SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo03_b.log''
21 TO ''/u02/app/oracle/oradata/orcl/redo/redo03_b.log'' ";
22 SQL "ALTER DATABASE RENAME FILE ''/u02/app/oracle/oradata/orcl/redo/redo04.log''
TO ''/u01/app/oracle/oradata/orcl/redo/redo04.log'' ";
23 SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo04_b.log''
24 TO ''/u02/app/oracle/oradata/orcl/redo/redo04_b.log'' ";
25
26 SET UNTIL SCN 1375117;
27
28 RESTORE DATABASE;
SWITCH DATAFILE ALL;
29
30 RECOVER DATABASE;
31}
32
33
34

The script above was saved to the file restore.rman. Below is the output.

1
2
3
4
5
6
7
8
9 RMAN> @restore.rman
10
11 RMAN> RUN {
12 2> SET NEWNAME FOR DATAFILE 1 TO '/u01/app/oracle/oradata/orcl/system01.dbf';
3> SET NEWNAME FOR DATAFILE 2 TO '/u01/app/oracle/oradata/orcl/sysaux01.dbf';
13 4> SET NEWNAME FOR DATAFILE 3 TO '/u01/app/oracle/oradata/orcl/undotbs01.dbf';
14 5> SET NEWNAME FOR DATAFILE 4 TO '/u01/app/oracle/oradata/orcl/users01.dbf';
15 6> SET NEWNAME FOR DATAFILE 5 TO '/u01/app/oracle/oradata/orcl/example01.dbf';
16 7> SET NEWNAME FOR DATAFILE 6 TO '/u01/app/oracle/oradata/orcl/test.dbf';
8> SET NEWNAME FOR DATAFILE 7 TO '/u01/app/oracle/oradata/orcl/dbfs01.dbf';
17 9>
18 10>
19 11> SQL "ALTER DATABASE RENAME FILE ''/u02/app/oracle/oradata/orcl/redo/redo01.log''
20 12> TO ''/u01/app/oracle/oradata/orcl/redo/redo01.log'' ";
13> SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/red01_b.log''
21 14> TO ''/u02/app/oracle/oradata/orcl/redo/red01_b.log'' ";
22 15> SQL "ALTER DATABASE RENAME FILE ''/u02/app/oracle/oradata/orcl/redo/redo02.log''
23 16> TO ''/u01/app/oracle/oradata/orcl/redo/redo02.log'' ";
24 17> SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo02_b.log''
18> TO ''/u02/app/oracle/oradata/orcl/redo/redo02_b.log'' ";
25 19> SQL "ALTER DATABASE RENAME FILE ''/u02/app/oracle/oradata/orcl/redo/redo03.log''
26 20> TO ''/u01/app/oracle/oradata/orcl/redo/redo03.log'' ";
27 21> SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo03_b.log''
28 22> TO ''/u02/app/oracle/oradata/orcl/redo/redo03_b.log'' ";
23> SQL "ALTER DATABASE RENAME FILE ''/u02/app/oracle/oradata/orcl/redo/redo04.log''
29 24> TO ''/u01/app/oracle/oradata/orcl/redo/redo04.log'' ";
30 25> SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo04_b.log''
31 26> TO ''/u02/app/oracle/oradata/orcl/redo/redo04_b.log'' ";
32 27>
28> SET UNTIL SCN 1375117;
33 29>
34 30> RESTORE DATABASE;
35 31> SWITCH DATAFILE ALL;
36 32>
33> RECOVER DATABASE;
37 34> }
38 executing command: SET NEWNAME
39
40 executing command: SET NEWNAME
41
42 executing command: SET NEWNAME
43
executing command: SET NEWNAME
44
45 executing command: SET NEWNAME
46
47 executing command: SET NEWNAME
48
49 executing command: SET NEWNAME
50
51 using target database control file instead of recovery catalog
sql statement: ALTER DATABASE RENAME FILE ''/u02/app/oracle/oradata/orcl/redo/redo01.log'' TO
52 ''/u01/app/oracle/oradata/orcl/redo/redo01.log''
53
54 sql statement: ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/red01_b.log'' TO
55 ''/u02/app/oracle/oradata/orcl/redo/red01_b.log''
56
57 sql statement: ALTER DATABASE RENAME FILE ''/u02/app/oracle/oradata/orcl/redo/redo02.log'' TO
''/u01/app/oracle/oradata/orcl/redo/redo02.log''
58
59 sql statement: ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo02_b.log'' TO
60 ''/u02/app/oracle/oradata/orcl/redo/redo02_b.log''
61
62 sql statement: ALTER DATABASE RENAME FILE ''/u02/app/oracle/oradata/orcl/redo/redo03.log'' TO
63 ''/u01/app/oracle/oradata/orcl/redo/redo03.log''
64
sql statement: ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo03_b.log'' TO
65 ''/u02/app/oracle/oradata/orcl/redo/redo03_b.log''
66
67 sql statement: ALTER DATABASE RENAME FILE ''/u02/app/oracle/oradata/orcl/redo/redo04.log'' TO
68 ''/u01/app/oracle/oradata/orcl/redo/redo04.log''
69
70 sql statement: ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo04_b.log'' TO
''/u02/app/oracle/oradata/orcl/redo/redo04_b.log''
71
72 executing command: SET until clause
73
74 Starting restore at 27-APR-10
75 allocated channel: ORA_DISK_1
76 channel ORA_DISK_1: SID=17 device type=DISK
allocated channel: ORA_DISK_2
77 channel ORA_DISK_2: SID=1 device type=DISK
78
79 channel ORA_DISK_1: starting datafile backup set restore
80 channel ORA_DISK_1: specifying datafile(s) to restore from backup set
81 channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/orcl/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/orcl/example01.dbf
82 channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/orcl/test.dbf
83 channel ORA_DISK_1: reading from backup piece /u01/app/oracle/oradata/orcl/backup/22lc5nqv_1_1
84 channel ORA_DISK_2: starting datafile backup set restore
85 channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00004 to /u01/app/oracle/oradata/orcl/users01.dbf
86 channel ORA_DISK_2: reading from backup piece /u01/app/oracle/oradata/orcl/backup/23lc5ns4_1_1
87 channel ORA_DISK_2: piece handle=/u01/app/oracle/oradata/orcl/backup/23lc5ns4_1_1 tag=TAG20100427T094358
88 channel ORA_DISK_2: restored backup piece 1
89 channel ORA_DISK_2: restore complete, elapsed time: 00:00:07
channel ORA_DISK_2: starting datafile backup set restore
90 channel ORA_DISK_2: specifying datafile(s) to restore from backup set
91 channel ORA_DISK_2: restoring datafile 00001 to /u01/app/oracle/oradata/orcl/system01.dbf
92 channel ORA_DISK_2: restoring datafile 00002 to /u01/app/oracle/oradata/orcl/sysaux01.dbf
93 channel ORA_DISK_2: restoring datafile 00007 to /u01/app/oracle/oradata/orcl/dbfs01.dbf
channel ORA_DISK_2: reading from backup piece /u01/app/oracle/oradata/orcl/backup/21lc5nqv_1_1
94 channel ORA_DISK_1: piece handle=/u01/app/oracle/oradata/orcl/backup/22lc5nqv_1_1 tag=TAG20100427T094358
95 channel ORA_DISK_1: restored backup piece 1
96 channel ORA_DISK_1: restore complete, elapsed time: 00:00:23
97 channel ORA_DISK_2: piece handle=/u01/app/oracle/oradata/orcl/backup/21lc5nqv_1_1 tag=TAG20100427T094358
channel ORA_DISK_2: restored backup piece 1
98 channel ORA_DISK_2: restore complete, elapsed time: 00:00:56
99 Finished restore at 27-APR-10
100
101datafile 1 switched to datafile copy
102input datafile copy RECID=9 STAMP=717436375 file name=/u01/app/oracle/oradata/orcl/system01.dbf
datafile 2 switched to datafile copy
103input datafile copy RECID=10 STAMP=717436375 file name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
104datafile 3 switched to datafile copy
105input datafile copy RECID=11 STAMP=717436375 file name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
datafile 4 switched to datafile copy
106input datafile copy RECID=12 STAMP=717436375 file name=/u01/app/oracle/oradata/orcl/users01.dbf
107datafile 5 switched to datafile copy
108input datafile copy RECID=13 STAMP=717436375 file name=/u01/app/oracle/oradata/orcl/example01.dbf
109datafile 6 switched to datafile copy
input datafile copy RECID=14 STAMP=717436375 file name=/u01/app/oracle/oradata/orcl/test.dbf
110datafile 7 switched to datafile copy
111input datafile copy RECID=15 STAMP=717436375 file name=/u01/app/oracle/oradata/orcl/dbfs01.dbf
112
113Starting recover at 27-APR-10
114using channel ORA_DISK_1
using channel ORA_DISK_2
115
116starting media recovery
117
118channel ORA_DISK_1: starting archived log restore to default destination
119channel ORA_DISK_1: restoring archived log
120archived log thread=1 sequence=2
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/oradata/orcl/backup/24lc5o0c_1_1
121channel ORA_DISK_1: piece handle=/u01/app/oracle/oradata/orcl/backup/24lc5o0c_1_1 tag=TAG20100427T094652
122channel ORA_DISK_1: restored backup piece 1
123channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
124archived log file name=/u02/oradata/orcl/arch/1_2_717335393.dbf thread=1 sequence=2
media recovery complete, elapsed time: 00:00:01
125Finished recover at 27-APR-10
126
127RMAN>
128RMAN> **end-of-file**
129
130RMAN>
131
132
133
134
135
136
137
138

All that is left is to open the database with the RESETLOGS option.

1RMAN> alter database open resetlogs;


2
3database opened
4
5RMAN>

Das könnte Ihnen auch gefallen