SQL backup to Amazon S3
Posted by Ruslan Sudentas in Random Thoughts on May 4, 2012
Amazon S3 is a great and cheap place to keep you SQL Server database backups.
The new version 7.2 of SQLBackupAndFTP due to be released in June 2012 will allow you to backup SQL Server databases to Amazon S3 directly.
SQL backup to Google Drive
Posted by Ruslan Sudentas in Random Thoughts on May 4, 2012
Google Drive starts you off with 5GB for free. Seems like a great place to keep you SQL Server database backups.
Here’s how to backup SQL Server databases to Google Drive using SQLBackupAndFTP:
- When you install Google Drive, it creates a special folder. Everything that you put into this folder will be synced to the Google Drive in the cloud.
- Open SQLBackupAndFTP, select databases to backup, check “Store backups in a local/network folder” and set the folder to be that Google Drive folder.
Note that there’s a big drawback – Google Drive will sync only when you are logged in. For a solution that would allow you to backup to Google Drive at any time you need to wait till SQLBackupAndFTP v 7.2 that is due to be released in June 2012.
SQL backup to SkyDrive
Posted by Ruslan Sudentas in Random Thoughts on May 4, 2012
SkyDrive from Microsoft gives you 25GB of cloud space for free. Seems like a great place to keep you SQL Server database backups.
Here’s how to backup SQL Server databases to SkyDrive using SQLBackupAndFTP:
- When you install SkyDrive, it creates a special folder. Everything that you put into this folder will be synced to the SkyDrive servers in the cloud.
- Open SQLBackupAndFTP, select databases to backup, check “Store backups in a local/network folder” and set the folder to be that SkyDrive folder.
Note that there’s a big drawback – SkyDrive will sync only when you are logged in. For a solution that would allow you to backup to SkyDrive at any time you need to wait till SQLBackupAndFTP v 7.2 that is due to be released in June 2012.
How to forward/redirect email in Google Apps
Posted by Ruslan Sudentas in Random Thoughts on January 12, 2012
It is very convenient to open Google Apps account and use Google as your mail server. However the simple email forwarding becomes a challenge. This post will explain how to setup email redirects in Google Apps. This assumes you are an administrator and know how to get to your domain management dashboard (from gmail’s wrench menu select “Manage this domain”)
Email forwarding with Groups (simplest to setup)
Create a group – all of it’s members will receive a copy of the email to this group. Sending from this group is also possible, but recipients (in Gmail) will see “john.smith@example.com via gmail.com”. Some claim it is unprofessional. We think it is minor. This method also saves you from creating new users – in free version you are limited to only 10.
- Click Groups > “Create a new group”
- Name the group and check “Also allow anyone on the Internet to post messages”
- Add members (recepients)
Email forwarding with forwarders in user’s account (simplest to setup)
- Create a new regular user
- Login as this user to gmail
- Go to “Mail
SQL backup to Dropbox
Posted by Ruslan Sudentas in Random Thoughts on October 1, 2010
My favorite way of setting SQL backups these days is to combine SQLBackupAndFTP with Dropbox. Dropbox allows you to store 2GB for free – more than enough for the majority of small clients.
Here’s how it works:
- When you install Dropbox, it creates a special “My Dropbox” folder. Everything that you put into this folder will be synced to the Dropbox servers in the cloud.
- Open SQLBackupAndFTP, select databases to backup, check “Store backups in a local/network folder” and set the folder to be “My Dropbox” folder.
Note that there’s a big drawback – Dropbox will sync only when you are logged in. For a solution that would allow you to backup to Dropbox at any time you need to wait till SQLBackupAndFTP v 7.1 that is due to be released in the beginning of June 2012.
Remote Desktop to Console/Admin Session on Windows Server 2003
Posted by Ruslan Sudentas in Random Thoughts on April 30, 2010
When you Remote Desktop to a Windows XP Professional computer, you always connect to the console (main/default) session. This is the default for Remote Desktop to Windows XP Professional. When you remote desktop to a Windows Server 2003 computer, the default is to start a new session.
This is how you can connect to the default/console/admin session:
Create a .bat file like this:
%SystemRoot%\system32\mstsc.exe “You RDP file” /admin
For options just run
%SystemRoot%\system32\mstsc.exe /?
This post is a good reference
Sql Server: The backup set holds a backup of a database other than the existing (Restore failed)
Posted by Ruslan Sudentas in SQL on March 3, 2010
There are few common tasks in SQL server that should work out of the box, but give errors that confuse less experiences developers. Like when you try to restore a backup from another server, you get:
Restore failed for Server ‘.\SQLEXPRESS’. (Microsoft.SqlServer.SmoExtended)
System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing ‘SomeDb’ database. (Microsoft.SqlServer.Smo)
The solution could not be simpler: you should use WITH REPLACE option of RESTORE command, or in SQL Server Management studio select “Options” page and check “Overwrite the existing database (WITH REPLACE)”
SQL Server 2008 ldf file size
Posted by Ruslan Sudentas in SQL on March 1, 2010
SQL Server is smart in selecting great default options for a new database. If you can afford to lose the changes between backups to keep maintenance simple (and in most of non-critical databases it is a reasonable compromise) and you backup your database regularly using a tool like SQLBackupAndFTP, then the “Simple” recovery model (selected by default) is appropriate for you. However if you ever had massive data operations, you may notice that the size of your transaction log (LDF) file is huge. The reason for it is that SQL server does not automatically shrinks the size of transaction log.
To keep log file under control, it may be tempting to enable Auto Shrink option. That would be a mistake – it is an evil option that should always be off. Shrink is a heavy procedure that should only be used rarely.
Instead just run this command to decrease the size of the data and log files to leave 10 percent free space (read more):
DBCC SHRINKDATABASE (YourDatabaseName, 10)
For more precise operation use DBCC SHRINKFILE or you can just do it in Management Studio
It is not over yet! Most often shrink will increase fragmentation of your indexes. To defragment indexes, you’ll need to use ALTER DATABASE – see this link
Creating a Self-Signed SSL Certificate without a mess of makecert.exe (using SSL Diagnostics Tool)
Posted by Ruslan Sudentas in Random Thoughts on December 13, 2008
Introduction:
So you have a server and you need to implement SSL to allow secure (https) communication. What choices do you have? You can buy a certificate from certification authority or you can issue a Self-Signed certificate to yourself. The difference is that your browser “knows” it can trust the certificates from the authorities (it has it installed). But when the browser encounters the https connection with a server with the self-signed certificate, the user is presented with a message like this:
Thus, self-signed certificates are OK for test and development web sites, but generally not OK for public websites.
This article will show you the simplest ways to create a Self-Signed SSL Certificate.
Here are your options. (Or just go to the Best Solution )
Solution 1 (quite long, but recommended by Microsoft)
Setting Up SSL Using IIS and Certificate Server
MS recommends that you get the certificate from the certificate server. This means that you have to have an access to Window 2000 or Windows 2003 server with “Certification Services” installed. You use IIS MMC to generate request to this server. Then using browser you submit this request to the server. Then, when somebody at that server approves the request, you will get back a certificate.
See details at http://support.microsoft.com/default.aspx?kbid=299525
Solution 2 (fast, but sometimes could be tricky)
Creating Self-Signed SSL Certificates using makecert.exe
It is a quite simple solution. The only problem is that sometimes it just doesn’t work, and it’s hard to determine what is wrong. The makecert.exe comes with VS.NET. It you don’t have .NET Framework 1.1 installed, the makecert might be outdated. You can download a newer version from http://download.microsoft.com/download/platformsdk/Update/5.131.3617.0/NT45XP/EN-US/makecert.exe
Just replace yourservername with the computer name of your PC and run:
makecert -r -pe -n “CN=yourservername” -b 01/01/2000 -e 01/01/2050 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sp “Microsoft RSA SChannel Cryptographic Provider” -sy 12
Then go to the IIS “Web Site Properties”, “Directory Security”, “Server Certificate…”, “Assign an existing certificate” and select the new certificate from the list.
It works? Fine! No? Go to the Best Solution
Solution 3 (OK for not-technical users)
Download a test certificate from certification authorities
The certificate companies like VeriSign and Thawte issue test certificates, but they expire after 90 days or so, and the process of getting it could be quite tedious.
Solution 4 (The Best and Recommended)
Create a Self-Signed Certificate using SSL Diagnostics Tool
Avoid all this pain with a nice tool from Microsoft: SSL Diagnostics . Download setup.exe (2112 KB) from here: http://www.microsoft.com/downloads/details.aspx?familyid=CABEA1D0-5A10-41BC-83D4-06C814265282&displaylang=en
Install it and run. In the main window of SSL Diagnostics, right-click the Web site level (shown by [W3SVC/<site number>]), and then click Create New Certificate.
That is it. You are done. Don’t forget to explore other capabilities of this nice tool.
Writing to Event Log in ASP.NET application
Posted by Ruslan Sudentas in Random Thoughts on December 13, 2008
Writing to Event Log is not simple, but very simple:
// Create an EventLog instance and assign its source.
EventLog
myLog = new EventLog();
myLog.Source
= "MySource";
// Write an informational entry to the event log.
myLog.WriteEntry("Writing
to event log.");
EventLog is in System.Diagnostics namespase.
Before using the source of the EventLog, you have to create
it. But if you use the code like this:
//Create Event Log if It Doesn’t Exist
if (! EventLog.SourceExists("MySource"))
EventLog.CreateEventSource("MySource",
"MySource");
you will get the error:
System.Security.SecurityException: Requested registry access
is not allowed.
Instead, go to registry editor (regedit), locate key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application
and create a new key with the source name