search
HomeDatabaseMysql Tutorial使用RMAN迁移数据库到异机

迁移数据库的方法有多种,较为常用的则是使用RMAN来迁移。使用RMAN迁移数据库属于数据库的物理备份与恢复范畴,整个过程中数据库

迁移数据库的方法有多种,较为常用的则是使用RMAN来迁移。使用RMAN迁移数据库属于数据库的物理备份与恢复范畴,整个过程中数据库的相关信息是完整地镜像。因此,基于此种方式还原恢复的数据库用于测试会使得与真实的生产环境差异相对较小。本文描述了使用RMAN来还原Oracle 10g数据库的过程。

一、主要步骤

1、备份数据库
2、ftp备份到目的服务器
3、为目标数据库创建项目目录
4、为目标数据库创建pfile或spfile(使用RMAN还原或复制原pfile到目的服务器)
5、还原控制文件
6、还原数据文件
7、OPEN 数据库

其实,这几个步骤比较好理解,整个实质是对数据库体系结构以及数据库整个启动过程的理解。

关于体系结构和启动过程可以参考

Oracle实例和Oracle数据库(Oracle体系结构)
Oracle 数据库实例启动关闭过程

下面对此进行一下描述

a、首先需要为实例的运行环境创建相应的目录,如dump位置,datafile位置,以及archive位置等等
如果是恢复到不同的路径,则后续RMAN时需要使用set newname for datafile 方式更新到控制文件
b、实例需要pfile来启动,因此需要恢复pfile或spfile,,然后将数据库切换到nomount状态
c、接下来的一步是通过控制文件将数据库切换到mount状态,因此需要恢复控制文件,然后再mount
d、mount之后就可以对数据库进行还原(restore)操作
e、还原完毕之后是对数据库进行恢复(recovery)操作(restore和recover需要基于控制文件的备份信息或恢复目录)
f、最后是open数据库

二、迁移演示

1、备份原数据库

此处演示的源数据库与目标数据库使用相同的版本为Oracle 10g R2(10.2.0.3),操作系统都为SUSE 10 +Sp3

备份过程略,有关备份脚本,请参考:Linux 下RMAN备份shell脚本

2、ftp所有的备份文件到需要恢复的服务器上

打包整个备份集ftp到目标服务器或scp到目标服务器

下面是ftp到目标服务器解压后包含的文件

3、创建所需的目录(使用oracle用户) 

4、创建密码文件 

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
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 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

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

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

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]

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

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

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download

Atom editor mac version download

The most popular open source editor