Showing posts with label regarding. Show all posts
Showing posts with label regarding. Show all posts

Monday, March 19, 2012

Bug regarding identity columns?

I'm seeing some weird behavior regarding identity columns in MSSQL 2000.

In a specific client database we have this table:

ID Name SecLevDG Flags
-- -- -- --
1029528 xxx 0 0
1029529 xxx 0 0
1049676 xxx 0 0

While upgrading this database to a later version of our product, some schema changes are necessary. For this particular table, the changes are

alter table Authority drop constraint apkAuthorityId
alter table Authority drop column SecLevDg
alter table Authority add new_id integer identity

This code has worked perfectly for years, and even in this particular database, there are no error messages. However, the result isn't quite the expected:

ID Name Flags new_id
-- - -- --
1029528 xxx 0 16777220
1029529 xxx 0 16777220
1049676 xxx 0 16777220

Notice that the new column did NOT get unique values 1, 2, 3, etc... In other tests I manage to get different values, but still not the expected ones. Is this a bug in MSSQL 2000?

DBCC CHECKIDENT returns:
Checking identity information: current identity value '1', current column value '1'.

DBCC CHECKDB returns no errors before running the above statement. Afterwards it returns this (only relevant messages included):
Server: Msg 8970, Level 16, State 1, Line 1
Row error: Object ID 293576084, index ID 0, page ID (1:277), row ID 0. Column 'new_id' was created NOT NULL, but is NULL in the row.
Server: Msg 8970, Level 16, State 1, Line 1
Row error: Object ID 293576084, index ID 0, page ID (1:277), row ID 1. Column 'new_id' was created NOT NULL, but is NULL in the row.
Server: Msg 8970, Level 16, State 1, Line 1
Row error: Object ID 293576084, index ID 0, page ID (1:1145), row ID 0. Column 'new_id' was created NOT NULL, but is NULL in the row.
[...]
CHECKDB found 0 allocation errors and 3 consistency errors in table 'Authority' (object ID 293576084).

Regards,
Oskar Berggren

WHen I'm creating a new identity column, I use this:

columnName int IDENTITY (1,1)

Perhaps it is balking because you aren't providing a seed value?

Or, if there are consistency errors, there's an issue with the table itself...

|||Also, although I can not find it now, I seem to remember reading that 2005 likes things to be specifically defined as NULL or NOT NULL.|||

I encountered an issue like this in SQL Server 2005 RTM (I think SP1 fixed it). I was able to work around it by setting Max Degree of Parallelism (MAXDOP) to 1 for the transaction and then back to 0 afterwards.

My theory on this is that multiple processors are working to set the identity and the processors somehow end up with the same value. By having it done with a single processor it might run a bit slower but it resolved the issue for me.

I've never seen this issue in 2000, though. I assume you have the latest service packs?

Regards,

Jared

Bug regarding identity columns?

I'm seeing some weird behavior regarding identity columns in MSSQL 2000.

In a specific client database we have this table:

ID Name SecLevDG Flags
-- -- -- --
1029528 xxx 0 0
1029529 xxx 0 0
1049676 xxx 0 0

While upgrading this database to a later version of our product, some schema changes are necessary. For this particular table, the changes are

alter table Authority drop constraint apkAuthorityId
alter table Authority drop column SecLevDg
alter table Authority add new_id integer identity

This code has worked perfectly for years, and even in this particular database, there are no error messages. However, the result isn't quite the expected:

ID Name Flags new_id
-- - -- --
1029528 xxx 0 16777220
1029529 xxx 0 16777220
1049676 xxx 0 16777220

Notice that the new column did NOT get unique values 1, 2, 3, etc... In other tests I manage to get different values, but still not the expected ones. Is this a bug in MSSQL 2000?

DBCC CHECKIDENT returns:
Checking identity information: current identity value '1', current column value '1'.

DBCC CHECKDB returns no errors before running the above statement. Afterwards it returns this (only relevant messages included):
Server: Msg 8970, Level 16, State 1, Line 1
Row error: Object ID 293576084, index ID 0, page ID (1:277), row ID 0. Column 'new_id' was created NOT NULL, but is NULL in the row.
Server: Msg 8970, Level 16, State 1, Line 1
Row error: Object ID 293576084, index ID 0, page ID (1:277), row ID 1. Column 'new_id' was created NOT NULL, but is NULL in the row.
Server: Msg 8970, Level 16, State 1, Line 1
Row error: Object ID 293576084, index ID 0, page ID (1:1145), row ID 0. Column 'new_id' was created NOT NULL, but is NULL in the row.
[...]
CHECKDB found 0 allocation errors and 3 consistency errors in table 'Authority' (object ID 293576084).

Regards,
Oskar Berggren

WHen I'm creating a new identity column, I use this:

columnName int IDENTITY (1,1)

Perhaps it is balking because you aren't providing a seed value?

Or, if there are consistency errors, there's an issue with the table itself...

|||Also, although I can not find it now, I seem to remember reading that 2005 likes things to be specifically defined as NULL or NOT NULL.|||

I encountered an issue like this in SQL Server 2005 RTM (I think SP1 fixed it). I was able to work around it by setting Max Degree of Parallelism (MAXDOP) to 1 for the transaction and then back to 0 afterwards.

My theory on this is that multiple processors are working to set the identity and the processors somehow end up with the same value. By having it done with a single processor it might run a bit slower but it resolved the issue for me.

I've never seen this issue in 2000, though. I assume you have the latest service packs?

Regards,

Jared

Friday, February 10, 2012

BOOT.INI File for 4GB RAM and SQL 2005

I have 3 questions regarding memory configuration on a Windows Server 2003
SP2 Enterprise Edition with SQL2005 SP2.
1. Can someone advise on the correct boot.ini file configuration to utilize
4GB of local memory? I'm not sure if I need the 3GB switch?
multi(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003,
Enterprise"/3GB/fastdetect/PAE/NoExectute=OptOut
2. Once Boot.ini configured, is the only setting in SQL 2005 to modify is
the sp_configure awe enabled config_value=1 and run_value=1 ?
3. Assuming nothing else is to be done to have SQL 2005 utilize more than
the 2GB memory space, how do you verify or validate SQL 2005 is using more
memory?
Thanks in advancezorro
Is it 64 bit or 32 bit?
> 1. Can someone advise on the correct boot.ini file configuration to
> utilize
> 4GB of local memory? I'm not sure if I need the 3GB switch?
You do need 3GB switch
> 2. Once Boot.ini configured, is the only setting in SQL 2005 to modify is
> the sp_configure awe enabled config_value=1 and run_value=1 ?
AWE is for utilyze more than 4GB
Yes, unless you use 64 bit , then you do not need AWE , make sure that an
account SQL Serverc runs under is added to LockPages in Memory Local Group
Policy
> 3. Assuming nothing else is to be done to have SQL 2005 utilize more than
> the 2GB memory space, how do you verify or validate SQL 2005 is using more
> memory?
Task Manager
"zorro" <zorro@.discussions.microsoft.com> wrote in message
news:C2009B55-7B5D-4F65-8986-3AF00547FA1E@.microsoft.com...
>I have 3 questions regarding memory configuration on a Windows Server 2003
> SP2 Enterprise Edition with SQL2005 SP2.
> 1. Can someone advise on the correct boot.ini file configuration to
> utilize
> 4GB of local memory? I'm not sure if I need the 3GB switch?
> multi(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003,
> Enterprise"/3GB/fastdetect/PAE/NoExectute=OptOut
> 2. Once Boot.ini configured, is the only setting in SQL 2005 to modify is
> the sp_configure awe enabled config_value=1 and run_value=1 ?
> 3. Assuming nothing else is to be done to have SQL 2005 utilize more than
> the 2GB memory space, how do you verify or validate SQL 2005 is using more
> memory?
> Thanks in advance
>|||>> 3. Assuming nothing else is to be done to have SQL 2005 utilize more than
>> the 2GB memory space, how do you verify or validate SQL 2005 is using
>> more
>> memory?
> Task Manager
Actually, I would use performance monitor. Task manager tends to
under-report what SQL Server is actually using.|||Aaron
I agreee. I assumed the OP wants to utilize 4GB ONLY , so after adding
3GB switch you can actually observe in TM.
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:%23qL67StfIHA.5088@.TK2MSFTNGP02.phx.gbl...
>> 3. Assuming nothing else is to be done to have SQL 2005 utilize more
>> than
>> the 2GB memory space, how do you verify or validate SQL 2005 is using
>> more
>> memory?
>> Task Manager
> Actually, I would use performance monitor. Task manager tends to
> under-report what SQL Server is actually using.|||Thanks Uri,
1. 32 bit Windows Server 2003 version.
2. To verify 3GB switch is needed for my 5GB physically installed RAM?
3. Also good catch on the LockPages in Memory setting within the gpedit.msc
Thanks,
zorro
"Uri Dimant" wrote:
> zorro
> Is it 64 bit or 32 bit?
> > 1. Can someone advise on the correct boot.ini file configuration to
> > utilize
> > 4GB of local memory? I'm not sure if I need the 3GB switch?
> You do need 3GB switch
> > 2. Once Boot.ini configured, is the only setting in SQL 2005 to modify is
> > the sp_configure awe enabled config_value=1 and run_value=1 ?
> AWE is for utilyze more than 4GB
> Yes, unless you use 64 bit , then you do not need AWE , make sure that an
> account SQL Serverc runs under is added to LockPages in Memory Local Group
> Policy
> > 3. Assuming nothing else is to be done to have SQL 2005 utilize more than
> > the 2GB memory space, how do you verify or validate SQL 2005 is using more
> > memory?
> Task Manager
>
>
> "zorro" <zorro@.discussions.microsoft.com> wrote in message
> news:C2009B55-7B5D-4F65-8986-3AF00547FA1E@.microsoft.com...
> >I have 3 questions regarding memory configuration on a Windows Server 2003
> > SP2 Enterprise Edition with SQL2005 SP2.
> >
> > 1. Can someone advise on the correct boot.ini file configuration to
> > utilize
> > 4GB of local memory? I'm not sure if I need the 3GB switch?
> >
> > multi(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003,
> > Enterprise"/3GB/fastdetect/PAE/NoExectute=OptOut
> >
> > 2. Once Boot.ini configured, is the only setting in SQL 2005 to modify is
> > the sp_configure awe enabled config_value=1 and run_value=1 ?
> >
> > 3. Assuming nothing else is to be done to have SQL 2005 utilize more than
> > the 2GB memory space, how do you verify or validate SQL 2005 is using more
> > memory?
> >
> > Thanks in advance
> >
> >
>
>|||See comments inline.
Linchi
"Uri Dimant" wrote:
> zorro
> Is it 64 bit or 32 bit?
> > 1. Can someone advise on the correct boot.ini file configuration to
> > utilize
> > 4GB of local memory? I'm not sure if I need the 3GB switch?
> You do need 3GB switch
>
Why?
> > 2. Once Boot.ini configured, is the only setting in SQL 2005 to modify is
> > the sp_configure awe enabled config_value=1 and run_value=1 ?
> AWE is for utilyze more than 4GB
I keep hearing that AWE is for utilizing more than 4GB. Not sure where that
comes from. Technically, it's not.
> Yes, unless you use 64 bit , then you do not need AWE , make sure that an
> account SQL Serverc runs under is added to LockPages in Memory Local Group
> Policy
> > 3. Assuming nothing else is to be done to have SQL 2005 utilize more than
> > the 2GB memory space, how do you verify or validate SQL 2005 is using more
> > memory?
> Task Manager
>
>
> "zorro" <zorro@.discussions.microsoft.com> wrote in message
> news:C2009B55-7B5D-4F65-8986-3AF00547FA1E@.microsoft.com...
> >I have 3 questions regarding memory configuration on a Windows Server 2003
> > SP2 Enterprise Edition with SQL2005 SP2.
> >
> > 1. Can someone advise on the correct boot.ini file configuration to
> > utilize
> > 4GB of local memory? I'm not sure if I need the 3GB switch?
> >
> > multi(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003,
> > Enterprise"/3GB/fastdetect/PAE/NoExectute=OptOut
> >
> > 2. Once Boot.ini configured, is the only setting in SQL 2005 to modify is
> > the sp_configure awe enabled config_value=1 and run_value=1 ?
> >
> > 3. Assuming nothing else is to be done to have SQL 2005 utilize more than
> > the 2GB memory space, how do you verify or validate SQL 2005 is using more
> > memory?
> >
> > Thanks in advance
> >
> >
>
>|||Hi Linchi
You are right, that technically, it's not. If I have 4GB RAM and want tio
utilize 3GB for SQL Server, so I simple add switch in BOOT.INI and why
bother enabling AWE? What do you think?
"Linchi Shea" <LinchiShea@.discussions.microsoft.com> wrote in message
news:61A4195E-F98E-4AE2-A24F-0BC6AC668D08@.microsoft.com...
> See comments inline.
> Linchi
> "Uri Dimant" wrote:
>> zorro
>> Is it 64 bit or 32 bit?
>> > 1. Can someone advise on the correct boot.ini file configuration to
>> > utilize
>> > 4GB of local memory? I'm not sure if I need the 3GB switch?
>> You do need 3GB switch
> Why?
>> > 2. Once Boot.ini configured, is the only setting in SQL 2005 to modify
>> > is
>> > the sp_configure awe enabled config_value=1 and run_value=1 ?
>> AWE is for utilyze more than 4GB
> I keep hearing that AWE is for utilizing more than 4GB. Not sure where
> that
> comes from. Technically, it's not.
>> Yes, unless you use 64 bit , then you do not need AWE , make sure that
>> an
>> account SQL Serverc runs under is added to LockPages in Memory Local
>> Group
>> Policy
>> > 3. Assuming nothing else is to be done to have SQL 2005 utilize more
>> > than
>> > the 2GB memory space, how do you verify or validate SQL 2005 is using
>> > more
>> > memory?
>> Task Manager
>>
>>
>> "zorro" <zorro@.discussions.microsoft.com> wrote in message
>> news:C2009B55-7B5D-4F65-8986-3AF00547FA1E@.microsoft.com...
>> >I have 3 questions regarding memory configuration on a Windows Server
>> >2003
>> > SP2 Enterprise Edition with SQL2005 SP2.
>> >
>> > 1. Can someone advise on the correct boot.ini file configuration to
>> > utilize
>> > 4GB of local memory? I'm not sure if I need the 3GB switch?
>> >
>> > multi(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003,
>> > Enterprise"/3GB/fastdetect/PAE/NoExectute=OptOut
>> >
>> > 2. Once Boot.ini configured, is the only setting in SQL 2005 to modify
>> > is
>> > the sp_configure awe enabled config_value=1 and run_value=1 ?
>> >
>> > 3. Assuming nothing else is to be done to have SQL 2005 utilize more
>> > than
>> > the 2GB memory space, how do you verify or validate SQL 2005 is using
>> > more
>> > memory?
>> >
>> > Thanks in advance
>> >
>> >
>>

BOOT.INI File for 4GB RAM and SQL 2005

I have 3 questions regarding memory configuration on a Windows Server 2003
SP2 Enterprise Edition with SQL2005 SP2.
1. Can someone advise on the correct boot.ini file configuration to utilize
4GB of local memory? I'm not sure if I need the 3GB switch?
multi(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003,
Enterprise"/3GB/fastdetect/PAE/NoExectute=OptOut
2. Once Boot.ini configured, is the only setting in SQL 2005 to modify is
the sp_configure awe enabled config_value=1 and run_value=1 ?
3. Assuming nothing else is to be done to have SQL 2005 utilize more than
the 2GB memory space, how do you verify or validate SQL 2005 is using more
memory?
Thanks in advance
zorro
Is it 64 bit or 32 bit?
> 1. Can someone advise on the correct boot.ini file configuration to
> utilize
> 4GB of local memory? I'm not sure if I need the 3GB switch?
You do need 3GB switch

> 2. Once Boot.ini configured, is the only setting in SQL 2005 to modify is
> the sp_configure awe enabled config_value=1 and run_value=1 ?
AWE is for utilyze more than 4GB
Yes, unless you use 64 bit , then you do not need AWE , make sure that an
account SQL Serverc runs under is added to LockPages in Memory Local Group
Policy

> 3. Assuming nothing else is to be done to have SQL 2005 utilize more than
> the 2GB memory space, how do you verify or validate SQL 2005 is using more
> memory?
Task Manager
"zorro" <zorro@.discussions.microsoft.com> wrote in message
news:C2009B55-7B5D-4F65-8986-3AF00547FA1E@.microsoft.com...
>I have 3 questions regarding memory configuration on a Windows Server 2003
> SP2 Enterprise Edition with SQL2005 SP2.
> 1. Can someone advise on the correct boot.ini file configuration to
> utilize
> 4GB of local memory? I'm not sure if I need the 3GB switch?
> multi(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003,
> Enterprise"/3GB/fastdetect/PAE/NoExectute=OptOut
> 2. Once Boot.ini configured, is the only setting in SQL 2005 to modify is
> the sp_configure awe enabled config_value=1 and run_value=1 ?
> 3. Assuming nothing else is to be done to have SQL 2005 utilize more than
> the 2GB memory space, how do you verify or validate SQL 2005 is using more
> memory?
> Thanks in advance
>
|||>> 3. Assuming nothing else is to be done to have SQL 2005 utilize more than
> Task Manager
Actually, I would use performance monitor. Task manager tends to
under-report what SQL Server is actually using.
|||Aaron
I agreee. I assumed the OP wants to utilize 4GB ONLY , so after adding
3GB switch you can actually observe in TM.
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:%23qL67StfIHA.5088@.TK2MSFTNGP02.phx.gbl...
> Actually, I would use performance monitor. Task manager tends to
> under-report what SQL Server is actually using.
|||Thanks Uri,
1. 32 bit Windows Server 2003 version.
2. To verify 3GB switch is needed for my 5GB physically installed RAM?
3. Also good catch on the LockPages in Memory setting within the gpedit.msc
Thanks,
zorro
"Uri Dimant" wrote:

> zorro
> Is it 64 bit or 32 bit?
> You do need 3GB switch
>
> AWE is for utilyze more than 4GB
> Yes, unless you use 64 bit , then you do not need AWE , make sure that an
> account SQL Serverc runs under is added to LockPages in Memory Local Group
> Policy
>
> Task Manager
>
>
> "zorro" <zorro@.discussions.microsoft.com> wrote in message
> news:C2009B55-7B5D-4F65-8986-3AF00547FA1E@.microsoft.com...
>
>
|||See comments inline.
Linchi
"Uri Dimant" wrote:

> zorro
> Is it 64 bit or 32 bit?
> You do need 3GB switch
>
Why?

> AWE is for utilyze more than 4GB
I keep hearing that AWE is for utilizing more than 4GB. Not sure where that
comes from. Technically, it's not.

> Yes, unless you use 64 bit , then you do not need AWE , make sure that an
> account SQL Serverc runs under is added to LockPages in Memory Local Group
> Policy
>
> Task Manager
>
>
> "zorro" <zorro@.discussions.microsoft.com> wrote in message
> news:C2009B55-7B5D-4F65-8986-3AF00547FA1E@.microsoft.com...
>
>
|||Hi Linchi
You are right, that technically, it's not. If I have 4GB RAM and want tio
utilize 3GB for SQL Server, so I simple add switch in BOOT.INI and why
bother enabling AWE? What do you think?
"Linchi Shea" <LinchiShea@.discussions.microsoft.com> wrote in message
news:61A4195E-F98E-4AE2-A24F-0BC6AC668D08@.microsoft.com...[vbcol=seagreen]
> See comments inline.
> Linchi
> "Uri Dimant" wrote:
>
> Why?
>
> I keep hearing that AWE is for utilizing more than 4GB. Not sure where
> that
> comes from. Technically, it's not.