Showing posts with label weird. Show all posts
Showing posts with label weird. Show all posts

Thursday, March 29, 2012

Delete data, but file size increase

I encounter one weird problem, I have a database with around 7 GB ...
when I delete a bunch of data from it, it suppose to reduce the
database file size, but weirdly, the file size increase to 8 GB.

Wondering why. Is it suppose to be like that?
Is it the architecture is designed to work like that?

Is there any way for me to reduce the database file size?

Thanks.

Peter CCHIf you take back daily with append data option, the size gets increased

Madhivanan|||What utility are you using to measure the database size?

Are you using sp_spaceused and just noting the "Database Size" column?
This also includes the transaction log, and this will increase when you
delete data from the database, until you either truncate or backup your
transaction log.

You can also get wrong space values from sp_spaceused if you are making
frequent and large changes to data, such as updates and deletes, as the
counters that record the new extent allocations and deallocations don't
get updated dynamically every time.

Try running sp_spaceused in the database, and note the values in all
columns.
Now, repeat this, but execute sp_spaceused @.updateusage='true'

(N.B. This can take a few minutes to run. I have never had a problem
running this on a live database during the day, but be aware that it
runs DBCC UPDATEUSAGE and forces updates to the sysindexes catalog; it
is less-risky to run it out of hours)

Here's a good example from one of my databases:

sp_spaceused
go

database_name, database_size, unallocated space
Roms, 22541.00 MB, -4407.84 MB

reserved, data, index_size, unused
27589472 KB, 16362352 KB, 11146992 KB, 80128 KB

Note the negative Unallocated Space value.

Now I run:

sp_spaceused @.updateusage='true'

database_name, database_size, unallocated space
Roms, 22541.00 MB, 1.43 MB

reserved, data, index_size, unused
23074376 KB, 15558360 KB, 7447464 KB, 68552 KB

You can see that, prior to this, the Reserved, Data and Index_Size
columns were all showing more space being used than the true value. I
suggest you try this after you delete your data in future, and see if
you get the values you expect.sql

Friday, March 9, 2012

Definition of Object Has Changed Since it was last compiles

All I'm having a weird problem.. I have 2 stored procedures that run 98% of the time without any issue but inconsistenly through the following error.

'The definition of object 'proc name goes here' has changed since it was compiled'

We have adding 'with recompile' to the proc but we still get this error - but not consistently. The stored proc is not changing nor is the table structure of any of the objects that are being used in the sp. Any idea to trace down the why this is happening or what objecte it thinks is changing? Let me know your thoughts.

Ken

We've started experiencing this, except:
- It's occurring 100% of the time on SQL 2K5, for a particular data set, but not for another data set on the same schema.
- It never occurred in SQL 2K.
- It only occurs on SQL 2K5 (w/ DB in 2K compatibility mode)

My first reaction, for our case, is that it's a broken 2K5/2K compatibility issue. We're doing something pretty shady - disabling a trigger on table B from within a trigger firing on table A. IOW:

Trigger A, Table A:
- Disable trigger B on table B
- UPDATE table B
- Re-enable trigger B

So I'm guessing SQL 2K5 is finally calling us out on this. But I'd still prefer a quick fix to rewriting the triggers. Have you had any luck with your issue?

Tuesday, February 14, 2012

Default protocols ..

Hi everyone,
I have something weird with an SQL Client connection and the default
protocols.
I set the TCP has the only one default client protocol with the CLICONFG
tool. On most of the computers, when a client wants to connect to a server
with its IP (somewhere over Internet), it uses the default protocols
perfectly.
Let's say, ie : osql -S IP -U usedID -P password
BUT. Sometimes, it doesn't. if I add the port to the server ip, then it
works. But I don't want to (in fact, I can't do it into my distribued
application) !
osql -S IP,1433 -U usedID -P password
Of course, I checked the default port fort the TCP and it is the good one.
If a run a netstat to see what happens, I can see something like that :
TCP POSTE1:2612 IP:ms-sql-s TIME_WAIT
TCP POSTE1:2613 IP:ms-sql-s TIME_WAIT
TCP POSTE1:2614 IP:ms-sql-s TIME_WAIT
TCP POSTE1:2615 IP:ms-sql-s TIME_WAIT
TCP POSTE1:2616 IP:ms-sql-s TIME_WAIT
TCP POSTE1:2617 IP:ms-sql-s TIME_WAIT
TCP POSTE1:2618 IP:ms-sql-s TIME_WAIT
So, it uses the TCP, connects to the right port BUT does not makes the
connection. If I just add this f**** ,1433, then it connects fine to the
same port. Really crazy...
Does anyone have an idea please ?
Thanks a lot !
Patrick
Some low probability possibilities:
When you say, "I checked the default port fort the TCP and it is the good
one" did you mean you checked the default
port for TCP/IP in the Client Network Utility on the client that can't
connect?
And are you in a totally SQL Server 2000 environment? If your client has SQL
Server 2005 installed, you may be using the SQL Server Native Client, and
need to check the client protocol and port number using the SQL Server
Configuration Manager. If your server is SQL Server 2005 there are
additional things you can check, but it sounds like it's not.
Rick Byham (MSFT)
This posting is provided "AS IS" with no warranties, and confers no rights.
"Patrick B." <patrick@.ikosoft.com> wrote in message
news:eOPhBmIyHHA.484@.TK2MSFTNGP06.phx.gbl...
> Hi everyone,
> I have something weird with an SQL Client connection and the default
> protocols.
> I set the TCP has the only one default client protocol with the CLICONFG
> tool. On most of the computers, when a client wants to connect to a server
> with its IP (somewhere over Internet), it uses the default protocols
> perfectly.
> Let's say, ie : osql -S IP -U usedID -P password
> BUT. Sometimes, it doesn't. if I add the port to the server ip, then it
> works. But I don't want to (in fact, I can't do it into my distribued
> application) !
> osql -S IP,1433 -U usedID -P password
> Of course, I checked the default port fort the TCP and it is the good one.
> If a run a netstat to see what happens, I can see something like that :
> TCP POSTE1:2612 IP:ms-sql-s TIME_WAIT
> TCP POSTE1:2613 IP:ms-sql-s TIME_WAIT
> TCP POSTE1:2614 IP:ms-sql-s TIME_WAIT
> TCP POSTE1:2615 IP:ms-sql-s TIME_WAIT
> TCP POSTE1:2616 IP:ms-sql-s TIME_WAIT
> TCP POSTE1:2617 IP:ms-sql-s TIME_WAIT
> TCP POSTE1:2618 IP:ms-sql-s TIME_WAIT
> So, it uses the TCP, connects to the right port BUT does not makes the
> connection. If I just add this f**** ,1433, then it connects fine to the
> same port. Really crazy...
> Does anyone have an idea please ?
> Thanks a lot !
> Patrick
>
|||Hi,
Thank you for you reply.
Yes, it is in a totally SQL Server 2000 environment, and every server has an
instance. And yes, I checked the default port in the Client Utility on the
client that can't connect.
I found new things, more and more weird.
On a client that can't connect, I tried with the local server (we install an
instancied MSDE with all of our softwares, and the configuration on clients
and servers are the same). The problem is exactly the same with the
localhost.
osql -S 127.0.0.1 -E ==> failed
osql -S 127.0.0.1\INSTANCENAME -E ==> ok
osql -S 127.0.0.1,1433 -E ==> ok
But on most pcs, those 3 cases are working perfectly ! I really don't
understand...
Thanks again,
Patrick
(sorry for my poor english !)
"Rick Byham, (MSFT)" <rickbyh@.REDMOND.CORP.MICROSOFT.COM> a crit dans le
message de news: 99849E87-A62F-40B7-AF97-567C1A3E9A6F@.microsoft.com...
> Some low probability possibilities:
> When you say, "I checked the default port fort the TCP and it is the good
> one" did you mean you checked the default
> port for TCP/IP in the Client Network Utility on the client that can't
> connect?
> And are you in a totally SQL Server 2000 environment? If your client has
> SQL Server 2005 installed, you may be using the SQL Server Native Client,
> and need to check the client protocol and port number using the SQL Server
> Configuration Manager. If your server is SQL Server 2005 there are
> additional things you can check, but it sounds like it's not.
> --
> Rick Byham (MSFT)
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> "Patrick B." <patrick@.ikosoft.com> wrote in message
> news:eOPhBmIyHHA.484@.TK2MSFTNGP06.phx.gbl...
>

Default protocols ..

Hi everyone,
I have something weird with an SQL Client connection and the default
protocols.
I set the TCP has the only one default client protocol with the CLICONFG
tool. On most of the computers, when a client wants to connect to a server
with its IP (somewhere over Internet), it uses the default protocols
perfectly.
Let's say, ie : osql -S IP -U usedID -P password
BUT. Sometimes, it doesn't. if I add the port to the server ip, then it
works. But I don't want to (in fact, I can't do it into my distribued
application) !
osql -S IP,1433 -U usedID -P password
Of course, I checked the default port fort the TCP and it is the good one.
If a run a netstat to see what happens, I can see something like that :
TCP POSTE1:2612 IP:ms-sql-s TIME_WAIT
TCP POSTE1:2613 IP:ms-sql-s TIME_WAIT
TCP POSTE1:2614 IP:ms-sql-s TIME_WAIT
TCP POSTE1:2615 IP:ms-sql-s TIME_WAIT
TCP POSTE1:2616 IP:ms-sql-s TIME_WAIT
TCP POSTE1:2617 IP:ms-sql-s TIME_WAIT
TCP POSTE1:2618 IP:ms-sql-s TIME_WAIT
So, it uses the TCP, connects to the right port BUT does not makes the
connection. If I just add this f**** ,1433, then it connects fine to the
same port. Really crazy...
Does anyone have an idea please ?
Thanks a lot !
PatrickSome low probability possibilities:
When you say, "I checked the default port fort the TCP and it is the good
one" did you mean you checked the default
port for TCP/IP in the Client Network Utility on the client that can't
connect?
And are you in a totally SQL Server 2000 environment? If your client has SQL
Server 2005 installed, you may be using the SQL Server Native Client, and
need to check the client protocol and port number using the SQL Server
Configuration Manager. If your server is SQL Server 2005 there are
additional things you can check, but it sounds like it's not.
--
Rick Byham (MSFT)
This posting is provided "AS IS" with no warranties, and confers no rights.
"Patrick B." <patrick@.ikosoft.com> wrote in message
news:eOPhBmIyHHA.484@.TK2MSFTNGP06.phx.gbl...
> Hi everyone,
> I have something weird with an SQL Client connection and the default
> protocols.
> I set the TCP has the only one default client protocol with the CLICONFG
> tool. On most of the computers, when a client wants to connect to a server
> with its IP (somewhere over Internet), it uses the default protocols
> perfectly.
> Let's say, ie : osql -S IP -U usedID -P password
> BUT. Sometimes, it doesn't. if I add the port to the server ip, then it
> works. But I don't want to (in fact, I can't do it into my distribued
> application) !
> osql -S IP,1433 -U usedID -P password
> Of course, I checked the default port fort the TCP and it is the good one.
> If a run a netstat to see what happens, I can see something like that :
> TCP POSTE1:2612 IP:ms-sql-s TIME_WAIT
> TCP POSTE1:2613 IP:ms-sql-s TIME_WAIT
> TCP POSTE1:2614 IP:ms-sql-s TIME_WAIT
> TCP POSTE1:2615 IP:ms-sql-s TIME_WAIT
> TCP POSTE1:2616 IP:ms-sql-s TIME_WAIT
> TCP POSTE1:2617 IP:ms-sql-s TIME_WAIT
> TCP POSTE1:2618 IP:ms-sql-s TIME_WAIT
> So, it uses the TCP, connects to the right port BUT does not makes the
> connection. If I just add this f**** ,1433, then it connects fine to the
> same port. Really crazy...
> Does anyone have an idea please ?
> Thanks a lot !
> Patrick
>|||Hi,
Thank you for you reply.
Yes, it is in a totally SQL Server 2000 environment, and every server has an
instance. And yes, I checked the default port in the Client Utility on the
client that can't connect.
I found new things, more and more weird.
On a client that can't connect, I tried with the local server (we install an
instancied MSDE with all of our softwares, and the configuration on clients
and servers are the same). The problem is exactly the same with the
localhost.
osql -S 127.0.0.1 -E ==> failed
osql -S 127.0.0.1\INSTANCENAME -E ==> ok
osql -S 127.0.0.1,1433 -E ==> ok
But on most pcs, those 3 cases are working perfectly ! I really don't
understand...
Thanks again,
Patrick
(sorry for my poor english !)
"Rick Byham, (MSFT)" <rickbyh@.REDMOND.CORP.MICROSOFT.COM> a crit dans le
message de news: 99849E87-A62F-40B7-AF97-567C1A3E9A6F@.microsoft.com...
> Some low probability possibilities:
> When you say, "I checked the default port fort the TCP and it is the good
> one" did you mean you checked the default
> port for TCP/IP in the Client Network Utility on the client that can't
> connect?
> And are you in a totally SQL Server 2000 environment? If your client has
> SQL Server 2005 installed, you may be using the SQL Server Native Client,
> and need to check the client protocol and port number using the SQL Server
> Configuration Manager. If your server is SQL Server 2005 there are
> additional things you can check, but it sounds like it's not.
> --
> Rick Byham (MSFT)
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> "Patrick B." <patrick@.ikosoft.com> wrote in message
> news:eOPhBmIyHHA.484@.TK2MSFTNGP06.phx.gbl...
>