http://blog.csdn.net/macliukaijie/article/details/8308643

1、创建两个表空间

SQL> create tablespace test1 datafile '/opt/test1.dbf' size 10m;

Tablespace created

SQL> create tablespace test2 datafile '/opt/test2.dbf' size 10m;

Tablespace created

2、创建两个用户

SQL> create user test1 identified by test1 default tablespace test1;

User created

SQL> create user test2 identified by test2 default tablespace test2;

User created

3.给权限

SQL> grant connect,resource to test1;

Grant succeeded

SQL> grant connect,resource to test2;

Grant succeeded

4.在test1表空间里建表

conn test1/test1
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 
Connected as test1

SQL> create table t(i number) tablespace test1;

Table created

SQL> begin 
  2  for i in 1..10000 loop
  3  insert into t values (i);
  4  end loop;
  5  commit;
  6  end ;
  7  
  8  /

PL/SQL procedure successfully completed

5.把表空间设置成只读模式

SQL> alter tablespace test1 read only;

Tablespace altered

6、使用transport tablespace导出数据

SQL> host exp transport_tablespace=y tablespaces=test1 file=/opt/test1.dmp

Export: Release 10.2.0.1.0 - Production on Mon Dec 17 04:44:11 2012

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

Username: sys   
Password:

EXP-00056: ORACLE error 28009 encountered
ORA-28009: connection as SYS should be as SYSDBA or SYSOPER
Username: sys as sysdba 
Password:

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)
Note: table data (rows) will not be exported
About to export transportable tablespace metadata...
For tablespace TEST1 ...
. exporting cluster definitions
. exporting table definitions
. . exporting table                              T
. exporting referential integrity constraints
. exporting triggers
. end transportable tablespace metadata export
Export terminated successfully without warnings.

7.将数据移到test2用户下

SQL> host imp transport_tablespace=y file=/opt/test1.dmp fromuser=test1 touser=test2 datafiles='/opt/test1.dbf';

Import: Release 10.2.0.1.0 - Production on Mon Dec 17 04:50:24 2012

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

Username: sys as sysdba
Password:

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

Export file created by EXPORT:V10.02.01 via conventional path
About to import transportable tablespace(s) metadata...
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses WE8ISO8859P1 character set (possible charset conversion)
. importing TEST1's objects into TEST2
. . importing table                            "T"
Import terminated successfully without warnings.

8.查询test2用户下的数据

SQL> select count(*) from t;

COUNT(*)
----------
     10000

9、完成

-----------------------未验证------------------

------------------另------------------------------------------------------------------------

ORACLE数据库设置表空间为只读/写模式

了保证表空间数据完整性,比如:进行数据库备份与还原操作、历史数据的完整性保护等情况下,可以将表空间设置到只读模式。只读表空间中的表不能进行INSERT、UPDATE、DELETE等操作,但是可以删除数据库对象。

需要dba权限的用户登录才可以进行一下操作:

    SQL> select tablespace_name,status from dba_tablespaces;

    SQL> alter tablespace demo read only;

 SQL> select tablespace_name,status from dba_tablespaces;

 

   SQL> alter tablespace demo read write;

   SQL> select tablespace_name,status from dba_tablespaces;

transport tablespace将一个表空间下的数据移到另一个表空间的更多相关文章

  1. sql server中将一个表中的部分数据插入到另一个表中

    可以通过存储过程完成,也可以通过在库名上右击“新建查询”执行.语句其实基本相同. 1. 存储过程: CREATE PROCEDURE pro1 as insert into tableB (field ...

  2. SQL语句 怎么把从一个表中查出来数据插入到另一个表中

    (1).select * into destTbl from srcTbl(2).insert into destTbl(fld1, fld2) select fld1, 5 from srcTbl

  3. 如何将一个excel表格的数据匹配到另一个表中

    我们在操作excel表的时,有时需要将一个excel表中的数据匹配到另一个表中,那么就需要用到VLOOKUP函数,VLOOKUP函数是Excel中的一个纵向查找函数,VLOOKUP是按列查找,最终返回 ...

  4. VLOOKUP函数将一个excel表格的数据匹配到另一个表中

    sklearn实战-乳腺癌细胞数据挖掘(博主亲自录制视频) https://study.163.com/course/introduction.htm?courseId=1005269003& ...

  5. 【转载】SQL语句将一个表的数据写入到另一个表中

    在日常的数据库运维过程中,有时候需要将Select查询出来的数据集写入到另一个数据表中,其中一种方式是通过存储过程循环写入数据,另一种简便的方式是直接使用Insert Into语句后面跟上Select ...

  6. sql将一个表中的数据插入到另一个表中

    sql将一个表中的数据插入到另一个表中 列名不一定要相同,只要你在HH中列出要插入列的列表跟select   from   mm表中的选择的列的列表一一对应就可以了,当然两边的数据类型应该是兼容的.  ...

  7. mysql中把一个表的数据批量导入另一个表中

    mysql中把一个表的数据批量导入另一个表中   不管是在网站开发还是在应用程序开发中,我们经常会碰到需要将MySQL或MS SQLServer某个表的数据批量导入到另一个表的情况,甚至有时还需要指定 ...

  8. MySql中把一个表的数据插入到另一个表中的实现代码

    web开发中,我们经常需要将一个表的数据插入到另外一个表,有时还需要指定导入字段,设置只需要导入目标表中不存在的记录,虽然这些都可以在程序中拆分成简单sql来实现,但是用一个sql的话,会节省大量代码 ...

  9. Oracle查询一个表的数据插入到另一个表

    1. 新增一个表,通过另一个表的结构和数据 create table XTHAME.tab1 as select * from DSKNOW.COMBDVERSION 2. 如果表存在: insert ...

随机推荐

  1. shell 脚本实战笔记(1)--source/fork/exec的区别

    在linux shell编程中, 随着脚本处理规模的变大, 会嵌套调用子进程. 但父进程以不同的方式调用子进程, 其结果和背后的机制不尽相同.这边就简单描述下source/fork/exec调用子进程 ...

  2. 使用oss批量上传图片

    <?php set_time_limit(0);// 引入自动加载类// 确保路径是否正确require_once 'autoload.php';// 确定参数 需要申请$accessKeyId ...

  3. 刚查了,Z3795不支持EPT,即WP8开发必须的SLAT,看来只能作为简单的WINDOWS备机了

    刚查了,Z3795不支持EPT,即WP8开发必须的SLAT,看来只能作为简单的WINDOWS备机了,也就只能做做文档编辑,脚本编写之类的. 数据来源 http://ark.intel.com/zh-C ...

  4. iOS字符串拆分

    NSString* poStr = @"local-8009-1408082245-8.wav"; NSArray* poArr1 = [naviAddressAndPort co ...

  5. android中ListView_SimpleAdapter

    1.首先看下main_activity.xml.其实里面就放了一个ListView. <LinearLayout xmlns:android="http://schemas.andro ...

  6. hihoCoder #1127:二分图最小点覆盖和最大独立集

    题目大意:求二分图最小点覆盖和最大独立集. 题目分析:如果选中一个点,那么与这个点相连的所有边都被覆盖,使所有边都被覆盖的最小点集称为最小点覆盖,它等于最大匹配:任意两个点之间都没有边相连的最大点集称 ...

  7. 最短路--floyd算法模板

    floyd算法是求所有点之间的最短路的,复杂度O(n3)代码简单是最大特色 #include<stdio.h> #include<string.h> ; const int I ...

  8. 关闭V-Ray warning消息框

    有时候模型使用低版本VR保存的,再次打开模型时会弹出V-Ray warning提示框 这个问题困扰了我一周时间.... 查了VR官方帮助文档 解决方法如下 setVRaySilentMode() -- ...

  9. 论文笔记之:MatchNet: Unifying Feature and Metric Learning for Patch-Based Matching

    MatchNet: Unifying Feature and Metric Learning for Patch-Based Matching CVPR  2015 本来都写到一半了,突然笔记本死机了 ...

  10. 整合UMDH结果的一个小工具

    ua.exe使用方法: 1.将UMDH生成的logcompare.txt改名为1.txt,内容示例: // Debug library initialized ... DBGHELP: moxia_d ...