search
HomeDatabaseMysql TutorialOracle导入导出EXPDP IMPDP详解

使用EXPDP工具时,其转储文件只能被存放在DIRECTORY对象对应的OS目录中,而不能直接指定转储文件所在的OS目录。因此使用EXPDP工具

expdp使用

  使用EXPDP工具时,其转储文件只能被存放在DIRECTORY对象对应的OS目录中,而不能直接指定转储文件所在的OS目录。因此使用EXPDP工具时,,必须首先建立DIRECTORY对象,并且需要为数据库用户授予使用DIRECTORY对象权限。

首先得建DIRECTORY:

  SQL> conn /as sysdba

  SQL> CREATE OR REPLACE DIRECTORY directory_name AS 'directory_path';

同样可以更改directory的os路径

  SQL> GRANT read,write ON DIRECTORY directory_name TOusername;

查询directory目录

SQL> select * from dba_directories;

SQL> select * from all_directories;

删除directory目录

SQL> drop directory directory_name;

 

expdp选项

1. ATTACH

  该选项用于在客户会话与已存在导出作用之间建立关联.语法如下:

  ATTACH=[schema_name.]job_name

  schema_name用于指定方案名,job_name用于指定导出作业名.注意,如果使用ATTACH选项,在命令行除了连接字符串和ATTACH选项外,不能指定任何其他选项,示例如下:

  expdp username/password ATTACH=username.job_name

2. CONTENT

  该选项用于指定要导出的内容.默认值为ALL.语法如下:

  CONTENT={ALL | DATA_ONLY | METADATA_ONLY}

  当设置CONTENT为ALL 时,将导出对象定义及其所有数据; 为DATA_ONLY时,只导出对象数据; 为METADATA_ONLY时,只导出对象定义,示例如下:

  expdp username/password DIRECTORY=directory_name DUMPFILE=dumpfile_name CONTENT=METADATA_ONLY

3. DIRECTORY

  指定转储文件和日志文件所在的目录.语法如下:

  DIRECTORY=directory_object

  directory_object用于指定目录对象名称.需要注意,目录对象是使用CREATE DIRECTORY语句建立的对象,而不是OS 目录,示例如下:

  expdp username/password DIRECTORY=directory_name DUMPFILE=dumpfile_name

  建立目录:

  CREATE DIRECTORY directory_name as '/Oracle/dump';

  查询创建了那些子目录:

  SELECT * FROM dba_directories;

4. DUMPFILE

  用于指定转储文件的名称,默认名称为expdat.dmp.语法如下:

  DUMPFILE=[directory_object:]file_name[,….]

  directory_object用于指定目录对象名,file_name用于指定转储文件名.需要注意,如果不指定directory_object,导出工具会自动使用DIRECTORY选项指定的目录对象,示例如下:

  expdp username/password DIRECTORY=directory_name DUMPFILE=directory_name:dumpfile_name

5. ESTIMATE

  指定估算被导出表所占用磁盘空间的方法.默认值是BLOCKS.语法如下:

  EXTIMATE={BLOCKS | STATISTICS}

  设置为BLOCKS时,oracle会按照目标对象所占用的数据块个数乘以数据块尺寸估算对象占用的空间,设置为STATISTICS时,根据最近统计值估算对象占用空间,示例如下:

  expdp scott/tiger TABLES=emp ESTIMATE=STATISTICS DIRECTORY=dumpDUMPFILE=a.dump

  一般情况下, 当用默认值(blocks)时, 日志中估计的文件大小会比实际expdp出来的文件大, 用statistics时会跟实际大小差不多.

6. EXTIMATE_ONLY

  指定是否只估算导出作业所占用的磁盘空间,默认值为N.语法如下:

  EXTIMATE_ONLY={Y | N}

  设置为Y时,导出作用只估算对象所占用的磁盘空间,而不会执行导出作业,为N时,不仅估算对象所占用的磁盘空间,还会执行导出操作,示例如下:

  expdp username/password ESTIMATE_ONLY=y NOLOGFILE=y

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
How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

How do you handle large datasets in MySQL?How do you handle large datasets in MySQL?Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you drop a table in MySQL using the DROP TABLE statement?How do you drop a table in MySQL using the DROP TABLE statement?Mar 19, 2025 pm 03:52 PM

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

How do you represent relationships using foreign keys?How do you represent relationships using foreign keys?Mar 19, 2025 pm 03:48 PM

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

How do you create indexes on JSON columns?How do you create indexes on JSON columns?Mar 21, 2025 pm 12:13 PM

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?Mar 18, 2025 pm 12:00 PM

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

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.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!