Backup, Drop and Restore Database step by step.

set oracle_sid=ORCL

SET ORACLE_UNQNAME=ORCL

Go to RMAN

sqlplus /nolog
conn / as sysdba
---- Get the Oracle DBID

select DBID from v$database;
1033682200

----- Giving folder permissions.

# chown -R oracle:oinstall /data/backup
# chmod -R 775 /data/backup

alter system set log_archive_dest_1='LOCATION=/data/backup/' scope = both;

archive log list;

shutdown immediate;
startup mount;
alter database archivelog;
alter database open;
archive log list;

ALTER DATABASE BACKUP CONTROLFILE TO '/data/backup/control.bkp';
ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
EXIT

rman target /

------- Now create backup location:

CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/data/backup/full_%u_%s_%p';
=====backup database;
configure controlfile autobackup on;
backup database plus archivelog;

EXIT
------- Drop database
sqlplus /NOLOG
conn / as sysdba
shutdown immediate;
startup mount exclusive restrict;
drop database;
exit
------ Restore Database
rman target /
set dbid 1033682200;

STARTUP NOMOUNT
RESTORE CONTROLFILE FROM '/data/backup/control.bkp';
ALTER DATABASE MOUNT;
catalog start with '/data/backup/';

RESTORE DATABASE;
RECOVER DATABASE;
ALTER DATABASE OPEN RESETLOGS;



Muhammad Abdullah Al Noor

Muhammad Abdullah Al Noor, An Oracle Apex Consultants and founder of Noors Technology (www.noorstech.com). Core Expertise : Database Administration, Oracle Forms and Reports Development, Oracle Apex Application Designer and Development, Linux Professional etc. Also the owner of TrainerBD Training and OraDemy E-Learning. WhatsApp +8801790721177

Post a Comment

Previous Post Next Post