Transact-SQL Restore Latest Backup File

Here the very basic steps to restore latest SQL backup file on the backup media location using the below Transact-SQL statement (T-SQL Statement).

  1. Open SQL management studio and make sure the SQL Server Agent is running.  If its not go to windows services.msc and start SQLSERVERAGENT service or use “net start SQLSERVERAGENT” cmd.
    Screenshot 2016-02-25 13.04.20
  2. Expand the Management from object explorer section and right click Maintenance Plans  to create create new maintenance plan.
  3. Drag and drop the Execute T-SQL Statement Task tool from Toolbox windows to design panel.
    Screenshot 2016-02-25 12.52.41
  4. Right click the task to put the below T-SQL statement on it
    Screenshot 2016-02-25 12.52.22
  5. Save the task and run from Jobs under SQL Server Agent
    Screenshot 2016-02-25 12.53.52
    Screenshot 2016-02-25 12.54.03
  6. Make sure the job successfully completed and check the database updates.



Analyse MS-SQL Database Memory Utilization

In most of the development environment or staging server will not be monitored by daily. So the database auto growth can occupy countlessly. Here, we can analyze the memory utilization about the table and we can remove if the database has cache, temp or logs table.