Monday, 10 February 2014

Top 10 Mongo Commands

It's been a while since I've posted something helpful. Here are the top 10 most useful commands from the mongo shell:

- show dbs - shows the databases that you have on your Mongo instance
- show collections - shows the collections/tables
- db.products.findOne() - find one rows, useful for seeing how the data is structured in a collection
- db.products.find() - finds all rows, use "it" to iterate over more rows
- db.products.insert() - insert a new document
- db.products.update() - update a document
- db.products.remove() - remove a document
- rs.help() - help on setting up replication sets
- sh.help() - help on sharding
- help() - all other help

Saturday, 8 February 2014

O'Reilly Review #4 - Time Management by Brian Tracy

A must read book for anyone that is either a business leader or just wanting to improve their daily lifes. It's quite often that you see people become bogged down with work and other tasks at hand. This book provides 21 short chapters on techniques that can be used in order to improve your daily life and you will feel more positive about yourself as a result of it. I have already started to adapt some of these techniques myself.

Sunday, 2 February 2014

O'Reilly Review #3 - Database Design & Relational Theory:Normal Forms and All That Jazz

A book by CJ Date on Database Design & Relational Theory. I'd recommend this book for anyone who has a good grasp on database technologies but is looking to improve their understanding on general DB design. This book was pretty technical and it was quite easy to get lost at times, so I found myself re-reading a fair bit, however all in all a good read.

Wednesday, 16 October 2013

Hearthstone Beta Key Giveaway - CLOSED

I've got 10 keys to giveaway this evening. Leave a comment below for a chance to win (valid gmail account required). Winners will be revealed tonight at 8pm GMT.#

UPDATE: All keys have now been sent to the winners. Thanks for all that contributed.

Monday, 27 May 2013

ora2pg - Oracle to PostgreSQL Migration Tool

ora2pg

ora2pg is a tool that has been around a while now and with that I knew that a lot of man hours had gone into the development so I was keen to take a look.


Installation 

Installing ora2pg is faily simple, all you require is, perl dbi, perl DBD::Oracle, perl DBD::Pg and an Oracle Instant Client.

- Oracle Instant Client (requires OTN login) - http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html - (grab sqlplus, basic and sdk binaries).

- Perl DBD Oracle - http://search.cpan.org/~pythian/DBD-Oracle-1.64/lib/DBD/Oracle.pm
- Perl DBD PostgreSQL - http://search.cpan.org/~turnstep/DBD-Pg-2.19.3/Pg.pm

- Perl DBI - http://dbi.perl.org/

Finally, the most important download is ora2pg:

http://ora2pg.darold.net/

Upload all relevant files and install:



For DBI and DBD Modules

tar zxvf filename.tar.gz
Perl Makefile.PL
make test
make install

For SQL Client (file names may differ)

mkdir /instantclient
mv instantclient-basic_11_2.zip instantclient_11_2-sqlplus.zip instantclient_11_2-sdk.zip /instantclient
unzip *.zip
cd ~
vi .bash_profile
add:

export ORACLE_HOME=/instantclient/instantclient_11_2
export PATH=$PATH:/instantclient/instantclient_11_2
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/instantclient/instantclient_11_2
export SQLPATH=/instantclient/instantclient_11_2
save and exit.

For ora2pg:

tar zxvf filename.tar.gz
Perl Makefile.PL
make test
make install


Configuration:



ora2pg can be configured in many ways so the best thing to do is to have a look at the configuration file in /etc/ora2pg. You can write data output to a file, or straight into a PostgreSQL database. 



The one thing I like about this tool is the client encoding detection, thus most data just goes straight from source to target without any issues.

Run:




Simply type: ora2pg... This reads in your config file and connects as appropriate. The one thing I would recommend is setting DEBUG=1 so you get the output to screen and see how far along your data migration is!








PostgreSQL - Reducing Restore Time - pg_restore

Over the last few months I've been importing a lot of data into PostgreSQL as my day-to-day job. Here's a few tips when importing which will ensure maximum import time. 

- ensure archive_mode is turned off by editing the postgresql.conf, set archive_mode = off and hash out your archive_command. Then restart your database.
- disable any triggers on underlying objects

- use the pg_restore -j option for example: pg_restore -d testdatabase -j4 -v /backup/live.dump - This allows parallelism and -j should be set to the number of cores that you would like to allocated to the pg_restore job.

Monday, 19 November 2012

Where are the Android Developer Options in 4.2?

Yep, they actually hid them, just in case someone breaks their Android device by turning on those pesky developer options! If you do need to turn them on then head over to settings -> about tablet (or phone) -> tap on the build number for a bit (not kidding, it will say something like "becoming a developer in x more taps")  and then go back to your system settings and you'll see the developer options. I had to do this just the once whilst looking at putting an app on my local device with the "usb debugging". Hope that helps!