CORRUPTION 101

CORRUPTION TOOLKIT: BACKUP & RESTORE - See if the backup is clean once you restore (usually on another server. BCP (Bulk Copy) & DB ATTACH - try to BCP remove the corrupt tables and restore (attach) the remaining database REBUILD/REPAIR databases System database issues (corruption) - rebuild will replace system database then you can replace … Continue reading CORRUPTION 101

How to Install Python 2 with PyCharm (Windows ONLY)

Installing Python 2 is a simple process as compared to the dark ages of Python, the installer will now even set the path variable for you (a whole different topic to discuss). Please click link to download the executable windows Python installer Download and run the installer, select “Install for all users,” and then click “Next.” … Continue reading How to Install Python 2 with PyCharm (Windows ONLY)

50 Frequently Asked SQL Server Interview Questions – Part I

How will you to performance tuning ? https://www.youtube.com/watch?v=P97_oFfD218 What will you look for in an execution plan ? http://www.mssqltips.com/sqlservertutorial/285/query-execution-plans/ What is bookmark look-up related to execution plan http://www.qdpma.com/CBO/s2kCBO_2a.html Table variables vs temp tables http://engineering.picscout.com/2012/04/ sql-temporary-tables-vs-table-variables_17.html How do you pass output parameter in a stored procedure... If you specify the OUTPUT keyword for a parameter in … Continue reading 50 Frequently Asked SQL Server Interview Questions – Part I

Cool Maintenance T-SQL Scripts

How to run an integrity check on all databases DECLARE @SQL VARCHAR(1000) DECLARE @DB sysname DECLARE curDB CURSOR FORWARD_ONLY STATIC FOR SELECT [name] FROM master..sysdatabases WHERE [name] NOT IN ('tempdb') and DATABASEPROPERTYEX(name, 'Status') != 'OFFLINE' ORDER BY [name] OPEN curDB FETCH NEXT FROM curDB INTO @DB WHILE @@FETCH_STATUS = 0 BEGIN SELECT @SQL = 'USE … Continue reading Cool Maintenance T-SQL Scripts

COOL T-SQL BACKUP/RESTORE QUERIES

How to Restore Database from a Shared Network Location --Restore Database from a shared network location --Change N' as needed and database name USE [master] RESTORE DATABASE [Db_Test] FROM DISK = N'\\Server_Name\Folder_Name\db_test.bak' WITH FILE = 1, MOVE N'DB_Test' TO N'F:\SQLData\Folder_Name\db_test.mdf', MOVE N'DB_Test_log' TO N'F:\SQLLogs\Folder_Name\db_test_log.LDF', NOUNLOAD, STATS = 5 GO   How to get Database Restore … Continue reading COOL T-SQL BACKUP/RESTORE QUERIES

How to change SQL Server Instance Collation in an Always On Environment.

SUMMARY You have successfully installed and configured a 2-Node Cluster with Always On which has been deployed into Production. Well you notice later that your 2 SQL Server Standalones participating in your AlwaysOn have different Server Collation. Assuming: Server A: Latin1_General_CI_AS - Case Insensitive Server B: SQL_Latin1_General_CP1_CI_AS ACTION We are instructed as DBA's to get … Continue reading How to change SQL Server Instance Collation in an Always On Environment.