Showing posts with label errors. Show all posts
Showing posts with label errors. Show all posts

Wednesday, March 21, 2012

Drop table / Allocation errors

I am getting this allocation error on sql 7.0 which won't go away with checkdb (repair_allow_data_loss). I had a suspicion about one table. After dropping this particular table CHECKDB(repair) removed all the allocation errors. The application people are dead against dropping the table. I was wondering if there is any way around this problem short of restoring. I have already tried dbreindex. Checktable does not return any error on this table. This table holds all the transaction logs for the application.

Server: Msg 8906, Level 16, State 1, Line 0
Page (1:656) in database ID 7 is allocated in the SGAM (1:3) and PFS (1:1), but was not allocated in any IAM. PFS flags 'MIXED_EXT ALLOCATED 100_PCT_FULL'.

thx,

BXWhy not transfer the data to another table (DTS, BCP, EIEIO), drop the bad table, repair the database, then recreate the table and transfer the data back? Off hours, of course.

Richard

Originally posted by bxmakin
I am getting this allocation error on sql 7.0 which won't go away with checkdb (repair_allow_data_loss). I had a suspicion about one table. After dropping this particular table CHECKDB(repair) removed all the allocation errors. The application people are dead against dropping the table. I was wondering if there is any way around this problem short of restoring. I have already tried dbreindex. Checktable does not return any error on this table. This table holds all the transaction logs for the application.

Server: Msg 8906, Level 16, State 1, Line 0
Page (1:656) in database ID 7 is allocated in the SGAM (1:3) and PFS (1:1), but was not allocated in any IAM. PFS flags 'MIXED_EXT ALLOCATED 100_PCT_FULL'.

thx,

BX

Monday, March 19, 2012

Drop Stored Procedure causing Dropped Tables

Hey guys, has anyone ever seen this happen:

Try to move stored proc from one DB to another using DTS, errors on create proc. Create proc manually.

Three tables referenced by that stored proc have been dropped and re-created with the same table structure.

I'm not 100% certain that it happened at exactly the same time, but it seems to be around the same time. Any ideas? Anyone seen this happen before?You will have to check the options you picked for the Transfer task in your DTS package. Did you ask it to move dependent objects also? For more help on the DTS package/tasks, please post in the SQL Server Integration Services forum.|||It was selected for dependent objects, but those tables are not dependent on the stored proc. As far as I know, the DTS method I used was the same as using DROP PROCEDURE, since it failed after the drop.|||I don't know how the DTS task determines dependencies. If it uses say sp_depends SP then you can check by running the SP for your SP to see the dependencies. Note, that this SP only gives immediate dependencies. If this doesn't help find how DTS determines dependencies then ask in the SSIS forum or run your package and trace the calls to SQL Server.

Friday, March 9, 2012

DROP DATABASE -> database in use error

when I do DROP DATABASE I'm getting errors because it's in use. But if I do a delete from the mgmt studio gui I have the option to close all connections as part of the delete. Is there a way to achieve the same effect from a sql script?

Here is an article I wrote about that:

http://drsql.spaces.msn.com/blog/cns!80677FB08B3162E4!950.entry

Basically:

alter database <databaseName>

set single_user with rollback immediate

I find this indispensible when testing database creation scripts with a few windows open and I need to drop the database, recreate it with scripts, fix some stupid bug and then re-run things.

Two tricks:

First, most every dialog in SSMS and SSMSE (express edition) have a script button. So most things you can just get the script. On my express edition however, the alter database stuff wasn't scripted, so I cannot say with 100% accuracy (it might just be a bug :)

Second, a trick to find these things sorts of things out. If you aren't using Express Edition, you can run profiler and usually see the commands that SQL Server is running. This way, if the script doesn't work like you expect it to, you can see what they are actually running :)

|||

There are scripts that you can get to kill all users in the database... it uses a simple cursor to collect the information from the sysprocesses table or the sp_who command and run a kill command against each of the connections that releate to the database in question. If you have a look at the scripts section of www.sqlservercentral.com you will be able to find the scripts i am talking about.

drop col from published table

I wish to add a col to a table I have published for merge replication.
When I attempt to do this I receive errors in regard to the rowguid col that
was added when creating my publication.
Do I need to drop the publication before adding col ?
Or is there another way out of this ?
You shouldn't have to if you use sp_repldropcolumn. What is the exact error
message you are getting?
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:eTmObDGBHHA.1012@.TK2MSFTNGP04.phx.gbl...
>I wish to add a col to a table I have published for merge replication.
> When I attempt to do this I receive errors in regard to the rowguid col
> that was added when creating my publication.
> Do I need to drop the publication before adding col ?
> Or is there another way out of this ?
>
|||Hi Hilary, and thanks for the response.
When I attempt to add (not drop) a col to a table I have published for
mobile merge replication I receive the following errors :
"Error validation the default for column 'rowguid'."
"It is invalid to drop the default constraint on the rowguid column that is
used by merge replication. The DDL operation failed inside merge DDL
replication manipulation. The transaction ended in the trigger. The batch
has been aborted."
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:ObR97mGBHHA.3380@.TK2MSFTNGP04.phx.gbl...
> You shouldn't have to if you use sp_repldropcolumn. What is the exact
> error message you are getting?
> --
> Hilary Cotter
> Director of Text Mining and Database Strategy
> RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
> This posting is my own and doesn't necessarily represent RelevantNoise's
> positions, strategies or opinions.
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
> "John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
> news:eTmObDGBHHA.1012@.TK2MSFTNGP04.phx.gbl...
>

Friday, February 24, 2012

Drive Dying - how to rescue SQL

Hi All,
I have sql 2000 on Win 2003.
I think my drive is dying (once I got in to work and machine was dead and
drive check showed a lot of errors)
Anyways, now I am having problems backup up certain SQL db's (in order to
make the log smaller again).
I get the error
Nonrecoverable I/O error occured on file c:\.......\xxxx.LDF
BACKUP LOG is terminating abnormally
As I cannot backup the databases, where do I go from here?tony wrote:
> Hi All,
> I have sql 2000 on Win 2003.
> I think my drive is dying (once I got in to work and machine was dead and
> drive check showed a lot of errors)
> Anyways, now I am having problems backup up certain SQL db's (in order to
> make the log smaller again).
> I get the error
> Nonrecoverable I/O error occured on file c:\.......\xxxx.LDF
> BACKUP LOG is terminating abnormally
> As I cannot backup the databases, where do I go from here?
Try to copy mdf and ldf on other PC
Later on you can attach them.
Regards
Amish Shah
http://shahamishm.tripod.com|||If the worst comes I have used a utiltity from http://www.runtime.org/
called GetBack for NTFS that does an excellent job of getting data off of
drives. When Windows reads bad drives it only puts in so much effort then
quits, but this program tries to get every readable piece of data off the
drive. If somenthing screws up the partition table or directories Windows
will not be able to read the drive. As long and the electronic are OK on
the drive and the platters move GetBack can get data off by looking at the
drive block by block and recreating a file system.
This is not all that simple to use because it even recovers deleted files or
moved files so sometimes you can see multiple saved versions of the same
file. Most of the time it is pretty clear which file you need to get off
and the ones that are not recoverable are old delete files anyway.
"amish" <shahamishm@.gmail.com> wrote in message
news:1155895549.783867.146780@.h48g2000cwc.googlegroups.com...
> tony wrote:
>> Hi All,
>> I have sql 2000 on Win 2003.
>> I think my drive is dying (once I got in to work and machine was dead and
>> drive check showed a lot of errors)
>> Anyways, now I am having problems backup up certain SQL db's (in order to
>> make the log smaller again).
>> I get the error
>> Nonrecoverable I/O error occured on file c:\.......\xxxx.LDF
>> BACKUP LOG is terminating abnormally
>> As I cannot backup the databases, where do I go from here?
> Try to copy mdf and ldf on other PC
> Later on you can attach them.
> Regards
> Amish Shah
> http://shahamishm.tripod.com
>|||Hi,
First verify free space in each of your databases (use enterprise manager --
click the database-- view taskpad view. If you have more free space
try to shrink the file. This will give you some extra space to backup. Once
you are done with the backup; then Add a
new drive the server and do:-
1. Detach the databases which grows heavily (See SP_detach_db)
2. Move the MDF and LDF to new drive
3. Attach the database (See SP_Attach_db from books online)
Thanks
Hari
SQL Server MVP
"tony" <tonyds@.nospam.mailbox.co.za> wrote in message
news:ec42oh$nr8$1@.ctb-nnrp2.saix.net...
> Hi All,
> I have sql 2000 on Win 2003.
> I think my drive is dying (once I got in to work and machine was dead and
> drive check showed a lot of errors)
> Anyways, now I am having problems backup up certain SQL db's (in order to
> make the log smaller again).
> I get the error
> Nonrecoverable I/O error occured on file c:\.......\xxxx.LDF
> BACKUP LOG is terminating abnormally
> As I cannot backup the databases, where do I go from here?
>
>