Saturday, January 12, 2008

server crash!!

So I run a few different websites with a few different companies. I have been buying up web domains or what I'd like to call virtual estate. But that is neither here nor there really... as I would like to be spending my time doing research on great domain names to buy up. Unfortunately at about 4:00 am I was going up to bed after a long night of watching bad movies and configuring domains. I noticed something was wrong with the server. I tried to login remotely and no dice... This is my personal server, where I do most of my development and host a few smaller sites. Luckily the financial impact is somewhat minimal at this point, but the frustration has taken it out of me.

As it turned out the server was toast, something happened to the boot sector and the OS, which had been suffering from another semi crash a few weeks ago, had decided to give way. It took me quite a long time to fix it as I was actually gullible enough to believe that I would be to able to repair the os properly. Well, I ended up re-installing SBS2k3... and now as I think back, I would recommend that if at all possible, go with Windows Server Standard Edition 2k3. Too much overhead with what I have deemed useless gadgets and services that are great for a small to midsize company, but not ideal if all you want to do is host a website and SQL Server. Why did I sign up for SBS then? It was a deal with the server.

So the quick lesson... code in php, use XAMP ;).

Just kidding - that's my preference, but I have a few clients that work with SQL Server/MSDE (and a few legacy systems I developed in classic ASP) - so that's not really a choice.

Anyhow, with all the frustration and and work to completely reinstall I came up with a few tips that might help - especially if you are trying to salvage your data:

- try to install a new os on a different partition. Do not create a new partition at this point. It is possible, but not likely you will succeed in creating a new partition AND save all your data. Didn't you make multiple partitions when you installed the system? Oh.. well, this is a good reason why you might want to do that.

- if you do not have a new partition to work on, or you really want to try to repair your system, try to the system repair with windows. Take out your cd-rom, insert it and boot with it. Do not press f2 on load up for the automated system restore... you will have to let the blue screen load until it prompts you if you want to (R)epair. You wan to try to repair your system (keep your eye on the screen).

This will overwrite all your major system files and try to restore your system from initial installation. If this is successful, you might get your system to boot, but you will then have to reapply pretty much all patches, service packs, and perhaps reinstall several applications.

I am no expert , more of a crazy mad scientist, so don't blame me if you mess your system up even further.

- upon finally loading the system, I was able to reinstall SQL server. If you know this trick, move on. But you can always go to databases, right click on databases- and choose the actino "attach database" file directly from enterprise manager. The system will prompt you for the location of hte data files. You can take the databases from your crashed os, and just attach them again. Although if you have sustained system damage, you might want to consider moving the files to a clean location.

- if you have mysql as well... also on the server... you can take the datafiles folder and copy and paste all those datafiles into your new mysql datafiles folder. Mysql Admin should recognize them the next time it checks the folder.

This saved me quite a bit of time as to how I was going to get the latest data from the databases since my db backups were not as current as they could have been.

- I was also able to reinstall FTPZilla Server to the same exact folder it was installed in previously, and this saved me from having to reconfigure.

- also had quite a bit of trouble getting php to work. I had it previously downloaded and tried to use the files I had previously. I took the latest version from Php.net and it worked fine. Normally, I like to archive versions I have worked with in the past for easy installation and recovery such as this case. Pros: For the installation of MySql, this was really handy. I tried searching online, and I am not sure what MySQL is doing, but they are making it seem harder and harder to find the open source free versions. After looking on my archive drive, I got it installed in 2 minutes. On the other hand, Sometimes trying to use older versions doesn't work in your favor to save time, as in the case of PHP.

- Now I'm running all sorts of checks, defrags, and drive analyses... but the server is back up and running. Hoping for a better Day tomorrow.

Labels: , , , , , , , , ,

SQL Server MSDE Separate Instance ASP.NET & DSN Connections

Today I ran into an issue where I had a bit of difficulty connecting ASP.net to SQL Server MSDE Named Instance. The problem is that the website previously did not need to specify a named instance of MSDE/SQL Server. I was able to address the connection over asp rather easily, but there was a bit of development already done in ASP.NET and I was not very familiar with the ASP.NET setup.

A little bit of background on myself... I'm a newbie to .NET, but I am always willing to learn. I've been coding in VBscript (ASP), SQL, PHP, XML/HTML, and Javascript for quite some time. I've even had the opportunity to work on some actionscript / flex projects incorporating calls between dhtml and simple flex applications. So you may laugh at how basic this little bit of info is, or (I hope) you may actually find a useful tidbit of knowledge.

I had been handed over a web site from a previous programmer/software company and I had to figure out a way to deploy the website rather quickly. We went with a Dedicated Machine on Win2k3 Web Edition. I knew that a lot of the other O/S I ran in the past had issues with too many unneeded services (Win2k3 SBS I'm looking at you!). So to help client keep costs low and through previous experience (and knowledge about web traffic) and requirements of site, I decided that using MSDE would be a sufficient solution for the database.

I am familiar with SQL Server Enterprise Manager and SQL Server Query Tool. In using MSDE, I didn't think through that I wouldn't have a GUI if I used MSDE. This lead me through the maze of what is IT and Dev...

So yeah, I called some friends and apparently you can run MSDE and just install SQL Server Tools on a machine to get GUI access. Lucky for my client (and me), I have a legitimate copy of SQL Server I bought for my business. But here's the kicker... Web Edition 2k3 doesn't allow you (due to its licensing) to install SQL Server on the same machine. So now I was back to square one. Eventually I figured out how to use SQL Server 2005 Express Edition to serve as the gui for the MSDE DB I had already created. Don't ask me why, but I didn't feel like porting over to a new instance of 2005 by this point.

Guess what though... you cannot import (at least I haven't figure out yet) data the same way you can with Enterprise Manager. The functionality is significantly limited from Enterprise Manager for importing and exporting data. I have tried to connect to MSDE Instance via tcp ip, but I think my isp seems to be blocking port 1433/1434 udp... but that is a topic for another post I suppose.

so the basics...
1) check web.config file where you have the dsn / application connection string stored. It seemed that ASP.NET was not connecting. After a bit of debugging I realized that it should be connecting to a different instance of SQL Server.

2) in the web config - this can also be edited through IIS - ASP.NET tab...

previously looked something like this:
add key= "DSN16" value="server=LOCALHOST;database=DBNAME;uid=sa;pwd=XC123XC123x;"/

3) Now change it to
add key= "DSN16" value="Server=COMPUTERNAME\INSTANCENAME;Database=DBNAME;uid=sqlserverlogin;pwd=XC123XC123x;"/

One thing I would recommend is that you try to login with SQL Server only credentials when you are logging in through Enterprise Manager or SQL Server Manager 2005. It took me a long time to figure this out, but if you know that you can login with the SQL Server only credentials, they should hypothetically work when ASP.NET is using these credentials to talk to SQL Server.

Oh yeah, another thing is that I had to look up on SQL Server properties to give me a clue to use COMPUTERNAME\INSTANCENAME. Since I had to figure it out on my own and I couldn't find the info online ... I did find about connections with named instances, but without realizing that the credentials i was using weren't SQL server credentials... well it was useless. until I switched to SQL server only credentials, then it worked.

hope this helps and saves you a bit of time. Now please click on a google ad.
thanks,
Mauricio

Labels: , , , , , , , ,