Backing Up ODI Files with GitHub
If you can’t get the upgrade you want, but need to save your files, here’s how.
Intended for ODI versions prior to 12.2.1. Subversion is supported in 12.2.1+. Article done on Windows environment, slight changes will need to be made for other systems.
Before getting started…..
*Note: This article will assume you have a personal or business GitHub account set-up online and that your branches (Master, Dev, Prod) are set up. In our demo we assume you are backing up your XML file for additional safe keeping. See How to Use Versioning in 12c to learn more about creating ‘checkpoints’.
Backing up your development work is crucial whether you are the only developer in-house or one of fifty. Not only does it secure your work from being lost, it aids in communication between yourself, other developers and operations by giving the option of a common starting point if anyone gets confused or something breaks. As we are aware, sometimes Oracle’s features can be slightly buggy. Versioning in ODI prior to 12.2.1 (and some might argue up to the most recent versions) is known to have some issues. So what other options are available in addition to the internal Versioning ODI offers? Well, we can achieve a workaround using GitHub.
This demonstration is about using a Procedure in ODI to backup changes, or files, to GitHub. If your company security policy does not allow for a web-based backup, then you can do the same thing using your local Git Repo.
In our demonstration we are going to backup an XML file for additional safe keeping.
Create a backup copy of an Archive XML Procedure so there is an extra copy. The file does not have sensitive data in it, but your manager wants to make sure that a backup file exists no matter what happens internally.
- Go to your Github.com account and create a new repo, I will call it ODIBackup3, and ‘Create Repository’
2. Next we will need to create the matching SSH keys. Just follow GitHub’s easy tutorial here: https://help.github.com/articles/generating-an-ssh-key/ (make sure you choose Mac, Windows or Linux at the top. Make sure you add the public key to your ODIBackup3 Repo, not profile. I did not use a passphrase for this demo.
3. Now add the public SSH key to the repo by going under the ‘Setting’ gear (top right in your newly created repo) and choosing ‘Deploy keys’. Paste your public key there. MAKE SURE to check ‘Allow Write Access’
Tip: locate your ~/.ssh/id_rsa.pub and open it with notepad or any text editor to copy and paste. You can also cd to the directory and use pbcopy < ~/.ssh/id_rsa.pub
4. (In GitHub.com) Click back to ‘code’ and copy and paste the ‘Create New Repo’ (or the option your personal setup has) and open the command line, cd to the directory where your files are being saved to, and type git clone and your copied Github.com repo path (SSH version)
5. If you already have files, move them into the newly created folder for GitHub (in this case, ODIBackup3). MAKE SURE you add this new folder path to the archive procedure in ODI like below
Review: Ok, so far we have setup the GitHub repo, set up the SSH keys, used the command line to clone and pull down the repo, made sure to add in the new folder in the variable path where the zip and archive is occurring and moved the existing zip files into this folder. Now we will add the ODI procedure/command to automatically push the zip to the GitHub.com backup.
If you have not already done so…..
6. Login to ODI Studio and connect to your development repo (or the repo where the code/objects are that you wish to backup)
7. Expand your Designer tab and expand the Projects folder to the procedure, in this demo it will be ‘Packages’ > ‘Archive Files’
8. In the ODI toolbox click on All > OdiOSCommand and place it on the stage and rename it GitCommit. Connect the last Archive XML step to it using the OK green arrow like below.
9. Next, we need to create a simple batch script, GitCommit.bat, file using a text editor. Using the GitHub commands we will create a script that will create a backup to script and save it in the folder where the backup is. Make sure you cd over to the location of the backup, add everything, commit and then push. Save it with .bat and set Save as Type to ‘All Files’ as below.
10. Return to the Archive Files stage and select the (red) OdiOsCommand and in the properties window type the path (the file location) in the ‘Command to execute’ and save.
11. If you want to test the GitCommit (since your data has likely not changed) you can add a test.txt to the backup folder and select the GitCommit > right click and ‘Execute Step’ then go online to your GitHub.com repo and see the changes.
You can backup most anything to GitHub for safe keeping, if your permissions allow. This is just an alternate method for creating backups in addition to Version checkpoints within ODI.
— — -
A special thanks to Pete Tamsin and Nick Padgett. Make sure to follow me on Twitter: that_is_julia
*All views are my own and are not associated with Oracle or RM