首先讲下,为什么会遇到这个问题: 自己想做两组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异地恢复, 感谢原作者分享。

Mastering the method of adding MySQL users is crucial for database administrators and developers because it ensures the security and access control of the database. 1) Create a new user using the CREATEUSER command, 2) Assign permissions through the GRANT command, 3) Use FLUSHPRIVILEGES to ensure permissions take effect, 4) Regularly audit and clean user accounts to maintain performance and security.

ChooseCHARforfixed-lengthdata,VARCHARforvariable-lengthdata,andTEXTforlargetextfields.1)CHARisefficientforconsistent-lengthdatalikecodes.2)VARCHARsuitsvariable-lengthdatalikenames,balancingflexibilityandperformance.3)TEXTisidealforlargetextslikeartic

Best practices for handling string data types and indexes in MySQL include: 1) Selecting the appropriate string type, such as CHAR for fixed length, VARCHAR for variable length, and TEXT for large text; 2) Be cautious in indexing, avoid over-indexing, and create indexes for common queries; 3) Use prefix indexes and full-text indexes to optimize long string searches; 4) Regularly monitor and optimize indexes to keep indexes small and efficient. Through these methods, we can balance read and write performance and improve database efficiency.

ToaddauserremotelytoMySQL,followthesesteps:1)ConnecttoMySQLasroot,2)Createanewuserwithremoteaccess,3)Grantnecessaryprivileges,and4)Flushprivileges.BecautiousofsecurityrisksbylimitingprivilegesandaccesstospecificIPs,ensuringstrongpasswords,andmonitori

TostorestringsefficientlyinMySQL,choosetherightdatatypebasedonyourneeds:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseTEXTforlong-formtextcontent.4)UseBLOBforbinarydatalikeimages.Considerstorageov

When selecting MySQL's BLOB and TEXT data types, BLOB is suitable for storing binary data, and TEXT is suitable for storing text data. 1) BLOB is suitable for binary data such as pictures and audio, 2) TEXT is suitable for text data such as articles and comments. When choosing, data properties and performance optimization must be considered.

No,youshouldnotusetherootuserinMySQLforyourproduct.Instead,createspecificuserswithlimitedprivilegestoenhancesecurityandperformance:1)Createanewuserwithastrongpassword,2)Grantonlynecessarypermissionstothisuser,3)Regularlyreviewandupdateuserpermissions

MySQLstringdatatypesshouldbechosenbasedondatacharacteristicsandusecases:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseBINARYorVARBINARYforbinarydatalikecryptographickeys.4)UseBLOBorTEXTforlargeuns


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

SublimeText3 Chinese version
Chinese version, very easy to use

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
