In this Document
APPLIES TO:Oracle Database - Enterprise Edition - Version 11.2.0.1 and laterOracle Database Cloud Schema Service - Version N/A and later Oracle Database Exadata Express Cloud Service - Version N/A and later Oracle Database Exadata Cloud Machine - Version N/A and later Oracle Cloud Infrastructure - Database Service - Version N/A and later Information in this document applies to any platform. GOAL
NOTE: In the images and/or the document content below, the user information and environment data used represents fictitious data
from the Oracle sample schema(s), Public Documentation delivered with an Oracle database product or other training material. Any similarity to actual environments, actual persons, living or dead, is purely coincidental and not intended in any manner.
Database Name: ORCL Steps to clone a database from Windows to Linux using RMAN . SOLUTION
Source database in Windows - DBName - ORCL (11.2.0.1)
Cloned database in Linux - DBName - ORCL (11.2.0.3) Step 1 :- Create a pfile from Source ++Take the backup of pfile from source . create pfile='<>' from spfile. Step 2 :- Shutdown the database immediate and mount it ++Take the backup of source database in Mount mode (Always take the cold backup) SQL>Shutdown immediate ; SQL>Startup mount ; SQL> select name,open_mode from v$database; NAME OPEN_MODE SQL> exit Step 3 :- Connect to Rman and take a cold backup of Source database $ rman target / Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL (DBID=<DBID>, not open) RMAN> backup database format 'D:\BAK\full_%U'; ----Full backup Starting backup at 04-MAY-16 Starting Control File and SPFILE Autobackup at 04-MAY-16 RMAN> backup current controlfile format 'd:\bak\control_%U'; --Controlfile backup Starting backup at 04-MAY-16 Starting Control File and SPFILE Autobackup at 04-MAY-16
Step 4 :- Copied the required files to the destination server (Linux) Cloned Server : ++Copy the pfile backup from source (Windows) to Target (Linux) and modify the location as per your environment . Step 5 :- No Mount the Destination database Start the cloned database in NOMOUNT mode . SQL> startup nomount pfile='/u01/oradata/ORCL/initORCL.ora'; Step 6 :- Restore the controlfile
++Connect through RMAN and restore the controlfile $ rman target / Recovery Manager: Release 11.2.0.3.0 - Production on Wed May 4 10:15:48 2016 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL (not mounted) RMAN> restore controlfile from '<backup location>/CONTROL_A7R4O1B4_1_1'; Starting restore at 04-MAY-16 channel ORA_DISK_1: restoring control file
RMAN> sql 'alter database mount'; sql statement: alter database mount Step 7 :- Run the Rman maintainance command to Mark the unwanted backups as expired
++Execute crosscheck command and delete the expired backup . RMAN> crosscheck backup; allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK crosschecked backup piece: found to be 'EXPIRED' backup piece handle=D:\BAK\FULL_A5R4O160_1_1 RECID=375 STAMP=910951617 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=D:\APP\ORCL\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2016_05_04\O1_MF_S_910951563_&***_.BKP RECID=376 STAMP=910951754 Crosschecked 2 objects RMAN> delete expired backup; using channel ORA_DISK_1 List of Backup Pieces Do you really want to delete the above objects (enter YES or NO)? yes Step 8 :- Catalog the backuppiece on the Destination server(Linux)
++Catalog all the backups copied in the cloned server . RMAN> catalog backuppiece '<backup location>/FULL_*****0_1_1'; cataloged backup piece ++Set the newname for datafile location's on cloned server . Step 9: -Restore the datafiles to new location RMAN> run { executing command: SET NEWNAME Starting restore at 04-MAY-16 channel ORA_DISK_1: starting datafile backup set restore RMAN> switch database to copy; datafile 1 switched to datafile copy "/u01/oradata/ORCL/datafile_data_D-ORCL_TS-SYSTEM_FNO-1"
datafile 2 switched to datafile copy "/u01/oradata/ORCL/datafile_data_D-ORCL_TS-SYSAUX_FNO-2" datafile 3 switched to datafile copy "/u01/oradata/ORCL/datafile_data_D-ORCL_TS-UNDOTBS1_FNO-3" datafile 4 switched to datafile copy "/u01/oradata/ORCL/datafile_data_D-ORCL_TS-USERS_FNO-4" RMAN> exit ++Once restore done ...open the database with RESETLOG mode along with UPGRADE option . If cloning the database with same RDBMS version as source , open the database in normal RESETLOG mode . $ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Wed May 4 10:18:23 2016 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: SQL> alter database open resetlogs upgrade; Database altered. Step 10 :- Run the required Upgrade scripts
REFERENCESNOTE:2003327.1 - Restore From Windows To Linux using RMAN Fails |