set oracle_sid=ORCL
SET ORACLE_UNQNAME=ORCLGo 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;
Tags:
Oracle Database