How to use Oracle data pump export utility to create dump file in local machine?

后端 未结 4 1788
野性不改
野性不改 2021-01-02 19:07

Oracle data pump export utility expect a parameter DIRECTORY (DBA_DIRECTORIES) which exist in DB server. Is it possible to map this directory to local machine or is there an

相关标签:
4条回答
  • 2021-01-02 19:49

    No, data pump sucks that way, but Oracle can get faster throughput using the same server the db sits on, so thats the tradeoff. Other enhancements too, but I still think this is a big disadvantage for data pump. Use old exp/imp or third party tools for this purpose.

    0 讨论(0)
  • 2021-01-02 19:53

    If using Data Pump, there is no direct way to store a dump file on your local machine. That is the way how Data Pump designed.

    However, there is one of possible ways to achieve what you want. A workaround has two steps:

    1. Run expdp as usual, which creates a dump file on server
    2. Use ocp tool to transfer a dump file from a database server to your local machine (and back, if you want to).

    An ocp tool stands for "Oracle Copy" and written exactly for the purpose of copying dump files back and forth from/to a database server. It is available here: https://github.com/maxsatula/ocp/releases/download/v0.1/ocp-0.1.tar.gz That is a source distribution, so once downloaded and unpacked, run ./configure && make

    (Hopefully you do not have Windows on a client side, because I never tried to compile it there)

    That is a simple command-line tool with a simple syntax. For example, this command will pull a file for you:

    ocp <connection_string> DATA_PUMP_DIR:remote_file_name.dmp local_file_name.dmp

    The tool uses a database connection and a minimum set of database privileges.

    Update:

    Finally I was able to adjust the source code and build ocp tool for Windows 32-bit:

    https://github.com/maxsatula/ocp/releases/download/v0.1/ocp-0.1-win32.zip

    Compiled/tested with 32-bit Instant Client 11.2.0.4 available here: http://www.oracle.com/technetwork/topics/winsoft-085727.html

    instantclient-basiclite-nt-11.2.0.4.0.zip (20,258,449 bytes)

    I believe it will work with a full Oracle Client installation too (just watch for bits, should be 32), however did not check myself.

    Unfortunately, Windows build of ocp does not have a fancy progress meter during file transfer. That piece of code had too much *nix-specific stuff, so I had to cut it off.

    Also, since it uses popt and zlib libraries, which are compiled as a part of GnuWin project, and available in 32-bit only, ocp for Windows is 32-bit only too. Hopefully, not having of a 64-bit version is not mission critical to you.

    Update 2:

    Warning! Make sure you always use DEDICATED server connection when download files from server, otherwise (for SHARED server) the downloaded copy of the file will be corrupted with no error messages!

    0 讨论(0)
  • 2021-01-02 19:59

    You should ask yourself: "Why do I want to keep data outside the database - the most secure place for my data? Where backup,restore and recovery is in place.

    If you are going to move data from database A to database B, make sure both databases have access to a common file-area where they can access the datadump-files through their directory-object and use the datapump.

    If you still want to export data to client side you can use the good old tools exp and imp.

    0 讨论(0)
  • 2021-01-02 20:03

    With a bit of a hack you can get data pump to do what you want, but you need to have a database on your local machine.

    What you need to do is create a database link on your local machine to the remote machine.

    Then in the datapump options, login to the local database as the db link owner, specify the 'network_link' option to be the name of the database link name you created. That way it should export from the remote database through the local database and create the file on your local instance. For example:

    expdp directory=<local_dir_object> network_link=<dblinkname on local instance> dumpfile=.. logfile=.. tables/schema=...
    
    0 讨论(0)
提交回复
热议问题