目录
1.创建实验用表空间
2 创建测试用户 trans
3 修改用户权限
4 创建实验表
5 将移动表空间修改为只读模式
6 使用数据泵导出 TRANS_TBS 表空间元数据
7 删除 TRANS_TBS 表空间
8 使用数据泵导入可移动表空间元数据
9 验证数据
1.创建实验用表空间
$ . oraenv
$ sqlplus / as sysdba
SQL>conn / as sysdba
SQL>create tablespace trans_tbs datafile '/home/oracle/trans01.dbf'
2 size 20M;
2 创建测试用户 trans
SQL>create user trans identified by trans
2 default tablespace trans_tbs;
3 修改用户权限
SQL>alter user trans quota unlimited on trans_tbs;
SQL>grant connect to trans;
SQL>grant create table to trans;
SQL>grant select on hr.employees to trans;
4 创建实验表
SQL>conn trans/trans;
SQL>create table trans_tb tablespace trans_tbs
2 as select * from hr.employees;
5 将移动表空间修改为只读模式
SQL>conn / as sysdba
6 使用数据泵导出 TRANS_TBS 表空间元数据
$ expdp system/oracle_4U directory=udbs_dir dumpfile=trans.dump TRANSPORT_TABLESPACES=trans_tbs_
7 删除 TRANS_TBS 表空间
SQL>drop tablespace trans_tbs including contents;
SQL>conn trans/trans
SQL>select count(*) from trans_tb;
注意:不要同时删除数据文件。
8 使用数据泵导入可移动表空间元数据
$ impdp system/oracle_4U directory=udbs_dir dumpfile=trans.dump transport_datafiles='/homeoracle/trans01.dbf'_
9 验证数据
SQL>conn / as sysdba
SQL>select name from v$tablesapce;
SQL>select count(*) from trans.trans_tb;



