Skip to content
alex-suv edited this page Jul 19, 2019 · 1 revision

Let's guess, we have an Oracle database named EXAMPLE on server 192.168.1.2, and we want to bind the scheme TEST with git repository placed on server https://gitrep.com/repo.git. For this, you need to execute next steps:

You need to move to directory you want to see as local repository. Then execute next commands:

dbgit init
dbgit remote add origin https://<git_user_name>:<git_password>@gitrep.com/repo.git
dbgit link jdbc:oracle:thin:@192.168.1.2:1521:EXAMPLE user=TEST password=<db_user_password>

By default dbgit will work with TEST schema only, and it will not work with tabledata, just description of db objects. Let's guess, you want to save to git repository all metadata of TEST schema, but also you want save data from table CONFIG_TABLE and package MAIN_LOGIC from schema MANAGE. For this you need to edit .dbignore file. Add next strings to the bottom of the file:

!TEST/CONFIG_TABLE.csv
!MANAGE/MAIN_LOGIC.pkg

Make sure db user TEST has grants SELECT_CATALOG_ROLE - it needs to work with other schemes.

Then execute next command:

dbgit add "*"

It will save to local git repository all db objects. If you realize you added to local git repository db object you don't need (let's guess, it's TEMPORARY_TABLE table), you can remove it via next command:

dbgit rm TEST/TEMPORARY_TABLE.tbl

After that you can send your data to remote git repository with next commands:

dbgit commit -m "init commit"
dbgit push

Let's guess, another developer wants to work with your repository. For this he needs to execute:

dbgit clone https://<git_user_name>:<git_password>@gitrep.com/repo.git
dbgit link jdbc:oracle:thin:@192.168.1.2:1521:EXAMPLE user=TEST password=<db_user_password>

If he doesn't have db objects in database:

dbgit restore -r

After that, he can create the new branch to work:

dbgit checkout -b dev

After making changes in database:

dbgit add "*"
dbgit commit -m "changes"
dbgit checkout master
dbgit merge dev
dbgit push

Clone this wiki locally