Search the Blog

Showing posts with label store procedure. Show all posts
Showing posts with label store procedure. Show all posts

Monday, September 7, 2020

SQL server Upgrade

 

When you upgrade to a new version of SQL Server, there are some critical things you should do to help avoid any surprise SQL Server performance issues. I mean new version  of SQL Server is 2016,2017 or 2019, Because Microsoft  closed its support up to some extent to older version


Why need the Requirement to upgrade the Version?

Basically it is because Microsoft ended Its support of some versions.

There are two type of Support

1- MainStream Support

2- Extended Support


SQL Server Versions

MainStream Support

Extended Support

SQL Server 2005

April 12, 2011

April 12, 2016

SQL Server 2008 or R2

July 8, 2014

July 9,2019

SQL Server 2012

July 11, 2017

July 12, 2022

SQL Server 2014

July 9, 2019

July 9, 2024

SQL Server 2016

July 13, 2021

July 14, 2026

SQL Server 2017

Oct 11, 2022

Oct 12, 2027

SQL Server 2019

July 1, 2025

Aug 1, 2030


For Upgrading any Version there are some preparations which need to be taken care.

1- Find the Upgrade Blockers. 

2- Clear Understanding of Version and Editions.

3- Clear Understanding of Features introduced and obsolete

3- Make a List of objects which use the features which  are obsolete from the newer version and currently in use.

4- Clear Hardware Requirement for newer Versions. 






















For this Activity i am upgrading the Server from 2012 to 2017.


Process to Upgrade the SQL Server Version.

There are 3 ways to upgrade

  1. - In-Place Upgrade

  2. - Side-by-Side Upgrade

  3. - Rolling Upgrade


Steps for an In-Place Upgrade 

In-place upgrades are the easiest to perform, but the most difficult to rollback should there be any issues. The steps involved in an in-place upgrade are as follows:

  1. Verify that backups exist for all databases (user and system). 

  2. Review the list of requirements for SQL server 2017 and install whatever is needed.

  3. Install SQL Server 2017 

  4. Restore the Backup

Side-by-Side Upgrade

  • 1- Backup all the database

  • 2-Script out any and all necessary system objects.

            3-Review the list of requirements for SQL server 2017 and install whatever is needed.

  • 4- Run the script to create the Object

  • 5-Select database(s) to migrate and it take offline. 

  • 6-Migrate database to new instance. Repeat for each database.

  •  

 

 

 

Rolling Upgrade


1- Select any High-Availability 

2- Install new Server instance 2017 and make it  as a Secondary node

3- Fail the Primary Node now New Instance will be active and will be Primary Node

 

Checklist need to Perform Before Planning to Upgrade about version of Server


1-Checking of Deprecated Features  in new version

SELECT * FROM sys.dm_os_performance_counters   WHERE object_name  = 'MSSQL$JFT:Deprecated Features   

2- Get the List top indexes which are in use maximum times in the current version.

SELECT OBJECT_NAME(IX.OBJECT_ID) Table_Name

      ,IX.name                     AS Index_Name

      ,IX.type_desc                 AS Index_Type

      ,SUM(PS.[used_page_count]) * 8     IndexSizeKB

      ,IXUS.user_seeks AS             NumOfSeeks

      ,IXUS.user_scans AS             NumOfScans

      ,IXUS.user_lookups AS             NumOfLookups

      ,IXUS.user_updates AS             NumOfUpdates

      ,IXUS.last_user_seek AS         LastSeek

      ,IXUS.last_user_scan AS         LastScan

      ,IXUS.last_user_lookup AS         LastLookup

      ,IXUS.last_user_update AS         LastUpdate

FROM sys.indexes IX

INNER JOIN sys.dm_db_index_usage_stats IXUS 

ON IXUS.index_id = IX.index_id AND IXUS.OBJECT_ID = IX.OBJECT_ID

INNER JOIN sys.dm_db_partition_stats PS 

on PS.object_id=IX.object_id

WHERE OBJECTPROPERTY(IX.OBJECT_ID,'IsUserTable') = 1

GROUP BY 

OBJECT_NAME(IX.OBJECT_ID) ,

IX.name ,

IX.type_desc ,

IXUS.user_seeks ,

IXUS.user_scans ,

IXUS.user_lookups,

IXUS.user_updates ,

IXUS.last_user_seek ,

IXUS.last_user_scan ,

IXUS.last_user_lookup ,

IXUS.last_user_update

3- Current Used Space at current instance and Available Space in the new instance.

4- Current OS Hardware Configuration.

5- Scripting of all user defined Objects.

 

Friday, August 7, 2020

Database Diagram Designing For Free Application for Various School

Database Diagram Designing For Free Application for Various School:-


This article will explain for SQL Developer and Database Architecture Designer to design the Database for School or Couching or Any academic center.

 To demonstrate this, I have created for tables
1- Student

Student
StudentIDNameUID
1Bill Gate1100110001
2SAM1100110002
3Jastin1100110004
4Bejos1100110015
5Rohit1100110016
6Sachin1100110020
7Virat1100110021
8Modi1100110023
9Trump1100110026
10Putin1100110030

 

2- Standard

Standard
StandardIDName
1I
2II
3III
4IV
5V
6VI
7VII
8VIII
9IX
10X
11XI
12XII

 

3- CENTER/ School/ Branch/ Location

CENTER
CenterIDCenter
1INDIA
2US
3CANADA
4RUSSIA
5UK

 

4-ANNUAL Charges

ANNUAL Charges
ACIDCenterIDStandardIDCHARGES($)
11I100
21II120
31III140
41IV160
51V180
61VI200
71VII220
81VIII240
91IX260
101X280
111XI300
121XII320
132I1000
142II1200
152III1400
162IV1600
172V1800
182VI2000
192VII2200
202VIII2400
212IX2600
222X2800
232XI3000
242XII3200
253I500
263II750
273III1000
283IV1250
293V1500
303VI1750
313VII2000
323VIII2250
333IX2500
343X2750
353XI3000
363XII3250
374I500
384II550
394III600
404IV650
414V700
424VI750
434VII800
444VIII850
454IX900
464X950
474XI1000
484XII1050
495I1100
505II1200
515III1300
525IV1400
535V1500
545VI1600
555VII1700
565VIII1800
575IX1900
585X2000
595XI2100
605XII2200

 

 Now to Design the Database Diagram for any Organization, First we need to check up to which level we need to create the flexibility. 

1- If all data is static then we should use the  one- to one- relationship

2- If we required full flexibility then we should use many-to-many relationship.



Translate