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 ...
随机推荐
- 【记忆化搜索】bzoj1079 [SCOI2008]着色方案
#include<cstring> #include<cstdio> using namespace std; #define MOD 1000000007 typedef l ...
- [Android Studio Problems]记录克隆项目中遇到的坑(问题)以及解决方法
①Migrate project to Gradle? 问题描述: This project does not use the Gradle build system. We recommend th ...
- 权限管理-RBAC
(一)RBAC 通过用户与角色关联,角色与操作的关联实现用户与操作的关联 (二)权限细分 (三)数据库设计 (四)程序设计 (五)权限与应用程序 (1)应用URL实现程序权限控制 (2)应用code实 ...
- 图像视图-ImageView
(一) 知识点: (1)imageView.setImageAlpha(Alpha):设置图片透明度 (2)在布局imageView中设置图片位置:android:scaleType="ce ...
- Java二进制指令代码解析
http://www.blogjava.net/DLevin/archive/2011/09/13/358497.html http://blog.csdn.net/sum_rain/article/ ...
- Network Connection Lost When Windows 8 Goes To Sleep
http://www.kapilarya.com/fix-network-connection-lost-when-windows-8-goes-to-sleep http://superuser.c ...
- oracle--v$lock type字段详解
Name Description AD ASM Disk AU Lock AF Advisor Framework AG Analytic Workspace Generation AK GES De ...
- Delphi 目前使用delay函数功能
procedure sdfg.iTimers1Timer4(Sender: TObject);var vsub : Cardinal; vSetinterval: Cardinal;begin vsu ...
- Shiro 设置session超时时间
通过api:Shiro的Session接口有一个setTimeout()方法 //登录后,可以用如下方式取得session SecurityUtils.getSubject().getSession( ...
- postgres访问认证配置文件pg_hba.conf
pg_hba.conf(默认位于/var/lib/pgsql/10/data/pg_hba.conf)是设置访问认证的主要文件,格式为每条记录一行,每行指定一条访问认证. 设定一条访问认证包含了5个部 ...