I want to put together a talk about how useful the Python programming language is for an Oracle database administrator or DBA. I thought that I would start by putting my thoughts down in a blog post as a possible starting point for a speech. I think the best way to organize this post is around a series of questions.
First off, why does an Oracle DBA need a programming language? We are not developers. DBAs do backup and recovery, performance tuning, installations, upgrades and patching, etc. We may write the occasional small script or program to help with our work but we are not full-time heads down 40 hours a week plus programmers. A lot of what I do uses simple SQL scripts that I run through Oracle’s SQL*Plus command line utility. A handful of these scripts include Oracle’s PL/SQL programming language so I have done some programming but it is not my full-time job. Our database servers have Unix and Linux shell scripts that do things like exports and trace file cleanups. In addition I have graphical tools like Toad or Oracle Enterprise Manager that I use in my job. I can do most of my job with SQL, PL/SQL, shell scripts, and GUI database tools. Why do a need a general purpose programming language like Python in my role as an Oracle DBA?
A language like Python helps me in my DBA job because it is easy to use and connects to a lot of things.
Why would a smart Oracle database administrator need a programming language that is easy to use? We are very technical people, are we not? I think DBAs need an easy to use programming language because they are not full-time developers. I don’t know about you, but I can only hold so many details in the front of my mind. I have a lot of Oracle database syntax and details rolling around in my head. I know how to join V$SESSION and V$PROCESS without looking it up. That’s not surprising after using Oracle for 20 plus years. But, I can only remember so much. Since programming is not my primary focus I do not think I can remember a language’s details very well. So, I think it makes sense for a DBA to have an easy to use programming language like Python. I can quickly look up details that I forget if it has been a while since I wrote a Python program, so I don’t need all the details in the front of my brain.
What do I mean when I say that Python connects to a lot of things? There are all kinds of libraries or modules that you can use with Python. One of Python’s claims to fame is that you can use it as the glue to tie varies components together. I use a graphics module that helps me make plots of Oracle performance metrics. I get the data using an Oracle database module. My SQL*Plus and Unix shell scripts did not let me connect to a client side graphics library. Plus, I use Python to connect to SQL*Plus and to ssh into Unix systems to run shell scripts. So, Python can connect to pretty much any type of system or resource that I could need in my job as a database administrator. On top of all that, cloud providers such as Amazon Web Services use Python. I have used Python to connect to AWS. Also, I have tested Python with the cloud based Snowflake database. I have also connected Python to a MySQL database. It connects to a lot of stuff! Contrast Python to PL/SQL. PL/SQL is great for Oracle database programming. But it doesn’t connect to other stuff very easily. You aren’t going to connect to Amazon Web Services or to a client side graphics library through PL/SQL. It is easy to connect to these things with Python.
So, to summarize my two points for why Python is a good programming language for Oracle DBAs :
- Python is easy to use and DBAs are not full-time programmers.
- Python connects to everything a DBA uses.
In my talk I want to go into more depth on each point. What makes Python easy to use? What are some things it connects to? It would be helpful for an audience to see evidence to support each point. I could include code examples or quotes from web sites.
Maybe to keep this post from being excessively long I can make this one an intro or outline and delve into the supporting material in follow-up posts. If anyone reading this has questions or criticisms of this material I would be happy to hear it. I’m presenting my own thoughts about Python’s usefulness in my job based on my experience. If other people have good reasons why Python is not so useful to an Oracle DBA or see problems with my reasoning I would be happy to hear your opinion.
Bobby
Bobby ,
Nice intro and argument about Python usefulness for Oracle DBA . I agree !
I myself wanted to delve into this area and that’s why read your post in less than 5 mins.
I’m interested to know more about this , how to use Python with Oracle database and what can we achieve bu putting these 2 together.
Looking forward to more posts on the topic.
Keep writing !
Thanks! Hopefully more is coming on Python for Oracle DBAs.
My name is krishna..I’m oracle dba . I’m going to learning python .in my laptop vm virtual box having linux7.7. But python version having old version 2.7 have. I want upgrade latest version 3..could you please how we can for this issue..
There are several ways to do it. You might be able to install python3 using Yum. I prefer to build it from source.
https://docs.python.org/3/using/unix.html
https://www.bobbydurrettdba.com/2020/02/11/python-3-8-1-linux-install-without-root/
https://www.liquidweb.com/kb/how-to-install-python-3-on-centos-7/
Bobby
I’m not a DBA, but I’m similar in the way that I need to write glue scripts or utility scripts, and you’re inspiring me to improve my Python abilities!
Thanks for your comment!
I am also a long time Oracle DBA with some development capabilities (plsql mostly).While I learned basics of Java and Python in the past to do some simple data retrieval, I forgot most of it as I don’t use it on a regular basis. I was able to find shell/plsql to meet my scripting demands.
I am looking forward to your articles on use cases for Python, like graphs and multi-database connections ( I can foresee a need to transfer data from say Oracle to Postgres ).
Thanks!
Thanks for your reply. It sounds like we have a similar background. Years ago I tried to use Java in a similar way to what I am doing with Python now but I changed jobs and got away from it. I was thinking of talking about my experience with Java compared to Python. Time will tell if I will stick with Python or if I will give up on it as I did Java. One difference today is how the cloud providers use Python so that provides additional motivation that I didn’t have with Java.
Pingback: Python for the Oracle DBA – Easy to use | Bobby Durrett's DBA Blog
Thanks for sharing the descriptive information on Python course. It’s really helpful to me since I’m taking Python training. Keep doing the good work and if you are interested to know more on Python, do check this Python tutorial.https://www.youtube.com/watch?v=qgOXopu4n7c
Thank you for your comment.
Bobby
Hi,I am an Oracle DBA for 10+ years now and looking forward to learn Python from very basic. Can you please guide me to right source?
Thank you for your comment. I have not used it but the class that I took recommended this free online book:
https://python.swaroopch.com/
I guess you can pay for a printed copy.
This is the official getting started in Python page on the python.org web site:
https://www.python.org/about/gettingstarted/
I would start with one of those.
Bobby
Hi Bobby ,
I have planning to make a decision about what is the scope of Oracle database in the coming time and started learning python as it interests me. I am an ORACLE DBA for past 6 years now and want to know its a right move to switch to python completely or still DBA has upper edge over learning a new language and implementing it ?
I do not know what would be best for your career. There is a lot to know about Oracle or any other SQL based database including SQL Server, PostgreSQL, and MySQL, etc. I think that today people try to minimize the importance of understanding database internals and think that they can develop applications without a detailed understanding of how the database works. That may work for small systems but large, complex, heavily used systems need people who can dive deep into the details of how the database works. So, people may advise you to focus on learning programming in Python or other languages and to not learn database internals but I think that is a mistake.
Oracle may be slowing down as the top database with competitors catching up so I do not know if you should do Oracle or something else. But, I think it can only help you to understand more about how databases work, if that is something you enjoy working on. You may be very different from me so I do not know for sure what would be good for you. I just know that there is value in understanding database technology.
Bobby
Thx Bobby , I agree .Now