Tag: Database
-
Recover a database with a DAMAGED and/or LOST log file
In this procedure we’ll manage one of the worst situation a DBA has to manage: corrupted files and data loss. When this heppen usually the common way is restoring but we’ll use sql server features to reduce stop time (avoiding a complete restore) and data loss. Possible starting problems: Corrupted logfile Corrupted logfile during a…
-
How to script logins with the original password HASH and original SID
A quick tip useful to avoid problems during migrations. This query allow to script instance users with orginal SID and password HASH. This can be very useful to transfer logins to a new or different instance. All informations come from master database catalog. You have to be member of sysadmin role to run correctly this…
-
Massive SQL Server Database Moving Using Detach – Attach: The Complete Procedure
This is a complete configurable metascript, prepared to create detach statements, file move statement and re-attach statements for every database in your instance. You have only to configure the final destination for datafiles and the database list you want to migrate. The final generated script for every database selected will be something like this (remembar…
-
How to make your databases smaller and faster: find unused indexes
It’s a boring job but sometimes a good DBA has to do it. Applications change and you have to understand what become unuseful in your databases: we are talking about unused indexes. In any SQL server database indexes take up a lot of space and have to be updated every time an application runs an…
-
Analyze SQL Server database historical growth: MONTLY size changes
The most simple way to analyze database historical growth is quering database backup catalog. SQL Server catalog stores informations about every single database backup in msdb..backupset. If you don’t have other instruments to collect historical database size this is a good point to start for a capacity planning This time we take the max size…
-
Analyze SQL Server database historical growth: DAILY size changes
The most simple way to analyze database historical growth is quering database backup catalog. SQL Server catalog stores informations about every single database backup in msdb..backupset. If you don’t have other instruments to collect historical database size this is a good point to start for a capacity planning. Remembar only this: – msdb..backupset stores historical…