Monday, June 13, 2011

South-East Tour Day 2 - Bayou Segnette State Park

This morning Kim was the first one up, followed by Athena and Aurora.  I got up last and began getting things packed up.  Arianna woke up very last.  She slept in the bottom bed with me.  Aurora and Kim slept up top.  Athena slept with Angel and Ashton.
Ashley made a breakfast of sausage patties and eggs.  There was also a bunch of watermelon my grandfather bought.  We were worried that there wasn't going to be enough food, but after cooking everything there was just enough to fill everyone's bellies.
Kim and I slowly got everything ready and eventually got things on the road.  After leaving the camp grounds we stopped by a Tom Thumb gas station for some ice and gas.  We then went across the street to Wal-Mart to get some other needed supplies, including letting the kids spend a little bit of the money we got for them to buy a toy to entertain them on the road.  Arianna got a mini version of the classic Fishing Game.  Athena bought herself a toy pony, and Aurora just got a bag of Skittles.
We kind of took our time in Wal-Mart because being in the air conditioning was feeling pretty nice.  However, we eventually drug ourselves back outside to the van and left around 12:30.
The initial estimation our GPS gave us to arrive in New Orleans was a little over four hours.  We had planned our trip so that we wouldn't be spending much more than four hours on the road each day.  I don't think the Google navigation software does a good job at taking into account the time that in-town driving has on stopping, going, and just generally having to drive slowly.
We stopped after about two and half hours on the road at a restartaurant called Saucy Q's.  It is a local Bar BQ place with some really great Bar BQ sauce in Mobile, AL.  Kim found herself eating french fries just to have something to dip into the sauce.  Everything there was really good, and it was worth pushing our already late lunch back a little bit to have some great local cooking.
One of the great things about taking the back roads is all the cool towns you get to go through, and all the really nice scenery.  Interstates have a habit of looking almost identical no matter how far you travel them.  The back roads of west Florida, Alabama, Mississippi, and Louisiana are absolutely gorgeous.  The bad part, and this was really rough, is that our actual time from leaving Pensacola to arriving at our destination was almost eight hours, including gas and food stops.
The kids where absolutely amazing.  For them to be on the road that long and maintain the mostly (mostly being a strong word here) good attitudes was unexpected.  The Nintendo DS, and CR-48 laptop (tethered to my Android phone) helped a lot.  So did the toys the two girls purchased.
I drove the first leg of the trip, and Kim took the second.  Athena got the treat of riding in the front today, something they are taking turns doing each day.  So Aurora played with Arianna a lot, which was very helpful.
The coastline in Mississippi is something you don't here much about, but it was really great to drive through.  Kim was pretty jealous that she was having to do the driving at the part because the sites where so great to look at, but she had to keep her eyes on the road.  Aurora was very taken by the sites too.  There where a lot of old houses along the way that where just magnificent.  You could also see the remaining foundations of many other homes that where presumably swept away by Katrina.  There was also a lot of brand new homes that where probably built sometime after Katrina came through in the remains of fallen homes.
The entrance to Louisiana is really awesome.  There are beautiful swamps filled with tall swamp grass that go on for miles and miles.  We also noticed a very strong coffee smell which we think might be Chicory plants growing in the area, but we'll have to research that later.
New Orleans appears to be a very diverse town where lots of cultures have taken route.  We passed by a very large Catholic monastary-looking area, followed by lots of Catholic churches and other Catholic features.  There was also a decidedly Asian area with what looked like Buddhist temples, and lots of other Asian culture buildings like restaurants and Buddhist worship areas.
There was also jumps from very poor looking areas that suddenly, and the turn of a single street, turned into very ritzy neighborhoods with mansions for houses.  What we didn't see much of was any sign of regular middle-class sections.
Finally towards the end sanity began to break down as we made our last few turns to get into the state park.  Finding the campgrounds was confusing because the signs didn't exactly lead you to them.  We first found ourselves at a boat landing area, and then we turned around and found ourselves going down what looked like a road under development with big tractors and dirt movers parked everywhere.
I used the Google map to try to guide us into the camping area but what looked like an entrance to the camp area was in actuality roped off.  By this time Kim was freaking out so I took over the wheel and just drove around the rope and into the campsites.  It looked completely empty when we first entered.  All the sites where vacant.  I continued to drive until we finally found a few sites with occupants.  Finally, we found our site, and there was even someone else camping in the site next to ours, so we felt reassured that all was well.
When we pulled in and parked Aurora began freaking out, after a very long trip of being very calm and in good spirits.  She was absolutely inconsolable.  She started getting a very nasty attitude towards her sisters and I had to put her at the bench away from everyone else.
I set up a tent we brought with us, so that we could put our stuff in it to keep the van empty.  As I got everything set up and moved everything we didn't need into the tent Aurora finally slowly settled down and then Athena got very grumpy.
We where going to have Kim take all the girls to shower so that I could get the bus set up and we could sleep.  I was going to shower the next morning.  However, Kim was not up to taking all three girls with Athena acting the way she was, so we all went up to the bath house and Athena bathed with me.
She cried very loudly the whole time, and Kim and sisters could hear her through the wall.  When we where finally bathed we went to wait in the van and I let Athena lay down on the bottom bed, which I had pulled out. Upon laying down she was instantly settled down.
When we got back to the site we got the bus all setup, and finally got each of the kids quited down and sleeping.
We are thinking about taking the Interstate, at a slow speed, for some of our future drives to save on time, even though the scenery won't be nearly as beautiful, because that much time on the road can really be draining, and we where really planning on keeping our road time to a minimum since a two week vacation of mostly driving isn't really much of a vacation at all.

Sunday, June 12, 2011

South-East Tour Day 1 - Big Lagoon State Park

Today we drove form our home in Tallahassee to Big Lagoon State Park.
Kim and I woke up around 7:30 this morning and we started doing the final stretch of loading up the Volkswagen, and cleaning up the house.  I made a breakfast of eggs, hash browns and toast.  The girls are usually up between 7:30 and 8:30, but when they where still not up around 9:00 we went ahead and woke them.  After feeding everyone and getting them ready for the day, we headed out.  We had to drop off Mollie with a pet sitter Kim found on Craig's List, and then we left town.
I drove the first leg of the trip all the way to Fort Walton Beach, taking Highway 20 almost the whole way. We dropped by a Subway for lunch, but ate in the car.
We arrived at the campsite around 4:30, making our trip around five hours, including the stopping for food and gas.  The kids where mostly well behaved on the trip, with the usual "I'm tired", "I'm hungry", and "How far?" along the way.  The bus held up like a champ the whole way too.
Nick and his family had stayed the previous night at one of the two campsites we had reserved, the night before. Him and my grandparents where already in their site when we arrived.
After getting settled in, Nick helped us install a boat seat in the back for Kim to sit in while I drove.  He also helped me install second cigarette lighter in the dash, which is going to be crucial so I can charge my phone, and have another appliance, such as a fan, going.
The beach at Big Lagoon isn't really the nicest in Florida, but the kids surely didn't mind.  The water here is very calm, and there where plenty of other children around our children's age to keep them company.  Aurora had something sting her on her chest so Kim took her back to the camp grounds.  Towards the end Arianna and I made a big sand castle, which was nothing more than a big pile of sand we made from digging a hole in the beach and laying the sand from it in one big pile.  We found a hermit crab that we put in our hole, which was full of water, and declared our crab as being a citizen of our castle, which we where the rulers of.  After that it was time to head back to start getting things prepared for dinner.  Arianna lost her Star Wars sunglasses somewhere in the water.
Kim and Ashley went to the store to get supplies, since raccoons ate all the food Nick and Ashley had purchased the previous night.  Nick cooked up a meal of cheese burgers, corn and baked beans.  We spent the rest of the night with the kids keeping an out for raccoons that where constantly on the alert to find some abandoned plate of food.
We finally wound down the night with Kim taking Aurora to the showers, Athena sleeping with Nick's family, and me putting Arianna down to bed.
All of the kids have agreed that so far they are having a really great time and are very excited about the nights to come.

Saturday, June 11, 2011

South-East Tour Day 0 - Getting Ready

Starting tomorrow (technically today since it is past midnight) we will be heading off for a two week adventure across the South-East in our 1980 Volkswagen.

We will be heading West to New Orleans, which I've been really wanting to visit for quite some time. We will then head North to Nashville, going back East through Nashville to Asheville, NC, then back down South and probably home.
We still have not yet planned our trip past Asheville, but it will probably involve a stop in Augusta, GA and a final stop at the Okefenokee Swamp State Park.
I have been able to use this trip as a way to motivate us to get some things done on the van that I've been meaning to take care of for quite some time.  I had my mechanic do some major engine work.  Kim and I also made curtains for the windows.  In fact, we just got done after midnight finishing the curtains.
The three girls are really excited about this trip, and Arianna has asked practically every day, "Are we going to start our trip tomorrow?"  Some mornings she'll even ask if the trip is starting that day.  So tonight I made a big deal out of how we would be leaving first thing tomorrow morning.  So yeah, we're all pumped.
Here's what we have planned so far.
216 miles. 4:29
Saturday 6/11: Pensacola, Fl Big Lagoon State Park Sites 50 & 51
222 miles.  4:43
Sunday 6/12: New Orleans Bayou Segnette Site CI074
Monday 6/13: New Orleans Bayou Segnette CI074
180 miles. 3:46
Tuesday 6/14: Natchez Trace Parkway Natchez State Park 044, Campground B
Wednesday 6/15: Memphis, TN Meeman-Shelby Forest State Park
Thursday 6/16: Memphis, TN Meeman-Shelby Forest State Park
6/17: Nashville, TN Seven Points Campground
Saturday 6/18 - Nashville, TN Seven Points Campground
Sunday 6/19 - Great Smoky Mountains National Park, Tenn. Elkmont Campground, site A7
Monday 6/20- Great Smoky Mountains National Park, Tenn. Elkmont Campground, site A7
Tuesday 6/21- Lake Powhatan State Park Asheville, NC Site 21
Wednesday 6/22- Georgia Somewhere
Thursday 6/23 - Georgia Somewhere
Friday 6/24- Okefenokee Swamp State Park
Saturday 6/25 - Drive to Tallahassee
Katie, Kim's sister, will be watching our cat for us.  We have paid an animal sitter to watch our dog Mollie.  I've now got to get back to the rest of our packing so I can hurry up and get to bed.
Oh yeah, and Kim has her own blog going on at http://baucumfamily.blogspot.com/

Saturday, May 14, 2011

Install Boxee on Ubuntu 11.04 Natty Narwhal

The Ubuntu package for the current version of Boxee as of this writing, 0.9.22.13692M, does not install on the latest version of Ubuntu.  It throws an error "Dependency is not satisfiable: libxmlrpc-c3"  The problem arises because libxmlrpc-c3 has been renamed to libxmlprc-c3-0.  The solution is to modify the debian package and change its dependencies.  This is easier than it sounds, but you have to know how.  Download the debian installer from the Boxee website, and place it in your home directory and then open up a terminal
dpkg-deb -x boxee-0.9.22.13692.i486.modfied.deb boxee
dpkg-deb --control boxee-0.9.22.13692.i486.modfied.deb boxee/DEBIAN
Now we need to edit the file that lists the dependencies.  Run the first command to do it with a GUI, or the second to use vim.
gedit boxee/DEBIAN/control
vi boxee/DEBIAN/control
Find libxmlrpc-c3 in this file and append -0 to the end of it so that is read "libxmlrpc-c3-0", and save the file.  Now we need to repackage our changes into a new debian package file.
dpkg -b boxee boxee-works.deb
When it is done simply double-click the newly created boxee-works.deb file and install it with Software Center.  Hopefully it will not be too long before the peeps over at Boxee fix the package so that it Just Works™.

Monday, April 25, 2011

cx_Oracle on Ubuntu 11.04 Natty

I used the following to install cx_Oracle on Ubuntu 11.04 for use with Python 3.2, though they should work with any version of Python supported by cx_Oracle.  This will basically involve using alien to convert lots of rpms into debian package.  Go ahead and install alien as well as some other libraries we will need.

sudo apt-get install alien libaio1 python3.2 libpython3.2

Change the above to reflect the version of Python you want to use.

First we need the Oracle Instant Client software.  Go to http://www.oracle.com/technetwork/topics/linuxsoft-082809.html or http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html (for 64-bit) and download either the basic or basiclite rpm.  I did not try the basiclite client, but I think they should both work.  You can also grab sqlplus and whatever other packages you may need while working with Oracle, but only the basic package is needed for cx_Oracle to work.  Once downloaded convert it to a debian package.

sudo alien -d oracle-instantclient11.2-sqlplus-11.2.0.2.0.i386.rpm

Replace the above line with the appropriate version of the instant client that you downloaded.

Now install it.

sudo dpkg -i oracle-instantclient11.2-basic_11.2.0.2.0-2_i386.deb

We need to create a configuration file pointing to the oracle library folder.

sudo vi /etc/ld.so.conf.d/oracle.conf

Depending on the version of the instant client installed you should have a folder like /usr/lib/oracle/11.2/client/lib.  This folder should be the first line to the oracle.conf file we create here.
Finally, for our Oracle client install, we need to define our ORACLE_HOME.  We need to create a new file.

sudo vi /etc/profile.d/oracle.sh

Add the following line, tweaking it as necessary to point to the version of Oracle you installed.
export ORACLE_HOME=/usr/lib/oracle/11.2/client
export LD_LIBRARY_PATH=$ORACLE_HOME/lib

On 64-bit installs then do the following line instead.
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export LD_LIBRARY_PATH=$ORACLE_HOME/lib

Now that our client software is setup, we can install the python library to connect to Oracle.

Download cx_Oracle from http://cx-oracle.sourceforge.net/  I want the 11gR2 client for my x86 (32-bit) machine, and I want to use it with Python 3.2, so here I download the line labeled CentOS 5 i386 RPM (Oracle 11g, Python 3.2)  Make sure NOT to download the Unicode version unless you know for sure you need it.  Download the version for the version of Oracle and Python that you plan on using.  Usually, regardless of the version of Oracle you plan on using, downloading the latest version will work with any of the older versions of Oracle.

After downloading we use alien again to created a debian package.

sudo alien -d cx_Oracle-5.1-11g-py32-1.i386.rpm
sudo dpkg -i cx-oracle_5.1-2_i386.deb

The way our debian installs cx_Oracle isn't quite what Ubuntu needs, so run the following command to set things right.

cd /usr/lib/python3.2
sudo mv site-packages/cx_Oracle* dist-packages/
sudo rmdir site-packages/
sudo ln -s dist-packages site-packages

If the dist-packages folder does not already exist, you may need to run the following.

sudo mkdir dist-packages

Now you should be able to import the cx_Oracle module into Python and start creating connection.

david@fink:/usr/lib/python3.2$ python3.2
Python 3.2 (r32:88445, Mar 25 2011, 19:28:28) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle

Profit!

Friday, March 18, 2011

Connect to MySQL database from LibreOffice Base on Ubuntu

LibreOffice's Base program can provide a quick easy way to access a MySQL database and write some reports against data.  The following outlines how to easily setup LibreOffice Base to connect to MySQL.  It assumes that you already have LibreOffice Base installed.  It works just as easily for OpenOffice Base.

First we need to install the JDBC driver for MySQL
sudo apt-get install libmysql-java
Next open up any LibreOffice program and then click on Tools->Options.  Expand LibreOffice and then click on Java.  Click on the Class Path button on the right followed by Add Archive.  Browse to /usr/share/java/mysql-connector-java.jar  Click Ok and choose to restart LibreOffice.

Now open LibreOffice Base and choose to Connect to an existing database.  In the drop-down menu choose MySQL, and connect using JDBC.  Click on the Test class button to make sure the JDBC driver loads successfully.  If it doesn't, then check that you followed the previous steps properly.  If it does load then simply enter the settings as it relates to your MySQL database.

If you get the JDBC driver to load properly, but you cannot connect to your MySQL database, then I would recommend installing the mysql client and making sure you can connect from the MySQL client first.  If the JDBC driver loads properly, and you can connect to your database with the MySQL database, then you should not have any problem connecting with LibreOffice.

Sunday, March 6, 2011

Installing Oracle 11gR2 on Ubuntu 10.04 Lucid Lynx 32-bit

I did this install in a virtual machine, which I would strongly suggest you do first before doing it on a physical install that you intend to use.
Start off by logging in as the user you created during the install.  This user should have sudo powers.  First we need to install the libraries needed.
sudo apt-get install unzip build-essential x11-utils rpm ksh lsb-rpm libaio1
Ubuntu 10.04 comes with libstdc++6, but we need libstdc++5_3.3.6.  Browse to http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-3.3/ and find the latest version.  When I wrote this it was 5_3.3.6-21.  Let's download and install it.
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-3.3/libstdc++5_3.3.6-21ubuntu1_i386.deb
dpkg-deb -x libstdc++5_3.3.6-21ubuntu1_i386.deb ia32-libs
sudo cp ia32-libs/usr/lib/libstdc++.so.5.0.7 /usr/lib/
sudo ln -s /usr/lib/libstdc++.so.5.0.7 /usr/lib/libstdc++.so.5
Next, we need to setup the oracle users and groups.
sudo addgroup oinstall
sudo addgroup dba
sudo useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle
sudo mkdir /home/oracle
sudo chown -R oracle:dba /home/oracle
sudo ln -s /usr/bin/awk /bin/awk
sudo ln -s /usr/bin/rpm /bin/rpm
sudo ln -s /usr/bin/basename /bin/basename
sudo mkdir /etc/rc.d
for i in 0 1 2 3 4 5 6 S ; do sudo ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ; done
sudo mkdir -p /u01/app/oracle
sudo chown -R oracle:dba /u01
Various configuration files need to be modified.  Next we back up the original configuration file and add the configurations.

sudo cp /etc/sysctl.conf /etc/sysctl.conf.bak
echo 'fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 1048576
net.core.wmem_max = 1048576
net.ipv4.ip_local_port_range = 9000 65535
' | sudo tee -a /etc/sysctl.conf > /dev/null
sudo cp /etc/security/limits.conf /etc/security/limits.conf.bak
echo 'oracle soft nproc 2047
oracle hard nproc 16383
oracle soft nofile 1023
oracle hard nofile 65535' | sudo tee -a /etc/security/limits.conf > /dev/null
sudo sysctl -p

Now it is time to log out, and then log back in as our new oracle user.  As the oracle user download the software from oracle.com  You should be able to find it at http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
Open a terminal and change into the directory where you downloaded both files.  And then run the following to unzip and run the installer.

unzip linux_11gR2_database_1of2.zip
unzip linux_11gR2_database_2of2.zip
cd database
./runInstaller
From here it is up to you which options you want to choose.  I used all the defaults and supplied 'password' for my passwords, since it is just a test install.
Last, we just need to setup our system paths.

sudo echo '
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
export EDITOR=/usr/bin/vi' >> /etc/profile
Your install is ready to go.  You should be able to log in with sqlplus, or any other IDE you want to use, based on the setup you chose during the install.
Now, we need Oracle to start up on each reboot.  To do this we need to create an init script.  As root, create a file at /etc/init.d/oracledb with the following contents.

#!/bin/bash
#
# /etc/init.d/oracledb
#
# Run-level Startup script for the Oracle Listener and Instances
# It relies on the information on /etc/oratab
# these are the paths for our base installation
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.1.0/dbhome_1
export ORACLE_OWNR=oracle
export PATH=$PATH:$ORACLE_HOME/bin
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
    echo "Oracle startup: cannot start"
    exit 1
fi
case "$1" in
    start)
        # Oracle listener and instance startup
        echo -n "Starting Oracle: "
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
        touch /var/lock/oracle
        echo "OK"
        ;;
    stop)
        # Oracle listener and instance shutdown
        echo -n "Shutdown Oracle: "
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
        rm -f /var/lock/oracle
        echo "OK"
        ;;
    reload|restart)
        $0 stop
        $0 start
        ;;
    *)
        echo "Usage: `basename $0` start|stop|restart|reload"
        exit 1
esac
exit 0

Now we need to make it bootable and tell Ubuntu to run it on bootup.

sudo chmod a+x /etc/init.d/oracledbsudo update-rc.d oracledb default
Use dbca to create and manage databases, and use netca to create and manage listeners.

Saturday, March 5, 2011

Aurora's first manga

Today we went to Borders so Aurora could spend a gift card she got for there.  I picked up a Python book and thumbed through it for a while.  Then Kim needed me to watch Aurora because she wanted to go look at books in places other than the kids section, where Athena and Arianna wanted to hang out.
Aurora had already picked out a book, but was still looking around.  We went over to the history section for a while a checked out what was in store there, and then started heading back to the kids section.
On our way back we ran into the manga section, and I made a comment to Aurora about how I'd like for her to try manga to see if she liked it.  She started talking about putting her book back and I told her that she needs the book she wants to buy, not the one I want her to buy.
She asked me what manga was about, so I randomly picked up a book that looked like it may be something in her area and showed her the first page.  I showed her how the first page is what we normally think of as the last page.  I then put the book back and started looking for something that I thought was closer to what she may like when she asked me for that same book back.  I explained it was just a book I randomly selected, not necessarily anything I thought she would like.
While I looked around she thumbed through the book and declared she wanted to put her other book back and get the one I had shown her.  It is called Neko Ramen.  It is about a cat named Taisho who owns a Ramen shop and comes up with ridiculous ideas about how he can sell Ramen, such as using spaghetti noodles and calling it Italian Ramen.
I double checked she really wanted to get this book I just randomly grabbed off the shelf instead of the one she had already picked out.  She assured me she was, so she ended up buying it.
On the way home she read through the book and thought it was really funny.  She thought it was really weird how the excited faces look.  I explained that it is part of the manga art style.  It took us both a while to realise that you ride from top-right, down, then move to the top of the next panel to the left.  We started off thinking you started at the top-right, moved left, and then down, until we realised why the panels sometimes made no sense.
I hope Aurora takes to this manga thing.  Aurora and I have didn't interests in books.  She likes non-fiction and historical fiction type books.  I prefer science fiction and fantasy.
I have been able to get her into the Narnia series.  We have finished The Magician's Nephew and The Lion, the Witch, and the Wardrobe.  At first she did not like The Magician's Nephew, but she gave it a second shot and started to get into it.  We are presently taking a break from the Narnia series and reading James and the Giant Peach.
So, if this trend continues, Aurora and I will have more things to do together.  Plus, it has been nice reading good children's books that I would otherwise not put any interest into.
As for me, I'm reading a chapter a day of an eleven-hundred plus page book on programming in Python, which is followed by another Python book that covers more advanced topics on the language and is equally as large.  Fun times.

Tuesday, February 22, 2011

Rebuilding invalid indexes in Oracle

I wrote many moons ago a post on finding invalid indexes in an Oracle database.  I have since written a script to go through all the invalid indexes and attempt to rebuild them, going down to the partition or subpartition level.  I have used this script many times and it appears to work as advertised.
It uses the all_indexes, all_ind_partitions, and all_ind_subpartitions so that it can interrogate all indexes it has permissions to view.  It will attempt to rebuild the invalid indexes, and will report on any indexes it could see, but not rebuild.  If run as a DBA account, it should be able to rebuild all invalid indexes in the system.

DECLARE

schema_name all_tab_partitions.table_owner%TYPE;
table_name all_tab_partitions.table_name%TYPE;
index_partition_name all_tab_partitions.partition_name%TYPE;

CURSOR invalid_indexes IS
SELECT owner,
index_name,
table_owner,
table_name,
status,
partitioned
FROM all_indexes
WHERE owner NOT IN ('SYS', 'SYSTEM')
AND status != 'VALID'
AND
(
status != 'N/A'
OR index_name IN
(
SELECT index_name
FROM all_ind_partitions
WHERE status != 'USABLE'
AND
(
status != 'N/A'
OR index_name IN
(
SELECT index_name
FROM all_ind_subpartitions
WHERE status != 'USABLE'
)
)
)
);

CURSOR tab_partitions IS
SELECT partition_name,
subpartition_count
FROM all_tab_partitions
WHERE table_owner = UPPER(schema_name)
AND table_name = UPPER(table_name);

CURSOR tab_subpartitions IS
SELECT subpartition_name
FROM user_ind_subpartitions
WHERE partition_name = index_partition_name;

successful_rebuilds NUMBER := 0;
unsuccessful_rebuilds NUMBER := 0;

BEGIN

FOR invalid_index IN invalid_indexes
LOOP
DBMS_OUTPUT.PUT_LINE('Rebuilding ' || invalid_index.owner || '.' || invalid_index.index_name);
IF invalid_index.partitioned = 'NO' THEN
BEGIN
EXECUTE IMMEDIATE('ALTER INDEX ' || invalid_index.owner || '.' || invalid_index.index_name || ' REBUILD');
successful_rebuilds := successful_rebuilds + 1;
EXCEPTION
WHEN OTHERS THEN
unsuccessful_rebuilds := unsuccessful_rebuilds + 1;
DBMS_OUTPUT.PUT_LINE('Unable to rebuild ' || invalid_index.owner || '.' || invalid_index.index_name || '.  ' || SQLERRM);
END;
ELSE
schema_name := invalid_index.table_owner;
table_name := invalid_index.table_name;
FOR tab_partition IN tab_partitions
LOOP
IF tab_partition.subpartition_count = 0 THEN
BEGIN
EXECUTE IMMEDIATE('ALTER INDEX ' || invalid_index.owner || '.' || invalid_index.index_name || ' REBUILD PARTITION ' || tab_partition.partition_name || ' COMPUTE STATISTICS');
successful_rebuilds := successful_rebuilds + 1;
EXCEPTION
WHEN OTHERS THEN
unsuccessful_rebuilds := unsuccessful_rebuilds + 1;
DBMS_OUTPUT.PUT_LINE('Unable to rebuild ' || invalid_index.owner || '.' || invalid_index.index_name || ', for partition ' || tab_partition.partition_name || '.  ' || SQLERRM);
END;
ELSE
index_partition_name := tab_partition.partition_name;
FOR tab_subpartition IN tab_subpartitions
LOOP
BEGIN
EXECUTE IMMEDIATE('ALTER INDEX ' || invalid_index.owner || '.' || invalid_index.index_name || ' REBUILD SUBPARTITION ' || tab_subpartition.subpartition_name);
successful_rebuilds := successful_rebuilds + 1;
EXCEPTION
WHEN OTHERS THEN
unsuccessful_rebuilds := unsuccessful_rebuilds + 1;
DBMS_OUTPUT.PUT_LINE('Unable to rebuild ' || invalid_index.owner || '.' || invalid_index.index_name || ', for subpartition ' || tab_subpartition.subpartition_name || '.  ' || SQLERRM);
END;
END LOOP;
END IF;
END LOOP;
END IF;
END LOOP;

DBMS_OUTPUT.PUT_LINE(successful_rebuilds || ' indexes successfully rebuilt.');
DBMS_OUTPUT.PUT_LINE(unsuccessful_rebuilds || ' indexes could not be rebuilt.');

END;

Friday, January 7, 2011

How to sync your Facebook calendar to Evolution

It looks like Facebook provides some very weak, but better than nothing, webcal support, that can be used to have your Facebook events show up in Evolution, and thus, on your Ubuntu desktop calendar.

  1. Log in to Facebook and then browse to http://www.facebook.com/?sk=events
  2. At the bottom, find the links that says, "Export Events"
  3. Right-click the webcal link and copy the link address.
  4. In Evolution, go to the Calendar section.
  5. Click on New->Calendar.
  6. Under Type, choose On The Web.
  7. Paste the link you copied from Facebook into the URL field.
  8. Give the calendar a name, like "Facebook", and put your Facebook username in the Username field.
  9. Click OK and then supply your Facebook password when prompted.
  10. Profit.
This webcal is read only, so you cannot add Facebook events through Evolution, and invites won't be synched back to Facebook either.