Home > PostgreSQL > DDL changes in mutiple Slony sets

DDL changes in mutiple Slony sets

I had a client scenario where we were replicating 16 different schemas using 16 sets with Slony and while doing DDL statements it was kind of confusing for the customer to remember which schema has what set number.

In the end I came up with a simple script that used to take input as:

executeDDL.sh schemaname ddl.sql

Here is how the script was…

echo "Schema is" $STR_SCHEMAecho "Filename is" $STR_FILEnames=( scehama1
scehama2 scehama3 scehama4  scehama5 scehama6 scehama7 scehama8
scehama9 scehama10 scehama11 scehama12 scehama13 scehama14
scehama15 scehama16 )
for (( i = 0 ; i < ${#names[@]} ; i++ ))
j=`expr $num + $i`
if [ $nm = $STR_SCHEMA ]
echo  "Set ID for Schema is" $SCHEMA_IDecho "Executing Command" "slonik_execute_script --config=slon_tools.conf $SCHEMA_ID $STR_FILE | slonik"
slonik_execute_script --config=slon_tools.conf $SCHEMA_ID $STR_FILE | slonik

Shoaib Mir

Categories: PostgreSQL Tags: ,
  1. May 23, 2009 at 12:35 pm

    Ey that’s nice, but you should try Slony-ctl. A brand new project (at least in the PgFoundry tree) developed in France.

  2. May 23, 2009 at 11:37 pm

    Thanks for pointing it out, I did download it when it was released but just never got time to try it… will surely do it first thing as I get a little time free.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: