/ MicroSoft SQL Server

SQL Server Profiler

The SQL Server Profiler is an absolutely essential tool for both DBAs and developers alike. Profiler provides the ability to monitor and record virtually every facet of SQL Server activity. It is actually a graphical interface for SQL Trace, which is a collection of stored procedures and functions that are used to monitor and record server activity.
SQL Server Profiler can be launched from the Tools menu of SQLServer Management Studio, or from the All Programs Microsoft SQL Server 2008 Performance Tools menu.
 

SQL Server Trace
The Profiler can be used to create and view SQL Server Traces. When creating a new trace, the Profiler will prompt you for the server on which you will be running the trace. Remember that the Profiler is just a graphical interface for SQL Trace, and what is occurring in the background is the execution of stored
procedures and functions on the server you connect to. If the server is very busy and is operating at the edge of its capabilities, the additional load of running SQL Trace on it may well put it over the edge.




Trace Properties
When creating a new trace, the Trace Properties dialog is shown below. The Trace Properties dialog includes two tabs: the General tab and the Events Selection tab. A third tab, Events Extraction Settings, will be enabled if any XML SHOWPLAN event is selected in the Events Selection tab. Trace Properties dialog.


General Tab
The General tab provides the ability to set the basic structure of the trace (such as the trace name, trace template, saving options, and trace stop time). It also displays the provider name and type, because SQL Server Profiler is not limited to the Data Engine. It can also be used to trace SQL Server Analysis Services.

Use the Template — This dropdown list contains several pre-built trace templates. Each template is a pre-defined set of events and filters that provide for the monitoring of SQL Server for particular purposes. These templates can be a good place to start when creating traces to monitor SQL Server. It is also possible to create your own templates, and it is strongly recommended that you do so. The provided templates are fine, but you will undoubtedly want to collect different information from that which the templates provide. To avoid having to create the same

custom trace over and over again, create and save a template to capture the information you are interested in.

Save to File — Selecting this checkbox will display a dialog prompting for a file location to save the trace data to. The filename defaults to the name assigned to the trace with the .trc extension. However, the name can be changed if desired. The default maximum file size for a trace file is 5 MB, but it can be set to virtually any size. When the ‘‘Save to file’’ option is selected, two additional options are enabled: the ‘‘Enable file rollover’’ option and the ‘‘Server processes trace data’’ option.

 Enable File Rollover — This option causes a new file to be created every time the maximum file size is reached. Each file created is named the same as the original file with a sequential number added to the end of the name. Each sequential file is linked to the preceding file, so that each file can be opened in sequence, or they can all be opened in a single trace window.

 Server Processes Trace Data — This option causes the server that the traces are running on to also process the trace information. By default, the Profiler application processes the  trace information. During high-stress operations, if the Profiler processes the data, it may  drop some events and even become unresponsive. If the server processes the trace data,  no events will be dropped. However, having the server process the trace data and run the     trace puts an additional load on the server, which can have a negative impact on server performance.
❑ Save to Table — Trace data can also be saved to a table instead of a file by selecting the ‘‘Save  to table’’ option. This is very useful if the trace data is going to be analyzed by an external application that requires access to the data stored in a relational format. The down side is that large traces will generate huge amounts of data that will be inserted into the storage table. This can also cause server performance issues, but you can mitigate this by saving trace information to a different server from your production system. If saving trace data to a table, the maximum amount of rows to be stored can also be assigned.
❑ Enable Trace Stop Time — Traces can be started and configured to automatically stop at a pre-defined time by enabling the ‘‘Enable trace stop time’’ option and assigning a stop time.
Events Selection Tab
The Events Selection tab provides the ability to choose what SQL Server events are to be traced  Events are grouped in 21 SQL Server event groups with a total of 170 distinct SQL Server events, plus 10 user-definable events. There are also 11 Analysis Services Groups with 38 distinct events.SQL Server Books Online has an excellent reference that describes each group and event. Search for the titles of ‘‘SQL Server Event Class Reference’’ for SQL Server events and ‘‘Analysis Services Event Classes’’for Analysis Services Events.
❑ Column Filters — Also in the Events Selection tab is the option to filter the events that are traced. The ability to filter the data is incredibly useful. For example, if you are troubleshooting a particular application, you can filter on just the events generated by the application of interest and avoid having to sift through all the events generated by SQL Server and other applications.
❑ Organize Columns — The Organize Columns button enables you to place the trace columns you are most interested in so that they are easily seen when viewing the trace. Because a great deal of
data can be returned, it may very well be that the column you are most interested in is off the screen to the left. The Organize Columns button helps prevent this.


What is RAID ?? How does it works in SQL Server ?


RAID (redundant array of independent disks) is a disk system that contains multiple disk drives, called an array, to provide greater performance, fault tolerance, storage capacity, at a moderate cost. While configuring your server system, you typically have to make a choice between hardware RAID and software RAID for the server’s internal disk drives.


RAID levels 0, 1, and 5 are typically implemented with SQL Server.

RAID 0 — RAID 0 offers no redundancy or fault tolerance, but instead helps improve performance by striping across multiple disks. RAID 0 also allows you to use the combined storage capacity of both disks.

Disk striping across 4 disks using RAID 0

RAID 1, also known as mirroring, provides fault tolerance by making a bit-for-bit copy of your data on two disks. While this provides basic redundancy and can improve Read performance (by having two separate disks available to read from), you might suffer minor loss of Write performance, since the data will have to be written across both disks.RAID 1 has 50 percent storage overhead.

Disk mirroring using RAID 1
RAID 5 — RAID 5 is one of the more common implementation types of RAID, utilizing three or more disks. RAID 5 is also called striping with parity, because as it stripes across multiple disks,it writes a parity block on each stripe that allows the data to be rebuilt in case of a disk failure.RAID 5 is considered a good option for most scenarios because it provides fault tolerance and
improved Read and Write performance and has a relatively low storage overhead. Because the available capacity on a RAID 5 array is n – 1 (n being the total number of disks in the array), the storage overhead decreases as the number of disks in the array increases.

Disk striping with parity using RAID 5

RAID 10 — RAID 10 (also sometimes known as RAID 1+0) is the cat’s pajamas of RAID, and is considered the optimal design solution for SQL Server database files. RAID 10 requires a minimum of four disks and essentially stripes data across two mirrored sets. So let’s say, for example,that you have four disks: a, b, c, and d. Disks a and b will be used to make one mirrored set, which  we’ll call ab, and disks c and d will be used to make the cd mirrored set. The two mirrored sets are then part of a new striped set, so when data is written to the array, it is striped across ab and cd.




Which RAID is suitable for SQL server


https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPShvxOz8-xLgPodfO7a-VOz9cv5kOKW1XUYZ8714ivbeIrYmeHwcZMyvCn_nB-W3P0NQ2ww50k6mefvTfZCRyjaadfkUa98N__yFxhiSRiLlgXCn_BMiR_p-gkq9Nk2_3yudiW7StHnjE/?imgmax=800

Schema

Each database can contain one or more schemas. A schema is a namespace for database objects. All data objects in a SQL Server 2008 database reside in a specific schema.
 
SQL Server 2008 implements the ANSI schema object. A database schema is a defined namespace in which database objects exist. It is also a fully configurable security scope. In previous releases of SQL Server, the namespace was defined by the owner of an object, and it wasn’t uncommon to see everything in thedatabase in the dbo schema. In SQL Server 2008, the ownership of an object is separated from an object’s namespace. An individual user may be granted ownership of a schema, but the underlying objects belong to the schema itself. This adds greater flexibility and control to the management and securing of database objects. Permissions can be granted to a schema, and those permissions will be inherited by all the objects defined in the schema.

How to troubleshoot SSL encryption issues in SQL Server ??

1. Check if the connection is encrypted

You can query the sys.dm_exec_connectionsdynamic management view (DMV) to see if the connections to your SQL Server is encrypted or not. If the value of encrypt_optionis "TRUE" then your connection is encrypted.

SELECT session_id, encrypt_option FROM sys.dm_exec_connections

2. Check if SQL Server service has been restarted after the configuration changed

You can query the sys.dm_os_sys_info DMV to see when the SQL Server service has been started, just look for the sqlserver_start_time value.

SELECT sqlserver_start_time FROM sys.dm_os_sys_info

3. Try to connect using the Fully Qualified Domain Name
It can cause an issue if you use only the computer name in the connection string. It is better to use the Fully Qualified Domain Name (FQDN) e.g. 

YourSQLServer.YourCompany.int\YourSQLServerInstance

4. Check the connection string of your application
Pay attention to the following properties of the connection string:
  • encrypt
  • trustServerCertificate
The value of the encrypt property should be 'true' to enable SSL encryption. If trustServerCertificate=true then it is possible to connect to the SQL Server using a self-signed certificate, but this scenario is recommended only in test environments.

5. Check the certificate properties
The certificate should be valid (Valid From and Valid To properties), the Common Name (CN) in the Subjectproperty of the certificate must be the same as the fully qualified domain name (FQDN) of the server, the Enhanced Key Usage property should include 'Server Authentication (1.3.6.1.5.5.7.3.1)' and the certificate must be created by using the KeySpec option of 'AT_KEYEXCHANGE'.

6. Check if the certificate is trusted by the client
The client machine should trust the certificate so there are two options:
  • The SQL Server's certificate should be installed on the client machine to establish a direct trust.
  • The certificate of the root certificate authority and the intermediate/chain certificates should all be trusted. This way you can take advantage of the chain of trust, the core principle of SSL certificate hierarchy.

Upgrading SQL 2005 to SQL 2014

I had an interesting discussion recently about whether this was still supported or not; it definitely was in SQL 2012 but in SQL 2014 it wasn't so clear because there are two sources of Microsoft documentation that are in conflict.

Document 1: Supported Version and Edition Upgrades

SQL Server 2014 supports upgrade from the following versions of SQL Server:
  • SQL Server 2005 SP4 or later
The table below lists the supported upgrade scenarios from earlier versions of SQL Server to SQL Server 2014.
Upgrade fromSupported upgrade path
SQL Server 2005 SP4 Standard SQL Server 2014 Standard
Any scenarios not specified in the list above are not supported, including but not limited to the following:
  • Installing SQL Server 2005 and SQL Server 2014 on same computer (side by side).

Document 2: Work with Multiple Versions and Instances of SQL Server

You can install SQL Server on a computer that is already running instances of an earlier SQL Server version. If a default instance already exists on the computer, SQL Server must be installed as a named instance.
The following table shows side-by-side support for SQL Server 2014:
Existing instance of SQL Server 2014Side-by-side support
SQL Server 2014 (32-bit)SQL Server 2005 (32-bit) SQL Server 2005 (64-bit) x64
SQL Server 2014 (64-bit) x64SQL Server 2005 (32-bit) SQL Server 2005 (64-bit) x64
The prelude text to that is about installing newer versions after older versions. But the heading "Existing instance of SQL Server 2014" seems to indicate the opposite: installing older versions of existing newer installs. But either way it indicates some kind of side-by-side install is a supported scenario.

Document 3: SQL Server 2014 Upgrade Technical Guide

I think this document is the tie-breaker as it repeatedly mentions SQL 2005 upgrades both in-place and side-by-side (too numerous to quote here). Also the reports from SQL Server Central are that they seem to co-exist side by side without issue.
I left a community note on Supported Version and Edition Upgrades requesting clarification anyway.

Upgrading SQL Databases From SQL Server 2005 to SQL Server 2008, 2008 R2 ,2012 and SQL Server 2014

Prerequisites 
 
1) Run upgrade adviser on the databases for the instance you want to upgrade.
2) If any issues are found, talk to your SME  for fixing the same.
3)If issues are fixed proceed with the actual upgrade. -- Do check for the other dependencies on the database which might effect the functionality if the instance gets upgraded or something like that.
4)Get the downtime for the database.
5)Create the latest full backup of the all databases -- any other strategy will also work, just make sure you can recover the database.
6)Take a clone of the server if it's a virtual server to roll back any changes.
7)Run the upgrade on the sql 2005 instance from the 2008 or 2008R2 or 2012 or 2014 set up. (do check the pre-requirements for upgrade to sql 2014)
 8)If everything is fine then you have an upgraded instance.
9)you have to check the compatibility of the each database and update the new value of sql server which you have upgraded .

If all is fine then congrats you have upgraded your sql server instance.