Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use RMAN to realize Oracle Database Migration

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to use RMAN to achieve Oracle database migration, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

1. Open RMAN

[oracle@ENMOEDU ~] $rman target /

Recovery Manager: Release 11.2.0.3.0-Production on Sun Apr 6 17:52:06 2014

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to target database: ENMOEDU (DBID=87396644)

RMAN >

two。 View current configuration information and modify configuration information

RMAN > show all

RMAN configuration parameters for database with db_unique_name ENMOEDU are:

CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

CONFIGURE BACKUP OPTIMIZATION OFF; # default

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO'% favored; # default

CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE MAXSETSIZE TO UNLIMITED; # default

CONFIGURE ENCRYPTION FOR DATABASE OFF; # default

CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default

CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE' DEFAULT' OPTIMIZE FOR LOAD TRUE; # default

CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

CONFIGURE SNAPSHOT CONTROLFILE NAME TO'/ u01qapplash oracleandproduct11.2.0Uniplicatedbhomeowners 1OndbSnapcfEnMOEDU.fect; # default

RMAN > CONFIGURE BACKUP OPTIMIZATION ON

New RMAN configuration parameters:

CONFIGURE BACKUP OPTIMIZATION ON

New RMAN configuration parameters are successfully stored

RMAN > CONFIGURE CONTROLFILE AUTOBACKUP ON

New RMAN configuration parameters:

CONFIGURE CONTROLFILE AUTOBACKUP ON

New RMAN configuration parameters are successfully stored

3. Make a complete database

RMAN > backup database include current controlfile plus archivelog

Starting backup at 06-APR-14

Current log archived

Using target database control file instead of recovery catalog

Allocated channel: ORA_DISK_1

.

.

.

Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 06-APR-14

4. View backups and delete redundant backups

RMAN > list backup

List of Backup Sets

=

BS Key Size Device Type Elapsed Time Completion Time

--

1 70.64M DISK 00:00:00 06-APR-14

BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20140406T181504

Piece Name: / u01/app/oracle/fast_recovery_area/ENMOEDU/backupset/2014_04_06/o1_mf_annnn_TAG20140406T181504_9n2b987h_.bkp

.

.

.

BS Key Type LV Size Device Type Elapsed Time Completion Time

11 Full 9.36M DISK 00:00:00 06-APR-14

BP Key: 11 Status: AVAILABLE Compressed: NO Tag: TAG20140406T183542

Piece Name: / u01/app/oracle/fast_recovery_area/ENMOEDU/autobackup/2014_04_06/o1_mf_s_844194942_9n2chyvw_.bkp

SPFILE Included: Modification time: 04-APR-14

SPFILE db_unique_name: ENMOEDU

Control File Included: Ckp SCN: 1302814 Ckp time: 06-APR-14

RMAN > delete obsolete

RMAN retention policy will be applied to the command

RMAN retention policy is set to redundancy 1

Using channel ORA_DISK_1

Deleting the following obsolete backups and copies:

Type Key Completion Time Filename/Handle

--

Archive Log 1 06-APR-14 / u01/app/oracle/fast_recovery_area/ENMOEDU/archivelog/2014_04_06/o1_mf_1_91_9n27s6o2_.arc

.

.

.

Do you really want to delete the above objects (enter YES or NO)? Yes

.

.

.

Deleted backup piece

Backup piece handle=/u01/app/oracle/fast_recovery_area/ENMOEDU/backupset/2014_04_06/o1_mf_ncnnf_TAG20140406T183529_9n2chwnm_.bkp RECID=9 STAMP=844194940

Deleted 11 objects

5. Send the backup under the quick recovery area to the host where you want to establish the database

[oracle@ENMOEDU ~] $cd / u01/app/oracle/fast_recovery_area/

[oracle@ENMOEDU fast_recovery_area] $scp-r ENMOEDU/ oracle@192.168.80.11:/u01/app/oracle/fast_recovery_area/

Oracle@192.168.80.11's password:

O1_mf_1_95_9n2chxov_.arc 100% 3072 3.0KB/s 00:00

O1_mf_nnndf_TAG20140406T183529_9n2chkgc_.bkp 100% 1059MB 53.0MB/s 00:20

O1_mf_nnndf_TAG20140406T183529_9n2chrl2_.bkp 100% 224MB 55.9MB/s 00:04

O1_mf_annnn_TAG20140406T183541_9n2chxs6_.bkp 100% 4608 4.5KB/s 00:00

O1_mf_s_844194942_9n2chyvw_.bkp 100% 9600KB 9.4MB/s 00:00

Control02.ctl 100% 9520KB 9.3MB/s 00:00

6. View the transferred backup on the host where the database is established

[oracle@FRANK ~] $ls / u01/app/oracle/fast_recovery_area/

ENMOEDU FRANK

At this point, the backup of the database was transferred successfully.

7. Using RMAN to restore Database

[oracle@FRANK ENMOEDU] $export ORACLE_SID=ENMOEDU

[oracle@FRANK ENMOEDU] $echo $ORACLE_SID

ENMOEDU

[oracle@FRANK ENMOEDU] $rman target /

Recovery Manager: Release 11.2.0.3.0-Production on Sat Mar 1 15:10:16 2014

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to target database (not started)

RMAN > startup nomount

Oracle instance started

Total System Global Area 171581440 bytes

Fixed Size 1343668 bytes

Variable Size 117444428 bytes

Database Buffers 50331648 bytes

Redo Buffers 2461696 bytes

1) restore control files

RMAN > restore controlfile FROM AUTOBACKUP

Starting restore at 01-MAR-14

Using channel ORA_DISK_1

Recovery area destination: / u01/app/oracle/fast_recovery_area

Database name (or database unique name) used for search: ENMOEDU

Channel ORA_DISK_1: AUTOBACKUP / u01/app/oracle/fast_recovery_area/ENMOEDU/autobackup/2014_03_01/o1_mf_s_841048138_9k2bgbo1_.bkp found in the recovery area

AUTOBACKUP search with format "% F" not attempted because DBID was not set

Channel ORA_DISK_1: restoring control file from AUTOBACKUP / u01/app/oracle/fast_recovery_area/ENMOEDU/autobackup/2014_03_01/o1_mf_s_841048138_9k2bgbo1_.bkp

RMAN-00571: =

RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =

RMAN-00571: =

RMAN-03002: failure of restore command at 03/01/2014 15:33:58

ORA-19870: error while restoring backup piece / u01/app/oracle/fast_recovery_area/ENMOEDU/autobackup/2014_03_01/o1_mf_s_841048138_9k2bgbo1_.bkp

ORA-19504: failed to create file "/ u01/app/oracle/oradata/ENMOEDU/control01.ctl"

ORA-27040: file create error, unable to create file

Linux Error: 2: No such file or directory

Additional information: 1

Follow the prompts to create a folder:

[oracle@FRANK 2014 / 04 / 06] $mkdir-p / u01/app/oracle/oradata/ENMOEDU

Continue the previous recovery work:

RMAN > restore controlfile FROM AUTOBACKUP

Starting restore at 01-MAR-14

Using channel ORA_DISK_1

Recovery area destination: / u01/app/oracle/fast_recovery_area

Database name (or database unique name) used for search: ENMOEDU

Channel ORA_DISK_1: AUTOBACKUP / u01/app/oracle/fast_recovery_area/ENMOEDU/autobackup/2014_03_01/o1_mf_s_841048138_9k2bgbo1_.bkp found in the recovery area

AUTOBACKUP search with format "% F" not attempted because DBID was not set

Channel ORA_DISK_1: restoring control file from AUTOBACKUP / u01/app/oracle/fast_recovery_area/ENMOEDU/autobackup/2014_03_01/o1_mf_s_841048138_9k2bgbo1_.bkp

Channel ORA_DISK_1: control file restore from AUTOBACKUP complete

Output file name=/u01/app/oracle/oradata/ENMOEDU/control01.ctl

Output file name=/u01/app/oracle/fast_recovery_area/ENMOEDU/control02.ctl

Finished restore at 01-MAR-14

The control file was restored successfully.

2) start the database to mount mode

RMAN > alter database mount

Database mounted

Released channel: ORA_DISK_1

Start successfully.

3) restore database files

RMAN > restore database

Starting restore at 01-MAR-14

Starting implicit crosscheck backup at 01-MAR-14

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: SID=19 device type=DISK

Crosschecked 9 objects

Finished implicit crosscheck backup at 01-MAR-14

.

.

.

Channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/ENMOEDU/backupset/2014_03_04/o1_mf_nnndf_TAG20140304T114802_9kbm7lm8_.bkp tag=TAG20140304T114802

Channel ORA_DISK_1: restored backup piece 1

Channel ORA_DISK_1: restore complete, elapsed time: 00:00:15

Finished restore at 01-MAR-14

RMAN > recover database

Starting recover at 01-MAR-14

Using channel ORA_DISK_1

Starting media recovery

Unable to find archived log

Archived log thread=1 sequence=1

RMAN-00571: =

RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =

RMAN-00571: =

RMAN-03002: failure of recover command at 03/01/2014 15:53:22

RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 9 and starting SCN of 1459216

From the prompt, the archive log has been used up, and the online log should be applied to restore the database.

4) transmit online log and apply

[oracle@ENMOEDU ENMOEDU] $cd / u01/app/oracle/oradata/ENMOEDU/

[oracle@ENMOEDU ENMOEDU] $ls

Control01.ctl redo01.log redo03.log system01.dbf test01.dbf undotbs01.dbf

Example01.dbf redo02.log sysaux01.dbf temp01.dbf test02.dbf users01.dbf

[oracle@ENMOEDU ENMOEDU] $scp * .log oracle@192.168.80.11:/u01/app/oracle/oradata/ENMOEDU/

Oracle@192.168.80.11's password:

Redo01.log 100% 50MB 50.0MB/s 00:01

Redo02.log 100% 50MB 50.0MB/s 00:01

Redo03.log 100% 50MB 50.0MB/s 00:01

RMAN > recover database

Starting recover at 01-MAR-14

Using channel ORA_DISK_1

Starting media recovery

Archived log for thread 1 with sequence 9 is already on disk as file

/ u01/app/oracle/oradata/ENMOEDU/redo01.log

Archived log file name=/u01/app/oracle/oradata/ENMOEDU/redo01.log thread=1 sequence=9

Media recovery complete, elapsed time: 00:00:00

Finished recover at 01-MAR-14

Thank you for reading this article carefully. I hope the article "how to use RMAN to achieve Oracle database migration" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report