Friday, March 9, 2012
Hardware Failure, Help w/recover of the msdb database
with the exception of Master, Model, and MSDB. I was able to recover the
msdbdata.mdf and msdblog.ldf from the hard drive the crashed.
Is it possible to recover the DTS packages from these files? or am I hosed?
Any help would be greatly appreciated.
Thanks
Kevin
You should be able to attach the old MSDB back to the server.
http://www.databasejournal.com/featu...le.php/3379901
http://www.support.microsoft.com/?id=224071
Andrew J. Kelly SQL MVP
"Kevin" <Kevin@.discussions.microsoft.com> wrote in message
news:0C69CE35-574E-49D5-810E-06854EE51460@.microsoft.com...
> We lost the hard drive on a dev server. All the databases where backed up
> with the exception of Master, Model, and MSDB. I was able to recover the
> msdbdata.mdf and msdblog.ldf from the hard drive the crashed.
> Is it possible to recover the DTS packages from these files? or am I
> hosed?
> Any help would be greatly appreciated.
> Thanks
> Kevin
Hardware Failure, Help w/recover of the msdb database
with the exception of Master, Model, and MSDB. I was able to recover the
msdbdata.mdf and msdblog.ldf from the hard drive the crashed.
Is it possible to recover the DTS packages from these files? or am I hosed?
Any help would be greatly appreciated.
Thanks
KevinYou should be able to attach the old MSDB back to the server.
http://www.databasejournal.com/features/mssql/article.php/3379901
http://www.support.microsoft.com/?id=224071
--
Andrew J. Kelly SQL MVP
"Kevin" <Kevin@.discussions.microsoft.com> wrote in message
news:0C69CE35-574E-49D5-810E-06854EE51460@.microsoft.com...
> We lost the hard drive on a dev server. All the databases where backed up
> with the exception of Master, Model, and MSDB. I was able to recover the
> msdbdata.mdf and msdblog.ldf from the hard drive the crashed.
> Is it possible to recover the DTS packages from these files? or am I
> hosed?
> Any help would be greatly appreciated.
> Thanks
> Kevin
Hardware Failure, Help w/recover of the msdb database
with the exception of Master, Model, and MSDB. I was able to recover the
msdbdata.mdf and msdblog.ldf from the hard drive the crashed.
Is it possible to recover the DTS packages from these files? or am I hosed?
Any help would be greatly appreciated.
Thanks
KevinYou should be able to attach the old MSDB back to the server.
http://www.databasejournal.com/feat...cle.php/3379901
http://www.support.microsoft.com/?id=224071
Andrew J. Kelly SQL MVP
"Kevin" <Kevin@.discussions.microsoft.com> wrote in message
news:0C69CE35-574E-49D5-810E-06854EE51460@.microsoft.com...
> We lost the hard drive on a dev server. All the databases where backed up
> with the exception of Master, Model, and MSDB. I was able to recover the
> msdbdata.mdf and msdblog.ldf from the hard drive the crashed.
> Is it possible to recover the DTS packages from these files? or am I
> hosed?
> Any help would be greatly appreciated.
> Thanks
> Kevin
Monday, February 27, 2012
Handling SQL Exception
I'm unsure how to handle an SQL Exception correctly when the database is unavailable/offline.
I have my aspx file with the C# code-behind, but all of the SQL stuff is done in a separate code file in the App_Code directory.
E.g.
CODE-BEHIND
DatabaseModifier.deleteUser(username);
DATABASEMODIFIER.cs
public static void deleteUser(string username)
{
SqlConnection conn = SqlLogin.SqlConnect;
SqlCommand command = new SqlCommand("DELETE FROM <table> WHERE Username = '" + username + "'", conn);
conn.Open()
command.ExecuteNonQuery();
conn.Close()
}
Now, that code works perfectly, however if the database I'm connecting to is offline, an SQLException is thrown and because the SQL is handled in my DatabaseModifier class, I'm not sure how to handle it correctly.
If I use a Try/Catch block in my code-behind, it doesn't get thrown because the error occurs in my DatabaseModifier class. If I use a Try/Catch block in my DatabaseModifier class, what can I put in the catch block that will inform the user of the database being offline and/or how can I perform a url redirection?
Any help is greatly appreciated.
You can write the connection open code in the database modifier class with try-catch block, and in the catch block you can just throw the exception being written. Again the the page code behind you can write the database activity in a try-catch block, and here in this catch you'll receive any exception which may be generated in the database modifier class. As the code in the database modifier class does nothing but to throw the exception, you can handle them in the page code.
Hope this will help.
|||So in the DatabaseModifier class:
Try
{
code
}
Catch(SqlException)
{
//nothing in here
}
In code behind:
Try
{
code
}
Catch(SqlException e)
{
//output e.Message to user?
}
Something like that:
In database modifier:Try{ code}Catch(SqlException exp){throw exp;}In code behind:Try{ code}Catch(SqlException e){//output e.Message to user?}
Now, you can see that the db modifier just throws any exceptions which it receives during any operation (this is fair also because you don't have any user out put system set in the db modifier class), and the page code is set up to handle the exceptions thrown by the db modifier as well as any other exceptions during the code execution of its own.
Hope this will help
Friday, February 24, 2012
Handling a SQL Exceptions and Custom Error Messages
Hello guys,
I need some ideas on how to handle an exception or a user defined error message.
I have a procedure that creates a new user. Lets say if the e-mail address entered is already in use. What are some of the best practices for notifying the user that the e-mail address is already in use?
This is what I was thinking...
Solution #1
-----
My proc will raise an error with a message id that is great than 50000, then my DAL will recognize this is a user defined error and spit back to the user instead of trapping it.
Solution #2
-----
The proc should have an output param ( @.CreationStatus CHAR(1) ).
If the @.CreationStatus has a value for example "E", I will have lookup the value for "E" in my app and spit back that custom error message. I don't really like this option because it is too concrete.
What are some of the ways you deal with this situation?
Your suggestions are greatly appreciated.
Thank you!
You could return a @.status value with (0=success, 1= failure and an appropriate status message @.Statusmsg ( = 'Success' if @.status = 0, custom error message if @.status = 1)
From your application you could check the value in @.status and if its not 0, then display the message from @.statusmsg. You can handle this in a number of ways, It comes down to setting up one standard way of doing it across all procs and communicating with your team and documenting it so the same logic is followed across all procs.