redhat6.3 x86_64系统oracle 12c版本数据库,如何运用rman进行单表恢复并移动到指定表空间

wujianqing18 2017-10-13 05:59:57
redhat6.3系统
在pdb数据库(pdb1)中创建了俩个表空间,分别为n1和n2,n1隶属于pdb1数据库下mars用户默认表空间是n1,并给了mars用户表空间n2的权限
create user mars identified by mars default tablespace n1;
alter user mars quota unlimited on n2;
表空间n1下有表t1和t4
SQL> select table_name,tablespace_name from all_tables where table_name = 'T1' ;

TABLE_NAME TABLESPACE_NAME
-------------------------------------------------------------------------------- ------------------------------
T1 N1
SQL> select table_name,tablespace_name from all_tables where table_name = 'T4' ;

TABLE_NAME TABLESPACE_NAME
-------------------------------------------------------------------------------- ------------------------------
T4 N1
表空间n2下有表t2
SQL> select table_name,tablespace_name from all_tables where table_name = 'T2' ;

TABLE_NAME TABLESPACE_NAME
-------------------------------------------------------------------------------- ------------------------------
T2 N2
表内数据如下:
SQL> select * from mars.t1
2 ;

ID
----------
1

SQL> select * from mars.t2 ;

no rows selected

SQL> select * from mars.t4 ;

no rows selected
进到rman进行备份执行backup database;
备份后,查询当前SCN号
SQL> select current_scn from v$database ;

CURRENT_SCN
-----------
11788104
恢复语句以及结果如下
[oracle@wjq ~]$ rman target /

Recovery Manager: Release 12.1.0.2.0 - Production on Mon Oct 2 10:04:20 2017

Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.

connected to target database: ORCL (DBID=1467166649)

RMAN> run
2> {
3> recover table mars.t1 of pluggable database pdb1
4> until scn 11788104
5> auxiliary destination '/home/oracle/recover'
6> datapump destination '/home/oracle/dumpfiles'
7> remap tablespace n1:n2 ;
8> }

Starting recover at 02-OCT-17
using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 10/02/2017 10:05:42
RMAN-05063: Cannot recover specified tables
RMAN-05112: table "MARS"."T1" already exists
请问恢复语句有什么错误么?为什么?怎么解决?谢谢各位大神!
...全文
756 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
minsic78 2017-10-19
  • 打赏
  • 举报
回复
引用 5 楼 wujianqing18 的回复:
并没有覆盖表,而是将表移动到别的表空间中
但是你没有更改schema啊,文档里写的很清楚了吧。
wujianqing18 2017-10-19
  • 打赏
  • 举报
回复
并没有覆盖表,而是将表移动到别的表空间中
minsic78 2017-10-19
  • 打赏
  • 举报
回复
查了下官方在线文档,原表存在的情况下确实不能覆盖,只能删除原表或者remap_table:
引用
TABLE schema.table[:partition] Specifies the tables or table partitions that must be recovered. The target database must be in read-write mode. Before performing the recovery, RMAN checks if there is sufficient space on the target host to store files for the auxiliary instance that is used during recovery. If sufficient space does not exist, then RMAN displays an error message and exits. You can assign new names for recovered tables or table partitions in the target database by using the REMAP TABLE option. When the recovered tables are imported into the target database, if a table with the same name exists in the target database, an error message is displayed indicating that the REMAP TABLE clause must be used to rename the tables. When you recover only certain partitions from a partitioned table, each partition is imported into the target database as separate table. If REMAP TABLE is not used to rename recovered objects, RMAN names each table by using a concatenation of the table name and partition name. The table names of the recovered objects are in the format tablename_partitionname. If a table with this name exists in the target database, RMAN appends _1 to the generated table name. If a table with this name too exists, RMAN appends _2 to the table name, and so on.
minsic78 2017-10-19
  • 打赏
  • 举报
回复
这个是12c的新功能?还能恢复单表了啊
wujianqing18 2017-10-19
  • 打赏
  • 举报
回复
把表删了,恢复成功了。 还想问一下,为什么要将表删除??
碧水幽幽泉 2017-10-13
  • 打赏
  • 举报
回复
你这个是恢复表和数据。
删除T1后,使用RMAN命令恢复试试。

3,491

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 高级技术相关讨论专区
社区管理员
  • 高级技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧