Showing posts with label instance. Show all posts
Showing posts with label instance. Show all posts

Tuesday, March 27, 2012

deadlocks

If an instance of SQL 2005 was in use and was using row versioning,
under what circumstances would the below error occur?

Transaction (Process ID 56) was deadlocked on lock resources with
another process and has been chosen as the deadlock victim. Rerun the
transaction

We used to get this sort of thing when a large copy process was running
under a transaction, but all it was doing was reading the records and
creating brand new records yet would still lock the entire table. Once
we enabled the row versioning, we stopped having this issue, but it
seems that there are some circumstances in which it still happens, i.e.
the above error.

Any ideas how that might occur?pb648174 (google@.webpaul.net) writes:
> If an instance of SQL 2005 was in use and was using row versioning,
> under what circumstances would the below error occur?
> Transaction (Process ID 56) was deadlocked on lock resources with
> another process and has been chosen as the deadlock victim. Rerun the
> transaction
> We used to get this sort of thing when a large copy process was running
> under a transaction, but all it was doing was reading the records and
> creating brand new records yet would still lock the entire table. Once
> we enabled the row versioning, we stopped having this issue, but it
> seems that there are some circumstances in which it still happens, i.e.
> the above error.
> Any ideas how that might occur?

Without knowledge of the code, and not have seen the deadlock trace?
Not even knowing which of the two varities of snapshot isolation
you are using. SET TRANSACTION LEVEL SHAPSHOT, or READ COMMITTED
SNAPSHOT?

To get a deadlock trace in the SQL Server error log, enable trace
flags 1222 and 3605. (It used be 1204, but 1222 is a new flag, which
gives better information.)

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||I didn't realize there were multiple kinds.. We are using ALTER
DATABASE DBName SET READ_COMMITTED_SNAPSHOT ON;

My questions is more of a general one - If row versioning is being used
and a particular record is involved in a transaction, should other
transactions just get the older version and not have to respect any
locks? We are seeing blocking happen for normal read operations, which
seems like it shouldn't happen. A write blocking I could see, but the
read blocking doesn't make sense to me.|||pb648174 (google@.webpaul.net) writes:
> I didn't realize there were multiple kinds.. We are using ALTER
> DATABASE DBName SET READ_COMMITTED_SNAPSHOT ON;

The other one you achieve with ALTER DATABASE db SET
ALLOW_SNAPSHOT_ISOLATION ON. Transactions what want snapshots, then
need to say SET TRANSACTION ISOLATION LEVEL SNAPSHOT.

The two yields slight different results. Pure shapshot isolation, gives
you the state of the database as it looked when the transaction started.
Read Committed Snapshot Isolation (RCSI) is an alternate implementation
of the read committed isolation level. An RCSI transaction can pick up
data that did not exist when the transaction started, but that committed
before the transaction came about to read it.

> My questions is more of a general one - If row versioning is being used
> and a particular record is involved in a transaction, should other
> transactions just get the older version and not have to respect any
> locks? We are seeing blocking happen for normal read operations, which
> seems like it shouldn't happen. A write blocking I could see, but the
> read blocking doesn't make sense to me.

Without any repro it's difficult to comment things out of the blue. However,
note that if you are using alternate isolation level, either by
SET TRANSACTION ISOLATION LEVEL or by query/table hints, the snapshot is
not involved. For instance, run this in one query window:

CREATE TABLE hubba (a int NOT NULL PRIMARY KEY)
go
INSERT hubba(a) VALUES (12)
go
BEGIN TRANSACTION
go
INSERT hubba(a) VALUES (2)
go

Then in another window run:

SELECT MAX(a), MIN(a) FROM hubba

This returns (12, 12). Now try_

SELECT MAX(a), MIN(a) FROM hubba WITH (REPEATABLEREAD)

This blocks, because the isolation level is no longer READ COMMITTED.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Ahhhhh... Now we are getting somewhere. I think other transactions are
set as serializable, so that would explain it. Thanks for the tip.

Friday, February 24, 2012

dbowner no more dbower (SID lost)

hello eveybody,
I have an Sql server 2000 installed with several databases.
this instance is configured with both sql server identification and
Windows ID
I have created a login called john and this login has a default
database mydb (sp_addlogin)
On this default database, i have granted the Access to this login
(sp_grantdbaccess)
a new application has created a new database newdb and, for
differents reasons, the program has created again the john login
(same name)
Now, I can Access with this login to the database newdb but no more
to the default one mydb .
When I say i can Access... that means :
Select * from toto is working on newdb
(I dont need to write Select * from john.toto)
But with mydb ,
Select * from toto does not work,
I need to write the select this way : Select * from john.toto
Since I use an application, I cannot change the sql statement
since john is "dbowner" and has a defaut db "mydb", this is strange
When I read master.dbo.sysusers, the user john has a complexe SID
( 0x93F921DB3... )
When i read master.dbo.sysdatabases :
The new database newdb has the same complexe SID ( 0x93F921DB3...
)
The old database mydb has lost the SID witch is replaced with 0x01
The table toto has the correct UID that is john in sysusers table
How can I reset "john" owner on all tables from mydb
many thanks
nicolasIt looks like someone has changed the owner of the old database to be sa
(sid = 0x01). You can execute sp_changedbowner to reset the database owner
to be John.
See
http://msdn.microsoft.com/library/d...>
cz_30s2.asp,
for more information on sp_changedbowner.
Thanks
Laurentiu Cristofor [MSFT]
Software Design Engineer
SQL Server Engine
http://blogs.msdn.com/lcris/
This posting is provided "AS IS" with no warranties, and confers no rights.
"906507N" <906507N@.10090.I20034> wrote in message
news:Xns980E2BCBAB870140507NA02619@.207.46.248.16...
> hello eveybody,
> I have an Sql server 2000 installed with several databases.
> this instance is configured with both sql server identification and
> Windows ID
> I have created a login called john and this login has a default
> database mydb (sp_addlogin)
> On this default database, i have granted the Access to this login
> (sp_grantdbaccess)
>
> a new application has created a new database newdb and, for
> differents reasons, the program has created again the john login
> (same name)
> Now, I can Access with this login to the database newdb but no more
> to the default one mydb .
> When I say i can Access... that means :
> Select * from toto is working on newdb
> (I dont need to write Select * from john.toto)
> But with mydb ,
> Select * from toto does not work,
> I need to write the select this way : Select * from john.toto
> Since I use an application, I cannot change the sql statement
> since john is "dbowner" and has a defaut db "mydb", this is strange
> When I read master.dbo.sysusers, the user john has a complexe SID
> ( 0x93F921DB3... )
> When i read master.dbo.sysdatabases :
> The new database newdb has the same complexe SID ( 0x93F921DB3...
> )
> The old database mydb has lost the SID witch is replaced with 0x01
>
> The table toto has the correct UID that is john in sysusers table
> How can I reset "john" owner on all tables from mydb
> many thanks
> nicolas
>|||many thanks for your help
I try the command but sql server say :
Server: Msg 15110, Level 16, State 1, Procedure sp_changedbowner, Line 47
The proposed new database owner is already a user in the database
I'm connected with the sa account into the default database of the owner
"Laurentiu Cristofor [MSFT]" <laur@.nospam.com> wrote in
news:ewzvm2dsGHA.3496@.TK2MSFTNGP06.phx.gbl:

> It looks like someone has changed the owner of the old database to be
> sa (sid = 0x01). You can execute sp_changedbowner to reset the
> database owner to be John.
> See
> http://msdn.microsoft.com/library/d...ry/en-us/tsqlre
> f/ts_sp_ca-cz_30s2.asp, for more information on sp_changedbowner.
> Thanks
>|||Try creating a temporary login, change the database to be
owned by that temp login. Then change the database to be
owned by John and drop the temp login. Something like:
use YourDatabase
go
exec sp_addlogin 'TempLogin'
exec sp_changedbowner 'TempLogin'
exec sp_changedbowner 'John'
exec sp_droplogin 'TempLogin'
-Sue
On Thu, 27 Jul 2006 18:00:28 -0700, 906507N
<906507N@.10090.I20034> wrote:
[vbcol=seagreen]
>many thanks for your help
>I try the command but sql server say :
>Server: Msg 15110, Level 16, State 1, Procedure sp_changedbowner, Line 47
> The proposed new database owner is already a user in the database
>
>I'm connected with the sa account into the default database of the owner
>
>"Laurentiu Cristofor [MSFT]" <laur@.nospam.com> wrote in
>news:ewzvm2dsGHA.3496@.TK2MSFTNGP06.phx.gbl:
>|||If this error comes as a result of attempting to make the owner to be
"John", then it means that while the owner was sa, a user was already
created for John in the database. If you now want to make John the database
owner, you should remove that user:
sp_dropuser 'John'
and then you should be able to call
sp_changedbowner 'John'
There is a catch: if 'John' owns objects in the database, you cannot drop
him, so you will have to change the ownership of those objects to someone
else first, by using sp_changeobjectowner.
Thanks
Laurentiu Cristofor [MSFT]
Software Design Engineer
SQL Server Engine
http://blogs.msdn.com/lcris/
This posting is provided "AS IS" with no warranties, and confers no rights.
"906507N" <906507N@.10090.I20034> wrote in message
news:Xns980E1E98F3B4D0140507NA02619@.207.46.248.16...
> many thanks for your help
> I try the command but sql server say :
> Server: Msg 15110, Level 16, State 1, Procedure sp_changedbowner, Line 47
> The proposed new database owner is already a user in the database
>
> I'm connected with the sa account into the default database of the owner
>
> "Laurentiu Cristofor [MSFT]" <laur@.nospam.com> wrote in
> news:ewzvm2dsGHA.3496@.TK2MSFTNGP06.phx.gbl:
>
>|||906507N <906507N@.10090.I20034> wrote in
news:Xns980E1E98F3B4D0140507NA02619@.207.46.248.16:

> many thanks for your help
> I try the command but sql server say :
> Server: Msg 15110, Level 16, State 1, Procedure sp_changedbowner, Line
47
> The proposed new database owner is already a user in the database
>
> I'm connected with the sa account into the default database of the
owner
>
> "Laurentiu Cristofor [MSFT]" <laur@.nospam.com> wrote in
> news:ewzvm2dsGHA.3496@.TK2MSFTNGP06.phx.gbl:
>
us/tsqlre[vbcol=seagreen]
>
sue and Laurentiu,
many thanks for your help
The solution was here
I created a new login, changeobjectowner for each database tables from
old user,delete and create again the old login, changeobjectowner back to
the old user all objects
now, it is correct
again, many thanks for your answers.
nicolas

dbo user / permissions error.

I had found one or two other questions about this, but neither of them seemed to be the same as my instance, and there solutions were not valid for me.

I purchased the Build a Program Now MS Visual C# 2005 Express Edition book with CD.

This was installed by the auto installer on the disk. which included the SQL Express 2005 version.

I have used the Visual Express C# interface, build a small program, created the database, created tables. all went well. I can even add data, and so forth.

My problem came when I went to click on database Diagrams in the Database Explorer.

I get a Dialog box stating

" This Database does not have a valid dbo user or you do not have permissions to impersonate the dbo user, so database diagramming is not available. Do you want to make yourself the dbo of this database in order to use the database diagramming?"

two options are Yes and No.

If I choose yes, I get the following dialog box stating,

" This databse does not have a valid dbo user or you do not have permissions to impresonate the dbo user, so database diagramming is not available. Ensure the dbo account is valid and ensure you have imprersonate permission on the dbo account."

One button, OK.

I have searched every where I can think of to try to figure out how to set / alter the dbo user info / permissions.

Can someone guide me on this?

Thanks in advance.

Tom

hi Tom,

try explicitely change the ownerwhip of the database to a valid principal..

start SQL Server Management Studio Express (http://www.microsoft.com/downloads/details.aspx?familyid=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&displaylang=en), select the database you are interested in, access it's properties and set the ownership to "sa" or another valid Login..

or, execute the statements

USE yorDatabase; GO EXEC sp_changedbowner @.loginame = 'sa', @.map= 'true';

http://msdn2.microsoft.com/en-us/library/ms178630.aspx

regards

|||

Andrea,

Thank you very much for the time and for sharing your knowledge.

I am trying to do as you stated above, however, when i start SMSE, I do not see the Database that i am actually using.

It shows the sql server itself, but does not show anything other than system items in it.

The program i am building is using a CDS.mdf, and I can not locate that anywhere in SMSE.

i am still going over it all, and doing some reading from the first link above that you sent.

If you have any other ideals, please send them my way.

Regards

Tom

|||

Think maybe I have done something wrong when i installed SQL Express or v c# Express?

I have went over every thing i can find over and over,, to no resolve.

Flustered

Tom

|||

Anyone else have any ideals?

Totally lost and stuck

Tom

|||

Hi Tom,

Check out my answer at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=690061&SiteID=1, it will explain why you can't see your database.

Mike

|||

Good Day Mike,

Just wanted to say thanks for the input and info. I am still working to resolve this issue, just been slow as I had some health issues.

Thanks again, and I'll let ya know later today if I can get a resolution using this info.

Regards

Tom

|||

Hey Mike.

I just wanted to let you know that I tried doing what was instructed in the other post.

It has not resolved my issue, I still cant use the manager to locate/attatch the dbase to work with its properties.

However its not a major issue, I am using a back door in Visual to make my relations and FK settings, even if I cant go through the one step because of the permissions error, there working all the same.

Regards

Tom

|||Here is my solution to this problem. I had this same issue. After searching this forum I had the cues I needed to correct the issue but none of the suggested methods worked. I think the problem stemed from the fact that I had renamed the primary windows user account to my name (the original Owner account left from the OS install). In the folder structure some of the folders were still titled "Owner" but further down the tree the new name was used. So this account was previously "Owner" but had been changed to my name. The solution was the create a new Windows account, all of the folders had the new name associated with them. Then I recreated the database and the problem accessing the database diagram didn't reoccur. I hope this helps. Fyi: I am using Visual Basic 2005 Express but I think it is the same issue.|||

There are two options to resolve the dbo owner issue, one is to set a new owner as described in one of the above posts (and in some situations doe not work) and the other is to change the compatability level of your database to "SQL Server 2005 (90)".

In order to do so you should right-click the database in the Management Studio; and then select:

Properties --> Options --> Change "Compatibility level" to "SQL Server 2005 (90)"

Good luck

- Gal Cohen

dbo user / permissions error.

I had found one or two other questions about this, but neither of them seemed to be the same as my instance, and there solutions were not valid for me.

I purchased the Build a Program Now MS Visual C# 2005 Express Edition book with CD.

This was installed by the auto installer on the disk. which included the SQL Express 2005 version.

I have used the Visual Express C# interface, build a small program, created the database, created tables. all went well. I can even add data, and so forth.

My problem came when I went to click on database Diagrams in the Database Explorer.

I get a Dialog box stating

" This Database does not have a valid dbo user or you do not have permissions to impersonate the dbo user, so database diagramming is not available. Do you want to make yourself the dbo of this database in order to use the database diagramming?"

two options are Yes and No.

If I choose yes, I get the following dialog box stating,

" This databse does not have a valid dbo user or you do not have permissions to impresonate the dbo user, so database diagramming is not available. Ensure the dbo account is valid and ensure you have imprersonate permission on the dbo account."

One button, OK.

I have searched every where I can think of to try to figure out how to set / alter the dbo user info / permissions.

Can someone guide me on this?

Thanks in advance.

Tom

hi Tom,

try explicitely change the ownerwhip of the database to a valid principal..

start SQL Server Management Studio Express (http://www.microsoft.com/downloads/details.aspx?familyid=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&displaylang=en), select the database you are interested in, access it's properties and set the ownership to "sa" or another valid Login..

or, execute the statements

USE yorDatabase;

GO

EXEC sp_changedbowner @.loginame = 'sa', @.map= 'true';

http://msdn2.microsoft.com/en-us/library/ms178630.aspx

regards

|||

Andrea,

Thank you very much for the time and for sharing your knowledge.

I am trying to do as you stated above, however, when i start SMSE, I do not see the Database that i am actually using.

It shows the sql server itself, but does not show anything other than system items in it.

The program i am building is using a CDS.mdf, and I can not locate that anywhere in SMSE.

i am still going over it all, and doing some reading from the first link above that you sent.

If you have any other ideals, please send them my way.

Regards

Tom

|||

Think maybe I have done something wrong when i installed SQL Express or v c# Express?

I have went over every thing i can find over and over,, to no resolve.

Flustered

Tom

|||

Anyone else have any ideals?

Totally lost and stuck

Tom

|||

Hi Tom,

Check out my answer at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=690061&SiteID=1, it will explain why you can't see your database.

Mike

|||

Good Day Mike,

Just wanted to say thanks for the input and info. I am still working to resolve this issue, just been slow as I had some health issues.

Thanks again, and I'll let ya know later today if I can get a resolution using this info.

Regards

Tom

|||

Hey Mike.

I just wanted to let you know that I tried doing what was instructed in the other post.

It has not resolved my issue, I still cant use the manager to locate/attatch the dbase to work with its properties.

However its not a major issue, I am using a back door in Visual to make my relations and FK settings, even if I cant go through the one step because of the permissions error, there working all the same.

Regards

Tom

|||Here is my solution to this problem. I had this same issue. After searching this forum I had the cues I needed to correct the issue but none of the suggested methods worked. I think the problem stemed from the fact that I had renamed the primary windows user account to my name (the original Owner account left from the OS install). In the folder structure some of the folders were still titled "Owner" but further down the tree the new name was used. So this account was previously "Owner" but had been changed to my name. The solution was the create a new Windows account, all of the folders had the new name associated with them. Then I recreated the database and the problem accessing the database diagram didn't reoccur. I hope this helps. Fyi: I am using Visual Basic 2005 Express but I think it is the same issue.|||

There are two options to resolve the dbo owner issue, one is to set a new owner as described in one of the above posts (and in some situations doe not work) and the other is to change the compatability level of your database to "SQL Server 2005 (90)".

In order to do so you should right-click the database in the Management Studio; and then select:

Properties --> Options --> Change "Compatibility level" to "SQL Server 2005 (90)"

Good luck

- Gal Cohen

dbo user / permissions error.

I had found one or two other questions about this, but neither of them seemed to be the same as my instance, and there solutions were not valid for me.

I purchased the Build a Program Now MS Visual C# 2005 Express Edition book with CD.

This was installed by the auto installer on the disk. which included the SQL Express 2005 version.

I have used the Visual Express C# interface, build a small program, created the database, created tables. all went well. I can even add data, and so forth.

My problem came when I went to click on database Diagrams in the Database Explorer.

I get a Dialog box stating

" This Database does not have a valid dbo user or you do not have permissions to impersonate the dbo user, so database diagramming is not available. Do you want to make yourself the dbo of this database in order to use the database diagramming?"

two options are Yes and No.

If I choose yes, I get the following dialog box stating,

" This databse does not have a valid dbo user or you do not have permissions to impresonate the dbo user, so database diagramming is not available. Ensure the dbo account is valid and ensure you have imprersonate permission on the dbo account."

One button, OK.

I have searched every where I can think of to try to figure out how to set / alter the dbo user info / permissions.

Can someone guide me on this?

Thanks in advance.

Tom

hi Tom,

try explicitely change the ownerwhip of the database to a valid principal..

start SQL Server Management Studio Express (http://www.microsoft.com/downloads/details.aspx?familyid=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&displaylang=en), select the database you are interested in, access it's properties and set the ownership to "sa" or another valid Login..

or, execute the statements

USE yorDatabase;

GO

EXEC sp_changedbowner @.loginame = 'sa', @.map= 'true';

http://msdn2.microsoft.com/en-us/library/ms178630.aspx

regards

|||

Andrea,

Thank you very much for the time and for sharing your knowledge.

I am trying to do as you stated above, however, when i start SMSE, I do not see the Database that i am actually using.

It shows the sql server itself, but does not show anything other than system items in it.

The program i am building is using a CDS.mdf, and I can not locate that anywhere in SMSE.

i am still going over it all, and doing some reading from the first link above that you sent.

If you have any other ideals, please send them my way.

Regards

Tom

|||

Think maybe I have done something wrong when i installed SQL Express or v c# Express?

I have went over every thing i can find over and over,, to no resolve.

Flustered

Tom

|||

Anyone else have any ideals?

Totally lost and stuck

Tom

|||

Hi Tom,

Check out my answer at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=690061&SiteID=1, it will explain why you can't see your database.

Mike

|||

Good Day Mike,

Just wanted to say thanks for the input and info. I am still working to resolve this issue, just been slow as I had some health issues.

Thanks again, and I'll let ya know later today if I can get a resolution using this info.

Regards

Tom

|||

Hey Mike.

I just wanted to let you know that I tried doing what was instructed in the other post.

It has not resolved my issue, I still cant use the manager to locate/attatch the dbase to work with its properties.

However its not a major issue, I am using a back door in Visual to make my relations and FK settings, even if I cant go through the one step because of the permissions error, there working all the same.

Regards

Tom

|||Here is my solution to this problem. I had this same issue. After searching this forum I had the cues I needed to correct the issue but none of the suggested methods worked. I think the problem stemed from the fact that I had renamed the primary windows user account to my name (the original Owner account left from the OS install). In the folder structure some of the folders were still titled "Owner" but further down the tree the new name was used. So this account was previously "Owner" but had been changed to my name. The solution was the create a new Windows account, all of the folders had the new name associated with them. Then I recreated the database and the problem accessing the database diagram didn't reoccur. I hope this helps. Fyi: I am using Visual Basic 2005 Express but I think it is the same issue.|||

There are two options to resolve the dbo owner issue, one is to set a new owner as described in one of the above posts (and in some situations doe not work) and the other is to change the compatability level of your database to "SQL Server 2005 (90)".

In order to do so you should right-click the database in the Management Studio; and then select:

Properties --> Options --> Change "Compatibility level" to "SQL Server 2005 (90)"

Good luck

- Gal Cohen