Showing posts with label showing. Show all posts
Showing posts with label showing. Show all posts

Thursday, March 29, 2012

Database in recovery

I have a database currently showing to be in recovery. I have not been able to find a GUI method to monitor the progress (to determine when it might complete) so is there a command line T-SQL method to monitor the recovery process?

If this is 2005, this might be what you need:

select der.session_id, der.command, der.status, der.percent_complete, *
from sys.dm_exec_requests as der

It works for other types of commands that have known progress indicators. If not, then I really don't think it tells you. You might also check the error log to see how long it took the previous time...

|||

Thanks Louis! It worked fine and the database eventually did recover.

|||Thanks Louis, it works for me too..

Database images not showing

How should I store an image into my SQL database in order to be able to read
it using Reporting Services Image control? I have a table with an image
field (datatype of the field is 'Image').
I have tried several ways and the report is always rendered with the image
showing a red cross inside it (image broken). However if I read the table
using MS Access ADP and double click on the image field, MS Paint opens and
shows up the image (this is a bmp image). I have also set the MIMEType of
the rs image field to 'image/bmp' (filling this field this is compulsory
with database images).
It seems that, even though the database field contents ('Image' field) are
properly stored, Reporting Services does not know how to handle it. May I
need to do a CONVERT(Binary, MyImageField) or the database field be of
another type? How should I store the image inside the database so that RS
could read it?
Regards.
PS: This is RS SP2.This sounds like the images are stored as OLE images in the database (e.g.
Access would convert images into OLE images). You can try the following
expression to get rid of the OLE chunk:
=System.Convert.FromBase64String(Mid(System.Convert.ToBase64String(Fields!Picture.Value),
105))
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"David Lightman Robles" <dlightman@.NOSPAMiname.com> wrote in message
news:e5gQDOJVFHA.584@.TK2MSFTNGP15.phx.gbl...
> How should I store an image into my SQL database in order to be able to
> read it using Reporting Services Image control? I have a table with an
> image field (datatype of the field is 'Image').
> I have tried several ways and the report is always rendered with the image
> showing a red cross inside it (image broken). However if I read the table
> using MS Access ADP and double click on the image field, MS Paint opens
> and shows up the image (this is a bmp image). I have also set the MIMEType
> of the rs image field to 'image/bmp' (filling this field this is
> compulsory with database images).
> It seems that, even though the database field contents ('Image' field) are
> properly stored, Reporting Services does not know how to handle it. May I
> need to do a CONVERT(Binary, MyImageField) or the database field be of
> another type? How should I store the image inside the database so that RS
> could read it?
> Regards.
> PS: This is RS SP2.
>|||Thanks for your reply but it seems that there should be another reason. Your
explanation is on the good road, but
I have tried your expression, with that 105 varying from 100 to 110 with the
same results. The red cross is still there.
Any other suggestion? Regards.
PS: Just for further debugging, I have an output of the first 950 bytes
generated by the expression:
=System.Convert.ToBase64String(Fields!Picture.Value)
Here they follow:
FRw5AAIAAAAXAA4AFAArAP////9JbWFnZW4gZGUgbWFwYSBkZSBiaXRzAFBhaW50LlBpY3R1cmUAAQUAAAIAAAAHAAAAUEJydXNoAAAAAAAAAAAAYEgAAEJNYEgAAAAAAAB2AAAAKAAAAM8AAACxAAAAAQAEAAAAAAAAAAAAEBcAABAXAAAAAAAAAAAAAAAAAAD///8A+vr6APPz8wDn5+cA29vbAMzMzAC5ubkAo6OjAIuLiwBzc3MAWVlZAEJCQgAvLy8AHx8fAA8PDwAREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREBEREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREQERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERAREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREBERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
"Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> escribió en el
mensaje news:eL5pK2LVFHA.612@.TK2MSFTNGP12.phx.gbl...
> This sounds like the images are stored as OLE images in the database (e.g.
> Access would convert images into OLE images). You can try the following
> expression to get rid of the OLE chunk:
> =System.Convert.FromBase64String(Mid(System.Convert.ToBase64String(Fields!Picture.Value),
> 105))
> --
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> "David Lightman Robles" <dlightman@.NOSPAMiname.com> wrote in message
> news:e5gQDOJVFHA.584@.TK2MSFTNGP15.phx.gbl...
>> How should I store an image into my SQL database in order to be able to
>> read it using Reporting Services Image control? I have a table with an
>> image field (datatype of the field is 'Image').
>> I have tried several ways and the report is always rendered with the
>> image showing a red cross inside it (image broken). However if I read the
>> table using MS Access ADP and double click on the image field, MS Paint
>> opens and shows up the image (this is a bmp image). I have also set the
>> MIMEType of the rs image field to 'image/bmp' (filling this field this is
>> compulsory with database images).
>> It seems that, even though the database field contents ('Image' field)
>> are properly stored, Reporting Services does not know how to handle it.
>> May I need to do a CONVERT(Binary, MyImageField) or the database field be
>> of another type? How should I store the image inside the database so that
>> RS could read it?
>> Regards.
>> PS: This is RS SP2.
>|||More information on the subject:
I have been doing more tests with this sample bitmap. I have sent it to
myself via email just to read the source code of the message and extract the
base64 of the bitmap. The header of attachment and some hundreds the
begining bytes are here:
--_=_NextPart_001_01C55532.6E34D77F
Content-Type: image/bmp;
name="PHOTO.BMP"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="PHOTO.BMP"
Qk1gSAAAAAAAAHYAAAAoAAAAzwAAALEAAAABAAQAAAAAAAAAAAAQFwAAEBcAAAAAAAAAAAAAAAAA
AP///wD6+voA8/PzAOfn5wDb29sAzMzMALm5uQCjo6MAi4uLAHNzcwBZWVkAQkJCAC8vLwAfHx8A
Dw8PABERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
EREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREQERERERER
ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
ERERERERERERERERERERERERERERERERERERERERERERERERERERERARERERERERERERERERERER
ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
EREREREREREREREREREREREREREREREREREREREREBERERERERERERERERERERERERERERERERER
ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
etc...
If I copy this base64 chunk of data and set the Reporting Services image
field to:
=System.Convert.FromBase64String("the chunk")
The image is shown perfecly on the report.
However, if I compare some bytes of the begining of this chunk (which is
shown to be correct) and try to find it somewhere on the string returned by:
=System.Convert.ToBase64String(Fields!Picture.Value)
which is:
FRw5AAIAAAAXAA4AFAArAP////9JbWFnZW4gZGUgbWFwYSBkZSBiaXRzAFBhaW50LlBpY3R1cmUAAQUAAAIAAAAHAAAAUEJydXNoAAAAAAAAAAAAYEgAAEJNYEgAAAAAAAB2AAAAKAAAAM8AAACxAAAAAQAEAAAAAAAAAAAAEBcAABAXAAAAAAAAAAAAAAAAAAD///8A+vr6APPz8wDn5+cA29vbAMzMzAC5ubkAo6OjAIuLiwBzc3MAWVlZAEJCQgAvLy8AHx8fAA8PDwAREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREBEREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREQERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERAREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREBERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
I can't find it anywhere. There is no 'Qk1gS' substring in it. Now my
question are: Are there multiple ways of converting a file into a base64
string? How can I remove the OLE header of the database if I cannot find the
matching of the image REAL data using this 'comparing' approach?
Regards.
"David Lightman Robles" <dlightman@.NOSPAMiname.com> escribió en el mensaje
news:%23AtcAySVFHA.2124@.TK2MSFTNGP14.phx.gbl...
> Thanks for your reply but it seems that there should be another reason.
> Your explanation is on the good road, but
> I have tried your expression, with that 105 varying from 100 to 110 with
> the same results. The red cross is still there.
> Any other suggestion? Regards.
> PS: Just for further debugging, I have an output of the first 950 bytes
> generated by the expression:
> =System.Convert.ToBase64String(Fields!Picture.Value)
> Here they follow:
> FRw5AAIAAAAXAA4AFAArAP////9JbWFnZW4gZGUgbWFwYSBkZSBiaXRzAFBhaW50LlBpY3R1cmUAAQUAAAIAAAAHAAAAUEJydXNoAAAAAAAAAAAAYEgAAEJNYEgAAAAAAAB2AAAAKAAAAM8AAACxAAAAAQAEAAAAAAAAAAAAEBcAABAXAAAAAAAAAAAAAAAAAAD///8A+vr6APPz8wDn5+cA29vbAMzMzAC5ubkAo6OjAIuLiwBzc3MAWVlZAEJCQgAvLy8AHx8fAA8PDwAREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREBEREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREQERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERAREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREBERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
>
> "Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> escribió en el
> mensaje news:eL5pK2LVFHA.612@.TK2MSFTNGP12.phx.gbl...
>> This sounds like the images are stored as OLE images in the database
>> (e.g. Access would convert images into OLE images). You can try the
>> following expression to get rid of the OLE chunk:
>> =System.Convert.FromBase64String(Mid(System.Convert.ToBase64String(Fields!Picture.Value),
>> 105))
>> --
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> "David Lightman Robles" <dlightman@.NOSPAMiname.com> wrote in message
>> news:e5gQDOJVFHA.584@.TK2MSFTNGP15.phx.gbl...
>> How should I store an image into my SQL database in order to be able to
>> read it using Reporting Services Image control? I have a table with an
>> image field (datatype of the field is 'Image').
>> I have tried several ways and the report is always rendered with the
>> image showing a red cross inside it (image broken). However if I read
>> the table using MS Access ADP and double click on the image field, MS
>> Paint opens and shows up the image (this is a bmp image). I have also
>> set the MIMEType of the rs image field to 'image/bmp' (filling this
>> field this is compulsory with database images).
>> It seems that, even though the database field contents ('Image' field)
>> are properly stored, Reporting Services does not know how to handle it.
>> May I need to do a CONVERT(Binary, MyImageField) or the database field
>> be of another type? How should I store the image inside the database so
>> that RS could read it?
>> Regards.
>> PS: This is RS SP2.
>>
>|||Instead of doing tests with the final image, I have created a 5x5 pix bitmap
to work/test with.
The Base64 encoding of it (grabbed from an email sourcecode is):
Qk2GAAAAAAAAADYAAAAoAAAABQAAAAUAAAABABgAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAA////////////////////AP///wAA/////////wAA/wD///////////////////8A////////AAD/////AAD/AAAA/////////////////wA=
It works perfectly if I set the value property of the rs image to:
=System.Convert.FromBase64String("the former base64 string")
Now, the database version of the same file: I set a texbox in the RS report
and set its value to =System.Convert.ToBase64String(Fields!Picture.Value) so
that I could retrieve the complete base64 of the image stored in the
database. Here it is:
FRw5AAIAAAAXAA4AFAArAP////9JbWFnZW4gZGUgbWFwYSBkZSBiaXRzAFBhaW50LlBpY3R1cmUAAQUAAAIAAAAHAAAAUEJydXNoAAAAAAAAAAAAoAAAAEJNhgAAAAAAAAA2AAAAKAAAAAUAAAAFAAAAAQAYAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAP///////////////////wD///8AAP////////8AAP8A////////////////////AP///////wAA/////wAA/wAAAP////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBQAAAAAAAIqtBf4=
By other means, I have been able to revert this base64 string back to binary
and here are the results:
9 + ÿÿÿÿImagen de mapa de bits Paint.Picture PBrush
BM? 6 ( P ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿ
ÿÿÿÿÿÿÿ ÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿ ÿÿÿÿ ÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿ
S­ þ
Of course, I have some rubbish here. But not everything is lost: Now I can
see that a localized language string is included in the OLE chunk before the
'BM' indicating the begining of the bitmap file. And now the final question:
Should I use other string than
=System.Convert.FromBase64String(Mid(System.Convert.ToBase64String(Fields!Picture.Value),
105))
when the locale of the systems/servers/software is not english? In my case
I'm using spanish and since the string 'Imagen de mapa de bits' is not as
long as 'Bitmap image file', I think that 105 is not valid/correct when
other languages are used.
After some calculations I think that the OLE chunk size for spanish (which
is my case) is 121 instead of 105. However the red cross is still there!!!!!
:(((
Another aproach, instead of letting RS cropping the image ole data, is to
retrieve the image from the database without it. Is it feasible to retrieve
just a 'substring' of the image?
Please help. I really need it. Thaks.
"David Lightman Robles" <dlightman@.NOSPAMiname.com> escribió en el mensaje
news:%23AtcAySVFHA.2124@.TK2MSFTNGP14.phx.gbl...
> Thanks for your reply but it seems that there should be another reason.
> Your explanation is on the good road, but
> I have tried your expression, with that 105 varying from 100 to 110 with
> the same results. The red cross is still there.
> Any other suggestion? Regards.
> PS: Just for further debugging, I have an output of the first 950 bytes
> generated by the expression:
> =System.Convert.ToBase64String(Fields!Picture.Value)
> Here they follow:
> FRw5AAIAAAAXAA4AFAArAP////9JbWFnZW4gZGUgbWFwYSBkZSBiaXRzAFBhaW50LlBpY3R1cmUAAQUAAAIAAAAHAAAAUEJydXNoAAAAAAAAAAAAYEgAAEJNYEgAAAAAAAB2AAAAKAAAAM8AAACxAAAAAQAEAAAAAAAAAAAAEBcAABAXAAAAAAAAAAAAAAAAAAD///8A+vr6APPz8wDn5+cA29vbAMzMzAC5ubkAo6OjAIuLiwBzc3MAWVlZAEJCQgAvLy8AHx8fAA8PDwAREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREBEREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREQERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERAREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREBERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
>
> "Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> escribió en el
> mensaje news:eL5pK2LVFHA.612@.TK2MSFTNGP12.phx.gbl...
>> This sounds like the images are stored as OLE images in the database
>> (e.g. Access would convert images into OLE images). You can try the
>> following expression to get rid of the OLE chunk:
>> =System.Convert.FromBase64String(Mid(System.Convert.ToBase64String(Fields!Picture.Value),
>> 105))
>> --
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> "David Lightman Robles" <dlightman@.NOSPAMiname.com> wrote in message
>> news:e5gQDOJVFHA.584@.TK2MSFTNGP15.phx.gbl...
>> How should I store an image into my SQL database in order to be able to
>> read it using Reporting Services Image control? I have a table with an
>> image field (datatype of the field is 'Image').
>> I have tried several ways and the report is always rendered with the
>> image showing a red cross inside it (image broken). However if I read
>> the table using MS Access ADP and double click on the image field, MS
>> Paint opens and shows up the image (this is a bmp image). I have also
>> set the MIMEType of the rs image field to 'image/bmp' (filling this
>> field this is compulsory with database images).
>> It seems that, even though the database field contents ('Image' field)
>> are properly stored, Reporting Services does not know how to handle it.
>> May I need to do a CONVERT(Binary, MyImageField) or the database field
>> be of another type? How should I store the image inside the database so
>> that RS could read it?
>> Regards.
>> PS: This is RS SP2.
>>
>

Sunday, March 25, 2012

Database free space

I noticed a database was showing 0 mb of free space even though I see 7 gb of
free space when I go to shrink. I added another 10 gb and I still see 0 mb of
free space. Is this a bug?
Try executing DBCC UPDATEUSAGE - you can find more
information on the command in books online.
Then check the space after you have executed the command.
-Sue
On Tue, 9 Nov 2004 13:19:07 -0800, "Derek"
<evans561@.hotmail.com> wrote:

>I noticed a database was showing 0 mb of free space even though I see 7 gb of
>free space when I go to shrink. I added another 10 gb and I still see 0 mb of
>free space. Is this a bug?

Database free space

I noticed a database was showing 0 mb of free space even though I see 7 gb of
free space when I go to shrink. I added another 10 gb and I still see 0 mb of
free space. Is this a bug?Try executing DBCC UPDATEUSAGE - you can find more
information on the command in books online.
Then check the space after you have executed the command.
-Sue
On Tue, 9 Nov 2004 13:19:07 -0800, "Derek"
<evans561@.hotmail.com> wrote:
>I noticed a database was showing 0 mb of free space even though I see 7 gb of
>free space when I go to shrink. I added another 10 gb and I still see 0 mb of
>free space. Is this a bug?

Database free space

I noticed a database was showing 0 mb of free space even though I see 7 gb o
f
free space when I go to shrink. I added another 10 gb and I still see 0 mb o
f
free space. Is this a bug?Try executing DBCC UPDATEUSAGE - you can find more
information on the command in books online.
Then check the space after you have executed the command.
-Sue
On Tue, 9 Nov 2004 13:19:07 -0800, "Derek"
<evans561@.hotmail.com> wrote:

>I noticed a database was showing 0 mb of free space even though I see 7 gb
of
>free space when I go to shrink. I added another 10 gb and I still see 0 mb
of
>free space. Is this a bug?

Thursday, March 22, 2012

database file has incorrect modified date

Hello all,
I have a very critical data file currently in use showing a modified date of
5/13/06, and the file is modified very often by an invoice application. When
I attempt to do a restore the file has the right date, I don't understand wh
y
the modified date is incorrect.
Should the file modified date not be very current, although if query for
invoices with date greater than 6/2 it return several. am I missreading the
modified date?
Please help.ITDUDE27 wrote on Mon, 5 Jun 2006 09:05:01 -0700:

> Hello all,
> I have a very critical data file currently in use showing a modified date
> of 5/13/06, and the file is modified very often by an invoice application.
> When I attempt to do a restore the file has the right date, I don't
> understand why the modified date is incorrect.
> Should the file modified date not be very current, although if query for
> invoices with date greater than 6/2 it return several. am I missreading
> the modified date?
> Please help.
You can't go by the last modified date of the mdf/ldf files on the hard
disk, as these dates are only normally updated when SQL Server feels the
need to. I have a database on my main server right now that processes all
the transactions for the company and has a last modified date of 25th May
2006, and a matching LDF with last modified of 15th September 2005.
Actually, most of the files in there are dated 15th Sept 2005, which is the
day this server had them all restored to it when it went live.
Dan|||"ITDUDE27" <ITDUDE27@.discussions.microsoft.com> wrote in message
news:1A118DF6-E57A-428A-935D-AE676D8BEF83@.microsoft.com...
> Hello all,
> I have a very critical data file currently in use showing a modified date
of
> 5/13/06, and the file is modified very often by an invoice application.
When
> I attempt to do a restore the file has the right date, I don't understand
why
> the modified date is incorrect.
>
The last modified date will only change when the file size is changed or the
database is open or closed.
Unless you have autoclose enabled (you should NOT normally) the only time
the database will normally close is when you stop or start the server.
If your server is up for a year, it's not unheard of to have a last modified
date of a year ago.

> Should the file modified date not be very current, although if query for
> invoices with date greater than 6/2 it return several. am I missreading
the
> modified date?
> Please help.

database file has incorrect modified date

Hello all,
I have a very critical data file currently in use showing a modified date of
5/13/06, and the file is modified very often by an invoice application. When
I attempt to do a restore the file has the right date, I don't understand why
the modified date is incorrect.
Should the file modified date not be very current, although if query for
invoices with date greater than 6/2 it return several. am I missreading the
modified date?
Please help.ITDUDE27 wrote on Mon, 5 Jun 2006 09:05:01 -0700:
> Hello all,
> I have a very critical data file currently in use showing a modified date
> of 5/13/06, and the file is modified very often by an invoice application.
> When I attempt to do a restore the file has the right date, I don't
> understand why the modified date is incorrect.
> Should the file modified date not be very current, although if query for
> invoices with date greater than 6/2 it return several. am I missreading
> the modified date?
> Please help.
You can't go by the last modified date of the mdf/ldf files on the hard
disk, as these dates are only normally updated when SQL Server feels the
need to. I have a database on my main server right now that processes all
the transactions for the company and has a last modified date of 25th May
2006, and a matching LDF with last modified of 15th September 2005.
Actually, most of the files in there are dated 15th Sept 2005, which is the
day this server had them all restored to it when it went live.
Dan|||"ITDUDE27" <ITDUDE27@.discussions.microsoft.com> wrote in message
news:1A118DF6-E57A-428A-935D-AE676D8BEF83@.microsoft.com...
> Hello all,
> I have a very critical data file currently in use showing a modified date
of
> 5/13/06, and the file is modified very often by an invoice application.
When
> I attempt to do a restore the file has the right date, I don't understand
why
> the modified date is incorrect.
>
The last modified date will only change when the file size is changed or the
database is open or closed.
Unless you have autoclose enabled (you should NOT normally) the only time
the database will normally close is when you stop or start the server.
If your server is up for a year, it's not unheard of to have a last modified
date of a year ago.
> Should the file modified date not be very current, although if query for
> invoices with date greater than 6/2 it return several. am I missreading
the
> modified date?
> Please help.

Database Field showing as zero in report footer but works in group footer

I'm fairly new to crystal so there may be an obvious solution but I just can't find it. So any help what-so-ever would be excellent and much appreciated...

Problem:

Database field shows correct value and works in formulas properly in group footer.
In Report footer this same database field shows as zero and therefore other formulas in the report footer do not calculate correctly.

Any solutions?Please. Any help would be greatly appreciated. I'm kind of in a time crunch.

I'm not sure why a database field would show the value in the group footer and come up zero in the report footer.

Any ideas??|||Sorry, don't know why either - the report footer always shows the final database record for me!
I have read of other people having this problem, and I believe that assigning the fiele to a shared variable has allowed the value to be used.|||I gave it a variable and now it works. How weird is that?!

Thanks for your help!sql

Monday, March 19, 2012

Database driven images not showing in non-english systems

I'd like to share with the community the results of 3 days of testings and
headaches. I finally found the reason for the problem and a way to solve it:
As stated in
http://www.microsoft.com/technet/prodtechnol/sql/2000/deploy/migratereports.mspx
dealing with 'How to Migrate Access Reports to Reporting Services', when
talking about database-stored images, the writer (Adam Cogan) says:
[...]
3. Replace the default value in the image Value field with the following
expression as shown in Figure 16:
=System.Convert.FromBase64String(Mid(System.Convert.ToBase64String(Fields!Picture.Value),105))
[...]
However this piece of code does not work under certain conditions. I have
seen several forum pages of people posting they are having the same problem
(see
http://forums.devarticles.com/archive/t-11844/displaying-image-fields-in-reporting-services )
. The former code takes the assumption that the images stored in the
database were saved by a English/American localised application. If you are
using an English version of MS Access, do copy a bitmap file and paste it
into an image field of SQL table (using ADP Access project), MS Access adds
an OLE header and trailer to the image you are storing. In the English case,
the header is 78 bytes and trailer 38 bytes. However, this header is not of
that size if you are using another language. In my case, we use spanish
applications and the OLE header for bitmap files is 88 bytes instead of 78
(the trailer is also 38 bytes but you can forget about it).
If you use the former piece of code in your reports and you are not using an
English OS and applications you will see red crosses on your reports (this
is an assumption of my own because at least in the Spanish case the header
size differs from English; I suppose the same might happen in German,
French, etc.).
The reason of this behaviour is because when converting those 78 bytes of
english header into a Base64 string, it turns to be exactly 104 Base64
chars:
78 bytes * 8 bits each = 624 bits
If you convert that stream of 624 bits using Base64 (6 bits each char):
624 bits / 6 bits = 104 Base64 chars
So the next Base64 char (105) belongs completely to the bitmap file data and
you don't experience any problem if you use the Mid function to cut the
string by 105th char and then FromBase64String to convert the Base64 string
back to a byte() (byte array).
However if you use Spanish applications, the OLE header is 88 bytes (704
bits). If you try to convert that stream of bits into a Base64 string:
740 bits / 6 bits each Base64 char = 123,333... chars
What does it mean? It means that it will use 123 chars and 2 bits of the
next char. The other 4 bits of the 124th Base64 char will have data
belonging to the bitmap file. And here is the tricky part: You CANNOT remove
the OLE header without turning the whole string into rubbish because of
this. Thats why you always see red crosses on your reports no matter the
number you use to remove the OLE header from the Base64 string. No matter if
you use 105, 104, 103, or 123, 124, etc. It will always break the Base64
string and when you convert it back to get the image you will get just
rubish.
THE SOLUTION:
Instead of using Base64 strings to cut the OLE header and try to rebuild the
image, you should use this piece of code in your Image RS components:
=System.Text.Encoding.Default.GetBytes(Mid(System.Text.Encoding.Default.GetString(Fields!Picture.Value),XXX))
Where XXX is the size of the localised OLE header + 1.
For Spanish use XXX = 89
For English use XXX = 79
For other languages you will have to guess (you can do some trial/error
until you find out).
Why is there this difference of sizes in the OLE header? The header contains
the type description of the file (the type column when you see the file
using explorer) using your local language. In Spanish, the default value for
a bitmap file is 'Imagen de mapa de bits' (22 bytes). However in English the
type description for that kind of files (I suppose) is 'Bitmap image' (12
bytes). Hence:
22 - 12 = 10
The OLE header is 10 bytes larger for spanish applications (in the case of
.bmp files). For other type of files the size probably differs (I have not
tested it).
Instead of trial/error to find the XXX value for your local languae you can
try to do this little calculation:
78 + ( length(bitmap type description for your language) - 12) + 1
That's all. Just use:
=System.Text.Encoding.Default.GetBytes(Mid(System.Text.Encoding.Default.GetString(Fields!Picture.Value),XXX))
being XXX the value you have just calculated and forget about the original
Adam's code.
I hope this could help to people experiencing this problem and save their
valuable time. I also hope that Adam Cogan revises his article to replace
his version of the code and explains the restrictions of this alternative
also. People tend to consider documentation under microsoft.com domain to be
fully trustable, but in this case the information was totally wrong for
users that are not using English localised applications.
Regards.Thanks for sharing your findings!
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"David Lightman Robles" <dlightman@.NOSPAMiname.com> wrote in message
news:uyB2AeiVFHA.228@.TK2MSFTNGP12.phx.gbl...
> I'd like to share with the community the results of 3 days of testings and
> headaches. I finally found the reason for the problem and a way to solve
> it:
> As stated in
> http://www.microsoft.com/technet/prodtechnol/sql/2000/deploy/migratereports.mspx
> dealing with 'How to Migrate Access Reports to Reporting Services', when
> talking about database-stored images, the writer (Adam Cogan) says:
> [...]
> 3. Replace the default value in the image Value field with the following
> expression as shown in Figure 16:
> =System.Convert.FromBase64String(Mid(System.Convert.ToBase64String(Fields!Picture.Value),105))
> [...]
> However this piece of code does not work under certain conditions. I have
> seen several forum pages of people posting they are having the same
> problem (see
> http://forums.devarticles.com/archive/t-11844/displaying-image-fields-in-reporting-services )
> . The former code takes the assumption that the images stored in the
> database were saved by a English/American localised application. If you
> are using an English version of MS Access, do copy a bitmap file and paste
> it into an image field of SQL table (using ADP Access project), MS Access
> adds an OLE header and trailer to the image you are storing. In the
> English case, the header is 78 bytes and trailer 38 bytes. However, this
> header is not of that size if you are using another language. In my case,
> we use spanish applications and the OLE header for bitmap files is 88
> bytes instead of 78 (the trailer is also 38 bytes but you can forget about
> it).
> If you use the former piece of code in your reports and you are not using
> an English OS and applications you will see red crosses on your reports
> (this is an assumption of my own because at least in the Spanish case the
> header size differs from English; I suppose the same might happen in
> German, French, etc.).
> The reason of this behaviour is because when converting those 78 bytes of
> english header into a Base64 string, it turns to be exactly 104 Base64
> chars:
> 78 bytes * 8 bits each = 624 bits
> If you convert that stream of 624 bits using Base64 (6 bits each char):
> 624 bits / 6 bits = 104 Base64 chars
> So the next Base64 char (105) belongs completely to the bitmap file data
> and you don't experience any problem if you use the Mid function to cut
> the string by 105th char and then FromBase64String to convert the Base64
> string back to a byte() (byte array).
> However if you use Spanish applications, the OLE header is 88 bytes (704
> bits). If you try to convert that stream of bits into a Base64 string:
> 740 bits / 6 bits each Base64 char = 123,333... chars
> What does it mean? It means that it will use 123 chars and 2 bits of the
> next char. The other 4 bits of the 124th Base64 char will have data
> belonging to the bitmap file. And here is the tricky part: You CANNOT
> remove the OLE header without turning the whole string into rubbish
> because of this. Thats why you always see red crosses on your reports no
> matter the number you use to remove the OLE header from the Base64 string.
> No matter if you use 105, 104, 103, or 123, 124, etc. It will always break
> the Base64 string and when you convert it back to get the image you will
> get just rubish.
>
> THE SOLUTION:
> Instead of using Base64 strings to cut the OLE header and try to rebuild
> the image, you should use this piece of code in your Image RS components:
> =System.Text.Encoding.Default.GetBytes(Mid(System.Text.Encoding.Default.GetString(Fields!Picture.Value),XXX))
> Where XXX is the size of the localised OLE header + 1.
> For Spanish use XXX = 89
> For English use XXX = 79
> For other languages you will have to guess (you can do some trial/error
> until you find out).
> Why is there this difference of sizes in the OLE header? The header
> contains the type description of the file (the type column when you see
> the file using explorer) using your local language. In Spanish, the
> default value for a bitmap file is 'Imagen de mapa de bits' (22 bytes).
> However in English the type description for that kind of files (I suppose)
> is 'Bitmap image' (12 bytes). Hence:
> 22 - 12 = 10
> The OLE header is 10 bytes larger for spanish applications (in the case of
> .bmp files). For other type of files the size probably differs (I have not
> tested it).
> Instead of trial/error to find the XXX value for your local languae you
> can try to do this little calculation:
> 78 + ( length(bitmap type description for your language) - 12) + 1
> That's all. Just use:
> =System.Text.Encoding.Default.GetBytes(Mid(System.Text.Encoding.Default.GetString(Fields!Picture.Value),XXX))
> being XXX the value you have just calculated and forget about the original
> Adam's code.
> I hope this could help to people experiencing this problem and save their
> valuable time. I also hope that Adam Cogan revises his article to replace
> his version of the code and explains the restrictions of this alternative
> also. People tend to consider documentation under microsoft.com domain to
> be fully trustable, but in this case the information was totally wrong for
> users that are not using English localised applications.
> Regards.
>

Sunday, March 11, 2012

Database Diagrams : Showing Relations Column to Column

Hi to all,

As I am going to deal with a huge number of database tables, I thought that drawing their diagrams will be the most professional way of keeping track of what I am doing. So In Enterprise Manager using the Wizard I made it to be drawn nicely.

But I have a problem now. I see that the relations defined among the tables are represented correctly but the line connecting the two table is drawn randomly. I mean the starting point of the line doesnt start from the column having the primary key and doesnt end near to the column having the foreign key. Viewing my diagram I want to see the lines to start and end showing the 2 related key columns.

Is there a way to accomplish this like setting an option, clicking somewhere or should I try to drag the lines to manually?

Thanks in advance

The quick way is to generate the create table statements of the tables and you will see the constraints and if you have constraints you may also check if you have DRI(declarative referential integrity). You can have constraints without DRI so check. Hope this helps.

Thursday, March 8, 2012

database diagram

Hi,
I restored my database from the backup file, which is working fine but it
is not showing the database diagram in SQL server management studio. What do
I need to do for that?
Thanks.
Manj.
Hi Manj,
I understand that after you restored your database, you found that the
database diagram disappeared in SQL Server Management Studio.
If I have misunderstood, please let me know.
Did you restore a SQL Server 2000 or earlier database to SQL Server 2005?
If so, it is by design that the database diagram will not be displayed in
SQL Server 2005 due to structure incompatibility. If your database is SQL
Server 2005, the database diagram should be there in your restored
database.
Anyway for this issue, after you restore your database, you can manually
create a diagram and add all of your tables to it.
Please feel free to let me know if you have any other questions or
concerns. Have a nice day!
Best regards,
Charles Wang
Microsoft Online Community Support
================================================== ===
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
================================================== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====
|||Hi Charles,
Thanks for the reply. It is SQL Server 2005 database. When I click on
database diagram I get the following message:
TITLE: Microsoft SQL Server Management Studio
Database diagram support objects cannot be installed because this database
does not have a valid owner. To continue, first use the Files page of the
Database Properties dialog box or the ALTER AUTHORIZATION statement to set
the database owner to a valid login, then add the database diagram support
objects.
BUTTONS:
OK
I added the owner from the Files page but still getting the same message.
When I connect to the database it does show the owner in the 'owner box'.
Cheers.
Manj.
"Charles Wang[MSFT]" wrote:

> Hi Manj,
> I understand that after you restored your database, you found that the
> database diagram disappeared in SQL Server Management Studio.
> If I have misunderstood, please let me know.
> Did you restore a SQL Server 2000 or earlier database to SQL Server 2005?
> If so, it is by design that the database diagram will not be displayed in
> SQL Server 2005 due to structure incompatibility. If your database is SQL
> Server 2005, the database diagram should be there in your restored
> database.
> Anyway for this issue, after you restore your database, you can manually
> create a diagram and add all of your tables to it.
> Please feel free to let me know if you have any other questions or
> concerns. Have a nice day!
> Best regards,
> Charles Wang
> Microsoft Online Community Support
> ================================================== ===
> When responding to posts, please "Reply to Group" via
> your newsreader so that others may learn and benefit
> from this issue.
> ================================================== ====
> This posting is provided "AS IS" with no warranties, and confers no rights.
> ================================================== ====
>
>
>
|||Hi Manj,
This is a known issue that was fixed in SP1 or SP2. When you upgrade a
database from SQL Server 2000 to 2005, the database remains in 80
compatibility mode. To use the database diagram tool in SQL Server 2005,
the database must be set to 90 mode. See this Books Online topic:
http://msdn2.microsoft.com/en-us/library/ms186345.aspx
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
Download the latest version of Books Online from
http://technet.microsoft.com/en-us/sqlserver/bb428874.aspx
"Manjree Garg" <garg@.newsgroup.nospam> wrote in message
news:7CAFD23C-FA12-4766-A26D-10E18863090A@.microsoft.com...[vbcol=seagreen]
> Hi Charles,
> Thanks for the reply. It is SQL Server 2005 database. When I click on
> database diagram I get the following message:
> TITLE: Microsoft SQL Server Management Studio
> --
> Database diagram support objects cannot be installed because this database
> does not have a valid owner. To continue, first use the Files page of the
> Database Properties dialog box or the ALTER AUTHORIZATION statement to set
> the database owner to a valid login, then add the database diagram support
> objects.
> --
> BUTTONS:
> OK
> --
> I added the owner from the Files page but still getting the same message.
> When I connect to the database it does show the owner in the 'owner box'.
> Cheers.
> Manj.
> "Charles Wang[MSFT]" wrote:
|||Hi Gail,
Thanks for the suggestion. Resolved the issue.
Manj.
"Gail Erickson [MS]" wrote:

> Hi Manj,
> This is a known issue that was fixed in SP1 or SP2. When you upgrade a
> database from SQL Server 2000 to 2005, the database remains in 80
> compatibility mode. To use the database diagram tool in SQL Server 2005,
> the database must be set to 90 mode. See this Books Online topic:
> http://msdn2.microsoft.com/en-us/library/ms186345.aspx
> --
> Gail Erickson [MS]
> SQL Server Documentation Team
> This posting is provided "AS IS" with no warranties, and confers no rights
> Download the latest version of Books Online from
> http://technet.microsoft.com/en-us/sqlserver/bb428874.aspx
> "Manjree Garg" <garg@.newsgroup.nospam> wrote in message
> news:7CAFD23C-FA12-4766-A26D-10E18863090A@.microsoft.com...
>
>

Wednesday, March 7, 2012

database diagram

Hi,
I restored my database from the backup file, which is working fine but it
is not showing the database diagram in SQL server management studio. What do
I need to do for that?
Thanks.
Manj.Hi Manj,
I understand that after you restored your database, you found that the
database diagram disappeared in SQL Server Management Studio.
If I have misunderstood, please let me know.
Did you restore a SQL Server 2000 or earlier database to SQL Server 2005?
If so, it is by design that the database diagram will not be displayed in
SQL Server 2005 due to structure incompatibility. If your database is SQL
Server 2005, the database diagram should be there in your restored
database.
Anyway for this issue, after you restore your database, you can manually
create a diagram and add all of your tables to it.
Please feel free to let me know if you have any other questions or
concerns. Have a nice day!
Best regards,
Charles Wang
Microsoft Online Community Support
=====================================================When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================|||Hi Charles,
Thanks for the reply. It is SQL Server 2005 database. When I click on
database diagram I get the following message:
TITLE: Microsoft SQL Server Management Studio
--
Database diagram support objects cannot be installed because this database
does not have a valid owner. To continue, first use the Files page of the
Database Properties dialog box or the ALTER AUTHORIZATION statement to set
the database owner to a valid login, then add the database diagram support
objects.
--
BUTTONS:
OK
--
I added the owner from the Files page but still getting the same message.
When I connect to the database it does show the owner in the 'owner box'.
Cheers.
Manj.
"Charles Wang[MSFT]" wrote:
> Hi Manj,
> I understand that after you restored your database, you found that the
> database diagram disappeared in SQL Server Management Studio.
> If I have misunderstood, please let me know.
> Did you restore a SQL Server 2000 or earlier database to SQL Server 2005?
> If so, it is by design that the database diagram will not be displayed in
> SQL Server 2005 due to structure incompatibility. If your database is SQL
> Server 2005, the database diagram should be there in your restored
> database.
> Anyway for this issue, after you restore your database, you can manually
> create a diagram and add all of your tables to it.
> Please feel free to let me know if you have any other questions or
> concerns. Have a nice day!
> Best regards,
> Charles Wang
> Microsoft Online Community Support
> =====================================================> When responding to posts, please "Reply to Group" via
> your newsreader so that others may learn and benefit
> from this issue.
> ======================================================> This posting is provided "AS IS" with no warranties, and confers no rights.
> ======================================================>
>
>|||Hi Manj,
This is a known issue that was fixed in SP1 or SP2. When you upgrade a
database from SQL Server 2000 to 2005, the database remains in 80
compatibility mode. To use the database diagram tool in SQL Server 2005,
the database must be set to 90 mode. See this Books Online topic:
http://msdn2.microsoft.com/en-us/library/ms186345.aspx
--
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
Download the latest version of Books Online from
http://technet.microsoft.com/en-us/sqlserver/bb428874.aspx
"Manjree Garg" <garg@.newsgroup.nospam> wrote in message
news:7CAFD23C-FA12-4766-A26D-10E18863090A@.microsoft.com...
> Hi Charles,
> Thanks for the reply. It is SQL Server 2005 database. When I click on
> database diagram I get the following message:
> TITLE: Microsoft SQL Server Management Studio
> --
> Database diagram support objects cannot be installed because this database
> does not have a valid owner. To continue, first use the Files page of the
> Database Properties dialog box or the ALTER AUTHORIZATION statement to set
> the database owner to a valid login, then add the database diagram support
> objects.
> --
> BUTTONS:
> OK
> --
> I added the owner from the Files page but still getting the same message.
> When I connect to the database it does show the owner in the 'owner box'.
> Cheers.
> Manj.
> "Charles Wang[MSFT]" wrote:
>> Hi Manj,
>> I understand that after you restored your database, you found that the
>> database diagram disappeared in SQL Server Management Studio.
>> If I have misunderstood, please let me know.
>> Did you restore a SQL Server 2000 or earlier database to SQL Server 2005?
>> If so, it is by design that the database diagram will not be displayed in
>> SQL Server 2005 due to structure incompatibility. If your database is SQL
>> Server 2005, the database diagram should be there in your restored
>> database.
>> Anyway for this issue, after you restore your database, you can manually
>> create a diagram and add all of your tables to it.
>> Please feel free to let me know if you have any other questions or
>> concerns. Have a nice day!
>> Best regards,
>> Charles Wang
>> Microsoft Online Community Support
>> =====================================================>> When responding to posts, please "Reply to Group" via
>> your newsreader so that others may learn and benefit
>> from this issue.
>> ======================================================>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> ======================================================>>
>>
>>|||Hi Gail,
Thanks for the suggestion. Resolved the issue.
Manj.
"Gail Erickson [MS]" wrote:
> Hi Manj,
> This is a known issue that was fixed in SP1 or SP2. When you upgrade a
> database from SQL Server 2000 to 2005, the database remains in 80
> compatibility mode. To use the database diagram tool in SQL Server 2005,
> the database must be set to 90 mode. See this Books Online topic:
> http://msdn2.microsoft.com/en-us/library/ms186345.aspx
> --
> Gail Erickson [MS]
> SQL Server Documentation Team
> This posting is provided "AS IS" with no warranties, and confers no rights
> Download the latest version of Books Online from
> http://technet.microsoft.com/en-us/sqlserver/bb428874.aspx
> "Manjree Garg" <garg@.newsgroup.nospam> wrote in message
> news:7CAFD23C-FA12-4766-A26D-10E18863090A@.microsoft.com...
> > Hi Charles,
> >
> > Thanks for the reply. It is SQL Server 2005 database. When I click on
> > database diagram I get the following message:
> >
> > TITLE: Microsoft SQL Server Management Studio
> > --
> >
> > Database diagram support objects cannot be installed because this database
> > does not have a valid owner. To continue, first use the Files page of the
> > Database Properties dialog box or the ALTER AUTHORIZATION statement to set
> > the database owner to a valid login, then add the database diagram support
> > objects.
> >
> > --
> > BUTTONS:
> >
> > OK
> > --
> >
> > I added the owner from the Files page but still getting the same message.
> > When I connect to the database it does show the owner in the 'owner box'.
> >
> > Cheers.
> >
> > Manj.
> > "Charles Wang[MSFT]" wrote:
> >
> >> Hi Manj,
> >> I understand that after you restored your database, you found that the
> >> database diagram disappeared in SQL Server Management Studio.
> >> If I have misunderstood, please let me know.
> >>
> >> Did you restore a SQL Server 2000 or earlier database to SQL Server 2005?
> >> If so, it is by design that the database diagram will not be displayed in
> >> SQL Server 2005 due to structure incompatibility. If your database is SQL
> >> Server 2005, the database diagram should be there in your restored
> >> database.
> >>
> >> Anyway for this issue, after you restore your database, you can manually
> >> create a diagram and add all of your tables to it.
> >>
> >> Please feel free to let me know if you have any other questions or
> >> concerns. Have a nice day!
> >>
> >> Best regards,
> >> Charles Wang
> >> Microsoft Online Community Support
> >> =====================================================> >> When responding to posts, please "Reply to Group" via
> >> your newsreader so that others may learn and benefit
> >> from this issue.
> >> ======================================================> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >> ======================================================> >>
> >>
> >>
> >>
> >>
> >>
>
>|||Hi all,
I have the same problem (SS2005):
TITLE: Microsoft SQL Server Management Studio
--
Database diagram support objects cannot be installed because this database
does not have a valid owner. To continue, first use the Files page of the
Database Properties dialog box or the ALTER AUTHORIZATION statement to set
the database owner to a valid login, then add the database diagram support
objects.
With:
SELECT USER
it returns "dbo"
Where the problem?
Thanks a lot.
Luigi|||The problem seems to be that the SID for your dbo user inside the database doesn't exist as a login
in the master database. Use either ALTER AUTHORIZATION (as suggested by the error message) or
sp_changedbowner to make sure that the database has an owner that really exist in the master
database (as a login).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Luigi" <ciupazNoSpamGrazie@.inwind.it> wrote in message
news:D544D243-9D98-4432-B91B-9D68BE0C189E@.microsoft.com...
> Hi all,
> I have the same problem (SS2005):
> TITLE: Microsoft SQL Server Management Studio
> --
> Database diagram support objects cannot be installed because this database
> does not have a valid owner. To continue, first use the Files page of the
> Database Properties dialog box or the ALTER AUTHORIZATION statement to set
> the database owner to a valid login, then add the database diagram support
> objects.
> With:
> SELECT USER
> it returns "dbo"
> Where the problem?
> Thanks a lot.
> Luigi
>
>|||"Tibor Karaszi" wrote:
> The problem seems to be that the SID for your dbo user inside the database doesn't exist as a login
> in the master database. Use either ALTER AUTHORIZATION (as suggested by the error message) or
> sp_changedbowner to make sure that the database has an owner that really exist in the master
> database (as a login).
Thank you Tibor, I'll make in this way.
Luigi

Tuesday, February 14, 2012

Database crashed its very urgent

Hi All,
one of my database is suddenly crashed with power fluctuation and when i
started the server it is showing "not able to connect database". I have take
n
backup and i was trying to attach database in other system. It has given me
the following error.
Microsoft SQL-DMO (ODBC SQLState: HY000)
--
Error 9003: The LSN (375:9588:1) passed to log scan in database
'QVLMSCASPARES' is invalid.
--
OK
--
Please any one can help me out.
With Regards,
AHARIHari
>I have taken
> backup and i was trying to attach database in other system. It has given m
e
> the following error.
You can recover the data wont attach it. You will attach only if you
have.mdf files with you.
When did you take back up.waht kind of back up( full,differential,log) what
is your recovery model.when did you take master back up.
above information is needed to suggest you right one.
Regards
R.D
--
Regards
R.D
--Knowledge gets doubled when shared
"Srihari" wrote:

> Hi All,
> one of my database is suddenly crashed with power fluctuation and when i
> started the server it is showing "not able to connect database". I have ta
ken
> backup and i was trying to attach database in other system. It has given m
e
> the following error.
> --
> Microsoft SQL-DMO (ODBC SQLState: HY000)
> --
> Error 9003: The LSN (375:9588:1) passed to log scan in database
> 'QVLMSCASPARES' is invalid.
> --
> OK
> --
>
> Please any one can help me out.
> With Regards,
> AHARI|||once the database has crashed i have stopped sqlserver and took the copy of
the microsoft sqlserver directory under program files and kept it in other
location.
I think i am having master back up also.
How can i retrieve the data.
With Regards,
AHARI
"R.D" wrote:
> Hari
> You can recover the data wont attach it. You will attach only if you
> have.mdf files with you.
> When did you take back up.waht kind of back up( full,differential,log) wha
t
> is your recovery model.when did you take master back up.
> above information is needed to suggest you right one.
> Regards
> R.D
> --
> Regards
> R.D
> --Knowledge gets doubled when shared
>
> "Srihari" wrote:
>|||Only God should save you . Back up is different from taking copy of file
after crash.
what kind of crash did you observe.
In the folder you wil find .mdf files
go to enterprise manager, and try to attach it, If you are lucky then you
should get your data.
At least hereafter, take back up in appropriate times. do read BOL
--
Regards
R.D
--Knowledge gets doubled when shared
"Srihari" wrote:
> once the database has crashed i have stopped sqlserver and took the copy o
f
> the microsoft sqlserver directory under program files and kept it in other
> location.
> I think i am having master back up also.
> How can i retrieve the data.
> With Regards,
> AHARI
> "R.D" wrote:
>|||Hi R D
God Helped me!... I had backup of one days prior and i have re entered the
data for one day. some how system is up but in these situations is there an
y
other way to resolve instead of re entering.
With Regards,
AHARI
"R.D" wrote:
> Only God should save you . Back up is different from taking copy of file
> after crash.
> what kind of crash did you observe.
> In the folder you wil find .mdf files
> go to enterprise manager, and try to attach it, If you are lucky then you
> should get your data.
> At least hereafter, take back up in appropriate times. do read BOL
> --
> Regards
> R.D
> --Knowledge gets doubled when shared
>
> "Srihari" wrote:
>|||Yes, that's what transaction log backups are for. Do you have log
backups? If not, then consider implementing them for next time. Read
about transaction log backups in Books Online.
Also, invest in a UPS if you haven't already done so. A database server
needs to be protected from power fluctuations.
David Portas
SQL Server MVP
--|||thanks for you suggestion. I am trying to get the procedure to retrieve data
from crashed database. No one is helping me in that way. Actually this
incident had happend at one of our client place.
At least now can any one tell me how to retrieve data from crashed database.
I tried in google i got some article which is not so clear. if i get the
master also along with crashed database that is LDF and MDF how to retrieve
the data tell me the procedure in detail.
Clients are using UPS too. The database is running from past 4 years.
I felt that News group MVPs will respond quickly and take the matter
serious. Hear i am seeing they are taking it lite and making fun of me.
with Regards,
AHARI
"David Portas" wrote:

> Yes, that's what transaction log backups are for. Do you have log
> backups? If not, then consider implementing them for next time. Read
> about transaction log backups in Books Online.
> Also, invest in a UPS if you haven't already done so. A database server
> needs to be protected from power fluctuations.
> --
> David Portas
> SQL Server MVP
> --
>|||I am not making fun of you. You said in a previous post that you had
already recovered the database so I understood that you didn't need
more help on that. I was answering your specific question about how to
recover additional data by asking for more information on whether you
have a log backup. You didn't answer that question unfortunately.
As I understand it you have restored an old database backup to another
server but you still have a copy of the latest MDF and LDF files
available. It isn't possible to apply the transaction log to a database
that is online and in a recovered state. To apply the transaction log
you first have to restore from a full database backup with the
NORECOVERY option. Only then can you start to restore transaction log
backups, assuming you have them.
To restore the master database you have to first put the database into
single user mode. Only attempt to restore master on either the server
that the backup was originally taken from or on a clean install of SQL
Server.
Have you tried re-attaching the MDF and LDF files as suggested by RD?
That should be your first course of action. There is an example of how
to re-attach under the sp_attach_db topic in Books Online. If you can
attach the database successfully then you are in luck. Take a backup
immediately, run DBCC CHECKDB and then you are back in business
hopefully.
If you re-attach your database but it is marked as "suspect" then
things are bit less rosy to say the least. I recommend you contact
Microsoft support directly as there are no documented solutions and the
possible fixes are not without their own risks. I don't want to suggest
anything that may make things worse.
Relevant articles in Books Online:
"sp_attach_db"
"Restoring the master Database"
"How to restore to the point of failure"
Hope this helps.
David Portas
SQL Server MVP
--|||Hello David portas,
Thanks you for your quick response.
If you see my first posting I have clearly mentioned that, i am attaching
database in other system and mentioned the error message too.
Ok. According to your reply if i get this error i cant retrieve data back.
"David Portas" wrote:

> I am not making fun of you. You said in a previous post that you had
> already recovered the database so I understood that you didn't need
> more help on that. I was answering your specific question about how to
> recover additional data by asking for more information on whether you
> have a log backup. You didn't answer that question unfortunately.
> As I understand it you have restored an old database backup to another
> server but you still have a copy of the latest MDF and LDF files
> available. It isn't possible to apply the transaction log to a database
> that is online and in a recovered state. To apply the transaction log
> you first have to restore from a full database backup with the
> NORECOVERY option. Only then can you start to restore transaction log
> backups, assuming you have them.
> To restore the master database you have to first put the database into
> single user mode. Only attempt to restore master on either the server
> that the backup was originally taken from or on a clean install of SQL
> Server.
> Have you tried re-attaching the MDF and LDF files as suggested by RD?
> That should be your first course of action. There is an example of how
> to re-attach under the sp_attach_db topic in Books Online. If you can
> attach the database successfully then you are in luck. Take a backup
> immediately, run DBCC CHECKDB and then you are back in business
> hopefully.
> If you re-attach your database but it is marked as "suspect" then
> things are bit less rosy to say the least. I recommend you contact
> Microsoft support directly as there are no documented solutions and the
> possible fixes are not without their own risks. I don't want to suggest
> anything that may make things worse.
> Relevant articles in Books Online:
> "sp_attach_db"
> "Restoring the master Database"
> "How to restore to the point of failure"
> Hope this helps.
> --
> David Portas
> SQL Server MVP
> --
>

Database crashed its very urgent

Hi All,
one of my database is suddenly crashed with power fluctuation and when i
started the server it is showing "not able to connect database". I have taken
backup and i was trying to attach database in other system. It has given me
the following error.
--
Microsoft SQL-DMO (ODBC SQLState: HY000)
--
Error 9003: The LSN (375:9588:1) passed to log scan in database
'QVLMSCASPARES' is invalid.
--
OK
--
Please any one can help me out.
With Regards,
AHARIWhat does your SQL Server log say? Looks like you have corruption.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Srihari" <Srihari@.discussions.microsoft.com> wrote in message
news:3479DD26-661B-48DD-BE5C-DFFAA0DB5EE2@.microsoft.com...
> Hi All,
> one of my database is suddenly crashed with power fluctuation and when i
> started the server it is showing "not able to connect database". I have
> taken
> backup and i was trying to attach database in other system. It has given
> me
> the following error.
> --
> Microsoft SQL-DMO (ODBC SQLState: HY000)
> --
> Error 9003: The LSN (375:9588:1) passed to log scan in database
> 'QVLMSCASPARES' is invalid.
> --
> OK
> --
>
> Please any one can help me out.
> With Regards,
> AHARI|||It says
"Error 9003: The LSN (375:9588:1) passed to log scan in database
'QVLMSCASPARES' is invalid."
With Reagards,
AHARI
"Mike Epprecht (SQL MVP)" wrote:
> What does your SQL Server log say? Looks like you have corruption.
> Regards
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Srihari" <Srihari@.discussions.microsoft.com> wrote in message
> news:3479DD26-661B-48DD-BE5C-DFFAA0DB5EE2@.microsoft.com...
> > Hi All,
> >
> > one of my database is suddenly crashed with power fluctuation and when i
> > started the server it is showing "not able to connect database". I have
> > taken
> > backup and i was trying to attach database in other system. It has given
> > me
> > the following error.
> >
> > --
> > Microsoft SQL-DMO (ODBC SQLState: HY000)
> > --
> > Error 9003: The LSN (375:9588:1) passed to log scan in database
> > 'QVLMSCASPARES' is invalid.
> > --
> > OK
> > --
> >
> >
> > Please any one can help me out.
> >
> > With Regards,
> > AHARI
>
>

Database crashed its very urgent

Hi All,
one of my database is suddenly crashed with power fluctuation and when i
started the server it is showing "not able to connect database". I have taken
backup and i was trying to attach database in other system. It has given me
the following error.
--
Microsoft SQL-DMO (ODBC SQLState: HY000)
--
Error 9003: The LSN (375:9588:1) passed to log scan in database
'QVLMSCASPARES' is invalid.
--
OK
--
Please any one can help me out.
With Regards,
AHARISrihari
Sounds like you are trying to reattach the data and log files. AM I correct/
Do you have a backup of the the db if so restore it on another server
--
Paul Zanbaka
DBA, Programmer Analyst
"Srihari" wrote:
> Hi All,
> one of my database is suddenly crashed with power fluctuation and when i
> started the server it is showing "not able to connect database". I have taken
> backup and i was trying to attach database in other system. It has given me
> the following error.
> --
> Microsoft SQL-DMO (ODBC SQLState: HY000)
> --
> Error 9003: The LSN (375:9588:1) passed to log scan in database
> 'QVLMSCASPARES' is invalid.
> --
> OK
> --
>
> Please any one can help me out.
> With Regards,
> AHARI|||I am attaching in other system then only i got this error.
With Regards
AHARI
"Paul Zanbaka" wrote:
> Srihari
> Sounds like you are trying to reattach the data and log files. AM I correct/
> Do you have a backup of the the db if so restore it on another server
> --
> Paul Zanbaka
> DBA, Programmer Analyst
>
> "Srihari" wrote:
> > Hi All,
> >
> > one of my database is suddenly crashed with power fluctuation and when i
> > started the server it is showing "not able to connect database". I have taken
> > backup and i was trying to attach database in other system. It has given me
> > the following error.
> >
> > --
> > Microsoft SQL-DMO (ODBC SQLState: HY000)
> > --
> > Error 9003: The LSN (375:9588:1) passed to log scan in database
> > 'QVLMSCASPARES' is invalid.
> > --
> > OK
> > --
> >
> >
> > Please any one can help me out.
> >
> > With Regards,
> > AHARI|||Srihari
Instead of attaching the db on other system try to restore it
RESTORE DATABASE
--
Paul Zanbaka
DBA, Programmer Analyst
"Srihari" wrote:
> I am attaching in other system then only i got this error.
> With Regards
> AHARI
> "Paul Zanbaka" wrote:
> > Srihari
> > Sounds like you are trying to reattach the data and log files. AM I correct/
> > Do you have a backup of the the db if so restore it on another server
> > --
> > Paul Zanbaka
> > DBA, Programmer Analyst
> >
> >
> > "Srihari" wrote:
> >
> > > Hi All,
> > >
> > > one of my database is suddenly crashed with power fluctuation and when i
> > > started the server it is showing "not able to connect database". I have taken
> > > backup and i was trying to attach database in other system. It has given me
> > > the following error.
> > >
> > > --
> > > Microsoft SQL-DMO (ODBC SQLState: HY000)
> > > --
> > > Error 9003: The LSN (375:9588:1) passed to log scan in database
> > > 'QVLMSCASPARES' is invalid.
> > > --
> > > OK
> > > --
> > >
> > >
> > > Please any one can help me out.
> > >
> > > With Regards,
> > > AHARI

Database crashed its very urgent

Hi All,
one of my database is suddenly crashed with power fluctuation and when i
started the server it is showing "not able to connect database". I have take
n
backup and i was trying to attach database in other system. It has given me
the following error.
Microsoft SQL-DMO (ODBC SQLState: HY000)
--
Error 9003: The LSN (375:9588:1) passed to log scan in database
'QVLMSCASPARES' is invalid.
--
OK
--
Please any one can help me out.
With Regards,
AHARIYou should use sp_detach_db to explicitly detach the files,
copy then and then try attaching on another system. You also
need to make sure you have all files from the original
database.
However, if your original database is corrupted you
shouldn't be using sp_detach/sp_attach. You should check all
logs and determine the cause of the corruption and address
that issue. Often you need to restore from your last known
good backup.
-Sue
On Mon, 3 Oct 2005 03:03:03 -0700, "Srihari"
<Srihari@.discussions.microsoft.com> wrote:

>Hi All,
>one of my database is suddenly crashed with power fluctuation and when i
>started the server it is showing "not able to connect database". I have tak
en
>backup and i was trying to attach database in other system. It has given me
>the following error.
>--
>Microsoft SQL-DMO (ODBC SQLState: HY000)
>--
>Error 9003: The LSN (375:9588:1) passed to log scan in database
>'QVLMSCASPARES' is invalid.
>--
>OK
>--
>
>Please any one can help me out.
>With Regards,
>AHARI

Database crashed its very urgent

Hi All,
one of my database is suddenly crashed with power fluctuation and when i
started the server it is showing "not able to connect database". I have taken
backup and i was trying to attach database in other system. It has given me
the following error.
Microsoft SQL-DMO (ODBC SQLState: HY000)
Error 9003: The LSN (375:9588:1) passed to log scan in database
'QVLMSCASPARES' is invalid.
OK
Please any one can help me out.
With Regards,
AHARI
Srihari wrote:
> Hi All,
> one of my database is suddenly crashed with power fluctuation and
> when i started the server it is showing "not able to connect
> database". I have taken backup and i was trying to attach database in
> other system. It has given me the following error.
> --
> Microsoft SQL-DMO (ODBC SQLState: HY000)
> --
> Error 9003: The LSN (375:9588:1) passed to log scan in database
> 'QVLMSCASPARES' is invalid.
What do you mean by "I have taken backup"? Do you mean you took a copy
of the database file(s) from the original server when SQL Server was
either off-line or the database was detached. Or do you mean you
performed a backup using BACKUP DATABASE? If you are trying to restore a
backup, then use RESTORE DATABASE. If you are using a copy of the
database files and log files, then use sp_attach_db or
sp_attach_single_file_db.
See if this helps.
http://support.microsoft.com/kb/328354
David Gugick
Quest Software
www.imceda.com
www.quest.com
|||I have taken files offline and trying to attach in other system.
With Regards,
AHARI
"David Gugick" wrote:

> Srihari wrote:
>
> What do you mean by "I have taken backup"? Do you mean you took a copy
> of the database file(s) from the original server when SQL Server was
> either off-line or the database was detached. Or do you mean you
> performed a backup using BACKUP DATABASE? If you are trying to restore a
> backup, then use RESTORE DATABASE. If you are using a copy of the
> database files and log files, then use sp_attach_db or
> sp_attach_single_file_db.
> See if this helps.
> http://support.microsoft.com/kb/328354
>
> --
> David Gugick
> Quest Software
> www.imceda.com
> www.quest.com
>
|||Srihari wrote:
> I have taken files offline and trying to attach in other system.
> With Regards,
> AHARI
>
According to BOL:
"sp_attach_db should only be executed on databases that were previously
detached from the database server using an explicit sp_detach_db
operation. If more than 16 files must be specified, use CREATE DATABASE
with the FOR ATTACH clause.
If you attach a database to a server other than the server from which
the database was detached, and the detached database was enabled for
replication, you should run sp_removedbreplication to remove replication
from the database."
I'm not sure what will happen if you try to attach a copy of the
database files without first using the detach function. Are you
attaching the log files as well? If so, have to tried to not attach the
log file.
See if using the CREATE DATABASE with the FOR ATTACH clause works
instead:
http://support.microsoft.com/?kbid=885712
David Gugick
Quest Software
www.imceda.com
www.quest.com

Database crashed its very urgent

Hi All,
one of my database is suddenly crashed with power fluctuation and when i
started the server it is showing "not able to connect database". I have taken
backup and i was trying to attach database in other system. It has given me
the following error.
Microsoft SQL-DMO (ODBC SQLState: HY000)
Error 9003: The LSN (375:9588:1) passed to log scan in database
'QVLMSCASPARES' is invalid.
OK
Please any one can help me out.
With Regards,
AHARI
What does your SQL Server log say? Looks like you have corruption.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Srihari" <Srihari@.discussions.microsoft.com> wrote in message
news:3479DD26-661B-48DD-BE5C-DFFAA0DB5EE2@.microsoft.com...
> Hi All,
> one of my database is suddenly crashed with power fluctuation and when i
> started the server it is showing "not able to connect database". I have
> taken
> backup and i was trying to attach database in other system. It has given
> me
> the following error.
> --
> Microsoft SQL-DMO (ODBC SQLState: HY000)
> --
> Error 9003: The LSN (375:9588:1) passed to log scan in database
> 'QVLMSCASPARES' is invalid.
> --
> OK
> --
>
> Please any one can help me out.
> With Regards,
> AHARI
|||It says
"Error 9003: The LSN (375:9588:1) passed to log scan in database
'QVLMSCASPARES' is invalid."
With Reagards,
AHARI
"Mike Epprecht (SQL MVP)" wrote:

> What does your SQL Server log say? Looks like you have corruption.
> Regards
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Srihari" <Srihari@.discussions.microsoft.com> wrote in message
> news:3479DD26-661B-48DD-BE5C-DFFAA0DB5EE2@.microsoft.com...
>
>

Database crashed its very urgent

Hi All,
one of my database is suddenly crashed with power fluctuation and when i
started the server it is showing "not able to connect database". I have taken
backup and i was trying to attach database in other system. It has given me
the following error.
Microsoft SQL-DMO (ODBC SQLState: HY000)
Error 9003: The LSN (375:9588:1) passed to log scan in database
'QVLMSCASPARES' is invalid.
OK
Please any one can help me out.
With Regards,
AHARI
Srihari
Sounds like you are trying to reattach the data and log files. AM I correct/
Do you have a backup of the the db if so restore it on another server
Paul Zanbaka
DBA, Programmer Analyst
"Srihari" wrote:

> Hi All,
> one of my database is suddenly crashed with power fluctuation and when i
> started the server it is showing "not able to connect database". I have taken
> backup and i was trying to attach database in other system. It has given me
> the following error.
> --
> Microsoft SQL-DMO (ODBC SQLState: HY000)
> --
> Error 9003: The LSN (375:9588:1) passed to log scan in database
> 'QVLMSCASPARES' is invalid.
> --
> OK
> --
>
> Please any one can help me out.
> With Regards,
> AHARI
|||I am attaching in other system then only i got this error.
With Regards
AHARI
"Paul Zanbaka" wrote:
[vbcol=seagreen]
> Srihari
> Sounds like you are trying to reattach the data and log files. AM I correct/
> Do you have a backup of the the db if so restore it on another server
> --
> Paul Zanbaka
> DBA, Programmer Analyst
>
> "Srihari" wrote:
|||Srihari
Instead of attaching the db on other system try to restore it
RESTORE DATABASE
Paul Zanbaka
DBA, Programmer Analyst
"Srihari" wrote:
[vbcol=seagreen]
> I am attaching in other system then only i got this error.
> With Regards
> AHARI
> "Paul Zanbaka" wrote:

Database crashed its very urgent

Hi All,
one of my database is suddenly crashed with power fluctuation and when i
started the server it is showing "not able to connect database". I have take
n
backup and i was trying to attach database in other system. It has given me
the following error.
Microsoft SQL-DMO (ODBC SQLState: HY000)
--
Error 9003: The LSN (375:9588:1) passed to log scan in database
'QVLMSCASPARES' is invalid.
--
OK
--
Please any one can help me out.
With Regards,
AHARISrihari
Sounds like you are trying to reattach the data and log files. AM I correct/
Do you have a backup of the the db if so restore it on another server
--
Paul Zanbaka
DBA, Programmer Analyst
"Srihari" wrote:

> Hi All,
> one of my database is suddenly crashed with power fluctuation and when i
> started the server it is showing "not able to connect database". I have ta
ken
> backup and i was trying to attach database in other system. It has given m
e
> the following error.
> --
> Microsoft SQL-DMO (ODBC SQLState: HY000)
> --
> Error 9003: The LSN (375:9588:1) passed to log scan in database
> 'QVLMSCASPARES' is invalid.
> --
> OK
> --
>
> Please any one can help me out.
> With Regards,
> AHARI|||I am attaching in other system then only i got this error.
With Regards
AHARI
"Paul Zanbaka" wrote:
[vbcol=seagreen]
> Srihari
> Sounds like you are trying to reattach the data and log files. AM I correc
t/
> Do you have a backup of the the db if so restore it on another server
> --
> Paul Zanbaka
> DBA, Programmer Analyst
>
> "Srihari" wrote:
>|||Srihari
Instead of attaching the db on other system try to restore it
RESTORE DATABASE
Paul Zanbaka
DBA, Programmer Analyst
"Srihari" wrote:
[vbcol=seagreen]
> I am attaching in other system then only i got this error.
> With Regards
> AHARI
> "Paul Zanbaka" wrote:
>