数据泵简单导入导出
2017-01-04 11:22
155 查看
1.创建测试用户并赋予dba权限:
注意一点:
5.导出成功后:
同时还有(如果你不指定日志名的话)默认创建的export.log --
具体如下:
6. 现在drop 掉 test1 表并且查看发现表已经被删除。
7. 用impdp命令恢复:
导入的时候命令很像,只需要把expdp 换成impdp就可以了:
备注:
1.直接在服务器端操作。
2.运行的时候后台会有一张历史表。
3.select job_name,operation,state from dba_datapump_jobs ;
4.导出发起后,其实是在后台进行了。Ctrl +C也无法打断
6. 如果不想导了,先 ctrl+c 然后 Stop _job =immediate适用于单线程的,不具备普适性。
kill job
7.ORA-39002:操作无效
ORA-39000: 转储文件说明错误
场景:
8.临时表的名称就是 job 名称。
9562
create user scott identified by tiger ;
grant connect,resource,dba to scott;2.在该用户下创建测试表(可以用sys 也可以用scott):
create table test1 (id int) ;3.插入上万条数据:
insert into scott.test1 values(1);
insert into test1 select * from test1;//可以把这条命令重复运行几次。主要作用是插入数据。
commit;
4.简单看下这挑expdp 导出命令:
expdp scott/tiger directory=data_pump_dir \ > tables = test1 dumpfile=scott.dump
directory=data_pump_dir :代表导出文件的目录
tables = test1 :代表要导出的是 scoot 的test1 表dumpfile =scott.dump : 导出文件名是 scott.dump
注意一点:
因为这里 scott 是 dba权限,所以对 data_pump_dir 有读写权限。如果不是dba权限用户,则会报错:
ORA-39002
ORA-39070:无法打开日志文件
ORA-39087碰到这种问题:需要给予 读写权限: 语句:grantread,write on directory
data_pump_dirto XX; XX代表当前用户,我这里是scott
5.导出成功后:
Starting "SCOTT"."SYS_EXPORT_TABLE_01": scott/******** directory=data_pump_dir tables=test1 dumpfile=scott.dump Estimate in progress using BLOCKS method... Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 0 KB Processing object type TABLE_EXPORT/TABLE/TABLE . . exported "SCOTT"."TEST1" 0 KB 0 rows Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is: /u02/app/oracle/product/11.2.0/db_home/rdbms/log/scott.dump Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at Sun Jan 8 21:54:09 2017 elapsed 0 00:00:16进入
/u02/app/oracle/product/11.2.0/db_home/rdbms/log/发现了-rw-r----- 1 oracle asmadmin 86016 Jan 8 21:54 scott.dump 文件。
同时还有(如果你不指定日志名的话)默认创建的export.log --
具体如下:
-rw-r----- 1 oracle asmadmin 86016 Jan 8 21:54 scott.dump -rw-r--r-- 1 oracle asmadmin 1127 Jan 8 21:54 export.log------------------------------------------华丽分割线------------------------------------------------------------------------------------华丽分割线------------------------------------------
6. 现在drop 掉 test1 表并且查看发现表已经被删除。
SQL> drop table test1 ; Table dropped.
SQL> select * from test1; select * from test1 * ERROR at line 1: ORA-00942: table or view does not exist
7. 用impdp命令恢复:
导入的时候命令很像,只需要把expdp 换成impdp就可以了:
impdp scott/tiger directory=data_pump_dir tables = test1 dumpfile=scott.dump
结果如下:导入
[oracle@rac1 ~]$ impdp scott/tiger directory=data_pump_dir tables = test1 dumpfile=scott.dump Import: Release 11.2.0.4.0 - Production on Sun Jan 8 22:07:59 2017 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options Master table "SCOTT"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded Starting "SCOTT"."SYS_IMPORT_TABLE_01": scott/******** directory=data_pump_dir tables=test1 dumpfile=scott.dump Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/TABLE_DATA . . imported "SCOTT"."TEST1" 0 KB 0 rows Job "SCOTT"."SYS_IMPORT_TABLE_01" successfully completed at Sun Jan 8 22:08:12 2017 elapsed 0 00:00:11
备注:
1.直接在服务器端操作。
2.运行的时候后台会有一张历史表。
3.select job_name,operation,state from dba_datapump_jobs ;
4.导出发起后,其实是在后台进行了。Ctrl +C也无法打断
6. 如果不想导了,先 ctrl+c 然后 Stop _job =immediate适用于单线程的,不具备普适性。
kill job
7.ORA-39002:操作无效
ORA-39000: 转储文件说明错误
场景:
8.临时表的名称就是 job 名称。
9562
相关文章推荐
- Ubuntu命令行下MySQL数据导出与导入简单示例
- informix中简单数据导入导出命令sh程序
- Ubuntu命令行下MySQL数据导出与导入简单示例
- MySQL数据表简单的导出excel和导入文件
- Oracle简单常用的数据泵导出导入(expdp/impdp)命令举例(上)
- Talend open studio数据导入、导出、同步Mysql、oracle、sqlserver简单案例
- sqoop简单操作-从mysql导入导出数据
- Postgresql数据库数据简单的导入导出
- Postgresql数据库数据简单的导入导出
- 股票数据导出分析(一)---数据导入MySQL以及网页表格简单show出来
- 命令行下MySQL数据导出与导入简单示例
- mysql学习小札(2)-- 数据备份、还原、导入导出方法的简单总结
- MySQL用户新建,授权,删除,改密 数据简单导入导出
- sqoop简单操作-从mysql导入导出数据
- Oracle 9i 数据库 数据导入和导出的最简单的方法
- SQL Server BI Step by Step 2--- 使用SSIS进行简单的数据导入导出
- 比较简单的导入导出EXCEL数据的方法
- SQL Server BI Step by Step 2--- 使用SSIS进行简单的数据导入导出
- Oracle简单常用的数据泵导出导入(expdp/impdp)命令举例(上)
- oracle触发器与数据导入导出的简单使用