0% found this document useful (0 votes)
39 views

Oracle Recovery

This document provides instructions for backing up an Oracle database on one Windows machine and restoring it on a new Linux server. It includes steps to: 1. Backup the database using RMAN and manually backup the control file. 2. Restore the control file, catalog the backups, and restore the database files to a new location on the Linux server. 3. Open the database after restoring and renaming the redo log files to the new location.

Uploaded by

saikiranypv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Oracle Recovery

This document provides instructions for backing up an Oracle database on one Windows machine and restoring it on a new Linux server. It includes steps to: 1. Backup the database using RMAN and manually backup the control file. 2. Restore the control file, catalog the backups, and restore the database files to a new location on the Linux server. 3. Open the database after restoring and renaming the redo log files to the new location.

Uploaded by

saikiranypv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Test windows machine -- this is non prod system.

Backup is on C:\Backup but database lives on D:


User Name:- Administrator
Password:- NiUr0JYvP.Ca)1o!q1*zx9dZ6e9yQ$Kz
Ip address:- 172.27.131.36

show file locations + archive log location

1. backup
archivelogs on (alter database archivelog;)+shutdown+startup
--not needed just making XE user data smaller
alter database datafile 'C:\APP\ADMINISTRATOR\PRODUCT\18.0.0\ORADATA\XE\XEPDB1\
USERS01.DBF' resize 8g;

Backup RMAN
connect target gladmin@xe;
crosscheck archivelog all;
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/backup/rman/full_%u_%s_%p';
BACKUP AS BACKUPSET DATABASE PLUS ARCHIVELOG;
+manual backup of controlfile

Copy Backup & Control file to new machine + note DBID XE (DBID=2977469957)
Check - select linux files location on new server.
datafiles - select file_ID, File_name from dba_data_files;
select GROUP#,TYPE,MEMBER from v$logfile;

RESTORE
sql>shutdown immediate
--cleaning of datafiles, controlfile, redo logs.
SQL> startup nomount (confirm by SQL> select status from v$instance;) Started =
NOMOUNT
RMAN>
connect target sys
SET DBID 2977469957;
RESTORE CONTROLFILE FROM "C:\BACKUP\RMAN\CONTROL01.CTL"; (you copy Control file to
some location <--)
alter database mount;
catalog start with "C:\BACKUP\RMAN\FULL_*";

---new path= D:\Oracle\oradata\XE -- change linux path


run {
allocate channel d1 DEVICE TYPE DISK;
allocate channel d2 DEVICE TYPE DISK;
allocate channel d3 DEVICE TYPE DISK;
allocate channel d4 DEVICE TYPE DISK;
allocate channel d5 DEVICE TYPE DISK;
allocate channel d6 DEVICE TYPE DISK;
set newname for datafile 1 to 'D:\Oracle\oradata\XE\SYSTEM01.DBF';
set newname for datafile 3 to 'D:\Oracle\oradata\XE\SYSAUX01.DBF';
set newname for datafile 4 to 'D:\Oracle\oradata\XE\UNDOTBS01.DBF';
set newname for datafile 5 to 'D:\Oracle\oradata\XE\PDBSEED\SYSTEM01.DBF';
set newname for datafile 6 to 'D:\Oracle\oradata\XE\PDBSEED\SYSAUX01.DBF';
set newname for datafile 7 to 'D:\Oracle\oradata\XE\USERS01.DBF';
set newname for datafile 8 to 'D:\Oracle\oradata\XE\PDBSEED\UNDOTBS01.DBF';
set newname for datafile 9 to 'D:\Oracle\oradata\XE\XEPDB1\SYSTEM01.DBF';
set newname for datafile 10 to 'D:\Oracle\oradata\XE\XEPDB1\SYSAUX01.DBF';
set newname for datafile 11 to 'D:\Oracle\oradata\XE\XEPDB1\UNDOTBS01.DBF';
set newname for datafile 12 to 'D:\Oracle\oradata\XE\XEPDB1\USERS01.DBF';
restore database;
switch datafile all;
}

--error on backup piece already included


ORA-19693: backup piece C:\BACKUP\RMAN\FULL_092D667K_9_1 already included
change backuppiece 'C:\BACKUP\RMAN\FULL_092D667K_9_1' uncatalog;
change backuppiece 'C:\BACKUP\RMAN\FULL_042D663C_4_1' uncatalog;
change backuppiece 'C:\BACKUP\RMAN\FULL_0A2D6684_10_1' uncatalog;
change backuppiece 'C:\BACKUP\RMAN\FULL_082D666H_8_1' uncatalog;
change backuppiece 'C:\BACKUP\RMAN\FULL_032D6629_3_1' uncatalog;

alter database open resetlogs;

redo log location


SQL> col member format a50
SQL> select GROUP#,TYPE,MEMBER from v$logfile;

alter database rename file 'C:\APP\ADMINISTRATOR\PRODUCT\18.0.0\ORADATA\XE\


REDO01.LOG','C:\APP\ADMINISTRATOR\PRODUCT\18.0.0\ORADATA\XE\REDO02.LOG','C:\APP\
ADMINISTRATOR\PRODUCT\18.0.0\ORADATA\XE\REDO03.LOG' to 'D:\Oracle\oradata\XE\
REDO01.LOG','D:\Oracle\oradata\XE\REDO02.LOG','D:\Oracle\oradata\XE\REDO03.LOG';
select

alter database open -- may be need resetlogs


Alter database open resetlogs;

You might also like