November 29, 2012 | In: Code, SQL

Backup MSSQL instances

While working actively on development of complex systems in small development team, my team often had a need for a simple instance backup, especially where there were more than one database in that instance. Even with one database this will save you a lot of time while backing up databases. I love this piece of code and i would like to share this with you.

First part is sql script.

Set The @filepath to shoot on your desired location, and make sure that you have that folder. You need as well to have folder with your instance name in this folder.

Hence: Instance name = SQLEXPRESS
Make sure that you have D:MyDBBackups\SQLEXPRESS folder

Second part is bat file which will invoke desired instance backup.

ECHO OFF
CLS
:MENU
ECHO.
ECHO ...............................................
ECHO SELECT SERVER or 0 to EXIT.
ECHO ...............................................
ECHO.
ECHO 1 - BACKUP INSTANCE SERVERNAME\INSTANCENAME
ECHO 0 - EXIT
ECHO.
SET /P M=Type 1 or 0, then press ENTER:
IF %M%==1 GOTO INSTANCENAME
IF %M%==0 GOTO EOF
ECHO Wrong value
GOTO MENU
:INSTANCENAME
osql -E -S SERVERNAME\INSTANCENAME -i mssql_db_backup.sql
GOTO MENU
ECHO Presed 0

Change SERVERNAME and INSTANCENAME to match your own.

Filename of the database backup will have this format: databasenameYYYYMMDD.bak

As You guessed, regarding to title of this post, You can add more instances to this bat file, same way this one is added.

instance database preview

Big thanks to  Dragan Zdravkovic for shoving me how.

August 30, 2012 | In: Git

Copy GIT commit to another branch

Here is the thought that can be shared to all you git newbies like myself. You have branch X and branch Y. You committed something on the branch X and now you want this commit on the branch Y. This is basically like you want to copy files, from one branch to another, but you don’t want actually to create new commits. You just want to take existing one from branch X.

git checkout Y
git cherry-pick SHA

You need SHA, from desired commit off course.

CFEclipse Syntax color theme Night Lights

Night Lights

Installation:

  • Download file org.cfeclipse.cfml.nightlights.prefs
  • Remove nightlights from file name. You need to get org.cfeclipse.cfml.prefs file
  • Just in case, backup org.cfeclipse.cfml.prefs file that is located in [workspace]/.metadata/.plugins/org.eclipse.core.runtime/.settings
  • Overwrite this file with the one you downloaded and renamed.
  • Restart Eclipse

Here is the nice post related to this subject.
Cheers!

Very useful piece of code, that we run from time to time, especially when your target database is lower version from the one you are working on.

January 2, 2012 | In: Thoughts

Resolution Code 2012

Decision we make, define us in the future. Start of the year is usually the best time for clearing thoughts and defining new goals  in the year that already started. Here are some things that I will try to accomplish in 2012:

  • I really want to be helicopter pilot and buy one Yacht.
  • Just kidding, I would like to find some time to dive into Ruby and Phyton.
  • No SQL is something that I found really interesting, but still didn’t get chance to try. I will try Coach DB or something similar as soon as I get chance for that.
  • Improve my coding skills and contribute to software development community.
  • Organize office activities in order to be more productive. Less work – More Job done.
  • Improve my serve.
  • Loose more weight.
  • Get Married finally

That is not all, god forbid.
Wish you all the best in 2012.

Let the force be with you!

 

  • Subscribe to RSS Feed
  • Follow me on Twitter

Categories