December 24, 2012

Training Kit (Exam 70-461) Querying Microsoft SQL Server 2012

I wrote about Programming SQL Server 2012 book before few months. But that book was not for beginners, it was little bit advance and not easy to catch the things from scratch. But Querying Microsoft SQL Server 2012 book is a good book for a beginner.

I was waiting for this book’s release. Because I wanted to know the things that covers the 70-461 exam. Authors covers important points and highlight them. This kit also consist of training resources such as questions. It helps you to face the exam with out any fear.

Every lesson comes with a new thing to me. And organization of this book is perfect. This book covers all the fundamentals in T-SQL. For novice DevDBA’s this would be the best book to know the capabilities of T-SQL. This book also covers new features best practices as well as bad practices.

Exam 70-461 is essential exam if you are looking for Microsoft SQL Server New Certifications. This book will definitely help you to pass this exam. And this covers standard methods of coding in SQL and TSQL both. In first chapter Authors discuss about Relational Theories very well. And they point out the misconceptions about relational database management system.

I call it complete Kit of learning TSQL. But this book is not for experienced DBAs or Developers. You can buy this book from here.

December 22, 2012

Ethics of Big Data

Everybody talks how to handle big data? and What are the technologies we are going to go with? What are the technologies that we are going to drop when we move towards the big data? What are the concepts that we put away when we move to big data? I even had such a problems in my mind. And I had asked them from some guys even. But I never thought what is the ethical background we need with big data. 

What are the disciplines that we need when we are moving forward to big data? This book reveals a aspect that technical guys usually don't think a lot much. Nobody know who use our data on social sites like facebook. This book is written with so many references. Basically with proofs. It is more like a encyclopedia on Ethics of Big Data. But to read and understand this book you need some experience with Information Technology.

In the perspective of business this book is very important. Because this book says how to make data more trust worthy to deliver to business. You will have just only few pages. But ethics are compressed within those pages. If you like big data you should read this book!

December 21, 2012

Titan with Cassandra

In a previous blog post about Titan I mentioned about Titan supports three different storage back ends. For this you need Titan and Cassandra both.
Then extract Cassandra and Titan both into a folder and take a terminal or a command prompt. Go to Cassandra bin and run cassandra.bat or cassandra. Before this you have to set JAVA_HOME.

bash cassandra


Then take gremlin from titan bin.

Then you have to configure storage backend. for that use following commands on gremlin.

cnf = new BaseConfiguration();
g =;
Now rest is your graph database experience!!!

Getting Started with Titan Graph Database

I have used Neo4J as my first graph database. And it had web console which makes more easier to handle. But this time I'm not going to tell you how to getting started with Neo4J. This time we are going to work with Titan which is an open source project which is held by Aurelius.

This database is more scalable graph database. Lets get to know how to get started with Titan Graph Database.

First download Titan from Titan Site
Click Here to download Titan Graph Database

Then extract titan to a disk. In this example I take D drive. If you are Linux user extract this Titan file to somewhere you can execute.

Then take a shell in Linux or command prompt in Windows. Then move to titan folder. Then move to bin.

Before take Gremlin Console you need to install Java.

After that if you are Linux guy run this command.
Or if you are windows guy you command is,

Now you are having gremlin. Now we are going to connect to graph database. Basically Titan we can use with three main storage backends. They are
  • Cassandra
  • HBase
  • Oracle Berkley 
But I'm not going to use any of them now. Now I'm just going to use Titans Native Storage.
 g ='local/tmp');
 Below command will initiate a graph and assign it to g variable. Now in you bin you can see local and temp folders are created.

If you hope to search through your graph in Titan you have to index it first. Otherwise you can't search it. Actually it's a bug like thing in titan, and it's a know issue. Let say we are going to search with "name" property. Then we have to add "name" index first.

g.createKeyIndex('name', Vertex.class);

Now you are ready to add nodes and edges. And you have a index on "name" property.

v = g.addVertex(null);
This will create a new node on graph. we are going to set properties to this node.
 v1 = g.addVertex(null);


 v2 = g.addVertex(null);


Now we have three nodes. Two of them are Persons and the other one is a institute.  Now we are going to create relationships between those three nodes.

e1 = g.addEdge(null, v, v2, 'study in');
e2 = g.addEdge(null, v1, v2, 'study in');
e3 = g.addEdge(null, v, v1, 'knows');
e4 = g.addEdge(null, v1, v, 'knows');

Now you have a graph like this.

 Now we are going to have a journey around our beautiful data!!! And now I want to know where malinda "study in". For that I have to load Malinda to a vertex variable. I'll use existing one.

v1.out('study in').map();

Now I want who study in UCSC.  For that I have to load UCSC to a variable first. I'll use existing one.'study in').map();

If I only need names of them then below one is the command.'study in').name;
Finally to commit all those thing to disk you have to shutdown the graph for that run below command.


Be careful those commands are case sensitive!!! Enjoy Graphs!!!

Windows 8 and Dedunu

I posted blog posts about Windows 8 Developer Preview and Consumer Preview. And now I'm using Windows 8 Enterprise Edition on my sweet heart laptop. Not like Windows 7, Windows 8 is light weight. And easy to use for me because I used Windows 8 from Developer Preview onwards. But some of new users get lost with Metro-UI.

Although some of geeks say that's not good. I think, I feel its cool and good. Because desktop users expect ease of use. Microsoft had worked on giving comfortable user experience. And Windows 8 RTM don't have Aero feature. They have decided to remove that because It makes computer slow.

And Windows 8 has only three editions they are Windows 8 RT, Windows 8 Pro, Windows 8 Enterprise. In Windows 8 RT there is nice things. It is office but it's not a full version. Somehow I recommend Windows 8 to home users!!!

Every year I have some major change

Every year I'm having a problem with host or domain or anything related to my blog. Some times I changed my domain. Sometimes I changed the style of blogging. So many new things happened to my blog.

But most of them make it more cool. Now I'm only blogging on IT things. And most of the times they are related to Database and this time I hope this change will last for long time!

Enjoy my blogging!!!

December 17, 2012

What's new in MongoDB Shell 2.2.2

I really suffered while using MongoDB Shell because auto completing was not there. I was very hard to type collection and database names correctly. I wished IntelliSense to get into there. I'm tough Microsoft User. Because of that I love IntelliSense a lot. ;)

And there was no any other solution to me to make done MongoDB things easier.  Because available MongoDB GUI's are not that much good. I feel I'm in 90's when I'm using them. So after a month I got addicted to Shells. Not Only to mongo shell I practiced PowerShell also.


Now what I wished is arrived in a different form. It's auto completing. And it made me comfortable because feeling is same like using PowerShell. And also It suggest possible commands and functions. Isn't it awesome? It makes easier to learn MongoDB. Somehow now MongoDB is having visual differences!

Go Mongo!!!

How to shutdown MongoDB instance from MongoDB Shell?

For some cases we may have access to database instance of MongoDB as DBA. But we may not have access to Linux or Windows box to shutdown the MongoDB service or MongoDB instance. To Shutdown the MongoDB instance you should be able to log in to "admin" database.  If your MongoDB instance is running with "auth" mode you really need a password and username. In this demo I assume MongoDB instance is not running with "auth" mode.

I login to MongoDB shell first.

Then I change the database to admin database.
use admin

Now I'm going to run that command. This command will shutdown the instance hence think twice before you use it.
db.runCommand( { shutdown : 1 } );

That is like adventure to a DBA because your database will crash if you don't have any replication plan. ;)

How to copy a Database from a MongoDB instance to another?

Some times we need to take backups or we need to copy databases to another servers for administrative purposes. But sometimes just copying files is not enough. In MongoDB Shell they support to copy database from remote instance to current one with a single command. ( :D Just like Single Click in Windows )

For this demo I made alive two instances of MongoDB from following commands.
//Instance 1
mongod --port 9990 --dbpath /data/db1
//Instance 2
mongod --port 9991 --dbpath /data/db2

In instance 1 there is a database called "csampledb1". For that I need to connect to first instance to create that database.
mongo localhost:9990


After that with following commands I create a database with one collection.
use csampledb1{id:1, name:"sample name"})

Then I log in to next MongoDB instance using MongoDB Shell.
mongo localhost:9991

Then I use single command to copy the database from instance 1 to instance 2.


Syntax of this function is like below. There are two arguments which I didn't use.
db.copyDatabase(fromdb, todb, fromhost, username, password)

December 05, 2012

MongoShell Database Navigation

If you are new to MongoDB you may need to discover the databases and collections (basically objects) on your MongoDB instance. For this easily you can use a GUI tool like MongoVUE. But in this blog post I’m not going to describe about GUI tools. I’m going to explain about MongoShell to navigate through database objects.

I can remember the first day that I used Linux. In that day I fed up with Terminal and gave it up. But now I think its cool!. Smile Some how if you want to do some thing easier I still recommend GUI Tools Winking smile.

First to execute those commands you should log into MongoShell. In windows mongo.exe.

How to take database List?

> show dbs

How to check the database that you are currently using?

> db


> print ( db );

How to change to a new database?

> use <database name>


> use AdventureWorks2012 

Winking smile

How to take the list of Collection in current Database?

> show collections


> db.getCollectionNames();

How to take the list of Users in Database?

> show users


> db.system.users.find();