oracle导出表的办法
1.先进行表分析(一定要执行此步,否则查询空表可能不准确)
select 'analyze table '||table_name||' compute statistics;' from user_tables;
2.再查询哪些表是空的(此步可以省略,直接进行第三步)
select table_name from user_tables where NUM_ROWS=0 order by table_name;
3.最后生成alert语句
select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0 order by table_name;
4.导出表---通过PLSQL Developer(tools->Export Tables)导出。
5.导入时通过命令行(cmd)进行导入 imp user/pass@orcl file=E:\data\data.dmp full=y
6.导出序列和视图 ---通过PLSQL Developer(tools->Export User Objects,然后选择要导出的视图)导出。
7.导入序列和视图---将seq.sql和view.sql中的空间名替换掉,然后新建Command Window-->分别load两个文件导入执行即可。
*********************************另外一种导出方法*********************************
EXP和IMP是客户端工具程序,它们既可以在客户端使用,也可以在服务端使用。
EXPDP和IMPDP是服务端的工具程序,他们只能在ORACLE服务端使用,不能在客户端使用。
如果想导入的用户已经存在:
1. 导出用户 expdp user1/pass1 directory=dumpdir dumpfile=user1.dmp
2. 导入用户 impdp user2/pass2 directory=dumpdir dumpfile=user1.dmp REMAP_SCHEMA=user1:user2 EXCLUDE=USER
如果想导入的用户不存在:
1. 导出用户 expdp user1/pass1 directory=dumpdir dumpfile=user1.dmp
2. 导入用户 impdp system/passsystem directory=dumpdir dumpfile=user1.dmp REMAP_SCHEMA=user1:user2
3. user2会自动建立,其权限和使用的表空间与user1相同,但此时用user2无法登录,必须修改user2的密码
今天需要另一个数据库的用户表导入到当前库中,但用户名不相同,以前exp/imp时,可以指定fromuser和touser来解决,在expdp中也提供了类似的解决方法
impdp system/zlsoft dumpfile=expdp:EXPDP_ZLHIS.DMP nologfile=y tables=zlhis.dept remap_schema=zlhis:scott remap_tablespace=ZL9BASEITEM:users,zl9indexhis
:users,zl9indexmtl:users table_exists_action=truncate exclude=object_grant
几个重要参数的说明一下:
1、remap_user 重新映射用户,格式: source_user1:target_user1,source_user2:target_user2
2、remap_tablespace 重新映射表空间
3、 table_exists_action 表已经存在的动作 有效关键字: (SKIP), APPEND, REPLACE 和 TRUNCATE。
4、exclude=object_grant 跳过对象授权
****************第三种导出方法(常用)****************
exp scott/tiger@orcl file=D:\database.dmp
imp scott/tiger@orcl full=y file=D:\database.dmp
非本机:
imp user1/pass1@192.168.153.68:1521/orcl file=E:\data.dmp full=y
exp user1/pass1@192.168.153.68:1521/orcl file=E:\data.dmp full=y
参看:https://blog.csdn.net/mzd8341/article/details/76595772
这样导出的表可能不全,请先看文章开头如何执行 alter table table_name_xxx allocate extent;
*********************************导出部分表方法*********************************
exp scott/tiger@orcl file=d:\test.dmp statistics=none TABLES=(TABLE1,TABLE2,TABLE3)
参看:https://blog.csdn.net/u011277123/article/details/53665302
oracle导出表的办法的更多相关文章
- 11g Oracle导出表 默认不导出数据为空的表解决
11g oracle导出表时会默认不导出数据为空 1.Oracle11g默认对空表不分配segment,故使用exp导出Oracle11g数据库时,空表不会导出. 2.设置deferred_segm ...
- Oracle 导出表结构
Oracle导出表结构 select A.Table_Name 表名 , -- A.column_name 字段名 A.column_name 字段名, A.data_type 数据类型, A.dat ...
- Oracle导出表(即DMP文件)的两种方法
转载:http://blog.csdn.net/lanpy88/article/details/7580691 方法一:利用PL/SQL Developer工具导出: 菜单栏---->Too ...
- ORACLE 日常处理办法
Oracle删除当前用户下所有的表的方法 1.如果有删除用户的权限,则可以: drop user user_name cascade; 加了cascade就可以把用户连带的数据全部删掉. 删除后再创建 ...
- PL/SQL不支持64位Oracle Client 解决办法
解决X64操作系统PL/SQL连接报错问题 make sure you have the 32 bits oracle client installed 说明PLSQL Developer并不支持Or ...
- Oracle导出表数据与导入表数据dmp,以及导入导出时候常见错误
使用DOS 操作界面导出表数据,导入表数据(需要在数据库所在的服务器上边执行) exp UserName/Password@192.168.0.141/orcl file=d:\xtables.d ...
- 无法连接windows虚拟机oracle的解决办法
在mac机上玩基于oracle db的开发真心不容易,oracle公司死活不出oracle express edition for mac OS,曾经发布过的oracle 10 for mac下载地址 ...
- oracle 导出表结构和数据,使用plsql
比如说需要把A数据库里面的数据,导入到B数据库 准备工作:在B数据库中创建B数据库同名的的用户名和表空间,注意大小写必须一样. 1,导出表结构.A数据库里点击工具栏里的tools--Export Us ...
- Sqlserver通过链接服务器访问Oracle的解决办法
转自http://blog.sina.com.cn/s/blog_614b6f210100t80r.html 一.创建sqlserver链接服务(sqlserver链接oracle) 首先sqlse ...
随机推荐
- 【数论】【欧拉函数】【筛法求素数】【乘法逆元】【快速幂取模】bzoj2186 [Sdoi2008]沙拉公主的困惑
http://www.cnblogs.com/BLADEVIL/p/3490321.html http://www.cnblogs.com/zyfzyf/p/3997986.html 翻了翻题解,这两 ...
- C语言计算器
地址: https://wenda.so.com/q/1371173683061754?src=140
- 关于css解决俩边等高的问题(等高布局)
等高布局 前段时间公司需哦一个后台管理系统,左侧是导航栏,右侧是content区域.然厚刚开始用的是js 去控制的,但是当页面的椰蓉过长的时候,有与js单线程,加载比较慢,就会有那么一个过程,查找了很 ...
- supervisord的环境变量的设置
在python中引用jar包,使用java的功能,需要使用三方包:pyjnius from jnius import autoclass 需要java环境,因此需要设置JAVA_HOME环境变量. 但 ...
- Kafka server.properties配置,集群部署
server.properties中所有配置参数说明(解释) broker.id =0每一个broker在集群中的唯一表示,要求是正数.当该服务器的IP地址发生改变时,broker.id没有变化,则不 ...
- 在线安装eclipse中html/jsp/xml editor插件 eclipseeditor
1.打开eclipse中的help————>Install New Software 2.点击Add按钮,然后弹出一个框,第一个文本框可以随便写,第二个一定要写: http://download ...
- POJ 2942 Knights of the Round Table 黑白着色+点双连通分量
题目来源:POJ 2942 Knights of the Round Table 题意:统计多个个骑士不能參加随意一场会议 每场会议必须至少三个人 排成一个圈 而且相邻的人不能有矛盾 题目给出若干个条 ...
- Unity导出webPlayer并且部署到IIS
http://blog.csdn.net/zooen2011/article/details/12884811 做好的Unity3D项目工程导出webPlayer类型,本地可以直接打开导出的html文 ...
- ajax 底层源码解析
对象: XMLHttpRequest 属性:readyState请求状态,开始请求时值为0直到请求完成这个值增长到4 responseText目前为止接收到的响应体,readyState<3此属 ...
- lodash 集合处理方法 map和filter区别
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8&quo ...