search
HomeDatabaseMysql TutorialOracle Data Pump使用范例及部分注意事项(expdp/impdp)

Oracle版本:Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production,另外,系统有进行了6个节点的RAC

最近系统要“缩容”,原因我不想多说,非常麻烦的一件事情,因为要把数据提出来压缩、存放。
 
和操作系统无关,主要系Oracle的数据。
 
Oracle版本:Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
 
另外,系统有进行了6个节点的RAC集群,,每个表都按照月份或者日期进行了分区。
 
一、前置工作:
 
1. 在系统中建立生成dmp文件(导出的数据文件)的目录(一般情况下都需要root权限,这个自由发挥了^_^):
 
root@bidb04# mkdir -p /data/oracle_backup
root@bidb04# chown oracle:oinstall /data/oracle_backup
 
另外提个醒,无论你导出导入的时候用的是什么用户和密码登陆,数据库都是用(linux系统中的)oracle用户导出文件的,所以这个目录一定要让(linux系统中的)oracle用户有写权限。
 
2. 在oracle中定义生成dmp文件(导出的数据文件)的目录:
 
使用sqlplus / as sysdba进入sqlplus:

sql> grant create any directory to scott;        --这一步也可以不用。
sql> create or replace directory oracle_backup as '/data/oracle_backup';        --有了上面那一步,目录也可以使用scott用户建立,当然直接就这么建立就完了。
sql> grant read, write on directory oracle_backup to scott;                --赋予目录访问权限。
sql> create or replace directory DATA_PUMP_DIR as '/oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/log/';        --这个貌似我是没有这么建立的,系统自己有了。
sql> grant read, write on directory DATA_PUMP_DIR to scott;                --同上备注。
sql> grant EXP_FULL_DATABASE to scott;        --导出权限
sql> grant IMP_FULL_DATABASE to scott;          --导入权限

二、Data Pump导出(expdp):

expdp CONTENT=PARALLEL=8 FILESIZE=2G ENCRYPTION=data_only ENCRYPTION_PASSWORD=password

备注:

#1. scott/**********@bidb4 (红色部分)用户名密码和SID,这个就和sqlplus登陆的一致了。
#2. TABLES (绿色部分)表名(表名称:分区)
#3. DIRECTORY (蓝色部分)要生成导出文件的目录名--在oracle dba_directories中定义(定义方法见前文)
#4. DUMPFILE (黄色部分)生成的导出文件名%u参数表示对个文件的后缀,与parallel、filesize一起使用
#5. LOGFILE (紫色部分)日志记录文件名称(log目录:log名称,其中log目录在oracle dba_directories中定义)(定义方法见前文)
#6. CONTENT (橙色部分)要包含的内容
#7. CLUSTER (灰色部分)是否使用集群,默认是Y,这里需要N(可以看看后记)
#8. PARALLEL (灰色部分)并行处理
#9. FILESIZE (灰色部分)单个文件最大大小
#10. ENCRYPTION (灰色部分)加密选项1,指定加密内容(附录中有描述参数可选内容)
#11. ENCRYPTION_PASSWORD (灰色部分)加密选项2,指定加密密钥

 

三、Data Pump导入(impdp):

impdp PARALLEL=8 FILESIZE=2G ENCRYPTION_PASSWORD=password

 

备注:

基本和expdp的参数配置一致,有区别主要在第2个和第10个,另外,导出的日志名最好稍微修改一下,不然就覆盖掉了。

#2. TABLES (绿色部分)表名(只要表名就好了,不用加上分区,因为导入的数据里面已经包含了分区信息)
#10. ENCRYPTION (不再需要了)

linux

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
MySQL BLOB : are there any limits?MySQL BLOB : are there any limits?May 08, 2025 am 12:22 AM

MySQLBLOBshavelimits:TINYBLOB(255bytes),BLOB(65,535bytes),MEDIUMBLOB(16,777,215bytes),andLONGBLOB(4,294,967,295bytes).TouseBLOBseffectively:1)ConsiderperformanceimpactsandstorelargeBLOBsexternally;2)Managebackupsandreplicationcarefully;3)Usepathsinst

MySQL : What are the best tools to automate users creation?MySQL : What are the best tools to automate users creation?May 08, 2025 am 12:22 AM

The best tools and technologies for automating the creation of users in MySQL include: 1. MySQLWorkbench, suitable for small to medium-sized environments, easy to use but high resource consumption; 2. Ansible, suitable for multi-server environments, simple but steep learning curve; 3. Custom Python scripts, flexible but need to ensure script security; 4. Puppet and Chef, suitable for large-scale environments, complex but scalable. Scale, learning curve and integration needs should be considered when choosing.

MySQL: Can I search inside a blob?MySQL: Can I search inside a blob?May 08, 2025 am 12:20 AM

Yes,youcansearchinsideaBLOBinMySQLusingspecifictechniques.1)ConverttheBLOBtoaUTF-8stringwithCONVERTfunctionandsearchusingLIKE.2)ForcompressedBLOBs,useUNCOMPRESSbeforeconversion.3)Considerperformanceimpactsanddataencoding.4)Forcomplexdata,externalproc

MySQL String Data Types: A Comprehensive GuideMySQL String Data Types: A Comprehensive GuideMay 08, 2025 am 12:14 AM

MySQLoffersvariousstringdatatypes:1)CHARforfixed-lengthstrings,idealforconsistentlengthdatalikecountrycodes;2)VARCHARforvariable-lengthstrings,suitableforfieldslikenames;3)TEXTtypesforlargertext,goodforblogpostsbutcanimpactperformance;4)BINARYandVARB

Mastering MySQL BLOBs: A Step-by-Step TutorialMastering MySQL BLOBs: A Step-by-Step TutorialMay 08, 2025 am 12:01 AM

TomasterMySQLBLOBs,followthesesteps:1)ChoosetheappropriateBLOBtype(TINYBLOB,BLOB,MEDIUMBLOB,LONGBLOB)basedondatasize.2)InsertdatausingLOAD_FILEforefficiency.3)Storefilereferencesinsteadoffilestoimproveperformance.4)UseDUMPFILEtoretrieveandsaveBLOBsco

BLOB Data Type in MySQL: A Detailed Overview for DevelopersBLOB Data Type in MySQL: A Detailed Overview for DevelopersMay 07, 2025 pm 05:41 PM

BlobdatatypesinmysqlareusedforvoringLargebinarydatalikeImagesoraudio.1) Useblobtypes (tinyblobtolongblob) Basedondatasizeneeds. 2) Storeblobsin Perplate Petooptimize Performance.3) ConsidersxterNal Storage Forel Blob Romana DatabasesizerIndimprovebackupupe

How to Add Users to MySQL from the Command LineHow to Add Users to MySQL from the Command LineMay 07, 2025 pm 05:01 PM

ToadduserstoMySQLfromthecommandline,loginasroot,thenuseCREATEUSER'username'@'host'IDENTIFIEDBY'password';tocreateanewuser.GrantpermissionswithGRANTALLPRIVILEGESONdatabase.*TO'username'@'host';anduseFLUSHPRIVILEGES;toapplychanges.Alwaysusestrongpasswo

What Are the Different String Data Types in MySQL? A Detailed OverviewWhat Are the Different String Data Types in MySQL? A Detailed OverviewMay 07, 2025 pm 03:33 PM

MySQLofferseightstringdatatypes:CHAR,VARCHAR,BINARY,VARBINARY,BLOB,TEXT,ENUM,andSET.1)CHARisfixed-length,idealforconsistentdatalikecountrycodes.2)VARCHARisvariable-length,efficientforvaryingdatalikenames.3)BINARYandVARBINARYstorebinarydata,similartoC

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools