Table of Contents
I needed a simple executable to explore and export data from an Oracle DB on a locked down corporate laptop/network. This was my starting point for an automated data retrieval program which I can't share publicly. This repo is public in hopes that someone else will find it useful.
Here's why:
- Oracle CLI produces broken CSV files
- Oracle Developer didn't work for me either.
- This is lightweight and simple;
Of course, no one tool will serve all projects since your needs may be different. So you may also suggest changes by forking this repo and creating a pull request or opening an issue.
To get a local copy up and running follow these simple example steps.
You will need to install Go.
- go Install Go
To get this up and running:
-
Clone the repo
git clone https://github.com/sixcolors/orasuck.git
-
Install Go mods
go mod tidy
-
Build orasuck
go build -o orasuck main.go
- for windows
GOOS=windows GOARCH=386 go build -o orasuck.exe main.go
- Query and display (pretty) to stdout
orasuck -server "oracle://user:pass@server/service_name" "select * from my_table"
- Query and export to csv file
orasuck -server "oracle://user:pass@server/service_name" -file "out.csv" "select * from my_table"
- Initial Release
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
We can test Orasuck using Oracle Database Free Edition. For more information, see Oracle Database Free Release Quickstart.
Run the Oracle DB container.
docker run --name oracle -p 1521:1521 -e ORACLE_PWD=Test123 container-registry.oracle.com/database/free:latest
Connect to the Oracle DB container.
docker exec -it oracle bash
Connect to the Oracle DB.
sqlplus sys@localhost:1521/FREE as sysdba
Create a user and grant privileges.
alter session set "_ORACLE_SCRIPT"=true;
CREATE USER test IDENTIFIED BY Test123;
GRANT CONNECT, RESOURCE TO test;
ALTER USER test QUOTA UNLIMITED ON USERS;
Create a table and insert some data.
CREATE TABLE test.test_table (id NUMBER, name VARCHAR2(50));
INSERT INTO test.test_table VALUES (1, 'John Doe');
INSERT INTO test.test_table VALUES (2, 'Jane Doe');
Grant select privileges.
GRANT SELECT ON test.test_table TO test;
Test the connection.
go run main.go -server "oracle://test:Test123@localhost:1521/FREE" "select * from test_table"
Distributed under the MIT License. See LICENSE.txt
for more information.
@sixcolors
Project Link: https://github.com/sixcolors/orasuck
I've used the following projects as dependencies.