Restore data from an old rman backup – ORA-01152

oraclerman

I have some trouble restoring some data from an old backup.

Original machine was lost and my mission is to restore data. This is not a critical machine, but some data is still useful.

  • Oracle on original server: 11.2.0.2
  • Oracle on destination server: 11.2.0.4

Server is redhat- 5.6 original. 6.x destination.

On the new machine, with oracle installed I did:

export ORACLE_SID=oldsid
rman TARGET /

And in rman i set the sid as the old databsae:

SET DBID 3348161342;

Then restored controlfile and spfile from the backup. Important note: these files are more recent than the backup.

RESTORE CONTROLFILE from '/mount/restorepoint/3348161342_41qtltn4_1_1_20160111.bck
restore spfile from '/mount/restorepoint/sp_OLDDB-3348161342_42qtltn6_1_1_20160111.bck';

Database in mount with:

ALTER DATABASE MOUNT;

And specified where the backup files are:

catalog start with '/mount/restorepoint/rmanfiles';

Because on the original db there is also TDE.

  • Created a directory to put wallet
  • Created sqlnet.ora files with indications on the wallet location

Altered system with:

alter system set encryption wallet open identified by "thetdepassword";

And then again in rman:

alter database mount;
RESTORE DATABSE;

So far, everything fine. But when I trai to OPEN database:

ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

Fine, my bad. Then I use: alter database open RESETLOGS; and I have the error:

ORA-01152: file 4 was not restored from a sufficiently old backup
ORA-01110: data file 4: '/ltm/data/oracle/dati/olddb/users01.dbf'

What am I missing?

In the original backup script options must be:

BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 0 DATABASE

How can I read again that data?

I come from sqlserver and postgresql world, so probably I miss something…

Best Answer

Lets see the information provided by oerr utility.

ORA-01152: file 1 was not restored from a sufficiently old backup

Cause: An incomplete recovery session was started, but an insufficient number of logs were applied to make the database consistent. This file is still in the future of the last log applied. The most likely cause of this error is forgetting to restore the file from a backup before doing incomplete recovery.

Action: Either apply more logs until the database is consistent or restore the database file from an older backup and repeat recovery

According to your post you have not recovered the database. You may try the following commands to recover your database.

SQL> recover database using backup controlfile until cancel;
SQL>alter database open resetlog;

Since you are new to Oracle, you may find the following link useful to restore old backup to new host.
Restoring a Database on a New Host