Monday, August 18, 2014

SQLTea - New SQL tutorial app in Google play store

SQLTea - Our new SQL Tutorial App on Google Play Store
 
We are happy to announce our new SQL tutorial app SQLTea  ( Native android app) for SQL learning which includes articles from this blog.


This application includes 

1) Articles for basic concepts like Normalization, Constrains, Joins, SQL Functions, SQL commands etc and also advance concepts like SQL Triggers, Views, Cursors, Stored Procedures and many more.

2) Every article is explained with the help of examples.

Techmixing.com new apptechmixing.com new app


3) Once installed, it will work in offline mode (No Internet needed). You can read articles easily even if you don't have Internet connections

4) Includes many popular articles from this blog.

5) Light weight and fast

6) Will going to frequently update this App with new blog articles.

7) Simple to use and navigates.

So please download this app and gives your valuable comments on it.



Sunday, August 17, 2014

How to restore database backup in SQL SERVER

In this article, I am going to explain the process of  Database restoration using the SQL Server Management Studio. In this article, I will try to explain this process in a simple way so that a database developer having little knowledge of DBA can restore that database using the database backup.

For database restoration process, we need to follow the below steps:-


Step 1:- Open the SQL Sever Management Studio. For this we have to follow the following path:-


START --> All Programs --> Microsoft SQL Server 2008R2 --> Click on SQL Sever Management Studio (SSMS) --> Open the SQL Server Management Studio using Login information (Username & password or Window authentication )

Please note:- Above path can be changed depending on the Window version.

Step 2:- Once SQL Sever Management Studio is opened, opened the Object Explorer. By default it will be already opened. If it is not opened, then follow the below steps to open it.

Click on the View(Top menu) --> Click on Object Explorer.

Step 3:- Under the Databases node, select the database for Restoration and right click on it. Then choose Tasks, click on Restore and then choose the Database... as shown in the below figure. Here we choose the Company_DB as database.


Select Database for restore process

Step 4:- On the click of Database.. link,  we get the Restore Database window. In this window, we can select the database backup file, first by selecting the Device radio button and then click on the Add button, as shown in the below figure:-

Select Backup file location

Step 5:- When we click on the Add button, Locate Backup File Window is opened. On this window, we have to choose the backup file of the database as shown in the below figure.



Select Database backup file

Step 6:- When user selected the database backup file and click on the OK button, it will close the Locate Backup File window. Now on the Restore database window we can see the selected database backup file as shown in the below figure.


Selected backup file
Step 7:- When we click on the Options link, below screen will be shown


Database restoration Options
In this screen, we can see many options like overwrite the existing database and many others. We can leave this screen with default values. we usually choose the option of overwrite the existing database, but user can choose other options as per his/her requirement.

If you want to know this process and its all option in detail, you can refer below link of MSDN


Restore a Database Backup (SQL Server Management Studio)


DMCA.com

How to take Database backup in SQL SERVER

This article explain the simple way to take up the backup of a database which can be easily understandable by the database programmer having little knowledge of DBA. For taking the database backup, we need to follow the given step.

Step 1:- Open the SQL Sever Management Studio. For this we have to follow the following path:-

START --> All Programs --> Microsoft SQL Server 2008R2 --> Click on SQL Sever Management Studio (SSMS) --> Open the SQL Server Management Studio using Login information (Username & password or Window authentication )

Please note:- Above path can be changed depending on the Window version.

Step2:- Once SQL Sever Management Studio is opened, opened the Object Explorer. By default it will be already opened. If it is not opened, then follow the below steps to open it.

Click on the View(Top menu) --> Click on Object Explorer.

Step3:- Under the Databases node, select the database for backup and right click on it. Then choose Tasks and then Back Up.. as shown in the below figure. Here we choose the Company_DB as database.


Database backup Fig-1
Choose Database for backup
Step4:- On the click on Back Up... link, it will create a Back Up Database window as shown below:-

Back up database Fig-2
Back Up Database Window
On this window, we have the options to choose the backup type. There are 3 backup types in SQL Server.

1) Full Backup 
2) Differential Back Up
3) Transaction Log

I will explain all 3 database types in another article. Full Backup type is the default Backup type and it is usually chosen for taking the database backup.

Also, if we want to choose another destination for storing the backup file, we can either remove the default backup destination first and then add the new destination for the database files or we can add the other destination file without removing the default destination by clicking on the Add button. On the click on Add button, it will open a new window from which we can choose our new destination. The backup file will have the extension of .bak. In this article, I will keep the default values.

If we click on the Options link from the left hand side menu, it will open the following screen.

  Backup database Fig 3
Backup database Option Screen
In this screen, we have the option of appending the new backup with the existing backup sets or overwriting the existing backup set. There are many other options available like backup like verify backup when finished and Perform checksum before writing to the Media for checking the reliability of the database backup. Let keeps the default setting. I will explains the Checksum in detail in another article.

When we click on the OK button, it will made the database backup either on the default destination which is given below:-

C:\Program Files\Microsoft SQL Server \ MSSQL10_50.MSSQLSERVER\ MSSQL\ Backup

or 

on the destination, which we have added by Clicking on the ADD button(see Back Up Database Window ).

DMCA.com

Database Creation using SQL Sever Management Studio (SSMS)

In the previous article (Database Creation using Create Database command), I explained the database creation using the Create database command. In this article, I am going to explain the steps of creation a database using SQL Sever Management Studio (SSMS) using SQL Server 2008 R2. These below database creation steps will be same for SQLServer 2005 and onward.

Step 1:- Open the SQL Sever Management Studio. For this we have to follow the following path:-

START --> All Programs --> Microsoft SQL Server 2008R2 --> Click on SQL Sever Management Studio (SSMS) --> Open the SQL Server Management Studio using Login information (Username & password or Window authentication )

Please note:- Above path can be changed depending on the Window version.

Step2:- Once SQL Sever Management Studio is opened, opened the Object Explorer. By default, it will be already opened. If it is not opened, then follow the below steps to open it.

Click on the View(Top menu) --> Click on Object Explorer

Once Object Explorer is opened, select the Databases node and right click on it . Then Select the open "New Database...".(as shown in the below figure)


Create database - Select database node
Create database fig-1
Step 3:- On the click of New Database option, New Database window is opened. In this window, we need to provide the database name and let the other values as default.(As shown in the below figure). Since we are creating the database Company_DB, we specify the name Company_DB as the Database name.


Create database fig-2
Specify database name

In this window, we can choose the owner of the database, Path, Initial size, File growth, maximum size for the Data file and the Log file. In this article, let them as default. 



Step 4:- In the "New Database" window, click on the left hand side Options link. It will open the below screen.

Create database Fig-3
Choose collation
In this screen, we can choose the database collation, Recovery Model and Compatibility level. Also there are many other options under the heading Other options, which we can change according to our need. But for creating a simple database, we can let these options has the default values.

Collation is required if we need to stored the data in the languages other than English. Many times we need to store the data of a country in its own language in to the database. For storing the data in different languages, we need to set the collation of the database as shown in the below figure:-

Create database Fig-4
Choose Collation
After that, Click on the OK button below to complete the database creation process. You can see the newly created database Company_DB under the main node Databases.