Skip to content

iliasaz/orautils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Oracle Utilities Docker

If you ever need to run tkprof, tnsping, export a large CSV file, or run other DB utilities on a client machine (ex., MacOS), and you can't or don't want to install a full Oracle Database Client or even InstantClient, keep on reading.

This is a collection of Oracle Database utilities that are packaged in a docker container that can be executed on any OS that supports docker. Oracle Instant Client is available for some platforms, and even it doesn't have some useful utilities like tkprof. Here it what's included:

  • tkprof
  • tnsping
  • utilities included in InstantClient
    • sqlplus
    • expdp, exp
    • impdp, imp
    • sqlldr
    • adrci
    • wrc
  • unload (more on this below)
  • Pro*C precompiler
  • gcc compiler (x86_64)

How to use

Build docker image

docker buildx build --platform linux/amd64 -t orautils .

Run a utility

Assuming that your tnsnames.ora, sqlnet.ora, database wallets are located in ${TNS_ADMIN} directory -

docker run --rm --platform linux/amd64 -it -v ${TNS_ADMIN}:/root/network/admin --name orautils orautils tnsping mydatabase

For tkprof, if not connecting to the database, you don't need ${TNS_ADMIN}. Instead, you might want to create a shell script with the following line and put it somewhere in your $PATH:

docker run --rm --platform linux/amd64 -it -v "$PWD":/root orautils tkprof $@ waits=yes sys=yes sort="(exeela,fchela)"

Then, you can run it as follows from anywhere on your computer:

tkprof my_trace_file.trc my_output.txt

What's included and how to modify

  • Slim packaging of OL9
  • gcc, and a few linux utilities
  • Oracle InstantClient (see the version in ARG release, update) as RPMs
  • Oracle binaries: tnsping, tkprof, support files
  • unload (source code)

You can easily modify the version of Oracle InstantClient as long as it's 19 series. Just change ARG update parameter to a newer version. If you want to use Pro*C precompiler or unload utility, you also need to update a path in pcscfg.cfg to match the new InstantClient version.

This package is not compatible with InstantClient 23ai The problem is that tkprof and tnsping supplied in this package are linked specifically to 19 series libraries of InstantClient.

Unload

This is a super fast utility for exporting data from Oracle tables in CSV format.

docker run --rm --platform linux/amd64 -it -v ${TNS_ADMIN}:/root/network/admin --name orautils orautils unload-csv userid=my_user/my_password@some_database sqlstmt="select * from MY_TABLE where rownum < 101" > output.csv

More examples here

How to modify

  • Modify the code in unload-csv.pc as needed.
  • Rebuild the docker image. It will compile the new version as part of the building process.

Or you can choose to do this interactively in the container.

docker run --rm --platform linux/amd64 -it -v ${TNS_ADMIN}:/root/network/admin --name orautils orautils bash
>> inside the container
proc iname=unload-csv.pc dbms=v8 prefetch=10000
make -f unload-csv.mk
cp unload-csv ${ORACLE_HOME}/bin/

Oracle binaries, utilities, support files are a property of Oracle Corporation and are provided here ONLY as a reference. You should obtain a license to download and use them from Oracle.

About

Oracle Utilities Docker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors