ORACLE 12C使用RMAN进行表恢复
admin
2023-04-14 10:21:26
0



     在12C以前的版本中rman可以进行db,tablespace,datafile,block级别和TSPITR的恢复,12C引入了table级别的恢复
在没有打开flashback的时候可以进行单个表的恢复.
 
例,创建表


SQL>  alter session set container=pdb2;

Session altered.

SQL> create table frank.t1 as select * from dba_tables;

Table created.


备份数据库

RMAN> backup database;

Starting backup at 16-JAN-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=265 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/u01/app/oracle/oradata/c12/sysaux01.dbf
input datafile file number=00001 name=/u01/app/oracle/oradata/c12/system01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/c12/undotbs01.dbf
input datafile file number=00038 name=/home/oracle/t1.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/c12/users01.dbf
input datafile file number=00014 name=/u01/app/oracle/product/12.1.0/db_1/dbs/test

....................

查询当前数据库的scn号

SQL> select current_scn from v$database;

CURRENT_SCN
-----------
    4898443


SQL> drop table frank.t1;

 


[oracle@o12c ~]$ mkdir /home/oracle/abc


RMAN> recover table frank.t1 of pluggable database pdb2
2>  until scn 4898443
3>  auxiliary destination '/home/oracle/abc'
4>   datapump destination '/home/oracle/abc';

Starting recover at 16-JAN-14
using channel ORA_DISK_1
RMAN-05026: WARNING: presuming following set of tablespaces applies to specified Point-in-Time

List of tablespaces expected to have UNDO segments
Tablespace SYSTEM
Tablespace UNDOTBS1

Creating automatic instance, with SID='vewD'

initialization parameters used for automatic instance:
db_name=C12
db_unique_name=vewD_pitr_pdb2_C12
compatible=12.1.0.0.0
db_block_size=8192
db_files=200
sga_target=1G
processes=80
diagnostic_dest=/u01/app/oracle
db_create_file_dest=/home/oracle/abc
log_archive_dest_1='location=/home/oracle/abc'
enable_pluggable_database=true
_clone_one_pdb_recovery=true
#No auxiliary parameter file used


starting up automatic instance C12

Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2296576 bytes
Variable Size                281019648 bytes
Database Buffers             780140544 bytes
Redo Buffers                   5480448 bytes
Automatic instance created

contents of Memory Script:

..............................................................


也是会新建一个auxiliary  instance,然后在auxiliary instance上做全库恢复再通过datapump工具导出和导入
整个过程和TSPITR极为相似.

恢复成功再次查询


SQL> select count(*) from frank.t1;

  COUNT(*)
----------
        2318

注意common user引用表的名称为 "c##frank".t1,而不是"c##frank.t1",否则会报以下错误
RMAN> recover table "c##frank.t1" until scn 4894140 auxiliary destination '/home/oracle/abc' datapump destination '/home/oracle/abc';

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "until": expecting one of: "dot"
RMAN-01007: at line 1 column 29 file: standard input

 


相关内容

热门资讯

赖清德窜访媚外,金门老百姓却苦... 探访厦金大桥赖清德“偷渡式”窜访,岛内民众大骂:这边民生受阻,那边你还去给外国人“跪”。反观今年4月...
特朗普访华,通用汽车和福特高层... 【文/观察者网 潘昱辰 编辑/高莘】美国总统特朗普将于5月13-15日对中国进行国事访问。据白宫披露...
还是谈不成,特朗普没招了 作者 | 谢奕秋 编辑 | 阿树美伊新一轮的和平提议交换,至5月10日宣告无果而终。伊朗对美国提案的...
网传“45岁独身男子病逝15万... 近日,南京一位老人照顾独身病侄,侄子离世后15万存款被转走的事件引发广泛关注。5月12日,针对网传“...
亚太经合组织电信工作组第72次... 来源:上海证券报·中国证券网 上证报中国证券网讯 据工业和信息化部5月12日消息,5月11日,亚太经...
银星能源获得实用新型专利授权:... 证券之星消息,根据天眼查APP数据显示银星能源(000862)新获得一项实用新型专利授权,专利名为“...
特朗普访华在即,随行商界大咖都... 美国总统特朗普将于5月13日至15日对中国进行国事访问。这是中美两国元首继去年10月釜山之后再次面对...
有线电视机顶盒安装问题求安装方... 有线电视安装说明: 一、将白色有线电视线一端连接有线电视终端盒另一端连接机顶盒后的射频输入口。 ...
60寸电视机尺寸画面长宽是多少...   60寸的液晶电视,60寸就是指电视屏幕对角线长度,因为长宽比有两种情况,经过寸转化为厘米计算之后...
长城电视机尺寸测量方法 长城电视机的尺寸测量方法与其他品牌的电视机测量方法基本相同。需要准备的工具有卷尺或直尺等测量工具,以...