Thursday, March 14, 2019

How to Find Latest Database restored on Database and which backup file used

SELECT 
   resh.destination_database_name, 
   resh.restore_date, 
   bckst.backup_start_date, 
   bckst.backup_finish_date, 
   bckst.database_name as sourceDBName, 
   bmf.physical_device_name as backupFileUsed,
   bckst.*
FROM msdb..restorehistory resh
INNER JOIN msdb..backupset bckst ON resh.backup_set_id = bckst.backup_set_id
INNER JOIN msdb..backupmediafamily bmf ON bckst.media_set_id = bmf.media_set_id
WHERE resh.destination_database_name = '**Database Name**'
ORDER BY resh.restore_date DESC

Most of time i was asked which database bacup has been restore on particular database, who restore the database, what is machine name, which backup file used, where the backup has been placed.
Donot worry about this sqlserver store all of this information as a metadata so above query is capable of give answers of what/when/where 3W/5W

Execute above query on any of database query window, add filder of database name on which you want to find all these questions. make sure user have the rights of executing query in cross databases.

Wednesday, March 13, 2019

py0016 : ModuleNotFoundError: No module named 'Tkinter'

Traceback (most recent call last):
  File "C:/Users/*****/PycharmProjects/Cal1/_main_.py", line 2, in
    from Tkinter import *
ModuleNotFoundError: No module named 'Tkinter'

While import from tkinter i was getting error as "ModuleNotFoundError: No module named 'Tkinter'". As further investigation i found tkinter is the part of python software that we have installed in actual. So no need to run anyother
pip install command for "tkinter".

i have recheck my code as i written "from Tkinter import *", so the error was here i used "T" capital T instead of "t"

so if you get the error i advise check your spelling before doing anything it should all in lowercase
web stats