Migrate database with RMAN

Source: Internet
Author: User

This article describes how to use RMAN to migrate a database to another server.

Server A: Linux ES4 + oracle9204 (source)
Server B: Linux ES4 + oracle9204 (target)

1. Create a directory

For the sake of simplicity, create a directory structure that is the same as Aon server B. If it is space or other reasons, you can use soft links to unify the directory structure.
If it cannot be done, you can use the set newname of RMAN to relocate data.

[Oracle @ datasrv2 ~] $ Mkdir-P/data/oradata/gpodb
[Oracle @ datasrv2 dbback] $ mkdir-P/data/dbback/gpofullbak
[Oracle @ datasrv2 admin] $ mkdir-P/data/admin/gpodb/udump
[Oracle @ datasrv2 admin] $ mkdir-P/data/admin/gpodb/bdump
[Oracle @ datasrv2 admin] $ mkdir-P/data/admin/gpodb/cdump
[Oracle @ datasrv2 admin] $ mkdir-P/data/archivelog/gpodb -- Archive

Ii. Full-Database Backup

[Oracle @ datasrv1 gpofullbak] $ export oracle_sid = gpodb
[Oracle @ datasrv1 gpofullbak] $ RMAN target/

Recovery MANAGER: Release 9.2.0.4.0-64bit Production

Copyright (c) 1995,200 2, Oracle Corporation. All rights reserved.

Connected to target database: gpodb (dbid = 1026346035)

RMAN> run {
2> Configure controlfile autobackup on;
3> Configure controlfile autobackup format for device type disk to '/data/dbback/gpofullbak/% F ';
4> allocate channel C1 type disk format'/data/dbback/gpofullbak/full _ % U ';
5> backup database tag 'full _ gpodb_data 'filesperset 10 plus archivelog filesperset 20 delete all input;
6> release channel C1;
7>}

Using target database controlfile instead of recovery catalog
Old rman configuration parameters:
Configure controlfile autobackup on;
New RMAN configuration parameters:
Configure controlfile autobackup on;
New RMAN configuration parameters are successfully stored

Old rman configuration parameters:
Configure controlfile autobackup format for device type disk to '/data/dbback/gpofullbak/% F ';
New RMAN configuration parameters:
Configure controlfile autobackup format for device type disk to '/data/dbback/gpofullbak/% F ';
New RMAN configuration parameters are successfully stored

Allocated channel: C1
Channel C1: SID = 15 devtype = Disk

Starting backup at 25-4 ?? -07
Current Log archived
Channel C1: Starting archive log backupset
Channel C1: specifying archive log (s) in backup set
Input archive log thread = 1 sequence = 97 recid = 68 stamp = 620843481
Channel C1: Starting piece 1 at 25-4 ?? -07
Channel C1: finished piece 1 at 25-4 ?? -07
Piece handle =/data/dbback/gpofullbak/full_26ig2kep_1_1 comment = none
Channel C1: Backup set complete, elapsed time: 00:00:02
Channel C1: deleting archive log (s)
Archive log filename =/data/archivelog/gpodb/ipv97.dbf recid = 68 stamp = 620843481
Finished backup at 25-4 ?? -07

Starting backup at 25-4 ?? -07
Channel C1: Starting full datafile backupset
Channel C1: specifying datafile (s) in backupset
Input datafile fno = 00007 name =/data/oradata/gpodb/ndindex01.dbf
Input datafile fno = 00009 name =/data/oradata/gpodb/ndindex03.dbf
Input datafile fno = 00011 name =/data/oradata/gpodb/ndindex05.dbf
Input datafile fno = 00013 name =/data/oradata/gpodb/ndmain02.dbf
Input datafile fno = 00015 name =/data/oradata/gpodb/ndmain04.dbf
Input datafile fno = 00017 name =/data/oradata/gpodb/ndmain06.dbf
Input datafile fno = 00004 name =/data/oradata/gpodb/indx01.dbf
Input datafile fno = 00003 name =/data/oradata/gpodb/drsys01.dbf
Input datafile fno = 00005 name =/data/oradata/gpodb/tools01.dbf
Input datafile fno = 00002 name =/data/oradata/gpodb/undotbs01.dbf
Channel C1: Starting piece 1 at 25-4 ?? -07
Channel C1: finished piece 1 at 25-4 ?? -07
Piece handle =/data/dbback/gpofullbak/full_27ig2ker_1_1 comment = none
Channel C1: Backup set complete, elapsed time: 00:05:45
Channel C1: Starting full datafile backupset
Channel C1: specifying datafile (s) in backupset
Input datafile fno = 00006 name =/data/oradata/gpodb/users01.dbf
Input datafile fno = 00008 name =/data/oradata/gpodb/ndindex02.dbf
Input datafile fno = 00010 name =/data/oradata/gpodb/ndindex04.dbf
Input datafile fno = 00012 name =/data/oradata/gpodb/ndmain01.dbf
Input datafile fno = 00014 name =/data/oradata/gpodb/ndmain03.dbf
Input datafile fno = 00016 name =/data/oradata/gpodb/ndmain05.dbf
Input datafile fno = 00001 name =/data/oradata/gpodb/system01.dbf
Channel C1: Starting piece 1 at 25-4 ?? -07
Channel C1: finished piece 1 at 25-4 ?? -07
Piece handle =/data/dbback/gpofullbak/full_28ig2kpk_1_1 comment = none
Channel C1: Backup set complete, elapsed time: 00:05:35
Finished backup at 25-4 ?? -07

Starting backup at 25-4 ?? -07
Current Log archived
Channel C1: Starting archive log backupset
Channel C1: specifying archive log (s) in backup set
Input archive log thread = 1 sequence = 98 recid = 69 stamp = 620844163
Channel C1: Starting piece 1 at 25-4 ?? -07
Channel C1: finished piece 1 at 25-4 ?? -07
Piece handle =/data/dbback/gpofullbak/full_29ig2l43_1_1 comment = none
Channel C1: Backup set complete, elapsed time: 00:00:02
Channel C1: deleting archive log (s)
Archive log filename =/data/archivelog/gpodb/ipv98.dbf recid = 69 stamp = 620844163
Finished backup at 25-4 ?? -07

Starting Control File and spfile autobackup at 25-4 ?? -07
Piece handle =/data/dbback/gpofullbak/c-1026346035-20070425-07 comment = none
Finished control file and spfile autobackup at 25-4 ?? -07

Released channel: C1

RMAN> exit

Recovery manager complete.

-- Create spfile
[Oracle @ datasrv1 gpofullbak] $ sqlplus "/As sysdba"

SQL * Plus: Release 9.2.0.4.0-production on D ?? Úè Y 4 ?? 25 10:48:17 2007

Copyright (c) 1982,200 2, Oracle Corporation. All rights reserved.

Connected:
Oracle9i Enterprise Edition Release 9.2.0.4.0-64bit Production
With the partitioning Option
Jserver release 9.2.0.4.0-Production

SQL> Create pfile from spfile;

File Created.

3. transfer files
Put the file in the same directory on server B.
[Oracle @ datasrv1 gpofullbak] $ SCP * 172.25.13.51: 'pwd'
Oracle@172.25.13.51's password:
C-1026346035-20070425-07 100% 1696kb 1.7 MB/S
Full_26ig2kep_1_1 100% 901kb 900.5kb/s
Full_27ig2ker_1_1 100% 1591 MB 11.0 MB/S
Full_28ig2kpk_1_1 100% 1281 MB 11.0 Mb/s 0
Full_29ig2l43_1_1 100% 140kb 139.5kb/s
[Oracle @ datasrv1 DBS] $ SCP initgpodb. ora 172.25.13.51: 'pwd'
Oracle@172.25.13.51's password:
Initgpodb. ora 100% 1021 1.0kb/s

[Oracle @ datasrv1 DBS] $ SCP orapwgpodb 172.25.13.51: 'pwd'
Oracle@172.25.13.51's password:
Orapwgpodb 100% 1536 1.5kb/s

4. Recover from B

[Oracle @ datasrv2 dbback] $ export oracle_sid = gpodb
[Oracle @ datasrv2 dbback] $ sqlplus "/As sysdba"

SQL * Plus: Release 9.2.0.4.0-production on D ?? Úè Y 4 ?? 25 11:00:50 2007

Copyright (c) 1982,200 2, Oracle Corporation. All rights reserved.

Connected to an idle instance.

SQL> startup pfile =? /Dbs/init @. ora nomount
Oracle instance started.

Total system global area 2585760448 bytes
Fixed size 746176 bytes
Variable Size 486539264 bytes
Database buffers 2097152000 bytes
Redo buffers 1323008 bytes

SQL> exit
[Oracle @ datasrv2 gpofullbak] $ RMAN target/

Recovery MANAGER: Release 9.2.0.4.0-64bit Production

Copyright (c) 1995,200 2, Oracle Corporation. All rights reserved.

Connected to target database: gpodb (not mounted)

RMAN> set dbid = 1026346035;

Executing command: Set dbid

RMAN> restore controlfile from '/data/dbback/gpofullbak/c-1026346035-20070425-07 ';

Starting restore at 25-4 ?? -16:57:38 2007

Using target database controlfile instead of recovery catalog
Allocated channel: ora_disk_1
Channel ora_disk_1: SID = 12 devtype = Disk
Channel ora_disk_1: Restoring controlfile
Channel ora_disk_1: restore complete
Replicating controlfile
Input filename =/data/oradata/gpodb/control01.ctl
Output Filename =/data/oradata/gpodb/control02.ctl
Output Filename =/data/oradata/gpodb/control03.ctl
Finished restore at 25-4 ?? -16:57:46 2007

RMAN> alter database Mount;

Database mounted

RMAN> Restore database from tag = 'full _ gpodb_data ';

Starting restore at 25-4 ?? -16:58:39 2007

Using channel ora_disk_1
Channel ora_disk_1: Starting datafile backupset restore
Channel ora_disk_1: specifying datafile (s) to restore from backup set
Restoring datafile 00002 to/data/oradata/gpodb/undotbs01.dbf
Restoring datafile 00003 to/data/oradata/gpodb/drsys01.dbf
Restoring datafile 00004 to/data/oradata/gpodb/indx01.dbf
Restoring datafile 00005 to/data/oradata/gpodb/tools01.dbf
Restoring datafile 00007 to/data/oradata/gpodb/ndindex01.dbf
Restoring datafile 00009 to/data/oradata/gpodb/ndindex03.dbf
Restoring datafile 00011 to/data/oradata/gpodb/ndindex05.dbf
Restoring datafile 00013 to/data/oradata/gpodb/ndmain02.dbf
Restoring datafile 00015 to/data/oradata/gpodb/ndmain04.dbf
Restoring datafile 00017 to/data/oradata/gpodb/ndmain06.dbf
Channel ora_disk_1: restored backup piece 1
Piece handle =/data/dbback/gpofullbak/full_27ig2ker_1_1 tag = full_gpodb_data Params = NULL
Channel ora_disk_1: restore complete
Channel ora_disk_1: Starting datafile backupset restore
Channel ora_disk_1: specifying datafile (s) to restore from backup set
Restoring datafile 00001 to/data/oradata/gpodb/system01.dbf
Restoring datafile 00006 to/data/oradata/gpodb/users01.dbf
Restoring datafile 00008 to/data/oradata/gpodb/ndindex02.dbf
Restoring datafile 00010 to/data/oradata/gpodb/ndindex04.dbf
Restoring datafile 00012 to/data/oradata/gpodb/ndmain01.dbf
Restoring datafile 00014 to/data/oradata/gpodb/ndmain03.dbf
Restoring datafile 00016 to/data/oradata/gpodb/ndmain05.dbf
Channel ora_disk_1: restored backup piece 1
Piece handle =/data/dbback/gpofullbak/full_28ig2kpk_1_1 tag = full_gpodb_data Params = NULL
Channel ora_disk_1: restore complete
Finished restore at 25-4 ?? -17:09:24 2007

RMAN> recover database;

Starting recover at 26-4 ?? -07
Using target database controlfile instead of recovery catalog
Allocated channel: ora_disk_1
Channel ora_disk_1: SID = 8 devtype = Disk

Starting media recovery

Channel ora_disk_1: Starting archive log restore to default destination
Channel ora_disk_1: Restoring archive log
Archive log thread = 1 sequence = 98
Channel ora_disk_1: restored backup piece 1
Piece handle =/data/dbback/gpofullbak/full_29ig2l43_1_1 tag = tag200701_t168243 Params = NULL
Channel ora_disk_1: restore complete
Archive log filename =/data/archivelog/gpodb/ipv98.dbf thread = 1 sequence = 98
Unable to find archive log
Archive log thread = 1 sequence = 99
RMAN-00571: ========================================================== ==============================
RMAN-00569: ==================== error message stack follows ==========================
RMAN-00571: ========================================================== ==============================
RMAN-03002: failure of recover command at 09:58:41
RMAN-06054: Media recovery requesting unknown log: thread 1 SCN 32837861

RMAN> alter database open resetlogs;

Database opened

Because online logs are not transmitted, you need to use resetlogs to open the database.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.