Friday 18 December 2020

Restoring a Backup after Loss of data

I have created a table named rakesh, then I added few records and took a backup. Accidently, I deleted data. I will recover data from my Backup. 
---------------------------------------------------------------------------------------------------------------

Lets start from very first step.
First, create a table rakesh.

And then, I have added three rows in the table.

Lets query the table.

Now, I am going to take a backup and delete the data. Click on the database > Tasks > Backup

Here, we need to specify the destination location for our backup. In the destination section, click Add button and in new window in file name click ... and select folder where I want my backup to be taken.
I have selected D:\BlogPost\Backup and Recovery\ and my file name rakesh_table_backup and press ok.



Backup done successfully.

Now, we will remove some data form table rakesh. 
truncate table rakesh;
I have deleted all the records from the table. 
Now, we will restore the database to recover our data from the table rakesh. We need to go to Task > Restotre > Database. We can see when the last backup was taken. press Ok.



Backup has been restored successfully. 


Now, we need to check our data in table rakesh.


Yes, our data is RESTORED. 
---------------------------------

Wednesday 16 December 2020

C Drive Partition without loosing data

I have bought a new Laptop. And I have C drive with size of 260 GB Free. I want to make a new partition E without loosing data from C drive




Firstly, access Disk Management with "Start”-> “Control Panel”->“Administrative Tools”-> “Computer Management”-> “Disk Management”. Then you will see the first window like this

NOw, right-click C drive and select “Shrink Volume”, you can type in the amount of space you want to shrink the disk. For 80 GB, I have 80*1024 = 81920 MB. This amount I need for new partition.
















Now we need to create a new partition from this space .. right click on the new partition -> New Simple Partition and we will get a Wizard like below 

Then next > Assign Letter to Partition, I did E, Next > I have written volume name RAKESH > Next > Finish.


we can see now, E drive (Rakesh) with 80 GB of space.


Sunday 13 December 2020

Restoring AdventureWorks2019 Database

Restoring AdventureWorks sample databases

In this post I will show steps to download AdventureWorks sample databases, and steps for restoring database on our SQL Server.

search "download adventureworks database" in google and click on the first link (docs.microsoft.com)


When we click, we will get a page like this


We will find three types of files :
OLTP data is for most typical online transaction processing workloads.
Data Warehouse (DW) data is for data warehousing workloads.
Lightweight (LT) data is a lightweight and pared down version of the OLTP sample.

At this stage we will download OLTP AdventureWorks2019.bak


Now we will open the SSMS and restore the database that we have downloaded. As we can see, we have only system databases.

I am going to click right on databases and Restore Database 

Now, we will get a dialog box like this. It looks bit complicated. Click on the device and press three dot button, we will get a new window like below
Now we need to add the Media and we need to find where we have saved it. We have saved our file in D:\AdventureWorks

Now click and we can see that source database name is AdventureWorks2019 and destination database name is AdventureWorks2019 (if we want, we can write new name in destination database) 


Press Ok and our database has been restored

We can see AdventueWorks2019 database in under the list of databases.





SSMS Installation Steps

SQL Server Management Studio (SSMS)

SQL Server Management Studio (SSMS) is an integrated environment for managing any SQL infrastructure. SMS is used to access, configure, manage, administer, and develop all components of SQL Server, Azure SQL Database, and Azure Synapse Analytics.

------------------------------------------------------------------------------------------------------------------

I will write steps to install SSMS and connect it to my Database.

First we need to download SSMS software. Search "Download SSMS" in search engine. 





Click on the link to start downloading SSMS Download SQL Server Management Studio (SSMS)

Run the Setup and click on Install


Installation in Progress


Installation Complete, restart required.

Now, I will open the SSMS, type SSMS in run to access it.


 and I will connect it to my SQL Server (rakesh), which I created in my previous post.



SSMS can access the SQL Server.


Saturday 12 December 2020

SQL Server 2019 Installation Steps

 Hello Guys, 


I am going to write steps how to install MS SQL Server 2019 on Windows 10.


Microsoft SQL Developer Edition is free. We can search in google and download the Media.


Download SQL Developer Edition, Its free.




Download the Media and open the Folder.


We are going to install Custom type of installation.

I have created new folder SQLDEV2019 in D drive.

I have created new folder SQLDEV2019 in D drive.



Next



Installation is in Progress


Once the software is installed we will get a new Windows like this, then we will click on the installations tab to install the database. 

 We will click on the New SQL server stand alone installation..


Next


Tick for updates (recommended)
Next


Next 


Next Screen we will get Windows Firewall Warning.  We can also disable firewall and re-run, but this is warning only, so leaving it.


Now this is the MAIN screen, here we will get what features we want to install in SQL Server.

-Database Engine Services
- Analysis Services


In the next screen we have default instance name MSSQLSERVER. I have changed instance name and instance ID to RAKESH


Next


In Next window, add current user for windows Authentication.



Now here, we have analysis configuration. We have three options
- Multidimensional and Data Mining mode
- Tabular mode
- Power Pivot mode

We will select Multidimensional and Data Mining mode now. we can add another option later by re-running the setup again.

Click next and Install

Installation in Progress



Complete.

 Installation Successful.

MS SQL Server and its Editions.

Microsoft SQL Server  Microsoft SQL Server is a relational database management system developed by Microsoft. As a database server, it is a ...