Posted in Development, Performance Tuning

How to collected inventory for SQL Server using Microsoft Assessment and Planning (MAP) tool

Hi friends,

We need to collect inventory for database migration as well as platform to set up environment for migration, development and testing.

Is there any tool from Microsoft to achieve this scenario?

Yes, we have Microsoft Assessment and Planning Tool (MAP) for it.

From BOL:

The Microsoft Assessment and Planning (MAP) Toolkit is an inventory, assessment, and reporting tool that helps you assess your current IT infrastructure and determine the right Microsoft technologies for your IT needs. The MAP toolkit uses Windows Management Instrumentation (WMI), Active Directory Domain Services (AD DS), SMS Provider, and other technologies to collect data in your environment and inventories computer hardware, software, and operating systems in small or large IT environments without installing any agent software on the target computers.

In order for the MAP Toolkit to successfully connect and inventory computers in your environment, you have to configure your machines through WMI and also allow your firewall to enable remote access through WMI. In addition to enabling WMI, you need accounts with administrative privileges to access desktops and servers in your environment.

Download and Install MAP tool

You can download Microsoft Assessment and Planning Toolkit from http://go.microsoft.com/fwlink/?LinkId=313396

Once the MAP tool is installed SQL Server LocalDB gets installed by default.

Latest Version of MAP tool is 9.4

MAP 9.4 is updated to inventory, assess and report the SQL Server 2016 instances and components in the SQL Server assessment.

  1. After opening it Create inventory database which will be used to save the inventory data and statistics inside it when working with MAP tool.

1

2. Once you opened the MAP tool in the Create or Select a Database to Use dialog click Create an inventory database and type student as a new database name and click OK.

Student database is created successfully and message will also appears for this.

3. To enable the remote administration open the Command Prompt as Run As Administrator.

Type the following command and press enter, you will get the message OK in response.

netsh advfirewall set currentprofile settings remotemanagement enable

 4. This is home screen for MAP tool which allow the different options to collect the inventory data for Server, Desktop, Cloud etc.

2

MAP toolkit uses WMI, Active Directory Domain Services, SQL Server Commands, VMware web services, Oracle client, PowerShell  and SSH with remote shell commands to collect the inventory information from the target network machines. It is not required to have the MAP tool on the target machine to collect the inventory.

5. Click on Database option from left side pane

6. Now click on Collect Inventory Data link, an Inventory and Assessment Wizard window opens.

3

You can choose the scenarios on your choice to collect the inventory with various scenarios available:

  • Windows-based computers
  • Linux-based computers
  • VMware computers
  • Exchange Server
  • Active Devices and users
  • Forefront Endpoint Protection Server
  • Lync Server
  • SQL Server
  • SQL Server with database details
  • Windows Azure Platform Migration
  • MySQL, Oracle, and Sybase

7. Choose option SQL Server and SQL Server with Database Details as Inventory Scenario.

8. Click Next.

Discovery Methods tab appears which is used to discover computers. Various discovery methods available for selection of method-

  • Active Directory® Domain Services
  • Windows networking protocols
  • System Center Configuration Manager
  • Scan an IP address range
  • Manually enter computer names and credentials
  • Import computer names from a file

 

9. Select option Manually enter computer names and credentials.

4
Click Next.

10. Now in All Computer Credentials page, click Create.

11. In the Account Entry dialog, type the username for the local computer user

12. In both the Password and Confirm Password fields, type the password for the local computer user then click Save

13. In the All Computer Credentials Page, click

14. Click Next in the Credentials Order

15. In the Enter Computers Manually page, click Next.

16. Now, in Specify computers and credentials page enter your computer name and Click on Add.

You can add multiple computer names here as per your requirement.

17. Click on Save

5

18. Then Clicking on Next button will take you on Summary section.

19. In Summary section you can see the summary of your selection including any detected errors.

620. Click on Finish

21. Inventory and Assessment Windows appears on screen where you can see the progress of Data collection.

7

How to generate reports to get SQL Server DB information?

 To generate the report, we will click on SQL Server from Database scenario.

In the option section two types of reports can be generated:

  1. Generate SQL Server Assessment Report
  2. Generate SQL Server Database Detail Report

Click on any report and save to your local disk.

8

These two reports shows different type of information which are like –

  1. SQL Server Assessment Report

This report shows information about Database Instances and Components.

2. SQL Server Database Detail Report

This report provides an information of all the SQL Server database engine instances and number of databases discovered on your network.

So, in this way we can use MAP tool to collect the inventory and statistics.

Advertisements
Posted in Performance Tuning, Uncategorized

SQL Server Execution Plan Operator – Table Scan

In my previous blog we discussed about the different format of SQL Server execution plan. Now in upcoming blogs we will discussed about the most commonly seen operators we see when execution plan generates. In this post I will start the easy one that is Table Scan operator.

As with the name of operator Table Scan it indicates that it returns the rows after scanning every row of a table.

When this operator appears in execution plan?

When there is no index present on the table then query optimizer has to scan every row of table to return the result set.

tablescan

In the returned result set data is retrieved after traversing data row by row.

When a table is having fewer rows and returning maximum rows then it’s faster for query optimizer to scan all rows rather than checking indexes.

That’s all for the day !!!

 

Posted in Development, Performance Tuning, Uncategorized

SQL Server Execution Plan formats

Execution plan helps in knowing how a query gets executed and troubleshooting a query which is performing poor.

In SQL Server execution plan can be of 2 types:

  1. Estimated Execution plan
  2. Actual Execution plan

Execution plan can be viewed in 3 different formats:

  • Text format
  • XML format
  • Graphical format

We can choose the format on depending what level of details we want to see.

Let’s discuss these format one by one.

  1. Text format

Execution plan in text format can be seen using these 3 methods.

  • Showplan_ALL
  • Showplan_Text
  • Statistics Profile

Showplan_ALL : Its shows the estimated execution plan of the query. To enable it we need to execute the query:

SET SHOWPLAN_ALL ON;

1

Once we analyze our query plan we can turn off this option by executing below query so that our subsequent queries will not get affected from this.

SET SOWPLAN_ALL OFF;

Showplan_Text: It’s also works with the estimated execution plan of the query. To enable it we need to execute the query:

SET SHOWPLAN_TEXT ON;

2

SET SHOWPLAN_TEXT OFF;

Statistics Profile: It works with the actual execution plan. We need to execute the below query to enable it:

SET STATISTICS PROFILE ON;

3

SET STATISTICS PROFILE OFF;

2 XML format plans

Execution plan can be seen in XML format by using following two methods:

Showplan XML

Statistics XML

Statistics XML: It is used to generate the execution plan in XML format. After clicking on XML link a graphical execution plan gets opened in a new window. We can save that graphical plan to our local disk with extension .sqlplan.

4

Showplan XML: It’s also generates the XML plan and only one result set appears in outcome with XML link.

5

3. Graphical Plan

This is the most easiest and readable option to generate the execution plan. It also has two option for generating execution plan:

Estimated execution plan

Actual execution plan

To enable the estimated execution plan we can press the shortcut key Ctrl +L. Also, we can navigate to Query tab and select Display Estimated Execution Plan.

Estimated execution plan is beneficial when we have complex query and not aware how much it will take for complete execution in such situation we can use this as this doesn’t execute the query to generate the plan.

6

Similarly, actual execution plan we can be enabled by using shortcut key Ctrl+M.

We can also activate it by selecting option Include Actual Execution Plan from Query menu tab.

That’s all for the day folks.

 

Posted in Uncategorized

Importance of Database Backup In SQL Server

Overview

To save any organisation from any big future loss, one needs make a proper strategy or disaster plan that will save them in their hard time. When working with critical data it becomes very necessary to backup organisation data. In any organisation, for an administrator it is very important task to make a disaster plan because the risk of loosing data due to hardware failures, human error, natural catastrophes, network intrusions is always there.

When the SQL server met with disaster, admin needs a plan or a way to recover their precious data.

To safeguard SQL server databases there is SQL server backup and restore component that protects data from any catastrophic data loss.

Why backup a Database In SQL Server ?

In order to save data from such damages, user needs to backup the database regular basis that will also preserve data from modifications, table corruption, etc. there should be a proper backup and restore, that will safeguard organisation data against data loss caused due to various factors. In any organisation there are number of systems having crucial information in them, virus intrusions in one of the system can cause huge loss entire network. By keeping data in backup storage, one can smooth perform restore their data after even the damage.

Hardware Failure/Media Failure: It includes reasons like bad sector, hard drive crash, etc.

User Error: sometimes people unintentionally deletes data or make any alteration on data. For example- when user drop a table by mistake.

Natural disaster: one can not save their on-premises data from such natural tragedy, however, SQL server provides a service called Windows azure storage service, in this user can create an off-site backup in a different location and then in on-premises location.

There are also, Other reasons due to which need of backup arises-Power failure, mechanical damage to hardware, viruses and damaging malware.

Backup Strategy Best Practices in SQL Server

  • SQL server perform backup when the user is in active state and transactions are being processed, therefore one can only back when system in use
  • User can shorten their backup period by using data compression feature and also by saving database to disk. However, user must not use same disk for backup that storing database or transaction log.
  • Time to time backup the transaction log, as it covers all activities and keeps it very up-to date.
  • User must backup SQL server system database as it contains all vital information of system configuration and required in the event of complete restore.
  • User must ensure the security of database.

Conclusion

SQL database backup is a very important activity that one can perform to safeguard the data present in the SQL database. Backup is one way with which users of an SQL database can restore their data preventing a catastrophic loss. In case, at the time of disaster, if one doesn’t have any backup strategy, then going for an SQL Database Recovery Software would be a good choice to recover data from disaster without a backup.