-1

I am an accidental DBA..I have to restore an oracle database using RMAN utility. I don't know anything about backups and restoration and this is my first assigned task. Are there any good forum(s) that has specific information and scripts that I could use for doing the recovery? I need your advice on this. Once the database is restored, what queries should i run to test if everything is ok?

2
  • 1
    Unix or Windows? Do you have any experience with Oracle? Is it a disaster recovery scenario with a backup and a new server or is everything already there on the server? Talk us through the situation....
    – Philᵀᴹ
    Jan 15, 2014 at 23:12
  • As others have said, the best way is to practise. The Oracle docs are very detailed and can be intimidating. However they do have all of the information you need, even if you don't know what it is yet. The best way to ask questions here is to ask specific questions about specific things because answering something like this is really tough. Jan 17, 2014 at 10:42

3 Answers 3

2

My advice:

If this is not a production database, read the manual, try the things you learn by reading the manual and bring specific questions to specific efforts that you've hit a bump in the road.

If this is a production database, hire a professional Oracle DBA. Immediately.

2
  • I will be updating my test server and not the test. I will definitely go through some of the sources mentioned here and try out things and if I hit a bump, I'll get back to the forum and let you know about it and ask your advice. The way it is set up is the production server is backed up daily. I think I will have to copy the backed up files on to my test server and use the RMAN utility to restore it.. I will let you know... Thanks a lot!
    – SS_7911
    Jan 17, 2014 at 14:02
  • Good luck and do come back with specific questions. You will be well received with them. General help to such a massive area of knowledge is not conducive to Stack Exchange. Jan 17, 2014 at 17:37
2

The speech is quite long and complicated. However, the online documentation is really great. So take this answer as a very brief and standard guideline on RMAN. The question is fairly generic, then the answer will be generic.

Introduction

The Recovery Manager (RMAN) utility is a way (available since Oracle 8i at no extra charge and recommended by Oracle) to provide backup and recovery activities, including full and incremental backup, reporting, detection of corrupt blocks, copy, restore and recovery of datafiles, control files, archived redo logs and spfiles. You can use either a GUI or command-line mode. Alsp you should build the repository. The repository is a very helpful separate source that contains the metadata about your taget database and all of the backup and recovery information for that database for maintenance purposes. This information can be used, for example, to restore files and recover the database by issuing very simple restore and recovery commands. This repository can be implemented in one of two ways: control files and recovery catalog database (recommended by Oracle).

Some operations in SQL*Plus

1) Let's create RMAN tablespace, catalog and user, and grant the authority to perform RMAN operations:

create tablespace rmantab datafile '/path/rmantab.dbf' size 50M;
create user rmanuser identified by <password> temporary tablespace temp default tablespace rmantab quota unlimited on rmantab;
grant connect, resource, recovery_catalog_owner to rmanuser;

2) Let's create recovery catalog and register target database with the RMAN catalog:

> rman catalog=rmanuser/<password>@<ORACLE_SID>
RMAN> catalog rmanuser/<password>@<ORACLE_SID>
RMAN> create catalog;
RMAN> exit;
RMAN> connect catalog rmanuser/<password>@<ORACLE_SID>
RMAN> connect target sys/<sys_password>@<ORACLE_SID_OF_TARGET_DB>
RMAN> register database;

3) Let's perform a back up of entire database:

RMAN> configure default device type to disk; --set the default backup device to disk
RMAN> configure controlfile autobackup on; --include control file and spfile with every backup
RMAN> backup database plus archivelog; --backup also database and archivelogs
RMAN> exit;

4) Let's set up the environment for a restore and recovery:

RMAN can automate file restores and can be used to restore datafiles, controlfiles, and archive redo logs. You can perform every RMAN operations (not only restores, like in my example) using stored scripts, which are a set of RMAN commands that are stored in the recovery catalog. This option allows you to develop, test, and save commands. The following is a sample stored script that perform a full restore and recovery, and set a new archive log directory destination:

RMAN> connect catalog rmanuser/<password>@<ORACLE_SID>
RMAN> connect target sys/<sys_password>@<ORACLE_SID_OF_TARGET_DB>
RMAN> replace script fullRestoreRecovery {
allocate channel ch1 type disk;
set archivelog destination to '/path/arch';
startup mount;
restore archivelog all; --restore archivelog files
restore controlfile; --restore control files
alter database mount; 
restore database; --copy physical files from backup medium
recover database; --apply all the archivelog and redo log files to bring up the database to the point of failure
alter database open resetlogs; --create new log files (a new incarnation)
release channel ch1;
}
host 'echo "start `date`"';
run { execute script fullRestoreRecovery; }
host 'echo "stop `date`"';
exit;

Take in account that each script is related to one target database only.

Verify whether database could be successfully restored

You can use the RMAN RESTORE VALIDATE command to validating backups before restoring them. For example:

run
{
restore database validate;
restore archivelog all validate;
restore controlfile validate;
restore spfile validate;
restore tablespace users validate;
...
}

The validation is identical to a real restore operation except that RMAN does not write output files. The lack of error messages means that RMAN had confirmed that it can use these backups successfully during a real restore and recovery.

By default, RMAN checks for physical corruption while validating. With the VALIDATE CHECK LOGICAL command, you can also instruct RMAN to check for logical corruption (corruptions, restore).

More info here.

0

The best way to get a good grip on RMAN is to start learning from scratch. Being an accidental DBA, this could mean a few white-nights. RMAN is a very critical component, and not knowing how it works, might cause massive data loss. Start by looking here: RMAN DOCS & Oracle Backup/Recovery Guide

Being new into this area, I suppose that you do not know much about redo logs, archives, working in archivelog mode etc. You should also read about this. Again, Oracle docs could prove a solid source of knowledge.

Not the answer you're looking for? Browse other questions tagged or ask your own question.