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 ...
随机推荐
- Vim复制一整行和复制多行
1.复制 1)单行复制 在命令模式下,将光标移动到将要复制的行处,按“yy”进行复制: 2)多行复制 在命令模式下,将光标移动到将要复制的首行处,按“nyy”复制n行:其中n为1.2.3…… 2.粘贴 ...
- Centos7.3 bbc tools安装
http://blog.csdn.net/orangleliu/article/details/54099528 更新到最新 CentOS 7.3 1611 yum update -y cat /et ...
- WCF服务测试工具
官网地址:http://www.wcfstorm.com/wcf/home.aspx WCFStorm Lite 来进行接口查看及调试,如下所示.
- ios 如何获得系统时间和日期
iphone 如何获得系统时间和日期 代码如下: #import <time.h> 1.获得当前的系统时间和日期 //获得系统时间 NSDate * senddate=[NSDate d ...
- Mysql -- Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’解决方法
启动mysql 报错: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/m ...
- 简化调用Web Service
年前在客户那里做POC,因为成型的OTMCS暴露Web Service的Schema太长,导致ICS无法支持和映射,讨论过后决定对Web Service调用进行封装,因OTMCS WebService ...
- smokeping网络监控
一.smokeping介绍 我们在选择机房的时候,如何知道这个机房的网络情况,这个时候就要用到网络监控软件:smokeping 本文主要介绍如何使用smokeping来监控idc机房的网络质量情况,从 ...
- 《深入理解Java虚拟机》笔记2
都知道Java对内存是自动垃圾回收的,什么样的内存是可以回收的? 这个问题是值得思考的. 对象已死的判定方法有两种: (1)引用计数器法 给对象添加一个引用计数器,有一个地方用到此对象,计数器加一. ...
- 转:Android推送技术研究
Android推送技术研究 字数5208 阅读4026 评论5 喜欢35 前言 最近研究Android推送的实现, 研究了两天一夜, 有了一点收获, 写下来既为了分享, 也为了吐槽. 需要说明的是有些 ...
- 【Android】The application has stopped unexpectedly.Please try again.
打出的android APK在android4.0.2手机上运行正常,但是在2.3.7的MOTO DEFY ME525上运行失败. android 2.3.3版本的模拟器上面运行失败: Sorry! ...