<%@ page contentType="text/html; charset=gb2312"%> Oracle利用传输表空间导出导入数据的步骤 (2)
网站公告:   ◆北天JAVA技术网热情为java爱好者服务,本网内容包括JAVA(JSP、servlet、EJB、webservice、j2ee、javabean、应用服务器、JavaScript),数据库(MYSQL、SQL Server、Sybase、Oracle、DB2、数据库综合知识),设计研究(设计模式、Struts、Spring、Hibernate、设计框架、设计综合知识),WEB2.0新技术(主要介绍AJAX),以及各种技术的入门、实例、例子等等,欢迎各位多来坐坐!◆  诚邀各位JAVA爱好者加盟!◆  本网站内容丰富,更新快,保证每周20篇以上!  
加入收藏
设为首页
联系站长
承接项目
  相关资源:网站首页 | 免费培训学院 | 技术论坛 | JAVA聊天室 | 作家专栏 | 开发工具 | 认证考试 | 会员俱乐部
  JAVA技术初学者园地 | jsp与servlet | javascript | Java源代码 | EJB | web service | 应用服务器 | JAVA综合知识
  设计研究设计模式 | 设计框架 | Struts | Spring | Hibernate | 开源项目 | 面向对象设计 | 设计综合知识
  数 据 库MYSQL | SQL Server | Sybase | Oracle | DB2 | Informix | Access | 数据库综合知识
  其他资源:AJAX新技术 | 网站开发 | ERP软件 | OA办公软件 | 商业智能BI | 开发综合知识 | 承接项目 | 项目试用

 
 
Oracle利用传输表空间导出导入数据的步骤 (2)
     发布者: 发布时间:2008-03-21

1.ltdb导出

root@t2000 # su - oracle

Sun Microsystems Inc. SunOS 5.10 Generic January 2005

$ ORACLE_SID=LTDB

$ export ORACLE_SID

$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jun 15 15:54:18 2006

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

SQL> conn / as sysdba

Connected.

SQL> create tablespace TSTS datafile '/tmp/LTDB/TSTS01.DBF' size 10M ,'/tmp/LTDB/TSTS02.DBF' size 10M;

Tablespace created.

SQL> create user ts identified by ts default tablespace tsts;

User created.

SQL> grant connect to ts;

Grant succeeded.

SQL> grant resource to ts;

Grant succeeded.

SQL> conn ts/ts

Connected.

SQL> create table t1(c1 varchar(255),c2 varchar(255));

Table created.

SQL> insert into t1 select sys_guid(),sys_guid() from dual connect by level <=10000;

10000 rows created.

SQL> commit;

Commit complete.

SQL> select * from t1 where rownum<=5;

C1 C2

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

163FD8C45C092993E04400144F025BB6 163FD8C45C0A2993E04400144F025BB6

163FD8C45C0B2993E04400144F025BB6 163FD8C45C0C2993E04400144F025BB6

163FD8C45C0D2993E04400144F025BB6 163FD8C45C0E2993E04400144F025BB6

163FD8C45C0F2993E04400144F025BB6 163FD8C45C102993E04400144F025BB6

163FD8C45C112993E04400144F025BB6 163FD8C45C122993E04400144F025BB6

SQL> conn system/sys

Connected.

SQL> alter tablespace tsts read only

SQL> /

Tablespace altered.

SQL> ho

$ exp userid=\'sys/sys as sysdba\' tablespaces=tsts file=/tmp/tsts.dmp l transport_tablespace=y

Export: Release 10.2.0.1.0 - Production on Thu Jun 15 16:20:29 2006

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

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production

With the Partitioning, OLAP and Data Mining options

Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set

Note: table data (rows) will not be exported

About to export transportable tablespace metadata...

For tablespace TSTS ...

. exporting cluster definitions

. exporting table definitions

. . exporting table

. exporting referential integrity constraints

. exporting triggers

. end transportable tablespace metadata export

Export terminated successfully without warnings.

2.epras导入

=============================================

root@t2000 # su - oracle

Sun Microsystems Inc. SunOS 5.10 Generic January 2005

$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jun 15 16:26:11 2006

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

SQL> conn / as sysdba

Connected.

SQL> ho

复制数据文件,此时数据库ltdb的tsts表空间还是read only

$ cp /tmp/LTDB/TS*DBF /oracle

建立目标数据库上的用户,如果不建立,导入时需要加touser=参数,否则会出错

SQL> create user ts identified by ts;

User created.

SQL> ho

SQL> revoke connect from ts;

Revoke succeeded.

SQL> revoke resource from ts;

Revoke succeeded.

SQL> ho

$ imp userid=\'sys/sys as sysdba\' tablespaces=tsts file=/tmp/tsts.dmp transport_tablespace=y datafiles=/oracle/TSTS01.DBF, /oracle/TSTS02.DBF

Import: Release 10.2.0.1.0 - Production on Thu Jun 15 18:24:06 2006

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

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit 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 ZHS16GBK character set and AL16UTF16 NCHAR character set

. importing SYS's objects into SYS

. importing SYS's objects into SYS

. importing TS's objects into TS

. . importing table "T1"

. importing SYS's objects into SYS

Import terminated successfully without warnings.

$ exit

SQL> alter tablespace tsts read write;

Tablespace altered.

SQL> select table_name from all_tables where owner='TS';

TABLE_NAME

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

T1

SQL> grant connect to TS;

Grant succeeded.

SQL> grant resource to TS;

Grant succeeded.

SQL> conn ts/ts

Connected.

SQL> set lines 132

SQL> set pages 9999

SQL> col c1 format a40

SQL> col c2 format a40

SQL> select * from t1 where rownum<=5;

C1 C2

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

163FD8C45C092993E04400144F025BB6 163FD8C45C0A2993E04400144F025BB6

163FD8C45C0B2993E04400144F025BB6 163FD8C45C0C2993E04400144F025BB6

163FD8C45C0D2993E04400144F025BB6 163FD8C45C0E2993E04400144F025BB6

163FD8C45C0F2993E04400144F025BB6 163FD8C45C102993E04400144F025BB6

163FD8C45C112993E04400144F025BB6 163FD8C45C122993E04400144F025BB6

SQL>

(责任编辑:卢兆林)


TAG:
Oracle



(转载文章请保留出处:北天JAVA技术网(www.java114.com))
 
更多精彩文章:
Springsource发布Eclipse工具集支持spring开发
Springsource发布Eclipse工具集支持spring开发
IBM宣布在多核芯片运行的光开关研制成功
IBM宣布在多核芯片运行的光开关研制成功
OpenJDK社区创新挑战赛
OpenJDK社区创新挑战赛
 
最近评论:
        
鍥炲
        
鍥炲
        
标 题:   
内 容:   
 
                                  
 
免责声明:该文章由网友发表,如果对您造成侵权,请联系站长

首页 - 承接项目 - 网站地图 - 联系我们 -
版权所有北天JAVA技术工作室 ICP证号:粤ICP备06079815号