Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Databases
  • SQL
  • MySQL
  • PostgreSQL
  • PL/SQL
  • MongoDB
  • SQL Cheat Sheet
  • SQL Interview Questions
  • MySQL Interview Questions
  • PL/SQL Interview Questions
  • Learn SQL and Database
Open In App
Next Article:
How to Restore SQL Server Database From Backup?
Next article icon

How to Restore SQL Server Database From Backup?

Last Updated : 15 Oct, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

A Database is defined as a structured form of data that is stored database a computer or data in an organized manner and can be accessed in various ways. It is also the collection of schemas, tables, queries, views, etc. Databases help us with easily storing, accessing, and manipulating data held on a computer. The Database Management System allows a user to interact with the database. In this article, we will see how can we restore SQL Server Database from Backup.

For the demonstration purpose, we will create one database named 'geeks'.

Step 1: Create Database

Use the below SQL statement to create database called geeks;

QUERY:

CREATE DATABASE geeks;

you can see database with name 'geeks' is created.

Step 2: Use database

Query:

USE geeks;

Step 3: Table definition

We have the following demo_table  in the database.

Query:

CREATE TABLE demo_table  (FIRSTNAME varchar(20),  LASTNAME varchar(20),  GENDER varchar(10), AGE int);

Step 4: Insert values

Following command is used to insert values into the table.

Query:

INSERT INTO demo_table VALUES  ('ROMY','KUMARI','FEMALE', 22),  ('PUSHKAR', 'JHA', 'MALE', 23),  ('SOUMYA', 'SHRIYA', 'FEMALE', 22),  ('NIKHIL', 'KALRA', 'MALE', 23),  ('ROHIT', 'KUMAR', 'MALE', 23),

Step 5: View data of the table

Query:

SELECT * FROM demo_table;

Output:

Restoring of database can be done through Object explorer in SQL Server.

Steps to restore database:

  • Select View from menu bar.
  • Select Object explorer option. Object explorer will be appeared on left side of the screen.
  • Right click on Database folder and select 'Restore Database' option.
  • The dialog box will open, select device option and browse the backup media.
  • After selecting the Backup media, click OK
  • Database will be restored successfully.

Now, for demonstration of restoring the database. Delete the geeks database.

Step 6: Delete the Database

Syntax:

DROP DATABASE database_name;

We can not drop the database while in use.

Query:

DROP DATABASE geeks;

Output:

geeks database is deleted. You can not find geeks database in the object explorer.

Step 7: Restore database

  • Right click on database and select 'Restore database' option
  • Select 'device' option and add backup media
  • Click Ok button
  • Prompt will appear showing the message as "Database restored successfully". Click OK.
  • Check Object explorer.

'geeks' database is restored successfully.


Next Article
How to Restore SQL Server Database From Backup?

R

romy421kumari
Improve
Article Tags :
  • SQL
  • TrueGeek
  • TrueGeek-2021
  • SQL-Server

Similar Reads

    How to Migrate Data from SQL Server to Oracle Database?
    The conversion of data from one database management system to another can be a difficult process, particularly when migrating from SQL Server to Oracle Database. In this article, We will learn about How to migrate data from SQL Server to Oracle database by providing clear and detailed procedures. Ov
    4 min read
    How to Open a Database in SQL Server?
    Opening a database in SQL Server is a fundamental task for database administrators and developers. It involves establishing a connection to the server instance and selecting a database to work with. In this article, we will explore two methods to open a database in SQL Server such as using SQL Serve
    3 min read
    How to Import and Export SQL Server Database?
    Creating and managing a SQL Server database is an essential skill for database administrators and developers. In this article, We will go through the process of setting up a database in SQL Server, from creating the database and tables to inserting records, and finally, exporting and importing the d
    3 min read
    How to Restore a Dump File in SQL Server
    Restoring a dump file in SQL Server is a fundamental process essential for database administrators and developers alike. This procedure involves reconstructing a database from a backup file, ensuring data integrity and continuity in the event of system failures or migrations. Leveraging SQL Server's
    3 min read
    How to Migrate SQL Server Database to MySQL?
    The migration of an SQL Server database to MySQL can be an intricate process, but using the ODBC driver facilitates the execution, so no worries for users with basic skills. This guide will take you through transferring the database called 'Work' from Microsoft SQL Server to MySQL, ensuring that all
    5 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences