July 25th, 2008

How to rename a column in Sybase ASE

Today I needed to rename a column in a Sybase ASE 12.5.1 database, and couldn’t seem to find the right syntax. My first few search results gave me syntax that was not actually relevant for my database. Two different pages led me to believe that some variation of this might work:

ALTER TABLE [table_name] RENAME [old_column_name] TO [new_column_name]

But that did not work for me. Upon closer inspection, I noticed that those two pages were for Sybase ASA, not ASE. I refined my search terms a bit, and found this:

sp_rename ‘[table_name].[old_column_name]’,'[new_column_name]’

Thanks to Rob Verschoor for posting this on dbforums.com!

April 14th, 2008

at&t wireless outage in the Northeastern US - day 3: April 13, 2008

News/Info:

My at&t wireless service has been horrible for the past 3 days, and I am not alone. My wife and several friends in my neighborhood (in Bristow, VA) have been having the same issues. We are not able to reliably make or receive calls or text messages. Details on the problems we’ve been having are below in the My Story section.

I finally called 611 for at&t customer service, this evening, and the Customer Service Representative (CSR) told me that this issue is affecting quite a few customers. She rattled off a list of states that were reporting these issues, and although the list may not have included every state in the Northeastern United States, it definitely included most of them. I can say, for sure, that DC, Maryland, and Virginia were on the list, since those are the ones I was listening for.

The CSR found as much information as she could, for me, from her computer and from other reps. As of 5:25pm EDT on 4/13/2008, 3200-something minutes had passed since they first learned of the issue (note: There are 1440 minutes in one day). Although she couldn’t tell me when the problem might be resolved, she said that it’s a “priority” and they’re working on it. For what it’s worth, she told me that our 911 service was still fully functional.

If it’s affecting people in that many different states, I figure that means potentially millions of customers may be without reliable voice and SMS service. The outage does not seem to affect all areas, though, but I know it at least covers about a 5 mile radius around my house. So, the actual number of at&t customers affected may be a lot smaller, if it’s just a bunch of small areas that are experiencing these problems.

My Story:

My cell phone started having issues late Friday night (4/11/2008), but at first I thought it was just my phone acting up. I just upgraded the OS on my AT&T 8525 (HTC Hermes) to Windows Mobile 6 last week, and it’s had a few minor issues every day.So, when a friend of mine IMed me and said they kept getting sent straight to voicemail when calling my mobile number, I figured my phone was just being stupid. So, I tried making an outgoing call, but it just kept saying “Dialing” and could not seem to connect.

I checked my signal strength, and saw that I had only 1 bar. Usually, in my house, I have 3-4 bars and my cell phone works just as well as the landline. So I went outside, to see if my signal would improve. I think it went up to 2 bars or something, and after a couple tries, I was able to call out. But, the call was very broken up and staticky–pretty much useless.

Still thinking it could be my phone’s fault, I went back inside, turned off the phone, and removed the battery and SIM card. I left it that way for a few minutes, since that was one of the troubleshooting steps that a Cingular CSR had be perform when I had some kind of problem last year

After about 5 minutes, I blew the visible dust out of the back of my phone, put it back together, and turned it on. When it was done booting, I still had only 1 signal bar, but I tried to make a call anyways. As expected, it was still not able to connect, and when I told my friend to try calling me again, they said it was still going straight to voicemail.

Oh well, it was late at night, and I needed to go to bed anyways. I didn’t really need to use my phone, so I just hoped it would work better in the morning.

On Saturday, my family and I planned to go out and have a pretty busy day with some friends. I ended up having the kids at home while Lacey went out with her friends Jena and Anne. It was a beautiful day out, so my kids and I went outside and planted some flowers (I tried to call Lacey to find out where, exactly, to plant them, but could not get a call through, so the kids and I just kinda used our best judgement for planting locations.), then took care of some long-overdue outside work (cleaning plant debris off the deck and treehouse).

We were expecting Dallin and Xander to come over eventually, to hang out while the wives were out shopping. I could not seem to get ahold of Dallin, though. When I tried to call him (from my landline), it went straight to voicemail. When I tried to send a text message, the message stayed in the Outbox for longer than usual, then popped up an error saying that it was unable to send.

I retried it a few times, and eventually got it to send, after about 10 minutes or so. I didn’t get a reply, though. About a half hour later, I tried to text him again, but had the same difficulties. A few minutes later, though, I received 2-3 messages from Dallin. Apparently he didn’t receive any of my messages when I sent them, but they had just come through all at once. Along with those messages from Dallin, I also received one from Lacey, which had a timestamp of about 45 minutes before. I tried to reply to Dallin and Lacey, but still could not get messages to go out without several retry attempts.

By this time, my kids were bored out of their minds, and we were all wondering what we should do. I eventually managed to get a voice call to Dallin, and by talking fast and repeating ourselves, we were able to have a short conversation, despite the fact that the call quality was horrible and static dominated the conversation. The gist of the conversation was that they were at their house, and we were going to come over.

So, the kids and I went over to Dallin’s house. We wanted to go out and do something fun, like go to the park and/or Chuck E Cheese’s. The girls had been out for quite a while, though, so we wanted to coordinate with them before going out anywhere. Of course, we were not able to effectively communicate with them. Thankfully, they arrived at Dallin’s house shortly after we did.

We had more trouble communicating with one another that evening (from the park, Burger King in Gainesville, etc.), and still more on Sunday. It’s been quite frustrating for all of us. We take our cell phone service for granted, since it’s usually pretty reliable. Jena and Dallin don’t actually have a landline, anymore, so they are pretty much cut off from the world right now when they’re at home (or anywhere near home).

I noticed that when we took the kids to their swim lessons in Manasass, Sunday evening, our phones worked just fine. We still couldn’t talk/message with Jena and Dallin, though, since they were at home. This is the point when I realized that the service problem seemed to be confined to a 5 mile radius around our neighborhood.

While the kids were swimming, I went ahead and called at&t, which brings me back to where this post started: Widespread outage, no ETA for a fix.

I’ll post updates when I find out anything more. Hopefully this entry is useful for some of those at&t customers that have been having similar frustrations. I was surprised that when I Google searched the web, news, and blogs, I did not find anything about this outage, even though it covers a wide area and has been happening for about 3 days now.

January 25th, 2008

BANKING: Funny overdraft scenario

In the past, when my checking accounts have been overdrawn, it has been no laughing matter. I’ve been sad, angry, annoyed at myself, annoyed at my bank, etc. Earlier this week, though, I actually had an overdraft occur which made me laugh out loud!

First, a little context (impatient? skip to the funny scenario):

Lacey and I have been using USAA for our home, auto, and life insurance needs since we’ve been married (9 years now!). A few years ago, their banking division, USAA Federal Savings Bank (FSB), offered us a good deal to refinance our van loan, and we did that. We’ve been very happy with all of the USAA services that we’ve used, and have had countless frustrations with Bank of America (BoA), so in June of 2007, I opened checking and savings accounts with USAA FSB. Over the course of a month or two, I switched all my spending and bill payment over to that account. In September of 2007, I closed my BoA checking and savings accounts (the last straw was when BoA started charging me fees for not using my accounts!).

USAA FSB has been wonderful! I do all my deposits via USAA Deposit@Home, using my scanner and their web application. The deposits post to my account immediately. The savings account has a pretty high interest rate (way better than BoA’s), and even the checking account earns interest (way more than BoA’s *savings* account). I earn rewards points using my check card, and there are no minimum balance requirements for any of this.

Another great thing about USAA FSB is that they let you specify two overdraft accounts. I have my checking account set up to draw from my savings account, then from a credit card (issued by another bank, even), in case of non-sufficient funds (NSF). The best part is, there are no fees for the overdraft protection!

We had a charge which would have put the checking account in the negative by twelve cents, a couple months ago, and USAA just quietly grabbed that $0.12 from the savings account, and that was that! I say quietly, but I’m sure I received an email about it. BoA would have charged me $35 for the NSF, then $30 for using the overdraft protection (to transfer the $0.12 from savings).

Now, for the funny scenario that happened this week:

A couple weeks ago, an automatic recurring charge for $101.95 went on my credit card (a BoA/FIA Card Services card, formerly MBNA, Merrill Lynch branded). I scheduled a credit card payment of $101.95 through USAA Web BillPay, to be paid from my USAA checking account. However, my checking account balance was a bit too low, this week. There was not enough to cover that payment, and not quite enough to cover my Verizon phone bill payment.

Here’s a screenshot showing a few transactions (charges and credits) and my account balance:

Screenshot: a few transactions in my USAA account

So, check #354 brought my account balance down to $71.60. My Verizon bill payment was $71.90, so USAA transferred (without charging fees) $0.30 from my savings account, to cover that charge. Remember, BoA would have already charged me $65 at this point.

Now, there was a $0.00 balance and my credit card bill payment for $101.95 needed to go through. My savings account only had a couple dollars in it, so USAA didn’t bother with that. BoA would have transferred the remaining balance from savings, even though it didn’t cover the overdraft, and would have charged me for it. Instead, they transferred (without charging fees) $200 from my secondary overdraft protection account, which happened to be the same credit card! This covered the $101.95, and left the account with a non-zero balance. I assume this was just in case any additional charges come through before I got a chance to add funds to the account.

Summary:

So, the end result is that my checking account transferred funds from my credit card for overdraft protection, to cover the bill payment I was making to that credit card. Later that night, my paycheck direct deposited to the account, so all was well. (Well, actually, the credit card charged me a $6 fee for some reason (they called it “BANK TRANSACTION FEE”). No surprises there, though. BoA finds ways to charge fees for anything they can think of! But $6 was a lot easier to handle than BoA checking account overdraft and NSF fees). I went ahead and made a $206 payment to my credit card, and had a good laugh!

I’m happy with USAA Federal Savings Bank, and highly recommend it for anyone that is eligible. (That’s the only downside of USAA FSB. You have to be eligible for USAA membership to open accounts there. Check membership eligibility requirements here.).

November 2nd, 2007

Windows Mobile and extended Daylight Savings Time

Ryan Somma recently blogged about software glitches due to the extended Daylight Savings Time that was introduced by the US government’s Energy Policy Act of 2005. One of the issues that he experienced was:

My cell phone has been waking me up an hour early all week because it thinks that Daylight Savings Time (DST) began last weekend. I can’t change the time because it’s managed by Cingular, so it’s the fault of their systems.

My cell phone’s been wrong this week, as well. I know I applied a DST patch back in the spring, but I think I must have installed a new copy of Windows Mobile on my phone since then, and it didn’t include the patch.

At first, I tried setting my phone’s clock manually, but then I experienced the same automatic time setting that Ryan did, care of Cingular. Yesterday, I finally got tired of seeing the wrong time, so I changed my time zone to Atlantic (GMT-4), and then went looking for the Windows Mobile Extended DST patch.

You can find the necessary patch(es) and instructions for Windows Mobile devices here, if you still need them. My phone is back to the Eastern (GMT-5) time zone, now, and is showing the correct time. Hopefully it will adjust properly on Sunday, too.

On a humorous but not directly related to DST note, I accidentally set my alarm clock one hour ahead when attempting to turn it off, earlier this week. Later that day, I was sitting in my room, working on my laptop, and tried to see what time it was. My laptop said one thing (the correct time), and Lacey’s alarm clock showed a similar (+/- 5 minutes) time, but my alarm clock was an hour ahead, and my cell phone was an hour behind. That was rather confusing. :)

September 4th, 2007

Sybase UPDATEs taking forever/timing out? Time to dump tran!

I’m a programmer, not a DBA, but I do have to be able to perform basic database configuration and maintenance tasks. One thing that’s come up, a couple times, over the past few years, is a transaction log getting full.

There are a couple of reasons this can happen:

  • poorly written queries that run for a very long time
  • applications neglecting to end transactions, when they encounter error conditions

Here are a few useful commands I’ve found that deal with transaction logs (Note: I’m using Sybase ASE 12.5.1):

check for long-running transactions (found here):
use master;

SELECT * FROM syslogshold
WHERE dbid = db_id(’MyDbName’);

transaction log space free:
SELECT CONVERT(CHAR,
(lct_admin('logsegment_freepages', 4) -
lct_admin('reserved_for_rollbacks', 4)) * 2)

transaction log space total:
SELECT SUM(size)
FROM master..sysusages
WHERE dbid = db_id('MyDbName')
AND segmap & 4 = 4 -- logsegment

dump the transaction log (clears it out, so things can get moving again!):
***WARNING*** Use this command at your OWN RISK! Please do some additional reading before executing the following statement, so that you fully understand the implications. The transaction log is there for a reason, and, from what I understand, you should not tamper with it unless you know what you’re doing. On the occasions that I’ve used this, it was a last resort. It solved my problems, with no ill effects, but it might not solve yours!

dump tran myDbName with truncate_only;
commit;

For additional information/reference, Sybase’s online books sometimes come in handy. When trying to find out how to dump transaction logs, I referred to their dump transaction page.

Another site I’ve found useful*, on numerous occasions, is Sybase 101. I found a related tip, there, for tips, there, for Dealing With Server Failure, which addresses what to do when your log fills up completely, such that you can’t even restart the server.

*Beware: I just noticed that Sybase 101 has become less useful than it used to be, because useful pages are automatically redirecting to one main start page. If they were just trying to prevent deep linking from the outside world, I could understand this behavior a little more; but it’s even happening when I click other links from their own site! Navigation works fine with javascript disabled, though.