oracle 数据泵 oracle全库导出pl的 导入时是否可以 按用户导入

Oracle数据泵导入导出案例
数据泵导入导出案例
Oracle导入导出工具,可以使用exp/imp,但这是比较早期的工具。本文主要介绍数据泵expdp/impdp工具的使用。
建立数据泵目录
使用数据泵需要先建directory
create directory dump_scott as'/home/oracle/dump/scott'
查看建立的目录
Select * from dba_directories
Grant read,write on directory dump_scott toscott
导出案例1,按表导出
expdp scott/tiger directory=dump_scottdumpfile=tab.dmp logfile=scott.log tables=dept,emp
导出案例2,按用户导出
expdp scott/tiger directory=dump_scottdumpfile=dumpscott.dmp schemas=scott
导出案例3,全库导出,且并行导出
expdp scott/tiger directory=dump_scottdumpfile=full.dmp parallel=4 full=y
导入案例1,按表导入,从scott到scott2
impdp scott2/tiger directory=dump_scottdumpfile=tab.dmp tables=scott.dept,scott.emp remap_schema=scott:scott2
导入案例2,按用户导入,从scott到scott2
impdp scott/tiger directory=dump_scottdumpfile=schema.dmp remap_schema=scott:scott2
导入案例3,全库导入
impdp scott/tiger directory=dump_scottdumpfile=full.dmp full=y
导入案例4,无落地文件的用户拷贝,需要建立db link
impdp scott/tiger directory=dump_scott network_link=remote_link remap_schema=scott:scott2当前位置: →
→ oracle 10g
数据泵导入导出
oracle 10g
数据泵导入导出
& 作者及来源: java环境变量 - 博客园 &
&收藏到→_→:
摘要: oracle 10g
数据泵导入导出
"oracle 10g
数据泵导入导出"::
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 数据泵导入导出
---------------------------------------------------------------------
*********************************************************************
&第一部分:数据泵导入导出概述
*********************************************************************
---------------------------------------------------------------------
----------------------------
--1.数据泵导入导出简单介绍
----------------------------
oracle 10g中数据泵技术是新技术,和sql*loader功能有区别,前者主要用来
将移入或移入到一个或多个表中。而oracle 10g中数据泵主要用来导出或
导入整个模式甚至整个 、或者某个模式下全部表、一个表;
oracle 10g中数据泵技术用来替代先前版本使用的导入/导出实用程序,
速度比原来在单线程情况下预计快15到40倍。但是新的数据泵技术只能运行在oracle
端并且只允许将数据导入到磁盘中,不支持将数据导出到磁带中。
oracle 10g中数据泵技术不建立完备备份,因为在导出文件中没有灾难发生时的最新数据,
即包括联机事务日志的内容。
oracle10g的数据泵技术由两个部分组成:
数据泵导出(data pump export)和数据泵导入(data pump inport).
oracle10g的数据泵技术由三个部件组成:
dbms_datapump程序包:这个是 元数据装载和卸载的主要引擎,该 主要执行数据泵导出和
导入两个实用程序的工作。
dbms_metadata程序包:为提取并修改元数据。
命令客户机:
------------------------------------------------------------
--2.数据泵导入导出帮助信息
------------------------------------------------------------
c:\&impdp help=y
import: release 10.2.0.1.0 - production on 星期四, 30 10月, :50
copyright (c) , oracle.& all rights reserved.
数据泵导入实用程序提供了一种用于在 oracle
的机制。该实用程序可以使用以下命令进行调用:
&&&& 示例: impdp scott/tiger directory=dmpdir dumpfile=scott.dmp
您可以控制导入的运行方式。具体 是: 在 'impdp' 命令后输入
各种参数。要指定各参数, 请使用关键字:
&&&& 格式:& impdp key =value 或 key =(value1,value2,...,valuen)
&&&& 示例: impdp scott/tiger directory=dmpdir dumpfile=scott.dmp
userid 必须是命令行中的第一个参数。
关键字&&&&&&&&&&&&&& 说明 (默认)
--------------------------------------------------------------------------
attach&&&&&&&&&&&&&&& 连接到现有作业, 例如 attach [=作业名]。
content&&&&&&&&&&&&&& 指定要加载的数据, 其中有效关键字为:
&&&&&&&&&&&&&&&&&&&&& (all), data_only 和 metadata_only。
directory&&&&&&&&&&&& 供转储文件, 日志文件和 sql 文件使用的目录对象。
dumpfile&&&&&&&&&&&&& 要从 (expdat.dmp) 中导入的转储文件的列表,
c:\&expdp help=y
export: release 10.2.0.1.0 - production on 星期四, 30 10月, :36
copyright (c) , oracle.& all rights reserved.
数据泵导出实用程序提供了一种用于在 oracle
的机制。该实用程序可以使用以下命令进行调用:
&& 示例: expdp scott/tiger directory=dmpdir dumpfile=scott.dmp
您可以控制导出的运行方式。具体 是: 在 'expdp' 命令后输入
各种参数。要指定各参数, 请使用关键字:
&& 格式:& expdp key =value 或 key =(value1,value2,...,valuen)
&& 示例: expdp scott/tiger dumpfile=scott.dmp directory=dmpdir schemas=scott
------------------------------------------------------------
--3.racle10g的数据泵技术默认的导出数据保存目录
------------------------------------------------------------
-- 3.1 默认目录
oracle 10g_r2默认新建一个目录对象在oracle_home\product\10.2.0\admin\orcl\dpdump(windows路径)下。
可以通过命令查看这个默认路径。
sql& select * from dba_
owner&&&&&&&&&&&&&&&&&&&&&&&&& directory_name&&&&&&&&&&&&&&&& directory_path
------------------------------ ------------------------------ --------------------------------------------------------------
sys&&&&&&&&&&&&&&&&&&&&&&&&&&& admin_dir&&&&&&&&&&&&&&&&&&&&& c:\ade\aime_10.2_nt_push\oracle/md/admin
sys&&&&&&&&&&&&&&&&&&&&&&&&&&& data_pump_dir&&&&&&&&&&&&&&&&& e:\oracle\product\10.2.0\admin\orcl\dpdump\
sys&&&&&&&&&&&&&&&&&&&&&&&&&&& work_dir&&&&&&&&&&&&&&&&&&&&&& c:\ade\aime_10.2_nt_push\oracle/work
&&&&&&&&&&&&&
在oracle10g中只有sys和system这样具备管理此文来自: 马开东博客
转载请注明出处 网址:
员权限的用户才能够实用这个默认目录。因此用户system和sys
可以启动一个数据泵导出作业而不需要指明目录名。但是在非授权用户能够实用数据泵导出或导入前,dba必须
新建一个目录对象或授权实用现在具有的目录权限。除了dba之外任何有权限create any directory权限的用户
都能够新建一个新的目录对象。
-- 3.2 用户自定义目录
--案例1:用户自定义目录(即用户获得对应的权限和具有默认目录)
sql& create user win identified by pass
user created
sql& grant c
grant succeeded
sql& create directory dup1 as 'e:\dp';&&&&
directory created
--e:\dp,这个dp目录需要我们用户新建。
sql& grant read, write on directory dup1
grant succeeded
--案例2:如果 中没有为普通用户设置目录和对应的权限
sql& create user win identified by pass
用户已创建。
sql& grant cre
授权成功。
--原因1:没有为用户指明具体目录,则用户使用默认目录
c:\&expdp scott/tiger
export: release 10.2.0.1.0 - production on 星期四, 30 10月, :49
copyright (c) , oracle.& all rights reserved.
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
ora-39002: 操作无效
ora-39070: 无法打开日志文件。
ora-39145: 必须指定目录对象参数且不能为空
--原因2:为用户指明具此文来自: 马开东博客
转载请注明出处 网址:
体目录但用户不具备访问目录的权限
c:\&expdp scott/tiger& directory=dp1 dumpfile=dp1.dmp
export: release 10.2.0.1.0 - production on 星期四, 30 10月, :54
copyright (c) , oracle.& all rights reserved.
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
ora-39002: 操作无效
ora-39070: 无法打开日志文件。
ora-39087: 目录名 dp1 无效
--案例3:新建目录并让用户获得目录权限
sql& create directory dup1 as 'e:\dp';&&&&
directory created
--e:\dp,这个dp目录需要我们用户新建。
sql& grant read, write on directory dup1
grant succeeded
c:\&expdp scott/tiger tables=t1 directory=dup1& dumpfile=1.dmp
export: release 10.2.0.1.0 - production on 星期四, 30 10月, :11
copyright (c) , oracle.& all rights reserved.
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
启动 &scott&.&sys_export_table_01&:& scott/******** tables=t1 directory=dup1 du
pfile=1.bmp
正在使用 blocks
进行估计...
处理对象类型 table_export/table/table_data
使用 blocks
的总估计: 64 kb
处理对象类型 table_export/table/table
. . 导出了 &scott&.&t1&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 4.929 kb&&&&&& 1 行
已成功加载/卸载了主表 &scott&.&sys_export_table_01&
******************************************************************************
scott.sys_export_table_01 的转储文件集为:
& e:\dp\1.bmp
作业 &scott&.&sys_export_table_01& 已于 18:15:21 成功完成
--案例4:新建目录并让用户获得目录权限 -unix平台
sql& create directory dup1 as 'e:\dp';&&&&
directory created
--e:\dp,这个dp目录需要我们用户新建。
sql&export data_pump_dir& dup1
c:\&expdp scott/tiger tables=t1& dumpfile=1.dmp
export: release 10.2.0.1.0 - production on 星期四, 30 10月, :11
copyright (c) , oracle.& all rights reserved.
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
启动 &scott&.&sys_export_table_01&:& scott/******** tables=t1 directory=dup1 du
pfile=1.bmp
正在使用 blocks
进行估计...
处理对象类型 table_export/table/table_data
使用 blocks
的总估计: 64 kb
处理对象类型 table_export/table/table
. . 导出了 &scott&.&t1&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 4.929 kb&&&&&& 1 行
已成功加载/卸载了主表 &scott&.&sys_export_table_01&
******************************************************************************
scott.sys_export_table_01 的转储文件集为:
& e:\dp\1.bmp
作业 &scott&.&sys_export_table_01& 已于 18:15:21 成功完成
如果使用数据泵时没有指明directory、则寻找是否有环境变量data_dump_dir、最后检查data_pump_dir,
但是data_pump_dir目录只有对dba和其他授权用户可用。
----------------------------------------------
--4.数据泵作业结构
----------------------------------------------
--4.1 数据泵作业结构主要包括
数据泵作业结构主要包括:主进程、工作进程、影子进程、客户机进程。
(1) master process(主进程)
master control process有一个dmnn的进程名。该进程使用一个特殊的表,记录导出转存文件中的各 对象的位置。
该表称为主表,主进程只是在导出 中使用主表。导出结束的最后一步,主进程将主表的内容写入导出转存文件并自动
从 中删除主表。只要导出成功完成则主表的删除将自动进行但是如果使用停止命令将一个作业停止完成或导出作业
由于某种原因失败则主表不从主 中删除。当你重新启动该导出的作业时,它将使用相同的表。
(2) worker process(工进程)
包含dwnn进程名;是实际执行繁重的装载和卸载数据工作的进程。master process新建worker process并决定master process
新建worker process的数量。
该进程主要维护主表的行。当他们导出或导入各种对象时,他们用作业的状态信息更新主表:完成、未决、失败。
(3) shadow process(影子进程)
当一个客户机登录到oracle时, 创建一个oracle进程为数据泵api的请求服务。此影子进程创建由主表和主进程组
成的作业。一旦客户机崩溃,该进程自动消失。
(4)client process (客户机进程)
客户机进程调用数据泵取api。
---------------------------------------------------------------------
*********************************************************************
&第二部分:执行数据泵导出和导入
*********************************************************************
---------------------------------------------------------------------
---------------------
-- 1.数据泵导出
---------------------
-- 1.1 使用命令行
c:\&expdp scott/tiger tables=accp& directory=dp1 dumpfile=1.dmp
export: release 10.2.0.1.0 - production on 星期五, 31 10月, :56
copyright (c) , oracle.& all rights reserved.
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
启动 &scott&.&sys_export_table_01&:& scott/******** tables=accp directory=dp1 du
mpfile=1.dmp
正在使用 blocks
进行估计...
处理对象类型 table_export/table/table_data
使用 blocks
的总估计: 64 kb
处理对象类型 table_export/table/table
. . 导出了 &scott&.&accp&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 4.929 kb&&&&&& 1 行
已成功加载/卸载了主表 &scott&.&sys_export_table_01&
******************************************************************************
scott.sys_export_table_01 的转储文件集为:
& e:\dp\1.dmp
作业 &scott&.&sys_export_table_01& 已于 10:37:05 成功完成
-- 1.2 使用参数文件
-步骤1:新建一个参数文件
在e盘新建一个文本文件1.txt,内容如下:
directory=dp1
dumpfile=2.dmp
tables=accp
-步骤2:调用这个参数文件
c:\&expdp parfile='e:\1.txt'
export: release 10.2.0.1.0 - production on 星期五, 31 10月, :21
copyright (c) , oracle.& all rights reserved.
用户名: scott
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
启动 &scott&.&sys_export_table_01&:& scott/******** parfile='e:\1.txt'
正在使用 blocks
进行估计...
处理对象类型 table_export/table/table_data
使用 blocks
的总估计: 64 kb
处理对象类型 table_export/table/table
. . 导出了 &scott&.&accp&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 4.929 kb&&&&&& 1 行
已成功加载/卸载了主表 &scott&.&sys_export_table_01&
******************************************************************************
scott.sys_export_table_01 的转储文件集为:
& e:\dp\2.dmp
作业 &scott&.&sys_export_table_01& 已于 10:47:30 成功完成
-- 1.3 使用 数据泵导出
c:\&expdp directory=dp1 dumpfile=3.dmp
export: release 10.2.0.1.0 - production on 星期五, 31 10月, :51
copyright (c) , oracle.& all rights reserved.
用户名: scott
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
启动 &scott&.&sys_export_schema_01&:& scott/******** directory=dp1 dumpfile=3.dm
正在使用 blocks
进行估计...
处理对象类型 schema_export/table/table_data
使用 blocks
的总估计: 256 kb
处理对象类型 schema_export/pre_schema/procact_schema
处理对象类型 schema_export/table/table
处理对象类型 schema_export/table/index/index
处理对象类型 schema_export/table/constraint/constraint
处理对象类型 schema_export/table/index/statistics/index_statistics
处理对象类型 schema_export/table/comment
处理对象类型 schema_export/table/constraint/ref_constraint
. . 导出了 &scott&.&accp&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 4.929 kb&&&&&& 1 行
. . 导出了 &scott&.&dept&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 5.656 kb&&&&&& 4 行
. . 导出了 &scott&.&emp&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 7.820 kb&&&&& 14 行
. . 导出了 &scott&.&salgrade&&&&&&&&&&&&&&&&&&&&&&&&&& 5.585 kb&&&&&& 5 行
. . 导出了 &scott&.&bonus&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 0 kb&&&&&& 0 行
已成功加载/卸载了主表 &scott&.&sys_export_schema_01&
******************************************************************************
scott.sys_export_schema_01 的转储文件集为:
& e:\dp\3.dmp
作业 &scott&.&sys_export_schema_01& 已于 10:51:14 成功完成
-------------------------------------
--2. 数据泵导出的方式
--------------------------------------
导出方式包括:
full export mode(全导出方式):导出整个
schema mode(模式 ):& 导出一个单独用户的数据或对象,必须使用schemas参数
tablespace mode(表空间方式):使用tablespaces参数,此文来自: 马开东博客
转载请注明出处 网址:
可以导出一个或多个表空间中的全部表。
如果使用transport_tablespaces参数,则只能导出包含在一个或多个表空间中的对象元数据。
可以通过先导出元数据来导出 之间的表空间,拷贝表空间的文件到目标,然后将元数据
table mode(表方式):使用tables参数,可以导出一个或多个表。
--2.1 使用模式 导出scott用户模式下所有内容
c:\&expdp system/pass & directory=dp1 dumpfile=scott.dmp schemas=scott&&
--如果这里不指明directory则system账户使用默认的directory
export: release 10.2.0.1.0 - production on 星期五, 31 10月, :07
copyright (c) , oracle.& all rights reserved.
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
启动 &system&.&sys_export_schema_01&:& system/******** directory=dp1 dumpfile=sc
ott.dmp schemas=scott
正在使用 blocks
进行估计...
处理对象类型 schema_export/table/table_data
使用 blocks
的总估计: 256 kb
处理对象类型 schema_export/user
处理对象类型 schema_export/system_grant
处理对象类型 schema_export/role_grant
处理对象类型 schema_export/default_role
处理对象类型 schema_export/pre_schema/procact_schema
处理对象类型 schema_export/table/table
处理对象类型 schema_export/table/index/index
处理对象类型 schema_export/table/constraint/constraint
处理对象类型 schema_export/table/constraint/ref_constraint
. . 导出了 &scott&.&accp&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 4.929 kb&&&&&& 1 行
. . 导出了 &scott&.&dept&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 5.656 kb&&&&&& 4 行
. . 导出了 &scott&.&emp&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 7.820 kb&&&&& 14 行
. . 导出了 &scott&.&salgrade&&&&&&&&&&&&&&&&&&&&&&&&&& 5.585 kb&&&&&& 5 行
. . 导出了 &scott&.&bonus&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 0 kb&&&&&& 0 行
已成功加载/卸载了主表 &system&.&sys_export_schema_01&
******************************************************************************
system.sys_export_schema_01 的转储文件集为:
& e:\dp\scott.dmp
作业 &system&.&sys_export_schema_01& 已于 11:01:24 成功完成
--2.2 使用模式 导出users表空间下所有内容
c:\&expdp system/pass
directory=dp1 dumpfile=users.dmp tablespaces=users
export: release 10.2.0.1.0 - production on 星期五, 31 10月, :31
copyright (c) , oracle.& all rights reserved.
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
启动 &system&.&sys_export_tablespace_01&:& system/******** directory=dp1 dumpfil
e=users.dmp tablespaces=users
正在使用 blocks
进行估计...
处理对象类型 table_export/table/table_data
使用 blocks
的总估计: 256 kb
处理对象类型 table_export/table/table
处理对象类型 table_export/table/index/index
处理对象类型 table_export/table/constraint/constraint
处理对象类型 table_export/table/constraint/ref_constraint
. . 导出了 &scott&.&accp&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 4.929 kb&&&&&& 1 行
. . 导出了 &scott&.&dept&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 5.656 kb&&&&&& 4 行
. . 导出了 &scott&.&emp&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 7.820 kb&&&&& 14 行
. . 导出了 &scott&.&salgrade&&&&&&&&&&&&&&&&&&&&&&&&&& 5.585 kb&&&&&& 5 行
. . 导出了 &scott&.&bonus&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 0 kb&&&&&& 0 行
已成功加载/卸载了主表 &system&.&sys_export_tablespace_01&
******************************************************************************
system.sys_export_tablespace_01 的转储文件集为:
& e:\dp\users.dmp
作业 &system&.&sys_export_tablespace_01& 已于 11:05:44 成功完成
--2.3 使用tablespace mode导出users表空间下所有内容
--步骤1:新建环境
sql& create tablespace accp
& 2& datafile 'e:\accp.dbf' size 200m;
表空间已创建。
sql& create table t01
& 2& (sid int)
表已创建。
sql& insert into t01 values (102);
已创建 1 行。
sql& select table_name from dba_tables where tablespace_name='accp';
table_name
------------------------------
--步骤2:导出表空间(排错)
c:\&host expdp system/pass
directory=dp1 dumpfile=accp.dmp transport_tablespaces=accp
export: release 10.2.0.1.0 - production on 星期五, 31 10月, :44
copyright (c) , oracle.& all rights reserved.
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
启动 &system&.&sys_export_transportable_01&:& system/******** directory=dp1 dump
file=users.dmp transport_tablespaces=accp
ora-39123: 数据泵可传输的表空间作业中止
ora-29335: 表空间 'accp' 不为只读
作业 &system&.&sys_export_transportable_01& 因致命错误于 11:10:47 停止
sql& show user
user 为 &sys&
sql& alter table
表空间已更改。
c:\&host expdp system/pass
directory=dp1 dumpfile=accp.dmp transport_tablespaces=accp
export: release 10.2.0.1.0 - production on 星期五, 31 10月, :26
copyright (c) , oracle.& all rights reserved.
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
启动 &system&.&sys_export_transportable_01&:& system/******** directory=dp1 dump
file=users.dmp transport_tablespaces=accp
ora-39123: 数据泵可传输的表空间作业中止
ora-29341: 可传送集不是自包含的
作业 &system&.&sys_export_transportable_01& 因致命错误于 11:12:30 停止
sql& execute sys.dbms_tts.transport_set_check('accp',true, true);
已成功完成。
sql& select * from sys.transport_set_
violations
------------------------------------------------------------------------
sys owned object& t01 in tablespace accp not allowed in pluggable set
/*解决办法:
提示表是sys的,不能进行操作。
sql& conn / as sysdba
sql& show user
user 为 &sys&
sql& select table_name from dba_tables where tablespace_name='accp';
table_name
------------------------------
sql& alter tablespace accp&
表空间已更改。
sql& drop table t01;
表已删除。
提交完成。
sql& conn scott/tiger
sql& show user
user 为 &scott&
sql& create table t01
& 2& (sid int)
表已创建。
sql& insert into t01 values (1001);
已创建 1 行。
提交完成。
sql& select * from t01;
&&&&&& sid
----------
&&&&& 1001
sql& conn / as sysdba
sql& select table_name from dba_tables where tablespace_name='accp';
table_name
------------------------------
sql& select * from sys.transport_set_
sql& alter table
表空间已更改。
--步骤3:正常导出表空间
sql& host expdp system/pass
directory=dp1 dumpfile=accp.dmp transport_tables
paces=accp
export: release 10.2.0.1.0 - production on 星期五, 31 10月, :47
copyright (c) , oracle.& all rights reserved.
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
启动 &system&.&sys_export_transportable_01&:& system/******** directory=dp1 dump
file=accp.dmp transport_tablespaces=accp
处理对象类型 transportable_export/plugts_blk
处理对象类型 transportable_export/table
处理对象类型 transportable_export/post_instance/plugts_blk
已成功加载/卸载了主表 &system&.&sys_export_transportable_01&
******************************************************************************
system.sys_export_transportable_01 的转储文件集为:
& e:\dp\accp.dmp
作业 &system&.&sys_export_transportable_01& 已于 12:37:58 成功完成
--步骤4:将导出的元数据和表空间的数据文件复制到目标上
将oracle 关闭,然后将数据文件和导出的元数据复制到目标上。
--步骤5:目标上导入表空间
--可能遇到的错误
sql& show user
user 为 &sys&
sql& host impdp system/pass
directory=dp1 dumpfile=accp.dmp transport_datafi
les='e:\accp.dbf'
import: release 10.2.0.1.0 - production on 星期五, 31 10月, :59
copyright (c) , oracle.& all rights reserved.
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
ora-39002: 操作无效
ora-39070: 无法打开日志文件。
ora-39087: 目录名 dp1 无效
sql& host impdp system/pass & dumpfile='e:\accp.dmp' transport_datafiles='e:\
import: release 10.2.0.1.0 - production on 星期五, 31 10月, :47
copyright (c) , oracle.& all rights reserved.
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
ora-39001: 参数值无效
ora-39000: 转储文件说明错误
ora-39088: 文件名不能包含路径说明
-- 1:将*.dmp文件拷贝到oracle安装目录oracle\product\10.2.0\admin\orcl\dpdump下,
并将dmp文件改名为expdat.数据文件保存到需要保存的地方。
sql& host impdp system/pass & transport_datafiles='e:\accp.dbf'
import: release 10.2.0.1.0 - production on 星期五, 31 10月, :12
copyright (c) , oracle.& all rights reserved.
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
已成功加载/卸载了主表 &system&.&sys_import_transportable_01&
启动 &system&.&sys_import_transportable_01&:& system/******** transport_datafile
s='e:\accp.dbf'
处理对象类型 transportable_export/plugts_blk
处理对象类型 transportable_export/table
处理对象类型 transportable_export/post_instance/plugts_blk
作业 &system&.&sys_import_transportable_01& 已于 13:09:16 成功完成
sql& select tablespace_name from dba_
tablespace_name
------------------------------
已选择6行。
sql& select table_name from dba_tables where tablespace_name='accp';
table_name
------------------------------
-- 2:新建一个directory并授权
sql& create directory dup1 as 'e:\dp';&&&&
directory created
--e:\dp,这个dp目录需要我们用户新建。
sql& grant read, write on directory dup1
grant succeeded
sql& host impdp system/pass
directory=dup1 dumpfile=accp.dmp transport_dataf
iles='e:\accp.dbf'
import: release 10.2.0.1.0 - production on 星期五, 31 10月, :13
copyright (c) , oracle.& all rights reserved.
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
已成功加载/卸载了主表 &system&.&sys_import_transportable_01&
启动 &system&.&sys_import_transportable_01&:& system/******** directory=dup1 dum
pfile=accp.dmp transport_datafiles='e:\accp.dbf'
处理对象类型 transportable_export/plugts_blk
处理对象类型 transportable_export/table
处理对象类型 transportable_export/post_instance/plugts_blk
作业 &system&.&sys_import_transportable_01& 已于 13:21:15 成功完成
--步骤6:查看新导入表空间的表
sql& show user
user 为 &sys&
sql& select * from t01;
select * from t01
&&&&&&&&&&&&& *
第 1 行出现错误:
ora-00942: 表或视图不存在
--解决办法:
sql& select owner, table_name from dba_tables where tablespace_name='accp';
owner&&&&&&&&&&&&&&&&&&&&&&&&& table_name
------------------------------ ------------------------------
scott&&&&&&&&&&&&&&&&&&&&&&&&& t01
sql& conn scott/tiger
ora-28001: the pass
has expired
更改 scott 的口令
重新键入新口令:
口令已更改
sql& select * from t01;
&&&&&& sid
----------
&&&&& 1001
sql& conn / as sysdba
sql& show user
user 为 &sys&
sql& select * from t01;
select * from t01
&&&&&&&&&&&&& *
第 1 行出现错误:
ora-00942: 表或视图不存在
sql& select * from scott.t01;
&&&&&& sid
----------
&&&&& 1001
-------------------------------------
--3. 数据泵导出/导出加密--------待解决,需要配置wallet
--------------------------------------
--步骤1:环境准备
sql& show user
user 为 &sys&
sql& select tablespace_name from dba_
tablespace_name
------------------------------
sql&create tablespace accp
datafile 'e:\accp.dbf' size 100m;
sql& select tablespace_name from dba_
tablespace_name
------------------------------
已选择6行。
sql& conn scott/tiger
ora-28001: the pass
has expired
更改 scott 的口令
重新键入新口令:
口令已更改
sql& show user
user 为 &scott&
sql&create table t1
sql& conn / as sysdba
sql& show user
user 为 &sys&
sql& create directory dup1 as 'e:\dp';
目录已创建。
--e:\dp,这个dp目录需要我们用户新建。
sql& grant read, write on directory dup1
grant succeeded
c:\ host expdp scott/tiger directory=dup1 dumpfile=t01.dmp& tables=t1 encryption_pass =123456
-------------------------------------
--4. 数据泵导出/导出远程
--------------------------------------
----step1:在远程oracle上新建一个测试的
c:\&sqlplus / as sysdba
sql*plus: release 10.2.0.1.0 - production on 星期五 10月 31 14:56:19 2008
copyright (c) , oracle.& all rights reserved.
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
sql& host ipconfig /all
windows ip configuration
&& host name . . . . . . . . . . . . : nanjing
&& primary dns suffix& . . . . . . . :
&& node type . . . . . . . . . . . . : unknown
&& ip routing enabled. . . . . . . . : no
&& wins proxy enabled. . . . . . . . : no
ethernet adapter 本地连接:
&& connection-specific dns suffix& . :
&& description . . . . . . . . . . . : intel 21140-based pci fast ethernet adapt
er (generic)
&& physical address. . . . . . . . . : 00-03-ff-3e-55-03
&& dhcp enabled. . . . . . . . . . . : no
&& ip address. . . . . . . . . . . . : 192.168.99.2
&& subnet mask . . . . . . . . . . . : 255.255.255.0
&& default gateway . . . . . . . . . :
sql& create tablespace beijing
& 2& datafile 'e:\beijing.dbf' size 200m;
表空间已创建。
sql& conn scott/tiger
ora-28001: the pass
has expired
更改 scott 的口令
重新键入新口令:
口令已更改
sql& create table beijing
& 2& (sid int,
& 3& sname varchar2(10)
表已创建。
sql& insert into beijing values (&1, '&2');
输入 1 的值:& 101
输入 2 的值:& wind
原值&&& 1: insert into beijing values (&1, '&2')
新值&&& 1: insert into beijing values (101, 'wind')
已创建 1 行。
输入 1 的值:& 102
输入 2 的值:& snow
原值&&& 1: insert into beijing values (&1, '&2')
新值&&& 1: insert into beijing values (102, 'snow')
已创建 1 行。
sql& select *
&&&&&& sid sname
---------- ----------
&&&&&& 101 wind
&&&&&& 102 snow
----step2:配置本地的tns( 3选一)
1.编辑本地oracle的tns配置文件并保存。
e:\oracle\product\10.2.0\db_1\network\admin
& (description =
&&& (address = (protocol = tcp)(host = 192.168.99.2)(port = 1521))
&&& (connect_data =
&&&&& (server = dedicated)
&&&&& (service_name =accp)
2.测试配置是否生效
c:\&sqlplus scott/tiger@remote
sql*plus: release 10.2.0.1.0 - production on 星期五 10月 31 15:02:44 2008
copyright (c) , oracle.& all rights reserved.
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
sql& show user
user 为 &scott&
sql& select table_name from user_
table_name
------------------------------
sql& select *
&&&&&& sid sname
---------- ----------
&&&&&& 101 wind
&&&&&& 102 snow
----step3:本地上新建 到远程oracle的连接
-1. 新建一个 连接到远程
c:\&sqlplus / as sysdba
sql*plus: release 10.2.0.1.0 - production on 星期五 10月 31 15:04:30 2008
copyright (c) , oracle.& all rights reserved.
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
sql& show user
user 为 &sys
link 语法:
create& public
connect to 用户名 identified by 密码
using ‘本地配置的数据的实例名’;
如果不指明public则只能新建
link的用户使用。
-- 1:已经配置本地的tns
create public
connect to system identified by pass
using 'remote';
链接已创建。
---- 2:没有配置本地的tns
create& public&
connect to system identified by pass
using '(description =
&&& (address = (protocol = tcp)(host = 192.168.99.2)(port = 1521))
&&& (connect_data =
&&&&& (server = dedicated)
&&&&& (service_name = accp)
sql& show parameters global_
name&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& type&&&&&&& value
------------------------------------ ----------- ---------
global_names&&&&&&&&&&&&&&&&&&&&&&&& boolean&&&& false
这里global_name是false则这里的连接名nj不需要和远程同名;
否则需要同名。system用户名和密码是远程的用户名和密码;
using ‘nanjing’,这里的nanjing是tns中的解析名。
-2. 测试连接
sql& host ipconfig
windows ip configuration
ethernet adapter 本地连接:
&& connection-specific dns suffix& . :
&& ip address. . . . . . . . . . . . : 192.168.99.1
&& subnet mask . . . . . . . . . . . : 255.255.255.0
&& default gateway . . . . . . . . . :
sql& show user
user 为 &sys&
sql& select * from scott.beijing@bj;
&&&&&& sid sname
---------- ----------
&&&&& 1001 wind
&&&&& 1002 snow
link按如下新建则查询时不需要指明前缀scott:
create& public
connect to scott identified by tiger
using 'remote';
----step3:将远程上的数据导入到本地
c:\&impdp system/pass
tables=beijing network_link=bj
import: release 10.2.0.1.0 - production on 星期五, 31 10月, :43
copyright (c) , oracle.& all rights reserved.
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
ora-31631: 需要权限
ora-39149: 无法将特权用户链接到非特权用户
---错误1解决办法:
create public
connect to system identified by pass
using 'remote';
链接已创建。
c:\&impdp system/pass
tablespaces=beijing& network_link=bj
import: release 10.2.0.1.0 - production on 星期五, 31 10月, :54
copyright (c) , oracle.& all rights reserved.
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
启动 &system&.&sys_import_tablespace_01&:& system/******** tablespaces=beijing
etwork_link=bj
正在使用 blocks
进行估计...
处理对象类型 table_export/table/table_data
使用 blocks
的总估计: 64 kb
处理对象类型 table_export/table/table
ora-39083: 对象类型 table 创建失败, 出现错误:
ora-00959: 表空间 'beijing' 不存在
失败的 sql 为:
create table &scott&.&beijing& (&sid& number(*,0), &sname& varchar2(10)) pctfre
&10 pctused 40 initrans 1 maxtrans 255 nocompress logging storage(initial 65536
next 1048576 minextents 1 maxextents
pctincrease 0 freelists 1 freel
st groups 1 buffer_pool default) tablespace &beijing&
作业 &system&.&sys_import_tablespace_01& 已经完成, 但是有 1 个错误 (于 17:38:07
---错误2解决办法:
sql&create tablespace beijing
datafile 'e:\beijing.dbf' size 100m;
c:\&impdp system/pass
tablespaces=beijing& network_link=bj
import: release 10.2.0.1.0 - production on 星期五, 31 10月, :00
copyright (c) , oracle.& all rights reserved.
连接到: oracle
10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
启动 &system&.&sys_import_tablespace_01&:& system/******** tablespaces=beijing n
etwork_link=bj
正在使用 blocks
进行估计...
处理对象类型 table_export/table/table_data
使用 blocks
的总估计: 64 kb
处理对象类型 table_export/table/table
. . 导入了 &scott&.&beijing&&&&&&&&&&&&&&&&&&&&&&nb搜索此文相关文章:此文来自: 马开东博客
网址: 站长QQ
oracle 10g
数据泵导入导出_博客园相关文章
博客园_总排行榜
博客园_最新
博客园_月排行榜
博客园_周排行榜
博客园_日排行榜

我要回帖

更多关于 oracleexp全库导出 的文章

 

随机推荐