search
HomeDatabaseMysql TutorialOracle rman恢复到异地、异机

原来的Oracle数据库服务器使用rman进行全库的备份,然后再异地的服务器上恢复一模一样的数据库

原来的Oracle数据库服务器使用rman进行全库的备份,,然后再异地的服务器上恢复一模一样的数据库

1.1      原服务器备份数据库

第一步,查看数据库的实例名和DBID

connected to target database: DB3 (DBID=2060124769, not open)

第二步,进行全备份

backup AS COMPRESSED BACKUPSET database

include current controlfile format '/orabak/db_%d_%T_%s'

plus archivelog format '/orabak/arch_%d_%T_%s' ;

第三步,查看数据库文件的位置: /home/oracle/oradata/db3/

第四步,将备份文件arch_DB3_20140910_8和 db_ DB3_20140910_7复制异机上/home/oracle/orabak

1.2      目标服务器上创建数据库

第一步,创建实例名相同(db3),数据库文件的位置相同(/home/oracle/oradata/db3/)的数据库。

 第二步,关闭实例,启动到nomount状态。Sql>startup nomount;

 第三步,设置dbid和原数据库dbid相同

rman target/

Recovery Manager: Release 10.2.0.5.0 - Production on Thu Sep 11 19:53:50 2014

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: db3 (not mounted)

RMAN> set dbid 2060124769

executing command: SET DBID

 第四步,恢复控制文件

RMAN> restore controlfile from '/home/oracle/db_DB3_20140910_7';

Starting restore at 11-SEP-14

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=153 devtype=DISK

channel ORA_DISK_1: restoring control file

channel ORA_DISK_1: restore complete, elapsed time: 00:00:05

output filename=/home/oracle/oradata/db3/db3/control01.ctl

output filename=/home/oracle/oradata/db3/db3/control02.ctl

output filename=/home/oracle/oradata/db3/db3/control03.ctl

Finished restore at 11-SEP-14

 

第五步,mount数据库

RMAN> alter database mount;

database mounted

released channel: ORA_DISK_1

 

第六步,注册从源数据库拷贝过来的备份集到rman中

RMAN> catalog start with '/home/oracle/orabak';

searching for all files that match the pattern /home/oracle/orabak

List of Files Unknown to the Database

=====================================

File Name: /home/oracle/orabak/arch_DB3_20140910_8

File Name: /home/oracle/orabak/db_DB3_20140910_7

Do you really want to catalog the above files (enter YES or NO)? yes

cataloging files...

cataloging done

 

第七步,恢复归档日志

RMAN> restore archivelog all;

Starting restore at 11-SEP-14

using channel ORA_DISK_1

archive log thread 1 sequence 6 is already on disk as file /oracle/product/10.2.0.5/dbs/arch1_6_857918757.dbf

channel ORA_DISK_1: starting archive log restore to default destination

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=3

channel ORA_DISK_1: reading from backup piece /home/oracle/orabak/arch_DB3_20140910_1

channel ORA_DISK_1: restored backup piece 1

piece handle=/home/oracle/orabak/arch_DB3_20140910_1 tag=TAG20140910T172944

(注:如果不恢复归档日志,

RMAN> recover database;

Starting recover at 11-SEP-14

using channel ORA_DISK_1

starting media recovery

unable to find archive log

archive log thread=1 sequence=7)

 

第八步,恢复数据库文件(因为目标数据库和原数据库的数据文件位置相同,所以简单些)

RMAN> restore database;

Starting restore at 11-SEP-14

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 00001 to /home/oracle/oradata/db3/system01.dbf

restoring datafile 00002 to /home/oracle/oradata/db3/undotbs01.dbf

restoring datafile 00003 to /home/oracle/oradata/db3/sysaux01.dbf

restoring datafile 00004 to /home/oracle/oradata/db3/users01.dbf

channel ORA_DISK_1: reading from backup piece /home/oracle/orabak/db_DB3_20140910_6

channel ORA_DISK_1: restored backup piece 1

piece handle=/home/oracle/orabak/db_DB3_20140910_6 tag=TAG20140910T173540

 

第九步,恢复数据库

RMAN> recover database;

Starting recover at 11-SEP-14

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=152 devtype=DISK

starting media recovery

media recovery complete, elapsed time: 00:00:03

Finished recover at 11-SEP-14

 

第十步,启动数据库

alter database open resetlogs;

--------------------------------------推荐阅读 --------------------------------------

RMAN 配置归档日志删除策略

Oracle基础教程之通过RMAN复制数据库

RMAN备份策略制定参考内容

RMAN备份学习笔记

Oracle数据库备份加密 RMAN加密

--------------------------------------分割线 --------------------------------------

本文永久更新链接地址:

linux

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How to solve the problem of mysql cannot open shared libraryHow to solve the problem of mysql cannot open shared libraryMar 04, 2025 pm 04:01 PM

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

Reduce the use of MySQL memory in DockerReduce the use of MySQL memory in DockerMar 04, 2025 pm 03:52 PM

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Run MySQl in Linux (with/without podman container with phpmyadmin)Run MySQl in Linux (with/without podman container with phpmyadmin)Mar 04, 2025 pm 03:54 PM

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

What is SQLite? Comprehensive overviewWhat is SQLite? Comprehensive overviewMar 04, 2025 pm 03:55 PM

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Running multiple MySQL versions on MacOS: A step-by-step guideRunning multiple MySQL versions on MacOS: A step-by-step guideMar 04, 2025 pm 03:49 PM

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.