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
请问恢复语句有什么错误么?为什么?怎么解决?谢谢各位大神!
...全文
754 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命令恢复试试。
SecureCRT and SecureFX v7.3.3 x86 x64 build 779 注册破解正式版 2015年3月31日官方正式更新发布! 附带了注册机和注册说明,亲测可用 SecureCRT是一款支持SSH(SSH1和SSH2)的终端仿真程序,简单地说是Windows下登录UNIX或Linux服务器主机的软件。SecureCRT支持SSH,同时支持Telnet和rlogin协议。SecureCRT是一款用于连接运行包括Windows、UNIX和VMS的理想工具。通过使用内含的VCP命令行程序可以进行加密文件的传输。有流行CRTTelnet客户机的所有特点,包括:自动注册、对不同主机保持不同的特性、打印功能、颜色设置、可变屏幕尺寸、用户定义的键位图和优良的VT100,VT102,VT220和ANSI竞争.能从命令行中运行或从浏览器中运行.其它特点包括文本手稿、易于使用的工具条、用户的键位图编辑器、可定制的ANSI颜色等.SecureCRT的SSH协议支持DES,3DES和RC4密码和密码与RSA鉴别。 SecureFX 支持三种文件传输协议:FTP、SFTP 和 FTP over SSH2。它可以提供安全文件传输。无论您连接的是任何一种操作系统的服务器,它都能提供安全的传输服务。它主要用于Linux操作系统redhat, ubuntu的客户端文件传输程序,您可以选择利用SFTP通过加密的SSH2实现安全传输,也可以利用FTP进行标准传输。该客户端具有Explorer风格的界面,易于使用,同时提供强大的自动化能力,可以实现自动化的安全文件传输。

3,491

社区成员

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

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