Quantcast
Channel: DBA SCRIPTS – SQL-BOX.COM
Browsing latest articles
Browse All 17 View Live

Image may be NSFW.
Clik here to view.

Configure SQL Server DBMAIL using T-SQL

Configuring dBMail involves 3 main steps Step 1: Creating Mail Profile Step2: Creating Mail Account Step3: Mapping Account to Profile. Below script will let you do this 3 steps and configures your...

View Article



Image may be NSFW.
Clik here to view.

How to bring a database online which is in restoring mode ?

For Example, In log shipping the secondary or a stand-by database will be in restoring mode while applying the logs from primary for every 15 minutes. In order to perform a DR test, we need to bring...

View Article

Image may be NSFW.
Clik here to view.

SQL Server 2012- Sample Databases

I was not able to find the sample databases for SQL server 2012 as most of the sites I have visited have only 2000  sample databases which we will be not able to restore to 2012. Here I have uploaded...

View Article

Image may be NSFW.
Clik here to view.

All about SQL server Statistics in simple words:

What is SQL server Statistics? SQL Server statistics will be used by optimizer to create the optimized execution plans where estimating the number of rows that can be returned, density of pages and...

View Article

Image may be NSFW.
Clik here to view.

Finding top 10 large tables in each database in an instance of SQL server

It is a good practice to find and monitor your large SQL server tables, we may surprise in some cases where our large audit or logging tables that are not being cleaned up frequently and fill into...

View Article


How to run a SQL Query on list of servers and save output to excel using...

You will see  how much is powershell is useful for DBA  after using this script. Step 1: Create a text file with list of servers you want to run the script on and name it ‘serverlist’ to...

View Article

How to list SQL Server Service Accounts using T-Sql?

There might be times for audit to list all the service accounts from all SQL Servers, In order get this done we need a flexible SQL script to run and get them listed. Here is the script

View Article

Database Mirroring Failover- all databases in a instance

--Script to failover all databases in a instance. declare  @mirroring  table (query varchar(200))  insert into  @mirroring  select 'use master;'  insert into  @mirroring  SELECT ' ALTER DATABASE...

View Article


Auto Fix orphan users on all Databases

DECLARE @DB_Name varchar(100)   DECLARE @Command nvarchar(2000)  DECLARE database_cursor CURSOR FOR   SELECT name  FROM  sys.databases where database_id>4  and name not like '%master%'    OPEN...

View Article


How to backup couchbase buckets and upload to S3.

This script can be configured in cron job to scheduled to run hourly and i will create one repo everyContinue reading

View Article
Browsing latest articles
Browse All 17 View Live




Latest Images