Because loyalty is a two-way street

CalvinParkYoga

Moving a dog to Australia with no money at hand

I always had plans to move to Brisbane, Australia, where my brother lived. After getting hitched, it was a long wait for my wife to be relieved from Central Government services before we moved to AU. With the way things worked in India, we were kept guessing when she would be relieved from duty. When one fine day she got the news from her senior, we made immediate plans to leave Bangalore – my home for almost seven years and hers, for two. While we cooled our heels in beautiful Wayanad, the next difficult task at hand was to move our handsome Goldie – Calvin – to AU.

kiddo

Calvin puppy

I hadn’t done a proper research for Calvin’s move. I knew it would be tough. I had checked with a couple of pet travel agents about it, but had no clue how much it would cost me. Now, I’m your average techie Joe, who liked to party and loved to spend almost all of his earnings. I had about 500k INR in savings and I was going to need that for the move. That meant I had no money to move Calvin and it was going to cost me about twice my savings. I was stumped!

nandi

Good times

calvinwithmummy

Calvin with mummy

Where there is a will, there are people who can help you🙂

The Urban Dawg

My problems were multifold – not only did I want to move Calvin to AU, but I also needed someone to take care of him as the whole process was going to take six months. I couldn’t afford to stay back for six months and I didn’t have anyone who would take care of him for me. My frantic efforts took me to Devisri (The Urban Dawg). I should thank FB group Bombat Dawgz for the reference.

When I first visited Devisri, to check out her facility, I found her passionate and caring. I had been to other boarding/ home-stay facilities and none of them were so homely, literally, because her dogs stayed at home with her! She was not the usual pet-sitter who liked dogs, she really knew about dogs and their behavior. I was amazed by her attention to detail and deep knowledge. It was an expensive option for me, but I chose to go with her.

She was to take care of Calvin for four to five months and I could pay her for two months at a time. It eventually stretched to seven months and over that period, I learned quite a few things from her about nutrition and dog behavior. Our Watsapp chats would be hundreds of lines and many a time, she surprised and amazed me with her dedication. I think she is one of a kind and quite a gem. She loved Calvin and Calvin loved her and big bro Caesar, who is Devisri’s adorable Goldie. Calvin had found a home away from home.

Over the months, she worked with Calvin on a few things – his social skills, crate training and diet. Calvin was a welterweight as I was always paranoid about having a fat Goldie. He weighed 27kg when I left him with Devisri. When Calvin left Devisri’s in December, he weighed 29kg and was in great shape.

IMG-20150620-WA0000

Calvin with Caesar bro

Anvis Inc

Moving a dog to AU is no easy task and it’s good to get professional help. I contacted Anand first in early January, 2015. AU keeps changing rules and there was a major change in March. Our initial plan was to have Calvin moved to SG and stay there for six months as AU didn’t accept pets from India directly. With the change in rules in March, his stay in SG would be for 6 weeks only. Moving your pet to AU is an extremely complicated process and I needed help. The amount of paperwork and co-ordination required makes my head spin.

Anand was going to be Calvin’s guardian angel, more like a knight in shining armour. He is a humble and committed person and he loves Deepika Padukone. She doesn’t know what she’s missing! To give an idea of his level of commitment – till date, we have had about 100 email exchanges, numerous calls and watsapp chats. He always kept me informed and updated, and he has a lot of experience moving pets all over the world. I couldn’t have done this without him.

Anvis

Ricted Kennels

Calvin flew to Singapore on 3rd December and stayed in quarantine for a month. Post quarantine, he stayed at a home for two weeks before flying to AU. Joanne and Thierry of Ricted Kennels were introduced to me by Anand. They handled Calvin’s quarantine, home boarding and paperwork in Singapore. Joanne would send me regular photo updates and also arranged for Skype sessions with Calvin’s new SG friends – Caishi Lim and Arrow. Caishi is the sweetest person ever and Arrow, a wonderful little bro. During the two weeks that Calvin stayed with them, they did everything to make him comfortable.

calvinarrow

With li’l bro Arrow

Jetpets Saga

Calvin reached Melbourne on 20th Jan 2016 and he remained in quarantine for 10 days. The last leg of his journey was from Melbourne to Brisbane. I had initially planned to drive down, but decided against it as I thought it would be too dangerous. I had no company and that meant I would be driving 4000km alone and 2000 of that with an anxious dog in the car. I contacted Jetpets in early January to arrange for Calvin’s pickup from Melbourne and flight to Brisbane. My initial experience with them was very ordinary as compared to the wonderful services I got from Ricted and Anvis. I had my doubts about them, but eventually I chose to use their services. I had not done a proper research about them as they were referred to me by a friend. That proved to be a costly mistake. The interwebz was filled with negative reviews about them; however their Facebook page, which I later found out was heavily moderated, showed stellar reviews and comments.

Calvin lost five toe nails during his flight from Melbourne to Brisbane. As per Jetpets, he might have got agitated during the one hour flight and tried to claw out of the crate he traveled in. I consider myself lucky to have got him back as he lost a lot of blood during the flight and another dog traveling with Jetpets passed away the same week. Calvin needed immediate medical attention on landing. I took him to an emergency Vet Hospital myself and Jetpets didn’t even bother to check on his condition until about 40 hours later. Calvin was in extreme pain for a week. Four weeks after the incident, he still has bandages on both his paws. He needs his wounds re-bandaged twice a week. Jetpets is paying for his vet bills. There has been no update from Qantas, the airlines that transported Calvin, despite registering a complaint.

Would I have flown him if I knew this would happen? – I don’t think so. I have decided that I’m never getting him on a flight again. It’s sad that what was meant to be a moment of great joy ended up being the most painful of recent times.

Flights

bloodiedcrate2

CalvinOnArrival

Impact on personal life

There are quite a few people who bring their dogs over to AU from India. I respect them, because it is not an easy task. It’s an expensive procedure and there are a lot of monetary needs when you move to a new country. Moving pets to any other country is easier and costs probably 1/10th. AU, being an island nation, has strict rules and import policies.

Read more ›

Tagged with: , , , , ,
Posted in Pets

Database Mail shutting down. Mail queue has been stopped.

DB mail in our production servers started acting up last week. We have SQL Server 2012 SP1. There were a couple of sets of symptoms. Following is what I did to get DB mail working again.

I hope you don’t spend 4 hrs like me to get a resolution.

Symptom 1:

Mails will not be sent anymore. Sending test mail will not work.  When DB mail status is checked using the following SP, it will return “STARTED”.

USE msdb
GO
EXEC dbo.sysmail_help_status_sp

However, checking the status of mail items themselves using the following SP will show that they are “unsent”.

SELECT TOP 10 sent_status, *
FROM dbo.sysmail_allitems WITH(NOLOCK READUNCOMMITTED)
ORDER BY send_request_date desc

Stopping DB mail using the following SP does not work anymore. The command takes forever to execute and nothing happens.

USE msdb
GO
EXEC dbo.sysmail_stop_sp

If these are the symptoms,

  1. Kill the process “DatabaseMail.exe” from task manager of the server to stop DB mail.
  2. Check status using sysmail_help_status_sp and ensure it shows “STOPPED”.
  3. Start DB mail using the following command.
    USE msdb
    GO
    EXEC dbo.sysmail_start_sp
  4. Check status of mail items. The sent_status column should now show “sent”.

Symptom 2:

Fix for “Symptom 1” worked on one server, but on another, mails were not being sent at all. If the above fix doesn’t do it for you, Stop DB mail and check mail log in SSMS at

Management->Database Mail->View Database Mail Log

If log shows the message – “DatabaseMail process is shutting down. Mail queue has been stopped”, check for mails stuck in the mail queue.

Use msdb
GO
Select count(*) from ExternalMailQueue – Check if this is non-zero
  1. If the above query returns a non-zero number, there are stuck mails. Use following script to remove all items from the queue. Please be informed that all these MAILS WILL BE LOST!
Use msdb
GO
ALTER QUEUE ExternalMailQueue WITH STATUS = ON
set nocount on
declare @Conversation_handle uniqueidentifier;
declare @message_type nvarchar(256);
declare @counter bigint;
declare @counter2 bigint;
set @counter = (select count(*) from ExternalMailQueue)
set @counter2=0
while (@counter2<=@counter)
begin
receive @Conversation_handle = conversation_handle, @message_type = message_type_name from ExternalMailQueue
set @counter2 = @counter2 + 1
end

2. Check number of mails in the mail queue. It will be zero.

Use msdb
GO
Select count(*) from ExternalMailQueue

3. Start DB mail using

USE msdb
GO
EXEC dbo.sysmail_start_sp

 4. Check status of mail items. The sent_status column should now show “sent”.

Posted in 2012, Edition, SQL Server

XQuery

In 2005 version of SQL Server, XQuerying was introduced. It’s a powerful feature and when used together with a CTE, it helps to keep code simple and clean. I use XML extensively in my code and many a time, I find myself looking up code, searching the internet or trying things out myself. I hope this post will be a single point of reference to most of the usual XQuery coding.

Following is a simple script to read from an XML variable. Same code can be used to read from an XML column as well.

NOTE: I will append more XQuery code samples to this post.

DECLARE @xmlProduct XML = 
'<Catalog>
	<Product>
		<Name>Selle Italia Road</Name>
		<Code>SIR-1</Code>
		<Category>Saddle</Category>
		<Description>Sleek saddle from Selle Italia</Description>
		<UnitPrice>50</UnitPrice>
		<Currency>USD</Currency>
	</Product>
	<Product>
		<Name>Brooks Tourer</Name>
		<Code>BT-T</Code>
		<Category>Saddle</Category>
		<Description>Brooks leather saddle for touring</Description>
		<UnitPrice>120</UnitPrice>
		<Currency>USD</Currency>
	</Product>
</Catalog>
'
--Read from nodes
SELECT
c.value('Name[1]','varchar(50)') [ProductName],
c.value('Code[1]','varchar(50)') [Code],
c.value('Category[1]','varchar(50)') [Category],
c.value('UnitPrice[1]','varchar(50)') + CHAR(32) + c.value('Currency[1]','varchar(50)') [Price],
c.value('Description[1]','varchar(50)') [Description]
FROM 
@xmlProduct.nodes('//Catalog/Product') AS TAB(c)

Output:
XQueryOutput

Tagged with: , , , , , , , ,
Posted in Database, SQL Server, TSQL

Retrieve unsaved query

I was working on a remote machine and while I was away, the machine was restarted. Lost the scripts I had not saved, or so I thought; and then I came up with this – was a life saver!

SELECT TOP 10 
EST.text
FROM sys.dm_exec_query_stats EQS
CROSS APPLY sys.dm_exec_sql_text(eqs.sql_handle) EST
WHERE EST.text LIKE '%text%'
ORDER BY last_execution_time DESC
Tagged with: , , , , , , , , ,
Posted in Database, SQL Server, TSQL

Find tables which are most commonly used in Stored Procedures

When you start working on a new project, one of the important tasks as a database developer is to get used to the table names. Here’s a script which will help you identify the most commonly used tables (assuming that the most commonly used are the most important).

SELECT TOP 50
t.name, COUNT(1) tcount
FROM INFORMATION_SCHEMA.routines r
INNER JOIN sys.tables t ON r.ROUTINE_NAME LIKE ('%' + t.name + '%')
GROUP BY t.name 
ORDER BY tcount desc
Tagged with: , , , , ,
Posted in Database, SQL Server, TSQL