Learn SQL With Bru

Bru Medishetty's SeekWell Blogs

  • Home
  • SQL Server Forum
  • SQL Server Tidbits
    • SQL Tidbits Jun 2010
    • SQL Tidbits May 2010
    • SQL Tidbits Apr 2010
    • SQL Tidbits Mar 2010
    • SQL Tidbits Feb 2010
    • SQL Tidbits Jan 2010
  • SQL Server Interview Questions and Answers
    • SQL Server DBA QandA
    • SQL Server DEV QandA
    • SQL Server BI DEV QandA
  • About Me

SQL Server fails to Start-Troubleshooting the failure

May 19th

Posted by Brumedishetty in SQL Server

No comments

Many times I see people asking in forums about SQL Server not started and how to troubleshoot the reasons for the failure to start the SQL Server.

This video explains the steps to troubleshoot the failures and find the error of a SQL Server startup failure. 

YouTube Preview Image

Comments / feedback will be highly appreciated.

–Bru Medishetty

Error Logs, SQL Server, SQL Server Errors, SQL Startup Problems, Troubleshooting

DB_NAME() System Function in SQL Server

May 17th

Posted by Brumedishetty in SQL Server

No comments

In this blog, let’s take a look at a SQL Server System function, DB_NAME() .

This function is pretty handy when writing scripts that need you to identify the the Database name based on Database ID.

DB_NAME()

DB_NAME() function accepts an optional integer parameter (database_id) and returns the database name of that database_id, if no parameter is mentioned it returns the database name of the current database in whose context the script session is being executed. Let’s look at examples to understand it.

In the following picure, the function DB_NAME() returns the name of the database whose database_id is 1. Since the parameter value is passed on it returns the database name of that database_id, even though the query is running in the database SampleDataBase.

In the next example we look at how this function behaves when the optional parameter is not passed.

 

The result in this query is the database name in which the  query is executed. It returns the database name under whose contect the query is run, when there is a requirement to capture the database name through script, this can be used.

You may also want to take a look at this blog which explains about renaming the Database and the Database objects using T-SQL command. http://learnsqlwithbru.com/2010/03/01/renaming-database-and-database-objects-using-t-sql/

–Bru Medishetty

Functions, Scripts, System Functions, T-SQL

Retrieving data from a Database Snapshots in SQL Server

May 10th

Posted by Brumedishetty in SQL Server

No comments

I wrote a blog earlier, on Database Snapshots which explained about Database Snapshots, steps to create Database Snapshots and some points to remember when working with them. Before continuing reading this blog, I would recommend you read that blog here… Introduction to Database Snapshots in SQL Server

In this blog we shall look at a simple task of restoring data from a Database Snapshots in case if a table is deleted accidentally.

I would recommend you to use the scripts that are available in the earlier blog mentioned above to create the database snapshot and the tables used in this blog. We start this process by dropping a table and assume that, this has happened as an unforeseen event (accidentally dropping a table, in other words, dropping a table instead of dropping an actual one).

Once that table is dropped, our next step is to create the same table and bring in the data from one of the most recent Database Snapshots. In order to do this I am using the SELECT INTO statement as shown below.

To confirm whether or not the table has got the data back, we run the SELECT command on the table we created and populated data, in the previous step.

In this way Database Snapshots can also be used an alternate mechanism of Disaster Recovery for unforeseen events such as accidental dropping, truncating or updating of data.

*** Note: You cannot retrieve entire data from a database snapshot table, since it contains only the data in the table at the point of creation of the database snapshot. Any new data that has been inserted, updated, modified or deleted after the creation of the database snapshot cannot be retrieved.

–Bru Medishetty


Disaster Recovery, snapshots, SQL Server
«12345»1020...Last »
  • Search this Site

  • Site Stats

    859,316 Views (Since Nov 1 2009)

    Stats are not updated real time, they are updated as the server information is updated.

  • Site Visitors

    World wide visitors to this blog since May 14th 2010..

    Locations of visitors to this page

  • My Other Blogs

    • Beyond Relational My blogs @ Beyond Relational
    • Full Throttle My blogs @ SQLServerCentral
    • MSSQLTips My Articles List @ MSSQLTips
    • SQL Server Club My blogs @ SQL Server Club
  • Blogs Archive

    • July 2010
    • June 2010
    • May 2010
    • April 2010
    • March 2010
    • February 2010
    • January 2010
    • December 2009
    • November 2009
    • October 2009
    • September 2009
    • August 2009
  • Tags

    .NET 3.5 2010 Access Administration Articles Backups Certification Charity configurations Deployment Downgrading Dynamic Mangement Views Error Logs General Goals High Availability Installation Linked Server Logging Monitoring MSSQLTips Multiple Instances New Features NULL Performance Tuning Personal Sample Databases Scripts Service Pack snapshots SQL PASS SQL Server SQL Server 2008 SQL Server 2008 R2 SSAS SSIS SSIS Warning Strings System Stored Procedures T-SQL Tips Transaction Logs Troubleshooting Tutorials Upgrade
  • Recent Comments

    • bHASKAR on SQL Server DBA QandA
    • Brumedishetty on Creating Primary Key in a SQL Server table
    • vru_sebe on Creating Primary Key in a SQL Server table
    • Ed Taylor on Choosing how the query result are displayed
    • Steve on Find SQL Agent Job name based on Activity Monitor
Mystique theme by digitalnature | Powered by WordPress
RSS Feeds XHTML 1.1 Top