oracle 传输表空间

传输表空间

1.   创建表空间,作为实验传输表空间

[oracle@edt3r10p1~]$ sqlplus / as sysdba

 

SQL*Plus:Release 11.2.0.3.0 Production on Wed Mar 5 15:49:09 2014

 

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

 

 

Connected to:

Oracle Database1100M Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With thePartitioning, Automatic Storage Management, OLAP, Data Mining

and RealApplication Testing options

 

SQL> createtablespace trans_tbs datafile '/home/oracle/trans01.dbf' size 20M;

 

Tablespacecreated.

2.   创建实验用户,用于验证数据。

SQL> createuser trans identified by trans

  2 default tablespace trans_tbs

  3 temporary tablespace temp;

 

User created.

3.   修改用户权限

SQL> alteruser trans quota unlimited on trans_tbs;

 

User altered.

 

SQL> grantconnect to trans;

 

Grant succeeded.

SQL>  grant create table to trans;

 

Grant succeeded.

 

SQL>  grant select on hr.employees  to trans;

 

Grant succeeded.

4.   创建实验表

SQL>  create table trans_tb tablespace trans_tbs

  2    as

  3   select * from hr.employees;

Table created.

SQL> selectcount(*) from trans.trans_tb;

  COUNT(*)

----------

       107

5.   将移动表空间修改为只读模式

SQL> conn /as sysdba

Connected.

SQL> altertablespace trans_tbs read only;

Tablespacealtered.

6.   使用数据泵导出移动表空间元数据

[oracle@edt3r10p1~]$expdpsystem/oracle directory=lin_dir  dumpfile=trans.dumpTRANSPORT_TABLESPACES=trans_tbs

 

Export: Release11.2.0.3.0 - Production on Wed Mar 5 15:57:06 2014

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

Connected to:Oracle Database 1100M Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With thePartitioning, Automatic Storage Management, OLAP, Data Mining

and RealApplication Testing options

Starting"SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01":  system/******** directory=lin_dirdumpfile=trans.dump TRANSPORT_TABLESPACES=trans_tbs

Processingobject type TRANSPORTABLE_EXPORT/PLUGTS_BLK

Processingobject type TRANSPORTABLE_EXPORT/TABLE

Processingobject type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK

Master table"SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" successfullyloaded/unloaded

******************************************************************************

Dump file setfor SYSTEM.SYS_EXPORT_TRANSPORTABLE_01 is:

  /home/oracle/trans.dump

******************************************************************************

Datafilesrequired for transportable tablespace TRANS_TBS:

  /home/oracle/trans01.dbf

Job"SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" successfullycompleted at 15:58:10

7.   删除表空间(在一个数据库做实验,模拟另外一个数据库)

SQL> droptablesap pace trans_tbs including contents;

Tablespacedropped.

SQL> conntrans/trans

Connected.

SQL> selectcount(*) from trans_tb;

select count(*)from trans_tb

                     *

ERROR at line 1:

ORA-00942: tableor view does not exist

注意:不要同时删除数据文件。

8.   使用数据泵倒入移动表空间元数据

[oracle@edt3r10p1~]$impdp system/oracle directory=lin_dir dumpfile=trans.dump transport_datafiles='/home/oracle/trans01.dbf'

Import: Release11.2.0.3.0 - Production on Wed Mar 5 16:07:57 2014

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

Connected to:Oracle Database 1100M Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With thePartitioning, Automatic Storage Management, OLAP, Data Mining

and RealApplication Testing options

Master table"SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfullyloaded/unloaded

Starting"SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01":  system/******** directory=lin_dirdumpfile=trans.dump transport_datafiles=/home/oracle/trans01.dbf

Processingobject type TRANSPORTABLE_EXPORT/PLUGTS_BLK

Processingobject type TRANSPORTABLE_EXPORT/TABLE

Processingobject type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK

Job"SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfullycompleted at 16:08:01

9.   验证数据

SQL> conn /as sysdba

Connected.

SQL> selectname from v$tablespace;

NAME

--------------------------------------------------------------------------------

SYSTEM

SYSAUX

TRANS_TBS

USERS

TEMP

EXAMPLE

TEMP1

UNDOTBS2

8 rows selected.

SQL> conntrans/trans

Connected.

SQL> selectcount(*) from trans.trans_tb;

  COUNT(*)

----------

       107

1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 、4下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。、可私 6信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 、4下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。、可 6私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 、4下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。、可私 6信博主看论文后选择购买源代码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值