RMAN之一:快速入门 分类: H2_ORACLE 2014-02-17 16:11 689人阅读 评论(0) 收藏
1、数据导出基础
(1)创建datapump导出文件的目录对象并为相应用户授予权限。
出于安全考虑,不允许oracle用户直接在OS上进行文件的操作,而应通过directory对象指定。
SQL> create directory dpump_dir1 AS '/opt/oracle/admin/orcl11g/dpdump';
Directory created.
SQL> grant read, write on directorydpump_dir1 to scott;
Grant succeeded.
(2)导出
[oracle@lujinhong dpdump]$ expdpscott/tiger directory=DPUMP_DIR1 dumpfile=scott.dmp nologfile=y Export: Release 11.2.0.1.0 - Productionon Tue Apr 23 20:24:44 2013 Copyright (c) 1982, 2009, Oracle and/orits affiliates. All rights reserved. Connected to: Oracle Database 11gEnterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Miningand Real Application Testing options
Starting"SCOTT"."SYS_EXPORT_SCHEMA_01": scott/******** directory=DPUMP_DIR1dumpfile=scott.dmp nologfile=y
Estimate in progress using BLOCKSmethod...
Processing object typeSCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method:192 KB
Processing object typeSCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object typeSCHEMA_EXPORT/TABLE/TABLE
Processing object typeSCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object typeSCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object typeSCHEMA_EXPORT/TABLE/COMMENT
Processing object typeSCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object typeSCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported"SCOTT"."DEPT" 5.937 KB 4 rows
. . exported"SCOTT"."EMP" 8.570 KB 14 rows
. . exported"SCOTT"."SALGRADE" 5.867 KB 5 rows
. . exported"SCOTT"."BONUS" 0 KB 0 rows
Master table"SCOTT"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set forSCOTT.SYS_EXPORT_SCHEMA_01 is:
/opt/oracle/admin/orcl11g/dpdump/scott.dmp
Job"SCOTT"."SYS_EXPORT_SCHEMA_01" successfully completed at20:25:08
注意:directory=DPUMP_DIR1中的DPUMP_DIR1应该在dba_directories中存在,否则应该在第一步中先创建然后授权。
2、数据导入基础
若即将导入的用户或者表空间不存在,则必须先创建用户及表空间。
[oracle@lujinhong dpdump]$ impdp sys/Lu123456 directory=dpump_dir1dumpfile=scott.dmp Import: Release 11.2.0.1.0 - Productionon Tue Apr 23 20:27:30 2013 Copyright (c) 1982, 2009, Oracle and/orits affiliates. All rights reserved. UDI-28009: operation generated ORACLEerror 28009
ORA-28009: connection as SYS should beas SYSDBA or SYSOPER Username: sys as sysdba
Password: Connected to: Oracle Database 11gEnterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Miningand Real Application Testing options
Master table"SYS"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting"SYS"."SYS_IMPORT_FULL_01": sys/******** AS SYSDBA directory=dpump_dir1 dumpfile=scott.dmp
Processing object typeSCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object typeSCHEMA_EXPORT/TABLE/TABLE
ORA-39151: Table"SCOTT"."DEPT" exists. All dependent metadata and data willbe skipped due to table_exists_action of skip
ORA-39151: Table "SCOTT"."EMP"exists. All dependent metadata and data will be skipped due totable_exists_action of skip
ORA-39151: Table"SCOTT"."BONUS" exists. All dependent metadata and datawill be skipped due to table_exists_action of skip
ORA-39151: Table"SCOTT"."SALGRADE" exists. All dependent metadata and datawill be skipped due to table_exists_action of skip
Processing object typeSCHEMA_EXPORT/TABLE/TABLE_DATA
Processing object typeSCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object typeSCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object typeSCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object typeSCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object typeSCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SYS"."SYS_IMPORT_FULL_01"completed with 4 error(s) at 20:27:41
由于原来已经存在这些表,因此先删除再导入:
SQL> drop table emp; Table dropped. SQL> select * from emp;
select * from emp
*
ERROR at line 1:
ORA-00942: table or view does not exist [oracle@lujinhongdpdump]$ impdp sys/Lu123456 directory=dpump_dir1 dumpfile=scott.dmpschemas=scott Import:Release 11.2.0.1.0 - Production on Tue Apr 23 20:31:37 2013 Copyright (c)1982, 2009, Oracle and/or its affiliates. All rights reserved. UDI-28009:operation generated ORACLE error 28009
ORA-28009:connection as SYS should be as SYSDBA or SYSOPER Username: sysas sysdba
Password: Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With thePartitioning, OLAP, Data Mining and Real Application Testing options
Master table"SYS"."SYS_IMPORT_SCHEMA_01" successfully loaded/unloaded
Starting"SYS"."SYS_IMPORT_SCHEMA_01": sys/******** AS SYSDBA directory=dpump_dir1dumpfile=scott.dmp schemas=scott
Processingobject type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processingobject type SCHEMA_EXPORT/TABLE/TABLE
ORA-39151:Table "SCOTT"."DEPT" exists. All dependent metadata anddata will be skipped due to table_exists_action of skip
ORA-39151:Table "SCOTT"."BONUS" exists. All dependent metadata anddata will be skipped due to table_exists_action of skip
ORA-39151:Table "SCOTT"."SALGRADE" exists. All dependent metadata anddata will be skipped due to table_exists_action of skip
Processingobject type SCHEMA_EXPORT/TABLE/TABLE_DATA
. .imported "SCOTT"."EMP" 8.570 KB 14 rows
Processingobject type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processingobject type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processingobject type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processingobject type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processingobject type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job"SYS"."SYS_IMPORT_SCHEMA_01" completed with 3 error(s) at20:31:44
3、导出、导入参数
不管是expdp还是impdp均存在大量的参数,以对导入导出过程进行灵活的配置,详见《数据库管理艺术》第14章。
(1)重映射参数【导入参数】
一般情况下,不管使用哪个用户进行导入,导入的数据均归属到数据原有的用户名下。如使用sys用户进行导入操作,但数据是从scott导出的,则数据将被导入至scott模式下。除非使用remap_schema参数。
[oracle@datatest_db1_160 irms_gd]$ impdpsystem/Lu123456 directory=dpump_dir dumpfile=scott.dmp remap_schema=scott:test_datapump
类似的参数还有remap_table,remap_tablespace,remap_datafile, remap_data。
4、实例
从项目中把表名中包含BTS的表导出,然后导入至测试库中。
(1)导出
SQL>select * from dba_directories;
bash-4.1$ expdpHN_CM_IRMS_35/HN_CM_IRMS_351 directory=EXPDIR DUMPFILE=HN.DMPinclude=TABLE\:\"LIKE \'%BTS%\'\"
(2)导入
[oracle@lujinhong /]$ impdp HN_CM_IRMS_35/HN_CM_IRMS_351directory=dpump_dir1 dumpfile=HN1.DMP
5、项目导出语句
#!/bin/bash
export ORACLE_BASE=/opt/ORACLE
export ORACLE_SID=IRMS
exportORACLE_HOME=/opt/ORACLE/irms/product/10.2.0/db_1
exportPATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:
export PATH=$ORACLE_HOME/bin:$PATH
user='system'
passwd='Ora_8109#'
datestr=`date +"%Y%m%d"`
expdp ${user}/${passwd}directory=expdp_bak dumpfile=XZ_CM_IRMS_35_${datestr}.dmp logfile=XZ_CM_IRMS_35_${datestr}.log schemas=XZ_CM_IRMS_35 exclude=statistics
在导入时,可以使用replace参数,这样的话就不需要先手工删除原有数据,再进行导入。
版权声明:本文为博主原创文章,未经博主允许不得转载。
RMAN之一:快速入门 分类: H2_ORACLE 2014-02-17 16:11 689人阅读 评论(0) 收藏的更多相关文章
- 【solr专题之一】Solr快速入门 分类: H4_SOLR/LUCENCE 2014-07-02 14:59 2403人阅读 评论(0) 收藏
一.Solr学习相关资料 1.官方材料 (1)快速入门:http://lucene.apache.org/solr/4_9_0/tutorial.html,以自带的example项目快速介绍发Solr ...
- Hdu 1010 Tempter of the Bone 分类: Translation Mode 2014-08-04 16:11 82人阅读 评论(0) 收藏
Tempter of the Bone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Othe ...
- C#中的线程(上)-入门 分类: C# 线程 2015-03-09 10:56 53人阅读 评论(0) 收藏
1. 概述与概念 C#支持通过多线程并行地执行代码,一个线程有它独立的执行路径,能够与其它的线程同时地运行.一个C#程序开始于一个单线程,这个单线程是被CLR和操作系统(也称为"主线 ...
- iOS开发网络数据之AFNetworking使用 分类: ios技术 2015-04-03 16:35 105人阅读 评论(0) 收藏
http网络库是集XML解析,Json解析,网络图片下载,plist解析,数据流请求操作,上传,下载,缓存等网络众多功能于一身的强大的类库.最新版本支持session,xctool单元测试.网络获取数 ...
- NPOI 通用导出数据到Excel 分类: C# Helper 2014-11-04 16:06 246人阅读 评论(0) 收藏
应用场景: 在项目中,经常遇到将数据库数据导出到Excel,针对这种情况做了个程序封装.工作原理:利用NPOI将SQL语句查询出的DataTable数据导出到Excel,所见即所得. 程序界面: ...
- ASP.NET 自定义URL重写 分类: ASP.NET 2014-10-31 16:05 175人阅读 评论(0) 收藏
一.功能说明: 可以解决类似 http://****/news 情形,Url路径支持正则匹配. 二.操作步骤: 1.增加URL重写模块: using System; using System.IO; ...
- ASP.NET 自定义URL重写 分类: ASP.NET 2014-10-31 16:05 174人阅读 评论(0) 收藏
一.功能说明: 可以解决类似 http://****/news 情形,Url路径支持正则匹配. 二.操作步骤: 1.增加URL重写模块: using System; using System.IO; ...
- Prime Path 分类: 搜索 POJ 2015-08-09 16:21 4人阅读 评论(0) 收藏
Prime Path Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 14091 Accepted: 7959 Descripti ...
- Removing Columns 分类: 贪心 CF 2015-08-08 16:10 10人阅读 评论(0) 收藏
Removing Columns time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...
随机推荐
- Android程序使用SOAP调用远程WebService服务
在现在的应用程序中.不可能不使用到网络,而且后台一定是有server作为支撑的. 现在最常见的调用方式有HTTP的GET .POST方式,返回JSON或者XML数据. 可是也有一种常见的形式就是调用W ...
- 用openssl生成含有中文信息的证书
openssl 支持 ASCII 和 UTF-8 两种编码,应该可以制作中文证书. 在生成证书签发申请时,当输入中文则 openssl 报错,这是因为当前输入的字符是 ANSI 本地编码格式,超出了 ...
- 建堆是 O(n) 的时间复杂度证明。
建堆的复杂度先考虑满二叉树,和计算完全二叉树的建堆复杂度一样. 对满二叉树而言,第 \(i\) 层(根为第 \(0\) 层)有 \(2^i\) 个节点. 由于建堆过程自底向上,以交换作为主要操作,因此 ...
- 关于mybatis里面的Executor--转载
原文地址:http://blog.csdn.net/w_intercool/article/details/7893344 使用mybatis查寻数据,跟踪其执行流程 最开始执行的语句 this.ge ...
- 实际感受美丽的Linux(多组视频)
1.Fedora 上使用google earth 2.体验桌面-GNOME 2.2.9 3.体验桌面-KDE4.4 永中Office使用演示(和MS Office 2003很相似哦) 4.在Fedor ...
- LiveReload配置,安装使用方法~~~前端页面神助手
一.Chrome端安装LiveReload插件 1.首先这里啰嗦一下,如果Chrome无法进入商店,可以先安装一下谷歌商店助手 谷歌商店插件地址 http://pan.baidu.com/s/1dF1 ...
- Writing buffer overflow exploits - a tutorial for beginners
Buffer overflows in user input dependent buffers have become one of the biggest security hazards on ...
- stackFromBottom-listview 内容从底部开始填充
今天遇到了一个问题,就是listview虽然占满了整个屏幕,但是,当它的内容只有几条的时候,它会从底部开始显示,上面留有空白.后来进入xml发现,listview有个属性stackFromBottom ...
- 学习 Perl(一) —— 安装及 hello world
所谓存在的即是合理的,尤其适用于琳琅满目的编程语言界.每种编程语言在设计之初均只为解决特定领域的特定问题而生,没有语言擅长所有的领域能够完美地解决所有的问题. 这里推荐一本经典的 perl 入门书:P ...
- Altium Designer中死铜的问题