Jul 26, 2019

SQL Server Shrink

Problem 

  • SQL Server disk usage is very high. 
  • SQL Server Management Studio is very slow.

Investigation

Windows Event log:
  • Starting Up Database
  • Could Not Allocate Space for Object Name in Database ‘DB’ Because the ‘PRIMARY’ Filegroup is Full
  • CREATE DATABASE or ALTER DATABASE failed because the resulting cumulative database size would exceed your licensed limit of 10240 MB per database.

Check

Size of database files (data and log) may be at maximum limit.

Size Limitation Database Size for Microsoft SQL Server versions
  • Microsoft SQL Server 2000 Desktop - 2 GB
  • Microsoft SQL Server 2005 Express edition has a database size limit to 4GB
  • Microsoft SQL Server 2008 Express edition has a database size limit to 4GB
  • Microsoft SQL Server 2008 R2 Express edition has a database size limit to 10GB
  • Microsoft SQL Server 2012 Express edition has a database size limit to 10GB
  • Microsoft SQL Server 2014 Express edition has a database size limit to 10GB
  • Microsoft SQL Server 2016 Express edition has a database size limit to 10GB

Solution

Shrink data file and log file.

Initial sizes:

  1. Connect SQL Server via SQL Management Studio.

  2. Find database in left pane, right click and select Tasks > Shrink > Files.


  3. Select "Log" under "File type" list. Select "Reorganize pages...". You can enter minimum MB in text box as shown next to it. I entered 1 and completed shrink.


  4. Now you may also want to shrink data file. Repeat 2nd and 3rd steps for "File type: Data".
  5. I entered 1000 and completed shrink.

File sizes after shrink:


Jul 23, 2019

Nvidia GPU driver errors

After Windows10 update Nvidia GPU driver corrupted. You can find driver downloads in Nvidia website (http://www.nvidia.com/Download/index.aspx)

Setup may not continue for some reasons. 2 errors described below.

Error1: Windows cannot verify the digital signature for this file

Disable enforced driver signing Run command line and type
shutdown /f /t 0 /r
Press "F8" and continue.
Click ‘Troubleshoot’.
Click ‘Advanced Options
Click ‘Windows Startup Settings
Click Restart.

After restart select ‘Disable driver signature enforcement‘ from the list by hitting F7. Then continue to install driver after Win10 booted.

Note: The shutdown command does not work in a RDP/Termial Session, otherwise error “The parameter is incorrect.(87)” occurs.

Error2: The graphic driver could not find compatible graphics hardware || Nvidia installer not compatible with this version of windows

Exit setup.

Go to Device Manager > Display Adapters > Select device from tree > Right click and select Properties
Go to Device tab > Select Hardware Ids from Property list
Copy first line (PCI\VEN_10DE&DEV_1BE0&SUBSYS_75071558&REV_A1) and quit

Go to Display.Driver folder which extracted from driver setup.

Open nvami.inf

Find NVIDIA Devices line: [NVIDIA_Devices.NTamd64.10.0...14310]

You will see many lines like below:
%NVIDIA_DEV.0DCE.204C.1043% = Section002, PCI\VEN_10DE&DEV_0DCE&SUBSYS_204C1043

Copy first line until PCI word: %NVIDIA_DEV.0DCE.204C.1043% = Section002,

Paste it to new line above copied line (under NVUDUA_Devices line) and then past hardwareId copied from Device Manager

%NVIDIA_DEV.0DCE.204C.1043% = Section002, PCI\VEN_10DE&DEV_1BE0&SUBSYS_75071558&REV_A1

Do same thing for the line [NVIDIA_Devices.NTamd64.10.0]

You will paste 2 newlines in total to nvami.inf file.

Save inf file to original location and run setup again.

Update

As of 23rd July something changed on Windows 10 and Nvidia setup. Check updates below.
1. If you can't reach Advanced Startup menu then lock your computer. While pressing shift key press power icon on screen and select Restart.

2. Changing inf file may not work on latest driver package. You may get following error:
Package install status code: Exception {0x800f024b - The hash for the file is not present in the specified catalog file. The file is likely corrupt or the victim of tampering.}.
3. Update Windows 10 to the latest version.
Check your version by typing winver to Windows search box to see version. Your version may be older than driver supports.

Install driver from inf file.

Press "Let me pick from a list..." option.
 Find your device in list.

Press "Have Disk" button and find inf file.