Why ?
Migrate
is move your database from machine to different machine and upgrade is moving
your data from old to new version , it is may you need to move and upgrade in
same time , below I am listing simple steps to achieve this goal by using RMAN
incremental backup to minimize the downtime needed in case the RMAN backup is
the only suitable solution in your case.
How ?
Below
are steps to be follow in order to achive the goal , I am assuming the below:
Source
DB 12c : orcl , running in archive log mode , OS is Linux
Destination
DB 19c : orcl , software only is installed , OS is Linux
1- check the archive log mode in source DB, if it
is disable then backup will be only offline backup ( cold backup) :
Sql> archive log list ;
2-
Take backup level 0 which is equivalent to full backup for both database and
archive logs:
rman> backup incremental level 0
database format '/u01/backup/db_%U' plus archivelog format
'/u01/backup/arch_%U';
3- On target database start create a password
file as below:
ORAPWD
file=PWD<ORACLE_SID>.ora password=<password>
4- take a pfile from spfile of source and
edited as needed and startup the target DB using this pfile:
Sql> create pfile=’location/orclinit.ora’
from spfile;
-- copy the file to the
target and edit it with the needed, make sure the create any missed directory
specially the adum path.
-- startup the target DB to
nomount:
Sql> startup nmount pfile=location\orclinit.ora;
5- On source database take backup of control
file:
rman> backup current
controlfile format '/u01/backup/cf_%U';
6- On target database restore backup of control
file and start database on mount stage:
rman> restore
controlfile from '/u01/backup/<filename> ;
rman> alter database
mount ;
7- On target database correct any path need to
be correct if it is differ from source , you may check this using the below:
sql> report schema ;
sql> select * from
v$logfile ;
sql> alter database rename file
'<sourcepath>/redo01.log' to '<distpath>/redo01.log';
sql> alter database rename file
'<sourcepath>/redo02.log' to '<distpath>/redo02.log';
sql> alter database rename file
'<sourcepath>/redo03.log' to '<distpath>/redo03.log';
8- On target database restore backup incremental
backup level 0:
rman>
run
{
allocate channel c1 device
type disk;
set newname for database to
'/u02/oradata/%U';
set newname for tempfile
'/u01/oradata/orcl/temp01.dbf' to '/u02/oradata/temp01.dbf' ;
restore database ;
switch datafile all;
switch tempfile all;
release channel c1;
}
8- On source database take backup incremental level
1:
rman> backup incremental
level 1 database format '/u01/backup/db_%U' plus archivelog format
'/u01/backup/arch_%U';
8- On target database recover backup incremental
level 1 and level 0 after catalog the new level1 in the control file, check the
last sequence and add 1 then:
rman> catalog start with
'/u01/backup/';
rman> list backup ;
run
{
allocate channel c1 device
type disk;
set until sequence (maxnumber+1);
recover database ;
release channel c1;
}
9- Now you can start database in upgrade stage and reset the logs , then perform the upgrade(you may use autoupgrade.jar) :
rman> alter databas open
resetlogs upgrade ;
cd $ORACLE_HOME/rdbms/admin
$ORACLE_HOME/perl/bin/perl
catctl.pl catupgrd.sql