oracle rman异机恢复 以及 RHEL6.3双机

1.安装好同版本的oracle
###############################################


###############################################

2.准备好备份集文件
#################################################




#################################################

3.恢复参数文件
##################################################
RMAN> startup nomount force;

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/db_1/dbs/initorcl.ora'

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area 158662656 bytes

Fixed Size 2211448 bytes
Variable Size 92275080 bytes
Database Buffers 58720256 bytes
Redo Buffers 5455872 bytes

########################################恢复参数文件#######################

[oracle@ora6311gr2 backup]$ ls
ARC_0oni2f44_1_1_20120807 control_bak_20120808 full_level0_0sni49k9_1_1_20120808
ARC_0tni49kc_1_1_20120808 full_level0_0rni49jq_1_1_20120808 SPFILE_0vni49kf_1_1_20120808
[oracle@ora6311gr2 backup]$ pwd
/backup

RMAN> restore spfile from '/backup/SPFILE_0vni49kf_1_1_20120808';

Starting restore at 10-AUG-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=5 device type=DISK

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /backup/SPFILE_0vni49kf_1_1_20120808
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 10-AUG-12

#####################编辑参数文件#########################
SQL> conn /as sysdba
Connected.
SQL> create pfile='/u01/oradata/pfile.ora' from spfile;

File created.

vi /u01/oradata/pfile.ora
符合现有环境

[oracle@ora6311gr2 oradata]$ vi pfile.ora
orcl.__db_cache_size=1258291200
orcl.__java_pool_size=16777216
orcl.__large_pool_size=16777216
orcl.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=1325400064
orcl.__sga_target=1979711488
orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=654311424
orcl.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/oradata/orcl/control01.ctl','/u01/app/oracle/flash_recovery_area/orcl/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='orcl'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4070572032
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.memory_target=536870912
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'


#################################################
SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup nomount pfile='/u01/ora

data/pfile.ora';
ORA-00845: MEMORY_TARGET not supported on this system

修改上面参数文件的内存值
########################################################

SQL> startup nomount pfile='/u01/oradata/pfile.ora';
ORA-01261: Parameter db_recovery_file_dest destination string cannot be translated
ORA-01262: Stat failed on a file destination directory
Linux-x86_64 Error: 2: No such file or directory


创建相应的目录
#######################################


File created.

SQL> shutdown immediate;
ORA-01507: database not mounted


ORACLE instance shut down.

######################################
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 534462464 bytes
Fixed Size 2215064 bytes
Variable Size 327156584 bytes
Database Buffers 197132288 bytes
Redo Buffers 7958528 bytes


#######################################
恢复控制文件

#######################################
RMAN> restore controlfile from '/backup/control_bak_20120808';

Starting restore at 10-AUG-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=129 device type=DISK

channel ORA_DISK_1: restoring control file
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 08/10/2012 17:47:54
ORA-19870: error while restoring backup piece /backup/control_bak_20120808
ORA-19504: failed to create file "/u01/oradata/orcl/control01.ctl"
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory

创建项目目录
################################################
RMAN> restore controlfile from '/backup/control_bak_20120808';

Starting restore at 10-AUG-12
using channel ORA_DISK_1

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/oradata/orcl/control01.ctl
output file name=/u01/app/oracle/flash_recovery_area/orcl/control02.ctl
Finished restore at 10-AUG-12
#####################################################

启动到mount状态
RMAN> sql 'alter database mount';

sql statement: alter database mount
released channel: ORA_DISK_1

####################################################

恢复数据库
####################################################

run{
allocate channel c1 type disk;
restore database;
release channel c1;
}

##############################################
RMAN> run{
allocate channel c1 type disk;
restore database;
release channel c1;
}2> 3> 4> 5>

allocated channel: c1
channel c1: SID=129 device type=DISK

Starting restore at 10-AUG-12
Starting implicit crosscheck backup at 10-AUG-12
Crosschecked 7 obj

ects
Finished implicit crosscheck backup at 10-AUG-12

Starting implicit crosscheck copy at 10-AUG-12
Finished implicit crosscheck copy at 10-AUG-12

searching for all files in the recovery area
cataloging files...
no files cataloged


released channel: c1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 08/10/2012 17:54:42
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore


备份集不在原位置
RMAN> list backup;


List of Backup Sets
===================


BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
15 Full 1.78G DISK 00:00:15 07-AUG-12
BP Key: 15 Status: EXPIRED Compressed: NO Tag: TAG20120807T165503
Piece Name: /home/oracle/backup/backupset/full_level0_0mni2f38_1_1_20120807
#####################################################################################
可以重新注册备份集或者修改现在备份集位置
catalog backuppiece '/backup/full_level0_0sni49k9_1_1_20120808';
catalog backuppiece '/backup/full_level0_0rni49jq_1_1_20120808';
catalog backuppiece '/backup/ARC_0oni2f44_1_1_20120807';
catalog backuppiece '/backup/ARC_0tni49kc_1_1_20120808';


##########################

RMAN> run{
allocate channel c1 type disk;
restore database;
release channel c1;
}2> 3> 4> 5>

allocated channel: c1
channel c1: SID=129 device type=DISK

Starting restore at 10-AUG-12

channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00001 to /oracle/oradata/orcl/system01.dbf
channel c1: restoring datafile 00002 to /oracle/oradata/orcl/sysaux01.dbf
channel c1: restoring datafile 00003 to /oracle/oradata/orcl/undotbs01.dbf
channel c1: restoring datafile 00004 to /oracle/oradata/orcl/users01.dbf
channel c1: reading from backup piece /backup/full_level0_0rni49jq_1_1_20120808
channel c1: ORA-19870: error while restoring backup piece /backup/full_level0_0rni49jq_1_1_20120808
ORA-19504: failed to create file "/oracle/oradata/orcl/users01.dbf"
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory


#####################################################
数据文件修改恢复路径
run{
allocate channel c1 type disk;
set newname for datafile 1 to '/u01/oradata/orcl/system01.dbf';
set newname for datafile 2 to '/u01/oradata/orcl/sysaux01.dbf';
set newname f

or datafile 3 to '/u01/oradata/orcl/undotbs01.dbf';
set newname for datafile 4 to '/u01/oradata/orcl/users01.dbf';
restore database;
switch datafile all;
release channel c1;
}


#####################################################
还原数据库
run{
allocate channel c1 type disk;
recover database;
release channel c1;
}


#####################################################
RMAN> sql 'alter database open resetlogs';

sql statement: alter database open resetlogs
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 08/10/2012 18:24:29
RMAN-11003: failure during parse/execution of SQL statement: alter database open resetlogs
ORA-00349: failure obtaining block size for '/oracle/oradata/orcl/redo01.log'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 9

######################################################
修改控制文件里面redolog 路径
SQL> select group#,member from v$logfile;

GROUP#
----------
MEMBER
--------------------------------------------------------------------------------
3
/oracle/oradata/orcl/redo03.log

2
/oracle/oradata/orcl/redo02.log

1
/oracle/oradata/orcl/redo01.log


alter database rename file '/oracle/oradata/orcl/redo01.log' to '/u01/oradata/orcl/redo01.log';
alter database rename file '/oracle/oradata/orcl/redo02.log' to '/u01/oradata/orcl/redo02.log';
alter database rename file '/oracle/oradata/orcl/redo03.log' to '/u01/oradata/orcl/redo03.log';


####################################################################
SQL> alter database open resetlogs;

Database altered.


#####################################################################


恢复完成





相关文档
最新文档