在生产系统中,因业务需求,56张表中清空54张表数据,另外两张表数据保留,数据量大约10G左右:
1.大部分人想法就是expdp/impdp,的确是这样,哈哈

2.rman

3.以下方法,move

虚拟机单表模拟如下:
[oracle@db01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Nov 3 18:40:16 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/orcl/system01.dbf
/u01/app/oracle/oradata/orcl/sysaux01.dbf
/u01/app/oracle/oradata/orcl/undotbs01.dbf
/u01/app/oracle/oradata/orcl/users01.dbf

创建表空间
SQL> create tablespace dahao datafile '/u01/app/oracle/oradata/orcl/dahao01.dbf' size 100m;

Tablespace created.

创建用户
SQL> create user dahao identified by dahao default tablespace dahao;

User created.

授权
SQL> grant dba to dahao;

Grant succeeded.

SQL> conn dahao/dahao
Connected.

SQL> show user
USER is "DAHAO"

创建测试表
SQL> create table dahao as select * from scott.emp;

Table created.

查看索引
SQL> select index_name from user_indexes;

no rows selected

创建索引
SQL> create index index_empno on dahao(empno) tablespace users;

Index created.

查看索引
SQL> select index_name from user_indexes;

INDEX_NAME
------------------------------
INDEX_EMPNO

创建表move的表空间
SQL> create tablespace yoon datafile '/u01/app/oracle/oradata/orcl/yoon01.dbf' size 100m;

Tablespace created.

将表设置只读模式
SQL> alter table dahao.dahao read only;

Table altered.

迁移表对应表空间
SQL> alter table dahao.dahao move tablespace yoon;

Table altered.

修改用户默认表空间
SQL> alter user dahao identified by dahao default tablespace yoon;

User altered.

查看表状态
SQL> select TABLE_NAME,TABLESPACE_NAME,READ_ONLY from dba_tables where owner='DAHAO' and table_name='DAHAO';

TABLE_NAME                     TABLESPACE_NAME                REA
------------------------------ ------------------------------ ---
DAHAO                          YOON                           YES

SQL> show user
USER is "DAHAO"

SQL> select index_name from user_indexes;

INDEX_NAME
------------------------------
INDEX_EMPNO

查看索引状态,失效
SQL> select INDEX_NAME,TABLE_OWNER,TABLE_NAME,STATUS from user_indexes where index_name='INDEX_EMPNO';

INDEX_NAME                     TABLE_OWNER                    TABLE_NAME                     STATUS
------------------------------ ------------------------------ ------------------------------ --------
INDEX_EMPNO                    DAHAO                          DAHAO                          UNUSABLE

重建索引
SQL> alter index index_empno rebuild tablespace users;

Index altered.

查看用户默认表空间
SQL> select username,default_tablespace from dba_users;
DAHAO                          YOON

将表设置读写模式
SQL> alter table dahao read write;

Table altered.

查看表状态
SQL> select TABLE_NAME,TABLESPACE_NAME,READ_ONLY from dba_tables where owner='DAHAO' and table_name='DAHAO';

TABLE_NAME                     TABLESPACE_NAME                REA
------------------------------ ------------------------------ ---
DAHAO                          YOON                           NO

oracle 表迁移方法 (一)的更多相关文章

  1. oracle 表迁移方法 (二) 约束不失效

    DB:11.2.0.3.0 在oracle 表迁移方法 (一)中,只是move了一张普通的表,如果表的字段带有主键约束呢 ? [oracle@db01 ~]$ sqlplus / as sysdba ...

  2. Oracle表空间数据文件移动的方法

    最近遇到这样的一个问题,Oracle存放表空间文件的盘符 空间不够了,必须把部分表空间迁移出去, [转]http://www.jb51.net/article/77026.htm 实现把用户表空间中的 ...

  3. oracle 表空间和表 read only迁移后不再read only

    DB :  11.2.0.3.0 1.将tablespace read only , 不允许再对表进行update.insert操作,测试dmp到另一个用户.表空间后是否可以update.insert ...

  4. 将Oracle表导入到Access方法,已经安装了Access但Win7提示 找不到access driver

    已经安装了Access但Win7提示 找不到access driver: 1.打开 "C:\Windows\SysWOW64\odbcad32.exe" 2.管理员cmd运行 命令 ...

  5. oracle表空间表分区详解及oracle表分区查询使用方法(转+整理)

    欢迎和大家交流技术相关问题: 邮箱: jiangxinnju@163.com 博客园地址: http://www.cnblogs.com/jiangxinnju GitHub地址: https://g ...

  6. Oracle 11gR2 用exp无法导出空表解决方法

    Oracle 11gR2 用exp无法导出空表解决方法 在11gR2中有个新特性,当表无数据时,不分配segment以节省空间.Oracle 当然在运行export导出时,空表则无法导出,可是还是有解 ...

  7. ORACLE表数据误删除的恢复方法(提交事务也可以)

    ORACLE表数据误删除的恢复方法(提交事务也可以) 缓存加时间戳 开启行移动功能:ALTER TABLE tablename ENABLE row movement 把表还原到指定时间点:flash ...

  8. Oracle表空间迁移Move Tablespace

    move一个表到另外一个表空间时,索引不会跟着一起move,而且会失效.(LOB类型例外) move分为: *普通表move *分区表move *LONG,LOB大字段类型move来进行测试和说明. ...

  9. ORACLE 表空间扩展方法

    ORACLE 表空间扩展方法 环境: linux系统 工具:PL/SQL DEVELOPER 第一步:查看表空间的名字及文件所在位置: select tablespace_name, file_id, ...

随机推荐

  1. VMware10中的CentOS6.5命令行安装VMwaretools工具启用windows与虚拟机中Linux系统的共享目录

    VMware10中的CentOS6.5命令行安装VMwaretools工具启用windows与虚拟机中Linux系统的共享目录 一.描述 系统描述:win7旗舰版64位系统+VMware Workst ...

  2. 使用C#调用windows API入门

    一:入门,直接从 C# 调用 DLL 导出   其实我们的议题应该叫做C#如何直接调用非托管代码,通常有2种方法: 1.  直接调用从 DLL 导出的函数. 2.  调用 COM 对象上的接口方法 我 ...

  3. SQL to_char,to_date日期字符串转换问题

    1.转换函数 与date操作关系最大的就是两个转换函数:to_date(),to_char() to_date() 作用将字符类型按一定格式转化为日期类型: 具体用法:to_date('2004-11 ...

  4. Winserver2008R2 .netframework4.5 asp.netmvc 访问出现的是文件列表。

    Winserver2008R2 .netframework4.5 asp.netmvc 访问出现的是文件列表,服务器需要安装如下的补丁,才可正常访问. http://www.microsoft.com ...

  5. Android基础总结(2)——活动Activity

    1.什么是活动(Activity) 活动(Activity)是一种可以包含用户界面的组件,主要用于和用户进行交互.一个应用程序中可以包含零个或多个活动,但不包含任何活动的应用程序很少见. 2.怎么使用 ...

  6. Leetcode008. String to Integer (atoi)

    /* improvement on dealing with overflow accroding to this: * https://discuss.leetcode.com/topic/5745 ...

  7. js的二元三元操作符

    二元 if ( a == b) { alert(a) } // (a == b) && alert(a) if ( a != b) { alert(a) } // (a == b) | ...

  8. Windows phone 8 学习笔记(6) 多任务(转)

    Windows phone 8 是一个单任务操作系统,任何时候都只有一个应用处于活跃状态,这里的多任务是指对后台任务的支持.本节我们先讲讲应用程序的运行状态,然后看看支持的后台任务,包括:后台代理.后 ...

  9. angular $apply()以及$digest()讲解1

    一些知名的批评和缺陷.他们都涉及到$digest loop(更新周期)中一个很常见的问题:如何在Angular之外更新$scope? 在哪调用 $apply? 更佳的做法是确保你是在$digest l ...

  10. Android IOS WebRTC 音视频开发总结(五六)-- 如何测试网络性能?

    本文主要介绍如何测试网络性能,文章来自博客园RTC.Blacker,欢迎关注微信公众号blacker,更多详见www.rtc.help 网络性能直接决定了视频通话效果,比如qq,很多时候我们我们觉得通 ...