Archive for the ‘SQL Server’ Category

Script all the jobs in SQL Server

Май 22nd, 2012
This is very interesting fact that people always look for shortcuts especially while accomplishing the big tasks.

Here i have came up with a scenario: I have got a task to setup a new server B (lets assume) exactly as a replica of Existing Server A.

It involve a lot of steps in which there is a step to copy all the EXISTING JOBS FROM SERVER A to SERVER B (Please note i have written All the Jobs).

 Here is a easiest way i have found which might be helpful for many people.

Step1: Enable Object explorer detail.

Step2:
In SQL Server 2005 or earlier:  goto view->Summary
In SQL Server 2008 or older:  goto view-> Object Explorer Details

Step3:
Expand SQL Server Agent and click on Jobs.

All the jobs will be visible in summary/Object Explorer Detail window. (See Screenshot).





Step4:

Here you can select all the jobs or the desired jobs which you want to script out.

After select right click -> Script Job As -> Create To -> and select the desired location where you want to script all the selected jobs (In the screenshot i have selected New Query Editor Window).




Note: The above screenshots/Examples are of SQL Server 2008R2 you can follow the same steps with SQL Server 2005 or earlier versions.


I hope this will be helpful for may people out there :)





PlanetMySQL Voting: Vote UP / Vote DOWN

Database is in Transition. try the statement later: SQL Server

Май 18th, 2012
Problem:

I was trying to take the database offline to perform some maintenance on one of our QA server.

We have got a strange error "Database is in Transition. try the statement later Error 952"

Even i was not able to run the sp_who and sp_who2 also as it was also giving the same error.


Resolution:  What i have tried?

I closed the SSMS (SQL Server Management Studio) and restarted it again.

Then to confirm and check for any blocking query, i ran sp_who and sp_who2 and it ran successfully.

 Then to make Database offline/online i have used the below command and it worked like a charm :)

USE master
GO

ALTER DATABASE <db_name>

SET OFFLINE WITH ROLLBACK IMMEDIATE
...
...
ALTER DATABASE <db_name> SET ONLINE


Its a strange error with SQL-2005 Management Studio or we can say a bug.


This small issue can cause a big headache for someone.. hope this will helpful. :)



PlanetMySQL Voting: Vote UP / Vote DOWN

Log Buffer #272, A Carnival of the Vanities for DBAs

Май 18th, 2012
It is evident and beyond doubt now that the new media technologies like Twitter and Facebook are not going to wipe-out the blogs, rather they are complimenting each other very nicely and it seems they were made for each other. This Log Buffer Edition enhances this match, and presents you Log Buffer #272. Oracle: It [...]
PlanetMySQL Voting: Vote UP / Vote DOWN

Log Buffer #272, A Carnival of the Vanities for DBAs

Май 18th, 2012
It is evident and beyond doubt now that the new media technologies like Twitter and Facebook are not going to wipe-out the blogs, rather they are complimenting each other very nicely and it seems they were made for each other. This Log Buffer Edition enhances this match, and presents you Log Buffer #272. Oracle: It [...]
PlanetMySQL Voting: Vote UP / Vote DOWN

Log Buffer #271, A Carnival of the Vanities for DBAs

Май 11th, 2012
They say, “April showers bring May flowers.”  They basically say that nature brings different things in different colors aimed at improving the things. That is so true for the blogging world too. This Log Buffer Edition also brings out different blog posts to improve things, so enjoy the Log Buffer #271. Oracle: One of world’s [...]
PlanetMySQL Voting: Vote UP / Vote DOWN

Log Buffer #271, A Carnival of the Vanities for DBAs

Май 11th, 2012
They say, “April showers bring May flowers.”  They basically say that nature brings different things in different colors aimed at improving the things. That is so true for the blogging world too. This Log Buffer Edition also brings out different blog posts to improve things, so enjoy the Log Buffer #271. Oracle: One of world’s [...]
PlanetMySQL Voting: Vote UP / Vote DOWN

Hardware Components Failures — Survey Results

Май 10th, 2012
When preparing for the the IOUG Collaborate 12 deep dive on deploying Oracle Databases for high Availability, I wanted to provide some feedback on what hardware components are failing most frequently and which ones are less frequently. I believe I have reasonably good idea about that but I thought that providing some more objective data [...]
PlanetMySQL Voting: Vote UP / Vote DOWN

Hardware Components Failures — Survey Results

Май 10th, 2012
When preparing for the the IOUG Collaborate 12 deep dive on deploying Oracle Databases for high Availability, I wanted to provide some feedback on what hardware components are failing most frequently and which ones are less frequently. I believe I have reasonably good idea about that but I thought that providing some more objective data [...]
PlanetMySQL Voting: Vote UP / Vote DOWN

Log Buffer #270, A Carnival of the Vanities for DBAs

Май 4th, 2012
As the summer in many parts of the world starts, not only the snow is thawing, many bloggers are also coming out of hiatus and the database blogosphere is seeing new sensational activity. This Log Buffer Edition includes blogging tidbits from Oracle, SQL Server and MySQL. Enjoy reading Log Buffer #270. Oracle: Oracle’s Timeline, Copious [...]
PlanetMySQL Voting: Vote UP / Vote DOWN

Log Buffer #269, A Carnival of the Vanities for DBAs

Апрель 27th, 2012
There is no replacement for the documentation of the database products. There is no alternative of forums for these technologies, and also there is no alter ego for the database blogs. They add up yet another avenue to explore when the professionals need help. This Log Buffer Edition helps professional in identifying few blog posts [...]
PlanetMySQL Voting: Vote UP / Vote DOWN