Showing posts with label High Availability. Show all posts
Showing posts with label High Availability. Show all posts

Jun 3, 2022

New features of SQL Server 2022

Hello guys, hope you are doing well. In this blog I'm going to discuss about the "New features of SQL Server 2022" 

The release of the SQL Server 2022 is much anticipated by the audience since the announcement of it being in the works on November 2nd, 2021. Although the complete details of this brand-new version will be brought to light in due time as it is currently in private preview. However, Microsoft has already disclosed its key features that the audience should look forward to.

Although most of the product’s features are still private, the released information has introduced some unique new performance-based features in the SQL Server 2022. Here is a detailed list of what you’d be working with once you get your hands on the product: 


1. Performance Improvement: This feature enables SQL Server to build better execution plans and potentially multiple execution plans, the performance of which depends on the parameter values that are provided at runtime.

The Query Store can now help resolve performance issues related to the MAXDOP (maximum degree of parallelism) setting, memory grants, and the cardinality estimator using a feedback cycle to adapt and improve query execution plans. Finally, Query Store now supports availability group (AG) read-only replicas. 


2.  High Availability and Connection Improvements: In SQL Server 2022, you may construct a distributed AG between an on-premises SQL Server and an Azure SQL Managed Instance (MI) for use as a disaster recovery backup server or as a read-only replica for reporting workloads, making high availability even better. With a few clicks, you may manually failover to the MI and back to the on-prem SQL Server.


3. Security and Governance Improvements: Using "blockchain" technologies, the  new functionality creates an immutable record of data alterations throughout time. This safeguards data from tampering, which is important in some contexts and use cases, as well as providing benefits for internal and external audits. Microsoft's initial feature set has been developed into a more comprehensive data governance platform. Purview now has tighter integration with SQL Server and Azure SQL, allowing you to scan SQL Server for metadata, classify data using common classifier labels and tagging (such as PII or HIPAA data), and configure and control specific SQL Server access rights and privileges from a single Azure Purview console.



4.  Query Store and Intelligent Query Processing: The SQL Server 2022 ensures that the Query Store will be available on all new databases on the server. It addresses the common issue in the previous models by allowing write access from readable secondaries. This feature will enable transparency into activity on secondary replicas. However, if a database from the older version of SQL is accessed, the Query Store will have to be manually enabled.

5. Parameter Sensitive Plan Optimization: In older SQL Server versions, input parameters at the time of storage had an impact on certain stored processes. Parameter Sniffing was the popular name for this problem. One of the unique features of SQL Server 2022 is the Parameter Sensitive Plan Optimization, which allows you to cache multiple parameter-sensitive queries while procedures are being saved. This will assist you avoid having to alter your code by using the recompile option or allocating the values of the input parameter to variables within the procedure.


6.  TempDB and Latch: During SQL Service Performance Tuning in older SQL server versions, 1 out of 10 clients would struggle with TempDB and Latch. Although you can address it in multiple ways, the practice took valuable time and energy. The SQL Server 2022 addresses these issues by enhancements to the TempDB database and the Memory Optimized TempDB Metadata. Experts are hopeful that clients will not struggle with these issues with the release of this new version.

 

7.  Bidirectional HA/DR to Azure SQL Managed Instance: For enhanced data backup and security, SQL Server 2022 adds Bidirectional HA/DR to Azure SQL Managed Instance. It allows you to connect a database to the cloud in only a few clicks. This not only saves money, time, and labour by eliminating the technicalities of data storage via hardware and virtual machines, but it also encourages better backup and recovery methods. It creates an Availability Group (AG) between a SQL Server and an on-premises Azure SQL Managed Instance.

8.  Azure Synapse Link: The Azure Synapse Link helps move data from an on-premises SQL Server to Synapse without ETL. It captures the changes in the server and feeds them to Azure Synapse Analytics. The Synapse link puts minimal strain on operating systems when conducting real-time analysis and analytical processing. It fastens data transfer and increases the connectivity of the data to other robust analytic programs.

9.  SQL Server Ledger: In comparison to the competition, SQL Server has experienced fewer security concerns in the recent decade. The new SQL Server Ledger, on the other hand, secures data even further by maintaining an immutable record of any changes made to the data or stored processes. The ledger prevents unauthorized parties from tampering with or corrupting the data, lowering the chance of a security breach.


10.Multi-Write Replication: Previously, when rewritten data clashed with different clones of the same database, the dispute had to be manually resolved. SQL Server 2022, on the other hand, addresses this problem by adding the concept of 'last write wins.' As a result, if a conflict between duplicates arises, the most recent rewrite will take precedence and be copied to all copies.


 --By Harigovind Gupta (Software Engineer)

    Clota Technology

Apr 29, 2022

Step by Step implementing Log Shipping

Log Shipping enables you to automatically send transaction log backups from a primary database on a primary server instance to one or more secondary databases on separate secondary server instances. The transaction log backups are applied to each of the secondary databases individually. 

 

ADVANTAGES OF LOG SHIPPING- 

  1. Easy setup. 
  2. Standby databases can be available for read -only queries. 
  3. Low Maintenance.
  4. Multiple standby servers can be configured.
  5. Provide both disaster recovery and high availability solution. 
  6. It supports both bulk logged and full recovery model. 

 

DISADVANTAGES OF LOG SHIPPING- 

  1. It is possible to loss data when the main database is corrupt. 
  2. It only works at database level and not at SQL server instance level. 
  3. There will be data transfer latency.
  4. Failover take time. 
  5. No automatic failover.

 

 TYPES OF LOG SHIPPING -

In SQL Server two types of log shipping which are given below-:  

  1. Standby Mode 
  2. Restore Mode

Standby Mode-The database is available for querying and users can access it, but in read-only mode. 

Restore Mode- In this mode the database is not accessible.    

 

STEPS TO CONFIGURE LOG SHIPPING-

  • I have used SQL 2019 to set up Log Shipping.  
  • First, connect to your primary instance and select a database. 
  • Take a full back up from primary instance.  

  • Now connect to secondary server. 
  • Here, restore the full back up on the secondary server with the help of move command with norecovery.

  • Now, restore the log backup on the secondary server which we have taken from primary server. 
  • Now, configure log shipping between both the server and Go to primary server->Go to database->Right click->Go to properties->Transaction Log Shipping

  • Select network path and local path in transaction log shipping. 


  • Now, go to add and connect with initialize secondary server. 
  • Add the path for copied files. 
  • Go through standby mode which means you can read from secondary server.

  • Now, at primary server insert some data in a selected database. 
  • Go to SQL Server agent and start the LS backup job at the primary server. 

  • Now, go to secondary server and go to SQL Server agent and start the LS Copy and LS Restore job at the secondary server.   

  • Now, go to secondary server and open a new query window and write a query- 



  • It means the secondary server is totally shrink with primary server.

JOBS CREATED FOR LOG SHIPPING-

There are 3 types of jobs in log shipping as given below-   

  • Backup job (LS Backup)- A SQL Server Agent job that performs the backup operations, logs history to the local server and the monitor server and deletes old backup file and history information. 
Go to SQL Agent->Jobs->LS Backup job

  • Copy job (LS Copy)A SQL Server Agent job that copies the backup files from primary server to a configurable destination on the secondary server and logs history on the secondary server and the monitor server. 

     

                                       Go to SQL Agent->Jobs->LS Copy job



  • Restore job (LS Restore)- A SQL Server Agent job that restores the copied backup file to the secondary database. 
Go to SQL Agent->Jobs->LS Restore job