Python/cx_Oracle utility functions

Posted by & filed under Python.

I recently created some utility functions to startup, mount and stop Oracle via cx_Oracle and thought I would share them. You will want to make sure you have password files setup correctly in order for this stuff to work. # shutdown abort: def shutdown_abort(sid): try: os.environ[’TWO_TASK’]=sid handle=cx_Oracle.connect("sys", "yourpwd", sid, cx_Oracle.SYSDBA) handle.shutdown(mode = cx_Oracle.DBSHUTDOWN_ABORT) return 0… Read more »

Primary Keys for Slony-I

Posted by & filed under PostgreSQL.

One of the prerequisites for Slony replication is to be sure that primary keys (or at least suitable columns) are defined for each table to be under replication. This is a simple example script for getting that data in postgresql. This assumes that the intention is to replicate all of the public schema. SELECT tablename… Read more »

Memory sizing for PostgreSQL

Posted by & filed under Database Engineering, PostgreSQL.

I needed to make an assessments of a linux server’s memory footprint consumed by postgresql, however, calculating the exact memory footprint of a postgresql database is not as straightforward as one might think. Since unix utilities like top, and ps tend to show some amount of shared memory usage in their tallies, they are next… Read more »

now on WordPress

Posted by & filed under Random.

I just updated the blog to WordPress in order to get a few (ok, a lot) more features, and use the general editing environment.  I imported some of the popular posts from my old blog as well.

Python and cx_oracle

Posted by & filed under Python.

I decided to start futzing with Python and Oracle. I generally use perl for most everything, and sometimes php for web based things, but I wanted to try Python at the urging of colleagues. I downloaded the source from here, and added in cx_Oracle from here . The installation on linux was about as smooth as possible. I installed… Read more »

Backing up Oracle optimizer statistics

Posted by & filed under Oracle.

Oracle 10g has some neat features for keeping track of old statistics. Pre-10g It used to be important to backup your statistics before you analyzed a table just in case your plans went crazy. Now Oracle does this for you automatically. There is a great post on Doug’s Oracle Blog that talks about this with some examples…. Read more »