Home Database Mysql Tutorial 基于RMAN的异机数据库克隆(rman duplicate)

基于RMAN的异机数据库克隆(rman duplicate)

Jun 07, 2016 pm 05:31 PM

实现这个功能我们可以借助rman duplicate方式以及其简单的方式来完成。duplicate方式不同于OS级别的备份,它会为辅助数据库(克隆

对于基于生产环境下的数据库的版本升级或者测试新的应用程序的性能及其影响,备份恢复等等,我们可以采取从生产环境以克隆的方式将其克隆到本地而不影响生产数据库的正常使用。实现这个功能我们可以借助rman duplicate方式以及其简单的方式来完成。duplicate方式不同于OS级别的备份,它会为辅助数据库(克隆出来的数据库)生成一个新的dbid,而能够同时将目标数据库(原数据库)与辅助数据库注册到同一个恢复目录。本文描述了使用rman duplicate实现异机数据库克隆。

1、RMAN支持的duplicate类型

支持基于备份的duplicate方式,其中该方式又分为连接到target DB与不连接target DB,不连接target DB又分为连接到catalog与不连接catalog

支持基于活动数据库的duplicate方式。更多关于duplicate的描述及duplicate步骤,请参考:基于RMAN的同机数据库克隆

这两种方式可以使用下面的图示简要描述。

基于RMAN的异机数据库克隆(rman duplicate)

2、RMAN异机恢复示意图

下面的图示是没有连接到target DB,也没有连接到recover catalog方式。基于这种方式实现duplicate,应指定备份文件所在的位置。

本文下面所演示的试验也是基于该方式,在演示的过程中,磁盘路径,目录,数据文件使用了相同的位置与文件名。

对于不同位置的duplicate情形,需要对文件位置进行转换,可参考: RMAN 数据库克隆文件位置转换方法

基于RMAN的异机数据库克隆(rman duplicate)

3、实战RMAN异机克隆

--环境:
--目标数据库: 192.168.7.25/sybo3      /u01/database/sybo3  主机名:linux3 
--辅助数据库: 192.168.7.26/sybo3      /u01/database/sybo3  主机名:linux4  目标数据库与辅助数据库使用相同的文件位置
--说明:   
--本次演示使用了备份文件,没有连接到catalog,也没有连接到target DB。
--对于下面描述过程中,如创建参数文件,密码文件,监听等等有不甚了解的,可参考下面链接中有关文章的描述。 

Oracle 联机重做日志文件(ONLINE redo LOG FILE) 详述

RMAN 还原归档日志(restore archivelog) 

基于 RMAN 的同机数据库克隆

Oracle RMAN 清除归档日志

Oracle 基于 RMAN 的不完全恢复(incomplete recovery by RMAN)

RMAN 提示符下执行SQL语句

[oracle@linux3 database]$ cat /etc/issue 
Enterprise Linux Enterprise Linux Server release 5.5 (Carthage) 
Kernel \r on an \m 
 
SQL> select * from v$version where rownum 
BANNER 
--------------------------------------------------------------------------------   
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production 


a、备份及ftp目标数据库
--目标数据库存在的表及其内容,用于后续验证
SQL> select * from t;

NAME      ACTION
---------- --------------------
Robinson  Transfer DB
Jackson    Transfer DB by rman

--下面备份目标数据库并ftp到辅助数据库所在的主机
$ export ORACLE_SID=sybo3
$ rman target /
RMAN> backup database include current controlfile plus archivelog delete input;
$ scp -r fra 192.168.7.26:/u01/database/sybo3/    -->如果有必要将将备份文件打包,此处fra目录是闪回区

--Author : Robinson
--Blog  :

--ftp参数文件,如果没有pfile文件,可从target db生成。 create pfile from spfile;
$ scp $ORACLE_HOME/dbs/initsybo3.ora 192.168.7.26:$ORACLE_HOME/dbs


b、创建相应的dump文件夹
[oracle@linux4 database]$ more sybo3.sh
#!/bin/sh
mkdir -p /u01/database
mkdir -p /u01/database/sybo3/adump
mkdir -p /u01/database/sybo3/controlf
mkdir -p /u01/database/sybo3/fra
mkdir -p /u01/database/sybo3/oradata
mkdir -p /u01/database/sybo3/redo
mkdir -p /u01/database/sybo3/dpdump
mkdir -p /u01/database/sybo3/pfile
[oracle@linux4 database]$ ./sybo3.sh


c、配置辅助实例参数文件
--由于auxiliary DB与target DB不存在文件位置转换,因此无需作任何修改。下面是target DB 复制到auxiliary的参数文件内容
[oracle@linux4 ~]$ more /u01/oracle/db_1/dbs/initsybo3.ora
sybo3.__db_cache_size=113246208
sybo3.__java_pool_size=4194304
sybo3.__large_pool_size=4194304
sybo3.__oracle_base='/u01/oracle'#ORACLE_BASE set from environment
sybo3.__pga_aggregate_target=150994944
sybo3.__sga_target=226492416
sybo3.__shared_io_pool_size=0
sybo3.__shared_pool_size=96468992
sybo3.__streams_pool_size=0
*.audit_file_dest='/u01/database/sybo3/adump/'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/database/sybo3/controlf/control01.ctl','/u01/database/sybo3/controlf/control02.ctl'
*.db_block_size=8192
*.db_domain='orasrv.com'
*.db_name='sybo3'
*.db_recovery_file_dest='/u01/database/sybo3/fra'
*.db_recovery_file_dest_size=4039114752
*.dg_broker_config_file1='/u01/database/sybo3/db_broker/dr1sybo3.dat'
*.dg_broker_config_file2='/u01/database/sybo3/db_broker/dr2sybo3.dat'
*.dg_broker_start=FALSE
*.diagnostic_dest='/u01/database/sybo3'
*.log_archive_dest_1=''
*.memory_target=374341632
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'

d、生成辅助实例密码文件 
--直接使用orapwd命令完成
$ orapwd file=/u01/oracle/db_1/dbs/orapwsybo3 password=oracle entries=10

Statement of this Website
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

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1670
14
PHP Tutorial
1274
29
C# Tutorial
1256
24
MySQL's Role: Databases in Web Applications MySQL's Role: Databases in Web Applications Apr 17, 2025 am 12:23 AM

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

Explain the role of InnoDB redo logs and undo logs. Explain the role of InnoDB redo logs and undo logs. Apr 15, 2025 am 12:16 AM

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

MySQL vs. Other Programming Languages: A Comparison MySQL vs. Other Programming Languages: A Comparison Apr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

How does MySQL index cardinality affect query performance? How does MySQL index cardinality affect query performance? Apr 14, 2025 am 12:18 AM

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.

MySQL for Beginners: Getting Started with Database Management MySQL for Beginners: Getting Started with Database Management Apr 18, 2025 am 12:10 AM

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

MySQL vs. Other Databases: Comparing the Options MySQL vs. Other Databases: Comparing the Options Apr 15, 2025 am 12:08 AM

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

Explain the InnoDB Buffer Pool and its importance for performance. Explain the InnoDB Buffer Pool and its importance for performance. Apr 19, 2025 am 12:24 AM

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

MySQL: Structured Data and Relational Databases MySQL: Structured Data and Relational Databases Apr 18, 2025 am 12:22 AM

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

See all articles