RESTORE DATABASE/SCHEMA/TABLE re-creates objects and data from an Oracle backup, letting you recover lost information or clone environments.
Use a restore when data is lost, corrupted, or you need to refresh a non-production database with production data. RMAN or Data Pump rebuilds files from backup sets or dump files, preserving integrity.
RMAN handles full instance or tablespace recovery; Data Pump (impdp) restores schemas or individual tables. Both support point-in-time recovery (PITR) and selective object import.
Start the instance in NOMOUNT, allocate channels, then run RESTORE DATABASE followed by RECOVER and OPEN RESETLOGS. This re-creates datafiles from backup pieces.
rman target /
RUN {
ALLOCATE CHANNEL c1 DEVICE TYPE DISK;
SET UNTIL TIME "TO_DATE('2024-05-18 23:55','YYYY-MM-DD HH24:MI')";
RESTORE DATABASE;
RECOVER DATABASE;
ALTER DATABASE OPEN RESETLOGS;
}
Use Data Pump. First, export from backup, then import only the needed table to a staging schema, and merge or swap.
impdp system/password \
directory=bkp_dir dumpfile=ecom_full.dmp \
logfile=imp_customers.log \
tables=customers \
remap_schema=prod:staging
List both tables in the TABLES parameter, or use INCLUDE=TABLE:"IN \('ORDERS','ORDERITEMS'\)" to keep referential integrity intact.
impdp system/password \
directory=bkp_dir dumpfile=ecom_full.dmp \
logfile=imp_pitr.log \
schemas=prod \
flashback_time="TO_TIMESTAMP('2024-05-18 23:55','YYYY-MM-DD HH24:MI')"
Validate backups with RMAN VALIDATE; keep catalog metadata current; always restore to a test instance first; document SCN/time used for PITR; enable block change tracking for faster incremental recovery.
Run checksums, compare row counts against backup reports, and run quick business queries like total_amount sums in Orders to ensure logical consistency.
Embed RMAN or impdp commands in shell scripts or CI pipelines; parameterize dates and directories; log outputs for auditing.
No native RMAN support for row-level restore. Use Data Pump to import to a temp schema, then INSERT SELECT required rows.
Time depends on backup size, storage throughput, and whether incremental backups are used. Expect roughly the backup duration plus recovery time.
No. Data Pump imports run while the database is open, although exclusive locks can appear on the target objects.