Showing posts with label situation. Show all posts
Showing posts with label situation. Show all posts

Thursday, March 29, 2012

Database In Recovery

What does it actually mean when the database is in recovery? My database has been in recovery overnight. What is normally going on in this situation. Should I wait or take more drastic action?

when your database is marked as recovering it is rolling forward all the committed transations and rolling back the uncommitted transactions......consider this scenario,when you do some bulk insert operations for many hrs and if you want to kill the process it will be roll backing state for hrs.....and if you abruptly restart the sql services it wud be in marked as recovering state and will come to normal if it fully recovers.....which is nothing but rolling forward and roll back operations

guys, pls correct me if am wrong !!!

|||

Is the state reported RESTORING or RECOVERING? They have different meanings and actions.

Thanks,

|||

Based on below I am saying Recovering.

|||

I'm guessing that you tried to paste a screenshot?

Can you tell me:

What version (and SP) of SQL you're running

Where you are looking to find the state

exactly what it says

What happened to the database leading up to this state (i.e. did the server crash and restart, did you restore the database? if so, what command did you use?

One common mistake is to use RESTORE WITH NORECOVERY on the last restore, which will leave the database in a RESTORING state until you run RESTORE WITH RECOVERY on it.

|||

In SQL Server Management Studio when I expand my databases folder it says (In Recovery) in parenthesis next to database name. This apparently was caused as a result of a server crash and restart due to device driver problem. I have tried to run RESTORE WITH RECOVERY, but that or anything else I try with the database tells me I can't do anything until recovery is complete.

|||

I left off version info from previous reply.

Microsoft SQL Server Management Studio 9.00.1399.00
Microsoft Analysis Services Client Tools 2005.090.1399.00
Microsoft Data Access Components (MDAC) 2000.085.1117.00 (xpsp_sp2_rtm.040803-2158)
Microsoft MSXML 2.6 3.0 4.0 5.0 6.0
Microsoft Internet Explorer 7.0.5730.11
Microsoft .NET Framework 2.0.50727.832
Operating System 5.1.2600|||I actually have three databases that have been (In Recovery). Two of the databases were my Report Services "ReportServer" and "ReportServerTempDB". My other database has finished, but I have not checked out yet. The "ReportServer" database now says (Suspect) and my "ReportServerTempDB" still says (In Recovery).

|||

refer, http://deepakinsql.blogspot.com/2007/08/how-to-recover-from-suspect-database.html to bring the suspect database back to normalcy.......if the db is marked you cannot use the db.......check if there is sufficient disk space for the log file to grow and ensure that the data and log files are not accessed by any antivirus process etc.....those might be the reason for the db marked as suspect..........

|||

Actually, it sounds like your databases are recovering and coming online.

What we need to look at is why it is taking so long.

Are there hardware errors being reported which could be slowing things down?

Were there long-running transactions which would take a long time to roll back?

Database In Recovery

What does it actually mean when the database is in recovery? My database has been in recovery overnight. What is normally going on in this situation. Should I wait or take more drastic action?

when your database is marked as recovering it is rolling forward all the committed transations and rolling back the uncommitted transactions......consider this scenario,when you do some bulk insert operations for many hrs and if you want to kill the process it will be roll backing state for hrs.....and if you abruptly restart the sql services it wud be in marked as recovering state and will come to normal if it fully recovers.....which is nothing but rolling forward and roll back operations

guys, pls correct me if am wrong !!!

|||

Is the state reported RESTORING or RECOVERING? They have different meanings and actions.

Thanks,

|||

Based on below I am saying Recovering.

|||

I'm guessing that you tried to paste a screenshot?

Can you tell me:

What version (and SP) of SQL you're running

Where you are looking to find the state

exactly what it says

What happened to the database leading up to this state (i.e. did the server crash and restart, did you restore the database? if so, what command did you use?

One common mistake is to use RESTORE WITH NORECOVERY on the last restore, which will leave the database in a RESTORING state until you run RESTORE WITH RECOVERY on it.

|||

In SQL Server Management Studio when I expand my databases folder it says (In Recovery) in parenthesis next to database name. This apparently was caused as a result of a server crash and restart due to device driver problem. I have tried to run RESTORE WITH RECOVERY, but that or anything else I try with the database tells me I can't do anything until recovery is complete.

|||

I left off version info from previous reply.

Microsoft SQL Server Management Studio 9.00.1399.00
Microsoft Analysis Services Client Tools 2005.090.1399.00
Microsoft Data Access Components (MDAC) 2000.085.1117.00 (xpsp_sp2_rtm.040803-2158)
Microsoft MSXML 2.6 3.0 4.0 5.0 6.0
Microsoft Internet Explorer 7.0.5730.11
Microsoft .NET Framework 2.0.50727.832
Operating System 5.1.2600|||I actually have three databases that have been (In Recovery). Two of the databases were my Report Services "ReportServer" and "ReportServerTempDB". My other database has finished, but I have not checked out yet. The "ReportServer" database now says (Suspect) and my "ReportServerTempDB" still says (In Recovery).|||

refer, http://deepakinsql.blogspot.com/2007/08/how-to-recover-from-suspect-database.html to bring the suspect database back to normalcy.......if the db is marked you cannot use the db.......check if there is sufficient disk space for the log file to grow and ensure that the data and log files are not accessed by any antivirus process etc.....those might be the reason for the db marked as suspect..........

|||

Actually, it sounds like your databases are recovering and coming online.

What we need to look at is why it is taking so long.

Are there hardware errors being reported which could be slowing things down?

Were there long-running transactions which would take a long time to roll back?

sql

Wednesday, March 7, 2012

Database design question...

I have a situation that some of you may be of help. I will name the tables
specifically so you can understand what I am talking about.

I have a COS_species table...the information in it cannot be changed.

Everything in this database is pretty much centered around the speciesID. We
also want other species that are no included in the COS_Species table.
Specifically...we want to be able to handle multi species which would
contain many of the species from COS_Species.

So...I would create a new table called Multi_Species and then a linking
table MultiSpeciesLink to link the 2 tables together.

The problem is...since everything is supposed to be centered around the
SpeciesID, how do I manage that since a speciesID can come from 2 different
tables?

Thanks for any input.Member wrote:

>I have a situation that some of you may be of help. I will name the tables
>specifically so you can understand what I am talking about.
>I have a COS_species table...the information in it cannot be changed.
>Everything in this database is pretty much centered around the speciesID. We
>also want other species that are no included in the COS_Species table.
>Specifically...we want to be able to handle multi species which would
>contain many of the species from COS_Species.
>So...I would create a new table called Multi_Species and then a linking
>table MultiSpeciesLink to link the 2 tables together.
>The problem is...since everything is supposed to be centered around the
>SpeciesID, how do I manage that since a speciesID can come from 2 different
>tables?
>Thanks for any input.
>
You have a major design problem. That the speciesID can come from two
different tables is the problem
that must be solved first. No doubt Joe Celko can quote you chapter and
verse on this one so before he
does you might want to check some of his numerous posts on what a table
is and make the appropriate
change.

What you describe will turn into a reporting nightmare if it is not
quickly remedied.

--
Daniel Morgan
http://www.outreach.washington.edu/...oad/oad_crs.asp
http://www.outreach.washington.edu/...aoa/aoa_crs.asp
damorgan@.x.washington.edu
(replace 'x' with a 'u' to reply)

Friday, February 24, 2012

database design issue

Here's a situation I'm trying to replicate in a database. A CASE can be tied to multiple EVENTS and an EVENT can have multiple CONTACTS. Each CASE or a CONTACT can have a SURVEY.
I am unable to figure a way to accomplish the last task.

Any help is greatly appreciated!
-Jay

Note: Words in capitals represent tables.Create a table of surveys and include the primary key as a foreign key in the CASE and CONTACTS tables.
Not sure what is so difficult about this...|||Not sure what is so difficult about this...Losing a table made it easier I guess :)|||Thank you Blindman...I guess i was thinking out loud :D|||Glad to help. Welcome to the forums.

Sunday, February 19, 2012

Database design

I have to design choices
Here's the situation (OLTP):
I have a WorkOrder table that could contain millions of record and a
WorkOrderId primary key. The record is inserted and then updated once
by a technician. The workorder is created when the user access a web
page and then updated when the user save the work order. The work
order is almost never canceled after it's creation.
The choices
1) I do all my processing directly in the table.
2) I have a temp table which is commited to the real table when the
technician saves the work orders.
What do you think? Are all these OLTP order systems working with temp
tables. Is there some things I should consier like having no indexes
on a temp table so insert is faster and response time is better. I
have a low number of user and not many concurrent requests but a lot of
data can accumulate over time.
Thanks for your time.
ObIt may not be as complicated as you apparently think. Just present the Web
page to the user - collect all then info there and then when the user goes
to save it, do an insert and you're done.
But have I missed something?
You talk about "all my processing directly in the table" or "do all my
processing..."
What processing is that? I couldn't imagine what it could possibly be that
would require any database involvement (temp table or otherwise) prior to
the user saving the new work order.
We could provide you with more specific guidance if you tell us what all
this processing is that you refer to that is apparently required on creation
of new work orders.
-HTH
"oberyn" <oberyn1martell@.yahoo.com> wrote in message
news:1141966631.129590.181350@.p10g2000cwp.googlegroups.com...
>I have to design choices
> Here's the situation (OLTP):
> I have a WorkOrder table that could contain millions of record and a
> WorkOrderId primary key. The record is inserted and then updated once
> by a technician. The workorder is created when the user access a web
> page and then updated when the user save the work order. The work
> order is almost never canceled after it's creation.
> The choices
> 1) I do all my processing directly in the table.
> 2) I have a temp table which is commited to the real table when the
> technician saves the work orders.
> What do you think? Are all these OLTP order systems working with temp
> tables. Is there some things I should consier like having no indexes
> on a temp table so insert is faster and response time is better. I
> have a low number of user and not many concurrent requests but a lot of
> data can accumulate over time.
> Thanks for your time.
> Ob
>|||ok I tried to simplify my situation to much. What I have is a work
order that can be modified multiple times before saving. Right now we
have a flag that represents the state of the work order each time it is
modified. And the same flag is set to completed when the work order is
saved. This state managing could all be done in an object and commited
to the database when the user saves the work order but we decided to
put it in the database to persist the state for up to 1 day because we
don't to want to have many pending asp.net sessions persisted (sql
server session state) all day and the technician has to be able to
resume the work order at any time during the day.
Should I have some sort of Cart table to hold the work orders and
commit them to the WorkOrder table when the flag is set to completed or
inserting and updating the main table (work order) with millions of
record is ok.?
Jordan wrote:
> It may not be as complicated as you apparently think. Just present the Web
> page to the user - collect all then info there and then when the user goes
> to save it, do an insert and you're done.
> But have I missed something?
> You talk about "all my processing directly in the table" or "do all my
> processing..."
> What processing is that? I couldn't imagine what it could possibly be that
> would require any database involvement (temp table or otherwise) prior to
> the user saving the new work order.
> We could provide you with more specific guidance if you tell us what all
> this processing is that you refer to that is apparently required on creati
on
> of new work orders.
> -HTH
>
>
> "oberyn" <oberyn1martell@.yahoo.com> wrote in message
> news:1141966631.129590.181350@.p10g2000cwp.googlegroups.com...|||Instead of a flag in your main table, why don't you have a
WorkOrderStatus table? Minimize UPDATEs, and simply INSERT new rows to
the Status table; when you want to find out what status a WorkOrder
has, join it to the Status table and retrieve the most recent status?
Stu|||Okay, then given this additional information I would go with the
recommendation earlier by Stu. His recommendation makes a lot of sense
because each of your "work order" thingies can each exist in multiple states
over time. Each of those states goes into a "Status" table which gives you
the benefit of knowing a date/time (if you record that, of course) of each
status change. A status "flag" column in your WorkOrder table would not
permit you to record or know the history of the order. Plus, from a data
modeling point of view an [order] is just an [order] regardless of its
current status ([current status] is just an attribute). Modeling an
[incomplete order] as a separate entity from a [completed order] would
likely be a misconceptualization of the data.
Finally and alternatively, you could persist the state data in a cookie (and
set it to expire after 24 hours) on the client and only store completed
orders in the database. But if you do this then you lose out on the status
history info and have a more fragile system to support (e.g., users with
cookies disabled, switching from one computer to another thoughout the day,
etc).
-HTH
"oberyn" <oberyn1martell@.yahoo.com> wrote in message
news:1141998248.065606.52840@.z34g2000cwc.googlegroups.com...
> ok I tried to simplify my situation to much. What I have is a work
> order that can be modified multiple times before saving. Right now we
> have a flag that represents the state of the work order each time it is
> modified. And the same flag is set to completed when the work order is
> saved. This state managing could all be done in an object and commited
> to the database when the user saves the work order but we decided to
> put it in the database to persist the state for up to 1 day because we
> don't to want to have many pending asp.net sessions persisted (sql
> server session state) all day and the technician has to be able to
> resume the work order at any time during the day.
> Should I have some sort of Cart table to hold the work orders and
> commit them to the WorkOrder table when the flag is set to completed or
> inserting and updating the main table (work order) with millions of
> record is ok.?
>
> Jordan wrote:
>|||I disagree. Finding the "latest status" for a workitem would require
either a "group by" or some flag to indicate which row is the latest
which frequently causes problems and requires an insert to also do an
update.
As I see it, a WorkItem only has 2 status 'Complete' and 'In Process'
and therefore will work fine with just the status on the main table.
If properly indexed, SQL server will have no problem updating 1 row out
of millions. If however, the status implies some sort of workflow then
storing each status, as well as other relative audit data historically
may have some value.
You should never rely on storing state in anything other than the
database because servers and computers can be rebooted and any objects
lost, cache cleared etc...|||Differences of opinion, I guess. As I get more experience with
database design, I've come to realize that the only constant thing in
design that you can truly rely on is that the user's specifications
will change the day after you roll something out :) I try to store as
much information as I can, and a bit flag doesn't tell me how long
something has been in that status, nor does it give me any sense of
direction (e.g., how do you handle "re-opened" tickets?). In other
words, even if the user doesn't mention workflow, I try to design
around that.
It has been my experience, though, that INSERTS are a lot less
expensive than UPDATE's, regardless of your indexes. I'd be
interested in understanding what problems you've had when dealing with
GROUP BY, and finding the latest row; it might influence some of the
decisions I'm making on a new project.
Stu|||RE:
<<Finding the "latest status" for a workitem would require either a "group
by" or some flag to indicate which row is the latest>>
Not true at all. If a date column in the Status table defualt value
automatically inserted when the status row is inserted (representing the
date/time the row was inserted), then it is real easy to get the latest
status without any GROUP BY clause - e.g., SELECT TOP N ... ORDER BY
date_column DESC.
RE:
<<a WorkItem only has 2 status 'Complete' and 'In Process'>>
You have no way to know that - and even if it were true today the
requirements could change tomorrow. What if there were 5 steps towards
completion - each of significance to the business. You would of course argue
that an int column could store a flag to indicate which of the 5 steps the
work order is at. The problem there is that you fail to record the
historical information about when the status changed, the employee who
changed the status, etc. Your little flag column really misses a lot of
potentially valuable information.
RE:
<< You should never rely on... >>
You should never say never. Really. If you are correct, then why are there
so many options for storing or managing state (database, View_State,
Application, Session, cookies, client-side objects persisted to file on the
client via XML (easily facilitated in .NET). There's a lot more to life (and
state) than databases.
-J
"JeffB" <jeff.bolton@.citigatehudson.com> wrote in message
news:1142017670.700641.290070@.i39g2000cwa.googlegroups.com...
>I disagree. Finding the "latest status" for a workitem would require
> either a "group by" or some flag to indicate which row is the latest
> which frequently causes problems and requires an insert to also do an
> update.
> As I see it, a WorkItem only has 2 status 'Complete' and 'In Process'
> and therefore will work fine with just the status on the main table.
> If properly indexed, SQL server will have no problem updating 1 row out
> of millions. If however, the status implies some sort of workflow then
> storing each status, as well as other relative audit data historically
> may have some value.
> You should never rely on storing state in anything other than the
> database because servers and computers can be rebooted and any objects
> lost, cache cleared etc...
>|||Ok the issue is a lot clearer for me now. Thank you all for your
answers.