Scripts

Technical Article

How to register SPN for SQL service account

Check if the SPN is already registered: setspn -l domain\xxxxx If not, run below commands: setspn -A MSSQLSvc/abc.xx.companyname.com:1433 domain\xxxxx setspn -A MSSQLSvc/abc.xx.companyname.com domain\xxxxx setspn -A MSSQLSvc/abc:1433 domain\xxxxx setspn -A MSSQLSvc/ abc domain\xxxxx   Verify again, setspn -l domain\xxxxx

5 (1)

You rated this post out of 5. Change rating

2020-06-17 (first published: )

6,838 reads

Technical Article

SQL Service account status with PowerShell

One of my client has the requirement to have SQL Service account running with domain account and should not be with local account. You may receive SSPI error after changing it to domain account. In order to fix that issue check my previous blog "How to register SPN for SQL service account" Output:

5 (1)

You rated this post out of 5. Change rating

2020-06-17

971 reads

Technical Article

Monitor basic Database parameters like Recovery Model, Page Verify, Auto Close, Auto Shrink, DB Owner, Auto Create Statistics Enabled, DB Create Date etc with PowerShell command.

I have created this script for one of our client, the requirement was all the databases should be in full recovery model and should be monitored. Also, I added other important parameters like AutoShrink, AutoClose etc. Output:

5 (2)

You rated this post out of 5. Change rating

2020-06-16

1,041 reads

Technical Article

Getting more info about who or what connect to your SQL Server

A couple of days ago I was playing with my small SQL Server enviroment (test) and auditting login events. I went ahead and created the audit for FAILED_LOGIN_GROUP and SUCCESSFULL_LOGIN_GROUP (let it run for a while). USE [master] GO CREATE SERVER AUDIT [Audit_LoginEvents] TO FILE ( FILEPATH = N'<PathToStoreData>' ,MAXSIZE = 100 MB ,MAX_FILES = […]

You rated this post out of 5. Change rating

2020-06-03 (first published: )

1,777 reads

Technical Article

Migrate and Upgrade SQL Instance (2014/2016) to 2019 version with 1 click

The script includes these steps:   STEP 1: CREATE EMPTY Databases STEP 2 - CREATE Logins WITH SERVER ROLES\PERMISSIONS STEP 3 - COPY LINKED SERVERS STEP 4 - COPY SERVER OPTIONS STEP 5 - COPY CREDENTIALS STEP 6 - COPY AGENT JOBS STEP 7 - COPY DB Mail STEP 8 - COPY CERTIFICATES STEP 9 […]

You rated this post out of 5. Change rating

2020-05-22 (first published: )

2,162 reads

Technical Article

Migrate and Upgrade SQL Instance (2014/2016) to 2019 version with 1 click

The script includes these steps:   STEP 1: CREATE EMPTY Databases STEP 2 - CREATE Logins WITH SERVER ROLESPERMISSIONS STEP 3 - COPY LINKED SERVERS STEP 4 - COPY SERVER OPTIONS STEP 5 - COPY CREDENTIALS STEP 6 - COPY AGENT JOBS STEP 7 - COPY DB Mail STEP 8 - COPY CERTIFICATES STEP 9 […]

You rated this post out of 5. Change rating

2020-05-22 (first published: )

1,060 reads

Technical Article

Powershell Script - Azure cosmos DB(SQL API)

Scripts contains 4 following functions. Users can create 3 different script from this for inserting, fetching and deleting a document.
1. Function Generate-MasterKeyAuthorizationSignature - This function is used to create connection to Azure cosmos DB. This function codes were taken from Technet.
2. Function Post-CosmosDb - Insert single document in azure cosmos DB. Same function can be used to perform bulkinsert. This function code was taken from following article. To make it useful i made some modification in it.
(https://www.systemcenterautomation.com/2018/06/cosmos-db-rest-api-powershell/)
3. Function Get-CosmosDocument - Fetch single document from azure cosmos DB. Same function can be used to fetch all documents from Cosmos DB.
4. Function Delete-CosmosDbDocument - Delete single document from cosmos DB. Same function can be used to delete more than one document with some additional codes.

To use any of the function like Post,Get, Delete. you have to comment the other 2 function call. If you are using all 3 functions(Post,Get, Delete), Be cautious while using them.

You rated this post out of 5. Change rating

2020-05-11 (first published: )

3,577 reads

Blogs

Query deadlock info in Azure SQL DB

By

A couple of weeks ago, a developer came to me and wanted to know...

MSSQL Database Property LastGoodCheckDbTime to Get the Last Successful DBCC CHECKDB on a Database

By

Database Property LastGoodCheckDbTime to Get the Last Successful DBCC CHECKDB on a Database As one...

Dynamic Warehouse & Lakehouse Connections in Microsoft Fabric Data Pipelines

By

When you develop data pipelines in Microsoft Fabric (the Azure Data Factory equivalent in...

Read the latest Blogs

Forums

Baseball Everywhere

By Ryan Booz

Comments posted to this topic are about the item Baseball Everywhere

How to run custom python module on SQL Server?

By yyang5823

I am working on a small test script on SQL server 2022 using python...

Upgrade to SQL2019 from 2012 Query is taking time, Need Query Optimization steps

By ralahari

Upgrade to SQL2019 from 2012 Query is taking time, Need Query Optimization steps and...

Visit the forum

Question of the Day

Sensitivity Ranks

I want to use the ADD SENSITIVITY CLASSIFICATION DDL to mark some columns in my SQL Server 2022 database as PII. Can I use this code?

ADD SENSITIVITY CLASSIFICATION TO dbo.sales.price,
    dbo.sales.discount
WITH (
    LABEL = 'Highly Confidential',
    INFORMATION_TYPE = 'Financial',
    RANK = 'INTERNAL ONLY'
);

See possible answers