SQL DBA : How to Update Statistics
How to Update StatisticsThere are two ways to update statistics. The first way is the easy way. It is one line of code that will update all the statistics in the database using the default sample size...
View ArticleSQL DBA : Msg 7303, Level 16, State 1, Line 1 oracle linked server error
1- install the Oracle OLEDB,2- create the linked server3- run the openquery at the server (it worked!!)4- run the openquery at a client Management Studio (it failed!!)In our case it failed and returned...
View ArticleSQL DBA : Killing All the Session in a DB
USE MASTERGOIF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_KillDatabaseProcesses]') AND type in (N'P', N'PC'))DROP PROCEDURE [dbo].[sp_KillDatabaseProcesses]GOCREATE...
View ArticleSQL DBA - Finding Last action on a Database using Script
Select the DB and run the Script WITH LastActivity (ObjectID, LastAction)AS( SELECT object_id AS TableName, Last_User_Seek as LastActionFROM sys.dm_db_index_usage_stats uWHERE database_id =...
View ArticleSQL DBA - How to change the SQL Server in Single user mode & How to restore...
1. MASTER database is a different beast from all the other databases. 2. The MASTER database stores the logins and the lists of all of your databases. 3. Without the MASTER database, you can't start...
View ArticleSQL 2005 - How to move System DB in SQL 2005
Moving System Database in SQL Server 20051. Ensure the Destination Drive is having enough space then the Current one.2. For Example :- Current Sys DB path : C:\Program Files\Microsoft SQL...
View ArticleSQL DBA - Delete OLD Backup files Using TSQL - SQL server 2005
Step 1 : USE MASTERGOStep 2 :EXECSP_CONFIGURE'show advanced options',1GOStep 3 :EXECSP_CONFIGURE'XP_CMDSHELL',1GORECONFIGUREGOStep 4: TSQL TO Delete All the Backup FilesDECLARE @DBbackuppath...
View ArticleSQL DBA - Unable to cast COM object of type...
TITLE: Microsoft Visual Studio------------------------------Unable to cast COM object of type 'Microsoft.SqlServer.Dts.Runtime.Wrapper.PackageNeutralClass' to interface type...
View ArticleSQL DBA - Get Complete Information of a SQL Server
SELECTCONVERT(CHAR(100),SERVERPROPERTY('Servername'))ASServer,CONVERT(CHAR(100),SERVERPROPERTY('ProductVersion'))AS ProductVersion,CONVERT(CHAR(100),SERVERPROPERTY('ProductLevel'))AS...
View ArticleSQL DBA - TSQL to get current location of all data and log files of all...
SELECTname, physical_name AS current_file_locationFROMsys.master_files
View ArticleSQL DBA - TSQL to find all TSQL/Commands running on a server at a time?
SELECT sqltext.TEXT,req.session_id,req.status,req.command,req.cpu_time,req.total_elapsed_timeFROMsys.dm_exec_requests reqCROSSAPPLY sys.dm_exec_sql_text(sql_handle)AS sqltext
View ArticleSQL DBA - Msg 8914, Level 16, State 1, Line 1 Incorrect PFS free space...
Errors :- When u Run DBCC CHECKDB you will get a Error like this :- Msg 8914, Level 16, State 1, Line 1Incorrect PFS free space information for page (1:278) in object ID 1047674780, index ID 0,...
View ArticleSQL 2005 - Finding and Listing ALL Procedures, Functions, and Views in SQL...
Below is the most basic coding to find out ALL of the Stored Procedures that exist within SQL Server 2005.USE[your_database_name_here];GOSELECT*FROMsys.all_objectsWHERE([type] ='P'OR [type] ='FN'OR...
View ArticleSQL DBA : SQL 2005 - Move C2 Trace file from one Location to another Location
Move C2 Trace file from one Location to another Location :-Create a Job With the Option of “ActiveX Script” (Select VB Script)dim TracePath ‘Declaring Variable for Assigning the Source pathdim...
View ArticleSQL Server DBA - Send e-mail notification when a database is not online
Checking the databases availability is one of the major task of a DBA which has to be performed at regular intervals to make sure that the critical live databases are always online and fix them...
View ArticleSQL Server DBA - T-SQL Queries to find SQL Server Cluster Nodes and Shared...
T-SQL Queries to find SQL Server Cluster Nodes and Shared Drives Find name of the Node on which SQL Server Instance is Currently running SELECT SERVERPROPERTY('ComputerNamePhysicalNetBIOS') AS...
View ArticleSQL Server DBA - How to uninstall the SQL Server 2008 SP 2
How to uninstall the SQL Server 2008 SP 2?This Feature is in introduced in SQL Server 2008 SP1 and above.Before you do the activity, it is recommended to take a full instance backup just in case to...
View ArticleSQL Server DBA - Msg 2501, Level 16, State 45, Line 1 Cannot find a table or...
Msg 2501, Level 16, State 45, Line 1Cannot find a table or object with the name “TableName”. Check the system catalog.You need to Defragment All the Indexes in the Database.Simple Way To De fragment...
View ArticleArticle 2
Script out all the Objects using Power Shell Script$Filepath='D:\Error'# local directory to save build-scripts to$DataSource='*****'# server name and instance$Database='*****'# the database to copy...
View ArticleHadoop- Bigdata Basics
Hadoop- Bigdata BasicsHadoop consisting of 2 Core concepts. MAP and ReduceHadoop is not good fit for small Data sets and wherever is a need for Transactions (OLTP).Hadoop is good fit for analyzing...
View ArticleHow to Load the Data in Complex Schema using SSIS
Case Study - How to Load the Data in Complex Schema using SSISScenarioFlat file which contains the Employee Information, and each row needs to move or insert multiple table/Schema in Parallel.Schema is...
View ArticleHow do I manually add the SQL Server Agent to the cluster resource group?
I was trying to install SQL Server 2008 R2 on a Windows Server 2008 R2 Failover Cluster, but the setup did not complete successfully. Upon further investigation, the issue seems...
View ArticleMicrosoft® SQL Server® Notes for Professionals
Click Here >> Microsoft® SQL Server® - Notes for Professionals
View ArticleReading and Storing the Text from PDF - Using SQL Server 2017 & R
How to Read Text from PDF - Using SQL Server 2017 & RInsertinto tbl_PDFEXECUTE sp_execute_external_script@language =N'R',@script =N' # load packages (Pdftools is the R package whicn needs to be...
View ArticleMongoDB : Collection and statistics Information
------get all the database collection count at once:---------db.getCollectionNames().map(function(colName){return{"columnName":colName,"count":db.getCollection(colName).count()}});----The following...
View Article