SQL Server experts - help
#1
Scooby Regular
Thread Starter
Join Date: Sep 2001
Location: A powerslide near you
Posts: 10,261
Likes: 0
Received 0 Likes
on
0 Posts
SQL Server experts - help
Got sql server 2000 and being crap as it is, I have a problem.
Machine was in the middle of a big udate query (on single table with many millions rows living in large database of 30GB+ in size) and the machine got reset.
Via Enterprise Manager, I can click on the Server + and it lists the servers OK, I click on the server in question OK and then click on the Databases + and it just waits forever (hours) trying to refresh the list of databases I guess (and the large database in question is causing the problem I assume).
This happened the other day and the only way I could get around it was by re-installing SQL server and re-creating the DB from scratch. This is obviously time consuming.
Anyone any thoughts?
Machine was in the middle of a big udate query (on single table with many millions rows living in large database of 30GB+ in size) and the machine got reset.
Via Enterprise Manager, I can click on the Server + and it lists the servers OK, I click on the server in question OK and then click on the Databases + and it just waits forever (hours) trying to refresh the list of databases I guess (and the large database in question is causing the problem I assume).
This happened the other day and the only way I could get around it was by re-installing SQL server and re-creating the DB from scratch. This is obviously time consuming.
Anyone any thoughts?
#2
Scooby Regular
Thread Starter
Join Date: Sep 2001
Location: A powerslide near you
Posts: 10,261
Likes: 0
Received 0 Likes
on
0 Posts
I think I've sorted it.
Basically the mdf/ldf got corrupted when rolling back or sommat.
Got some instruction of t'internet with a load of instuctions on how to attach an MDF without the LDF (obv transaction data will be lost, but in my case it's worthless anyway )
FYI of those that are interested:
shutdown sql services
move the current database file or rename it
restart sql server
create a new database of the same name and log file and location as the
old database and log file
get rid of the old database.
you may be able to right click delete it in this situation or used
sp_removedb
create a new database of the right size and shape with correct log and
data file locations
stop sql
rename the new databases.mdf or delete it if you don't have enough
space - do not touch the .ldf
move back in the old database .mdf file or rename it back again
restart sql server
it should come up suspect
then
1. From a query window, set the status so that you can update the
system
tables by running the following query:
use Master
go
sp_configure "allow", 1
go
reconfigure with override
go
2. Then set the status of the DB that is giving you the problem (XXXXX)
into
Emergency Mode by running the following query:
update sysdatabases set status = 32768 where name = '<DBName>'
go
checkpoint
go
shutdown with nowait
go
3. Go into the data directory (MSSQL7\DATA) and rename the log file
associated
the DB in question (XXXX.ldf) to some
temporary name, such as XXXX.TMP.
4. Exit the query window.
5. Then start up SQL Server from a DOS command window by issuing:
sqlservr -c -T3608 -T4022.
6. Bring up another query window and verify that the DB is in emergency
mode
by issuing:
select Name, Status from Sysdatabases where name = '<DB_Name>'
7. Verify that the status is 32768. If it is, then issue the query:
dbcc traceon(3604)
dbcc rebuild_log ('<DB_Name>','<log_filename>') <--- You will need
the quotation marks
REBUILD_LOG should take less than 5 minutes even on a very large
database. It should complete with the message
DBCC execution completed
8. Take the database out of bypass recovery mode by issuing the command
update sysdatabases set status = 0 where name = '<DBName>'
9. Exit the query window and then shutdown (Ctrl-C in the DOS window)
and
restart SQL server
Roll on Oracle I say. At worst, I'm gonna get my boss to get me some SQLServer DBA training (I'm not a DBA and no plan on being one, but I could have saved myself a lot of time on the back of a few days training in this area. On the other hand, I did manage to find a resolution although the next problem is round the corner I'm sure )
Basically the mdf/ldf got corrupted when rolling back or sommat.
Got some instruction of t'internet with a load of instuctions on how to attach an MDF without the LDF (obv transaction data will be lost, but in my case it's worthless anyway )
FYI of those that are interested:
shutdown sql services
move the current database file or rename it
restart sql server
create a new database of the same name and log file and location as the
old database and log file
get rid of the old database.
you may be able to right click delete it in this situation or used
sp_removedb
create a new database of the right size and shape with correct log and
data file locations
stop sql
rename the new databases.mdf or delete it if you don't have enough
space - do not touch the .ldf
move back in the old database .mdf file or rename it back again
restart sql server
it should come up suspect
then
1. From a query window, set the status so that you can update the
system
tables by running the following query:
use Master
go
sp_configure "allow", 1
go
reconfigure with override
go
2. Then set the status of the DB that is giving you the problem (XXXXX)
into
Emergency Mode by running the following query:
update sysdatabases set status = 32768 where name = '<DBName>'
go
checkpoint
go
shutdown with nowait
go
3. Go into the data directory (MSSQL7\DATA) and rename the log file
associated
the DB in question (XXXX.ldf) to some
temporary name, such as XXXX.TMP.
4. Exit the query window.
5. Then start up SQL Server from a DOS command window by issuing:
sqlservr -c -T3608 -T4022.
6. Bring up another query window and verify that the DB is in emergency
mode
by issuing:
select Name, Status from Sysdatabases where name = '<DB_Name>'
7. Verify that the status is 32768. If it is, then issue the query:
dbcc traceon(3604)
dbcc rebuild_log ('<DB_Name>','<log_filename>') <--- You will need
the quotation marks
REBUILD_LOG should take less than 5 minutes even on a very large
database. It should complete with the message
DBCC execution completed
8. Take the database out of bypass recovery mode by issuing the command
update sysdatabases set status = 0 where name = '<DBName>'
9. Exit the query window and then shutdown (Ctrl-C in the DOS window)
and
restart SQL server
Roll on Oracle I say. At worst, I'm gonna get my boss to get me some SQLServer DBA training (I'm not a DBA and no plan on being one, but I could have saved myself a lot of time on the back of a few days training in this area. On the other hand, I did manage to find a resolution although the next problem is round the corner I'm sure )
Last edited by Dracoro; 17 December 2006 at 10:26 PM.
Thread
Thread Starter
Forum
Replies
Last Post
The Joshua Tree
Computer & Technology Related
18
11 September 2015 09:24 PM