This section explains how to prepare the database for migration. This section makes the following assumptions:
You want to migrate the database to two Oracle ASM disk groups: +DATA
for the database and +FRA
for the fast recovery area.
The database to be migrated to Oracle ASM storage is named mydb
.
To prepare the database for Oracle ASM migration:
If the COMPATIBLE
initialization parameter setting for the database is less than 11.0.0
, then make any read-only transportable tablespaces read/write.
Read-only transportable tablespaces cannot be migrated because RMAN cannot back them up.
If the database is a physical standby database, and if managed recovery is started, then stop managed recovery.
A physical standby database is a copy of a production database that you can use for disaster protection.
For example, connect SQL*Plus to the database with SYSBACKUP
privileges (rather than SYSDBA
privileges) to enforce the separation of duty security model, and run the following statement to stop managed recovery:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
Keep this terminal window open.
Copy the server parameter file or initialization parameter file to a temporary location.
The following example uses an operating system utility to copy the server parameter file:
$ cp spfileMYDB.ora orig_spfileMYDB.ora
In a new terminal window, start RMAN session and connect as TARGET
to the database to be migrated. Optionally, connect to a recovery catalog. Connect with SYSBACKUP
privileges to enforce the separation of duty security model.
Back up the data files to the Oracle ASM disk group.
The following example uses a RUN
command to make a level 0 incremental backup and allocates four channels to increase the backup speed. A level 0 incremental backup is an RMAN incremental backup that backs up all data blocks in the data files being backed up. An incremental backup at level 0 is identical in content to a full backup, but unlike a full backup the level 0 backup is considered a part of the incremental backup strategy.
An incremental backup is a RMAN backup in which only modified blocks are backed up. Incremental backups are classified by level. A level 0 incremental backup performs the same function as a full backup in that they both back up all blocks that have ever been used. The difference is that a full backup does not affect blocks backed up by subsequent incremental backups, whereas an incremental backup affects blocks backed up by subsequent incremental backups.
A full backup is a non-incremental RMAN backup. Full does not refer to how much of the database is backed up, but to the fact that the backup is not incremental. Consequently, you can make a full backup of one data file.
Increase or decrease this number accordingly. The format clause specifies +DATA
, which is the name of the Oracle ASM disk group to be used for storing the database.
RUN { ALLOCATE CHANNEL dev1 DEVICE TYPE DISK; ALLOCATE CHANNEL dev2 DEVICE TYPE DISK; ALLOCATE CHANNEL dev3 DEVICE TYPE DISK; ALLOCATE CHANNEL dev4 DEVICE TYPE DISK; BACKUP AS COPY INCREMENTAL LEVEL 0 DATABASE FORMAT '+DATA' TAG 'ORA_ASM_MIGRATION'; }
If block change tracking is enabled for the database, then optionally make a level 1 incremental backup that you can use later to recover the database copy.
Block change tracking is a database option that causes Oracle to track data file blocks affected by each database update. The tracking information is stored in a block change tracking file. When block change tracking is enabled, RMAN uses the record of changed blocks from the change tracking file to improve incremental backup performance by only reading those blocks known to have changed, instead of reading data files in their entirety.
The following example makes an incremental level 1 copy of the level 0 backup created in the previous step:
RUN { ALLOCATE CHANNEL dev1 DEVICE TYPE DISK; ALLOCATE CHANNEL dev2 DEVICE TYPE DISK; ALLOCATE CHANNEL dev3 DEVICE TYPE DISK; ALLOCATE CHANNEL dev4 DEVICE TYPE DISK; BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'ORA_ASM_MIGRATION' DATABASE; }
If the database is in ARCHIVELOG
mode, and if the database is open, then archive the online logs.
The following example uses the SQL
command to archive the current redo logs:
RMAN> SQL "ALTER SYSTEM ARCHIVE LOG CURRENT";
If the database instance is currently using a server parameter file, then back it up.
The following example backs up the server parameter file:
RMAN> BACKUP AS BACKUPSET SPFILE;
If block change tracking is enabled, then disable it.
The following command disables block change tracking:
RMAN> SQL "ALTER DATABASE DISABLE BLOCK CHANGE TRACKING";
If Flashback Database is enabled, then disable it and drop any guaranteed restore points.
Disabling Oracle Flashback Database is necessary because you cannot migrate flashback logs to Oracle ASM. The following command disables Flashback Database:
RMAN> SQL "ALTER DATABASE FLASHBACK OFF";
The following command drops the guaranteed restore point named Q106
:
RMAN> SQL "DROP RESTORE POINT Q106";
Shut down the database consistently.
The following command shuts down the database:
RMAN> SHUTDOWN IMMEDIATE;