oracle数据库rman备份计划及恢复

1.rman完全恢复的前提条件:历史的datafile,controlfile和spfile备份,加上完整的archivelog和完好的redolog。

2.rman备份脚本:

  a.RMAN 0级备份命令:

run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
backup incremental level 0 tag  ‘level0‘  format "E:\recovery_area\rfdb\rfdb\AUTOBACKUP\rman_dir\RFDB_level_0_%u_%s_%p"  as compressed backupset
database;
sql "alter system archive log current";
backup filesperset 3 format "E:\recovery_area\rfdb\rfdb\AUTOBACKUP\rman_dir\arch_%u_%s_%p_%c"
archivelog all delete input; #备份归档可选,可以单独定期备份
release channel c1;
release channel c2;
release channel c3;
}  

rman_level_0

  b.RMAN 1级备份命令:

run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
backup incremental level 1 tag  ‘level1‘ format ‘E:\recovery_area\rfdb\rfdb\AUTOBACKUP\rman_dir\RFDB_level_1_%u_%s_%p‘   as compressed backupset
database;
sql ‘alter system archive log current‘;
backup filesperset 3 format ‘E:\recovery_area\rfdb\rfdb\AUTOBACKUP\rman_dir\arch_%u_%s_%p‘
archivelog all delete input; #备份归档可选,可以单独定期备份
release channel c1;
release channel c2;
release channel c3;
}  

rman_level_1

  c.rman删除备份命令(在保留最近一天备份的情况下,删除其他备份):

DELETE NOPROMPT OBSOLETE RECOVERY WINDOW OF 1 DAYS;   

  d.操作系统层面运行rman备份或删除命令:

rman target sys/[email protected] nocatalog CMDFILE ‘D:\app\rman\rman_file\level_0.txt‘ log=E:\recovery_area\rfdb\rfdb\AUTOBACKUP\rman_dir\log\rman_level_0.log

3.rman恢复

a.拷贝datafile,controlfile和spfile的rman备份,以及完整的archivelog和完好的redolog文件到新的数据库。

b.切换至oracle用户,进入rman(先设置sid):

export ORACLE_SID=rfdb
rlwrap  rman target /

c.启动一个伪实例:

RMAN> startup nomount

connected to target database (not started)
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file ‘/u01/app/oracle/product/11.2.0/db1/dbs/initrfdb.ora‘

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

Total System Global Area    1068937216 bytes

Fixed Size                     2260088 bytes
Variable Size                281019272 bytes
Database Buffers             780140544 bytes
Redo Buffers                   5517312 bytes

d.在伪实例下恢复spfile文件(必须要指定rman的备份片):

RMAN> restore spfile from "/u01/ora_bak/ora_bak/autobackup/2015_12_07/o1_mf_s_897845728_c6bnq1rq_.bkp";

Starting restore at 14-DEC-15
using channel ORA_DISK_1

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/ora_bak/ora_bak/autobackup/2015_12_07/o1_mf_s_897845728_c6bnq1rq_.bkp
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 14-DEC-15

e.关闭伪实例,用spfile文件启动至nomount状态:

RMAN> shutdown abort

Oracle instance shut down

RMAN> startup nomount

connected to target database (not started)
Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2260088 bytes
Variable Size                910164872 bytes
Database Buffers             150994944 bytes
Redo Buffers                   5517312 bytes

f.恢复控制文件(必须要指定rman的备份片,备份片应该和spfile的恢复片是同一个):

RMAN> restore controlfile from "/u01/ora_bak/ora_bak/autobackup/2015_12_07/o1_mf_s_897845728_c6bnq1rq_.bkp";

Starting restore at 14-DEC-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1146 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/ATEST/controlfile/o1_mf_c5fr9b0h_.ctl
output file name=/u01/app/oracle/fast_recovery_area/ATEST/controlfile/o1_mf_c5fr9b6n_.ctl
Finished restore at 14-DEC-15

g.启动数据库至mount状态:

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

h.把拷贝到新机器的备份文件注册到(刚恢复的)控制文件中(redolog不能被注册,所以最后有报错,没有关系):

RMAN> catalog start with "/u01/ora_bak";

Starting implicit crosscheck backup at 14-DEC-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1146 device type=DISK
Crosschecked 1 objects
Finished implicit crosscheck backup at 14-DEC-15

Starting implicit crosscheck copy at 14-DEC-15
using channel ORA_DISK_1
Finished implicit crosscheck copy at 14-DEC-15

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/app/oracle/fast_recovery_area/ATEST/backupset/2015_12_09/o1_mf_nnndf_TAG20151209T161546_c6hrslnq_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ATEST/autobackup/2015_12_09/o1_mf_s_898014415_c6hsghgm_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ATEST/autobackup/2015_12_09/o1_mf_s_898013812_c6hrvo18_.bkp

searching for all files that match the pattern /u01/ora_bak

List of Files Unknown to the Database
=====================================
File Name: /u01/ora_bak/O1_MF_S_895896351_C4KSF2YN_.BKP
File Name: /u01/ora_bak/ora_bak/arch/1_11_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_23_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_19_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_33_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_8_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_9_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_17_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_21_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_20_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_12_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_6_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_14_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_26_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_24_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_30_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_16_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_22_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_7_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_27_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_31_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_25_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_29_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_28_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_13_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_18_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_10_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_15_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_32_896812716.dbf
File Name: /u01/ora_bak/ora_bak/controlfile/o1_mf_c5fr9b6n_.ctl
File Name: /u01/ora_bak/ora_bak/onlinelog_f/o1_mf_2_c5fr9h1f_.log
File Name: /u01/ora_bak/ora_bak/onlinelog_f/o1_mf_3_c5fr9kfo_.log
File Name: /u01/ora_bak/ora_bak/onlinelog_f/o1_mf_1_c5fr9ds4_.log
File Name: /u01/ora_bak/ora_bak/onlinelog/o1_mf_3_c5fr9k9d_.log
File Name: /u01/ora_bak/ora_bak/onlinelog/o1_mf_2_c5fr9gy5_.log
File Name: /u01/ora_bak/ora_bak/onlinelog/o1_mf_1_c5fr9dmk_.log
File Name: /u01/ora_bak/ora_bak/backupset/2015_12_07/o1_mf_nnndf_TAG20151207T173421_c6bnnxsl_.bkp
File Name: /u01/ora_bak/ora_bak/autobackup/2015_12_07/o1_mf_s_897845728_c6bnq1rq_.bkp
File Name: /u01/ora_bak/O1_MF_S_895896118_C4KS5S1R_.BKP

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/ora_bak/ora_bak/arch/1_11_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_23_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_19_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_33_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_8_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_9_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_17_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_21_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_20_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_12_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_6_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_14_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_26_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_24_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_30_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_16_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_22_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_7_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_27_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_31_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_25_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_29_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_28_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_13_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_18_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_10_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_15_896812716.dbf
File Name: /u01/ora_bak/ora_bak/arch/1_32_896812716.dbf
File Name: /u01/ora_bak/ora_bak/backupset/2015_12_07/o1_mf_nnndf_TAG20151207T173421_c6bnnxsl_.bkp
File Name: /u01/ora_bak/ora_bak/autobackup/2015_12_07/o1_mf_s_897845728_c6bnq1rq_.bkp

List of Files Which Where Not Cataloged
=======================================
File Name: /u01/ora_bak/O1_MF_S_895896351_C4KSF2YN_.BKP
  RMAN-07518: Reason: Foreign database file DBID: 966107096  Database Name: RFDB
File Name: /u01/ora_bak/ora_bak/controlfile/o1_mf_c5fr9b6n_.ctl
  RMAN-07519: Reason: Error while cataloging. See alert.log.
File Name: /u01/ora_bak/ora_bak/onlinelog_f/o1_mf_2_c5fr9h1f_.log
  RMAN-07529: Reason: catalog is not supported for this file type
File Name: /u01/ora_bak/ora_bak/onlinelog_f/o1_mf_3_c5fr9kfo_.log
  RMAN-07529: Reason: catalog is not supported for this file type
File Name: /u01/ora_bak/ora_bak/onlinelog_f/o1_mf_1_c5fr9ds4_.log
  RMAN-07529: Reason: catalog is not supported for this file type
File Name: /u01/ora_bak/ora_bak/onlinelog/o1_mf_3_c5fr9k9d_.log
  RMAN-07529: Reason: catalog is not supported for this file type
File Name: /u01/ora_bak/ora_bak/onlinelog/o1_mf_2_c5fr9gy5_.log
  RMAN-07529: Reason: catalog is not supported for this file type
File Name: /u01/ora_bak/ora_bak/onlinelog/o1_mf_1_c5fr9dmk_.log
  RMAN-07529: Reason: catalog is not supported for this file type
File Name: /u01/ora_bak/O1_MF_S_895896118_C4KS5S1R_.BKP
  RMAN-07518: Reason: Foreign database file DBID: 966107096  Database Name: RFDB

i.开始restore数据文件:

RMAN> restore database;

Starting restore at 14-DEC-15
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/ATEST/datafile/o1_mf_system_c5fr6s3v_.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/ATEST/datafile/o1_mf_sysaux_c5fr6s6d_.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/ATEST/datafile/o1_mf_undotbs1_c5fr6s7n_.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/ATEST/datafile/o1_mf_users_c5fr6s88_.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/ATEST/backupset/2015_12_09/o1_mf_nnndf_TAG20151209T161546_c6hrslnq_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/ATEST/backupset/2015_12_09/o1_mf_nnndf_TAG20151209T161546_c6hrslnq_.bkp tag=TAG20151209T161546
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 14-DEC-15

j.开始recover数据(在此之前,需要先拷贝redolog到控制文件默认的路径下):

redolog默认路径:

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_3_c5fr9k9d_.log
/u01/app/oracle/fast_recovery_area/ATEST/onlinelog/o1_mf_3_c5fr9kfo_.log
/u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_2_c5fr9gy5_.log
/u01/app/oracle/fast_recovery_area/ATEST/onlinelog/o1_mf_2_c5fr9h1f_.log
/u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_1_c5fr9dmk_.log
/u01/app/oracle/fast_recovery_area/ATEST/onlinelog/o1_mf_1_c5fr9ds4_.log

6 rows selected.

开始recover数据库:

RMAN> recover database;

Starting recover at 14-DEC-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1137 device type=DISK

starting media recovery

archived log for thread 1 with sequence 15 is already on disk as file /u01/ora_bak/ora_bak/arch/1_15_896812716.dbf
archived log for thread 1 with sequence 16 is already on disk as file /u01/ora_bak/ora_bak/arch/1_16_896812716.dbf
archived log for thread 1 with sequence 17 is already on disk as file /u01/ora_bak/ora_bak/arch/1_17_896812716.dbf
archived log for thread 1 with sequence 18 is already on disk as file /u01/ora_bak/ora_bak/arch/1_18_896812716.dbf
archived log for thread 1 with sequence 19 is already on disk as file /u01/ora_bak/ora_bak/arch/1_19_896812716.dbf
archived log for thread 1 with sequence 20 is already on disk as file /u01/ora_bak/ora_bak/arch/1_20_896812716.dbf
archived log for thread 1 with sequence 21 is already on disk as file /u01/ora_bak/ora_bak/arch/1_21_896812716.dbf
archived log for thread 1 with sequence 22 is already on disk as file /u01/ora_bak/ora_bak/arch/1_22_896812716.dbf
archived log for thread 1 with sequence 23 is already on disk as file /u01/ora_bak/ora_bak/arch/1_23_896812716.dbf
archived log for thread 1 with sequence 24 is already on disk as file /u01/ora_bak/ora_bak/arch/1_24_896812716.dbf
archived log for thread 1 with sequence 25 is already on disk as file /u01/ora_bak/ora_bak/arch/1_25_896812716.dbf
archived log for thread 1 with sequence 26 is already on disk as file /u01/ora_bak/ora_bak/arch/1_26_896812716.dbf
archived log for thread 1 with sequence 27 is already on disk as file /u01/ora_bak/ora_bak/arch/1_27_896812716.dbf
archived log for thread 1 with sequence 28 is already on disk as file /u01/ora_bak/ora_bak/arch/1_28_896812716.dbf
archived log for thread 1 with sequence 29 is already on disk as file /u01/ora_bak/ora_bak/arch/1_29_896812716.dbf
archived log for thread 1 with sequence 30 is already on disk as file /u01/ora_bak/ora_bak/arch/1_30_896812716.dbf
archived log for thread 1 with sequence 31 is already on disk as file /u01/ora_bak/ora_bak/arch/1_31_896812716.dbf
archived log for thread 1 with sequence 32 is already on disk as file /u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_2_c5fr9gy5_.log
archived log for thread 1 with sequence 33 is already on disk as file /u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_3_c5fr9k9d_.log
archived log for thread 1 with sequence 34 is already on disk as file /u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_1_c5fr9dmk_.log
archived log file name=/u01/ora_bak/ora_bak/arch/1_15_896812716.dbf thread=1 sequence=15
archived log file name=/u01/ora_bak/ora_bak/arch/1_16_896812716.dbf thread=1 sequence=16
archived log file name=/u01/ora_bak/ora_bak/arch/1_17_896812716.dbf thread=1 sequence=17
archived log file name=/u01/ora_bak/ora_bak/arch/1_18_896812716.dbf thread=1 sequence=18
archived log file name=/u01/ora_bak/ora_bak/arch/1_19_896812716.dbf thread=1 sequence=19
archived log file name=/u01/ora_bak/ora_bak/arch/1_20_896812716.dbf thread=1 sequence=20
archived log file name=/u01/ora_bak/ora_bak/arch/1_21_896812716.dbf thread=1 sequence=21
archived log file name=/u01/ora_bak/ora_bak/arch/1_22_896812716.dbf thread=1 sequence=22
archived log file name=/u01/ora_bak/ora_bak/arch/1_23_896812716.dbf thread=1 sequence=23
archived log file name=/u01/ora_bak/ora_bak/arch/1_24_896812716.dbf thread=1 sequence=24
archived log file name=/u01/ora_bak/ora_bak/arch/1_25_896812716.dbf thread=1 sequence=25
archived log file name=/u01/ora_bak/ora_bak/arch/1_26_896812716.dbf thread=1 sequence=26
archived log file name=/u01/ora_bak/ora_bak/arch/1_27_896812716.dbf thread=1 sequence=27
archived log file name=/u01/ora_bak/ora_bak/arch/1_28_896812716.dbf thread=1 sequence=28
archived log file name=/u01/ora_bak/ora_bak/arch/1_29_896812716.dbf thread=1 sequence=29
archived log file name=/u01/ora_bak/ora_bak/arch/1_30_896812716.dbf thread=1 sequence=30
archived log file name=/u01/ora_bak/ora_bak/arch/1_31_896812716.dbf thread=1 sequence=31
archived log file name=/u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_2_c5fr9gy5_.log thread=1 sequence=32
archived log file name=/u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_3_c5fr9k9d_.log thread=1 sequence=33
archived log file name=/u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_1_c5fr9dmk_.log thread=1 sequence=34
media recovery complete, elapsed time: 00:00:04
Finished recover at 14-DEC-15

k.以resetlogs打开数据库(在此之前,先删除原来的redolog,因为数据库会重新创建一组redolog):

删除原来的redo:

rm -rf /u01/app/oracle/oradata/ATEST/onlinelog/*

以resetlogs打开数据库:

RMAN> alter database open resetlogs;

using target database control file instead of recovery catalog
database opened

至此,数据库恢复全部完成!

---恢复内容结束---

时间: 2024-10-26 02:01:41

oracle数据库rman备份计划及恢复的相关文章

利用SHELL脚本来验证Oracle数据库RMAN备份集的有效性

利用SHELL脚本来验证Oracle数据库RMAN备份集的有效性 作者:赵全文  网名:guestart 我们生产环境的Oracle数据库都做了RMAN备份,是采用了一周的RMAN备份保留策略:除了使用RMAN备份以外,我们还使用了爱数(Eisoo)备份软件来进行备份,可以说是做到了有备无患.可是,如果有一天,Oracle数据库由于主机层面硬件原因或是数据库层面的原因不能对外提供高可用服务的时候,假设数据丢了一大部分,我们只有用RMAN备份来进行恢复,再如果发现,RMAN备份失效了,那就往地缝里

ORACLE数据库文件丢失后的恢复测试

一.测试环境 数据库版本是11GR2,在做完一份完全备份之后,关机,做一份快照,每一次开机之后都执行数次alter system switch logfile以产生归档日志. 之后的测试都是基于这么一个完全备份来恢复. CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/backup/%F'; backup incremental level 0 format '/backup/%T_%f' database; 二.

Oracle数据库的备份方法

1.引言 Oracle数据库的备份方法很多,无论使用那种备份方法,备份的目的都是为了在出现故障后能够以尽可能小的时间和代价恢复系统.比如使用export实用程序导出数据库对象.使用Oracle备份数据库.使用Oracle对称复制.使用Oracle并行服务器.使用Oracle冷备份.使用Oracle热备份等各种备份方法都有其优缺点.适用的场合和相应的软硬件要求.本文主要就用export实用程序导出数据库对象.Oracle冷备份.Oracle热备份这三种最基本的备份方法进行详细的探讨,分析各自的优缺

ORACLE数据库不同故障下的恢复总结

ORACLE数据库不同故障下的恢复总结1. 非归档模式下丢失或损坏的文件--1.1 数据文件--启动数据库的状态到MOUNT--恢复方法:通过之前创建的数据库完整备份,修复整个数据库,不过备份之后发生的所有修改将丢失:修复数据库之后不需要进行RECOVER操作.(由于没有归档,也无从RECOVER),直接通过RESETLOGS方式打开数据库即可. --1.2 数据文件及联机重做日志文件--启动数据库的状态到MOUNT--恢复方法(同上):通过之前创建的数据库完整备份,修复整个数据库,不过备份之后

oracle数据库的备份及升级

以oracle用户登陆数据库所在的服务器,例如家目录为/home./oracle.执行以下命令进行备份操作. sqlplus /nolog connect /as sysdba sql>createdirectory dump_bx as '指定一个存放dmp文件的目录'; sql>grantread,write on directory dump_bx to  boss数据库的用户名称 ; sql>exit oracle>expdp boss数据库的用户名称/密码 directo

ORACLE中采用rman备份异机恢复数据库详细过程

场景:        有一个生产库的用户下面所有的表都不见了,怀疑人为被删除了,现在需要用备份去恢复下,找出原来的表,线上是oracle dataguard环境,有全库备份文件,准备去测试库恢复一下. 1,从生产库上copy好全备份文件恢复数据库需要准备的文件:rman完整备份(包括数据文件.日志文件.控制文件.参数文件),记录源数据库的DBID 安装的测试数据库ORACLE数据库软件并创建跟源数据库同名和数据库SID并修改数据库DBID跟源数据库DBID一样,创建跟源数据库服务器相同的数据文件

oracle数据库rman异地恢复

自己想做两组rac之间的data guard,由于datafile,controlfile,甚至是archivelog都是存放在asm上的,直接复制数据有点不现实,asm磁盘总归都是要用的,所以想从a库做rman全备份,然后把备份文件拷贝到b库上做rman恢复,初衷就是这么简单,结果却遇到了n多的折腾,无法实现,下面是我自己经过无数次测试得到的方法. oracle版本:11.2.0.0 第一组RAC A PS:前面的hostname,冒号后面是instancenamerac1:orcl1rac2

netbackup 7.5.0.7 之oracle数据库的备份和恢复

Oracle数据库的数据结构 Oracle的文件系统主要分为四大部分: 1) 控制文件 2) 数据文件 3) 日志文件 4) 其他文件(如参数文件,密码文件等) 前三种文件系是Oracle文件系统的主要组成部分,一般在以下路径可以找到: $ORACLE_HOME$\oradata\orcl .CTL文件为控制文件 .DBF 文件为数据文件 .LOG 文件为日志文件 除了前三种文件还有一种参数文件,参数文件不是数据库系统中的有效组成部分,在启动数据库时,参数文件不直接参与工作,只是控制文件是由参数

使用rman备份异机恢复数据库

一.RMAN备份源库注意点: 最好保留rman备份日志 $rman target / log=backup.log RMAN>run { allocate channel t1 type disk; allocate channel t2 type disk; allocate channel t3 type disk; allocate channel t4 type disk; backup format '<give location of backup/%U>' filesper