oracle数据库rman异地恢复
首先讲下,为什么会遇到这个问题: 自己想做两组rac之间的data guard,由于datafile,controlfile,甚至是archivelog都是存放在asm上的,直接复制数据有点不现实,asm磁盘总归都是要用的,所以想从a库做rman全备份,然后把备份文件拷贝到b库上做rman恢复,初
首先讲下,为什么会遇到这个问题:
自己想做两组rac之间的data guard,由于datafile,controlfile,甚至是archivelog都是存放在asm上的,直接复制数据有点不现实,asm磁盘总归都是要用的,所以想从a库做rman全备份,然后把备份文件拷贝到b库上做rman恢复,初衷就是这么简单,结果却遇到了n多的折腾,无法实现,下面是我自己经过无数次测试得到的方法。
oracle版本:11.2.0.0
第一组RAC A ?PS:前面的hostname,冒号后面是instancename
rac1:orcl1
rac2:orcl2
rac3:orcl3
第二组RAC B
rac8:orcl1
rac9:orcl2
我已经创建好了两组rac,并且在上面分别创建了orcl数据库,我在A组rac的数据库里做了一些操作,我希望这些新建的表数据什么的在RAC B上也同样出现,我现在要做的就是在rac1上使用rman做数据库全备份然后把备份文件拷贝到rac8上,然后做rman恢复,使得rac8是rac1上oracle数据库的一个拷贝
1、rac1做rman全备份
登录到rac1上,使用rman全备份数据库,如下:
[oracle@rac1 ~]$ rman target /
RMAN> backup database format ‘/u01/app/oracle/backup/orcl01.dbf’;
备份成功了会告诉我:
数据文件备份文件为/u01/app/oracle/backup/orcl01.dbf’
controlfile,spfile备份文件为/u01/app/oracle/backup/c-1351646173-20130822-00
注意:我这边加了format参数备份成我指定的文件路径和名称,原因就是在异地恢复的时候,rman读取备份文件的目录和需要和备份时的目录一致,如果这边不使用format,备份到默认的asm磁盘上,则备份文件想要复制到异地的asm磁盘上有一定的难度,比如我遇到的问题就是默认备份到asm上的文件名称参数很长无法复制到异地的asm磁盘上
2、从rac1上拷贝备份文件到rac8
需要拷贝的文件如上:
数据文件备份文件为/u01/app/oracle/backup/orcl01.dbf’
controlfile,spfile备份文件为/u01/app/oracle/backup/c-1351646173-20130822-00
拷贝到rac8上之后仍然放在相同的路径下,设置具有相同的权限,一般是oracle:oinstall权限
3、rac8上做rman恢复
我们这边只需要恢复controlfile和datafile。
按理来说备份恢复应该使用一样的spfile,但是我们看到A组rac是3个节点,B组rac是2个节点,我这里还要说的是这两组rac server的配置是有差异的,spfile中定义了节点的信息,还定义了相关的初始化信息,A组RAC的这些信息在B组上并不适用的,所以我这里只恢复controlfile和datafile。
网上看到说异地rman恢复需要设置异地的dbid为本地的值,折腾了好久,发现这个是不需要的,dbid已经定义在controlfile当中,只要恢复了controlfile,dbid自然是相同的了。
恢复controlfile需要数据库置于nomount状态
[oracle@rac8 ~]$ uniread sqlplus ‘/ as sysdba’
SQL> shutdown immediate;
SQL> shutdown nomount;
[oracle@rac8 ~]$ uniread rman target /
RMAN> restore controlfile from ‘/u01/app/oracle/backup/c-1351646173-20130822-00′;
完了会告诉你恢复成功
恢复数据文件需要数据库置于mount状态
[oracle@rac8 ~]$ uniread sqlplus ‘/ as sysdba’
SQL> shutdown immediate;
SQL> shutdown mount;
注意:启动到mount的状态可能需要加参数resetlogs
[oracle@rac8 ~]$ uniread rman target /
RMAN> list backup of database;
可以看到备份文件信息
RMAN> restore database;
RMAN> recover database;
这样就恢复结束了
4、rac8上启动oracle到open状态
单独讲这个是有意义的,恢复之后,因为rac8上的数据字典等信息已经改变,所有他会报错ORA-39700: database must be opened with UPGRADE option
那我们就需要启动到升级模式了
SQL> startup?UPGRADE;
报错:ORA-39701: database must be mounted EXCLUSIVE for UPGRADE or DOWNGRADE
这个报错的解决方法是要禁掉集群参数
SQL> STARTUP NOMOUNT;
SQL> ALTER SYSTEM SET CLUSTER_DATABASE=FALSE scope=spfile ;
SQL> SHUTDOWN IMMEDIATE;
SQL> startup?UPGRADE;
这样就启动成功了,再有就是记得把集群参数开启。
?
原文地址:oracle数据库rman异地恢复, 感谢原作者分享。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

When Oracle log files are full, the following solutions can be adopted: 1) Clean old log files; 2) Increase the log file size; 3) Increase the log file group; 4) Set up automatic log management; 5) Reinitialize the database. Before implementing any solution, it is recommended to back up the database to prevent data loss.

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

Oracle views can be exported through the EXP utility: Log in to the Oracle database. Start the EXP utility, specifying the view name and export directory. Enter export parameters, including target mode, file format, and tablespace. Start exporting. Verify the export using the impdp utility.

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.
