Showing posts with label specific. Show all posts
Showing posts with label specific. Show all posts

Sunday, March 25, 2012

data encryption in SQL Server 2005 - protect from SQL Admnis

I need to store some sensitive data in SQL 2005.
Stored procedures will encrypt & decrypt the data. The client app is written
in .NEt using a specific user (belonging to a specific - custom role).
However, inspite of the above, the local Admin can always view the code in
the decription stored procedure & decrypt & hence view the data.
How can i prevent the administrator (everyone) except for the application
from being able to view the data.
Is it possible to remove access to a stored procedure even from an
administrator & give access to a special user (the password of which is know
only by the application)'
Then again the owner of the above role will have access to the stored
procedures!!This is a good backgrounder on the topic:
http://blogs.msdn.com/lcris/archive...encryption.aspx
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Don" <Don@.discussions.microsoft.com> wrote in message
news:A25E337B-AA5C-456B-95AD-E4D2F36D4B0A@.microsoft.com...
>I need to store some sensitive data in SQL 2005.
> Stored procedures will encrypt & decrypt the data. The client app is writt
en
> in .NEt using a specific user (belonging to a specific - custom role).
> However, inspite of the above, the local Admin can always view the code in
> the decription stored procedure & decrypt & hence view the data.
> How can i prevent the administrator (everyone) except for the application
> from being able to view the data.
> Is it possible to remove access to a stored procedure even from an
> administrator & give access to a special user (the password of which is kn
ow
> only by the application)'
> Then again the owner of the above role will have access to the stored
> procedures!!

Data Driven Subscriptions-Expressions in Parameters

I'm trying to create a report that, when generated, puts in a start
date of last Sunday to last Saturday. To be more specific, take this
week which begins on Sunday, Feb 10 and ends Saturday, Feb 16. When
this report gets generated anytime this week, the start date should be
Sunday Feb 3 and the end date should be Saturday Feb 9. When the
report is run next week, the start date/end date for that report
should be Feb 10/Feb 16.
I figured out the date expression for the start and end dates and set
them as the default for this report in Visual Studio. However, when I
upload them to my Report Server and set the data driven subscription
(DDS) to use the default for those date parameters, it won't let me.
So my question is, in the DDS itself, can I use an expression for the
date paramenters? If the answer is no, then I'm obviously not getting
the syntax correctly.
Any help would be greatly appreicated.On Feb 12, 4:49=A0pm, lsantos13 <lsanto...@.gmail.com> wrote:
> I'm trying to create a report that, when generated, puts in a start
> date of last Sunday to last Saturday. =A0To be more specific, take this
> week which begins on Sunday, Feb 10 and ends Saturday, Feb 16. =A0When
> this report gets generated anytime this week, the start date should be
> Sunday Feb 3 and the end date should be Saturday Feb 9. =A0When the
> report is run next week, the start date/end date for that report
> should be Feb 10/Feb 16.
> I figured out the date expression for the start and end dates and set
> them as the default for this report in Visual Studio. =A0However, when I
> upload them to my Report Server and set the data driven subscription
> (DDS) to use the default for those date parameters, it won't let me.
> So my question is, in the DDS itself, can I use an expression for the
> date paramenters? =A0If the answer is no, then I'm obviously not getting
> the syntax correctly.
> Any help would be greatly appreicated.
Correction on the last sentence - I meant to say "If the answer is
YES,..."|||Did you ever get a fix on this, as I am having the same problem. In my report
definition in VS I have a multi-select YEAR parameter that is dynamically
generating values using the query (a google query :).
***********
SELECT (YEAR(GETDATE()) -5) + 5*5*(a-1)+5*(b-1) + c AS [YEAR] FROM
(SELECT 1 a UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION
ALL SELECT 5) x
CROSS JOIN
(SELECT 1 b UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION
ALL SELECT 5) y
CROSS JOIN
(SELECT 1 c UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION
ALL SELECT 5) z
WHERE 5*5*(a-1)+5*(b-1) + c <= (YEAR(GETDATE())+1-(YEAR(GETDATE()) -5))
ORDER BY 1
*************
and default values for current year and last year using Year(Now) and
Year(Now)-1. This is causing an error in data-driven subscription
rsReportParameterValueNotSet. The odd thing is that this only occurs if other
parameters are set to "Query Results Field". If all parameters are set to
"Static Selection" and "Use Default" is checked everything works fine.

Thursday, March 22, 2012

Data driven subscription printing problem

Hi
I installed the printer delivery sample.When i tried to set up
the data driven subscription with delivery mode as printing to a
specific printer.I am getting error.
Done: 2 processed of 2 total; 2 errors.
When i set it as an email.Its working.I am getting email.I could
successfully set up the printer.I did not get any error.In the log
files i dont see any explanation.Is there any setup we have to tell
for printer delivery also log the information.
Thanks
vkvWhen you say you "successfully set up the printer", under which identity did
you set it up? Under what identity is the subscription job running?
Or do you just mean you "successfully told the Reporting Services
configuration about it in its XML file"? In which case, read my first
paragraph again <g>.
>>.Is there any setup we have to tell
>> for printer delivery also log the information.
Are you seeing anything in the log related to this extension at all (in case
you are looking in the wrong log)?
I looked briefly at the code and it looks like it logs all the time.
>L<
"vamsi" <vamsii@.gmail.com> wrote in message
news:1176861152.048216.29700@.b58g2000hsg.googlegroups.com...
> Hi
> I installed the printer delivery sample.When i tried to set up
> the data driven subscription with delivery mode as printing to a
> specific printer.I am getting error.
> Done: 2 processed of 2 total; 2 errors.
> When i set it as an email.Its working.I am getting email.I could
> successfully set up the printer.I did not get any error.In the log
> files i dont see any explanation.Is there any setup we have to tell
> for printer delivery also log the information.
> Thanks
> vkv
>|||Hi
I did set up the subscription under my username identity.I am
having admin permissions on the report server.It did not generate the
log immediately.It generated after 6 hours.I just saw the log file it
said
Notification f57f14c4-32fa-47eb-84f3-3e75e6aa175e completed.
Success: False, Status: Error: Error writing to log file: Access to
the path 'C:\WINDOWS\system32\PrinterDeliveryLog.txt' is denied.,
DeliveryExtension: Printer Delivery Sample, Report:
I created a text document with this name.The subscription ran
successfully and i am getting 0 errors.I checked it did not print the
report.I saw in the PrinterDeliveryLog in system32,i got this message
04/18/2007 08:54:02
Number of pages: 1046
The printer \\SYSTEMS\PRN295_3 is not currently installed on the
server.: at
Microsoft.Samples.ReportingServices.PrinterDelivery.PrinterDeliveryProvider.PrintReport(Notification
notification, SubscriptionData data)
"SYSTEMS" is the server name of all the printers.PRN295_3 is the
printer name.It is installed on the report server.I added this printer
to the server personally.Anything i have to do regarding installing
the printer.
Thanks
vkv|||It doesn't matter that you have admin permissions on the report server...
Your report subscription job is not running under your identity, probably,
and the printer, while installed on the server, is not accessible to the
identity under which that job is running.
The first thing I would do is check to see who has rights to print to that
printer.
This is a common problem with code running in web server apps FWIW... it's
not something I know about specifically to do with Reporting Services, but
it is a common problem for code running under a service account. Check the
account and check if it has rights to print to that (or any!) printer.
>L<
"vamsi" <vamsii@.gmail.com> wrote in message
news:1176913746.971631.47520@.e65g2000hsc.googlegroups.com...
> Hi
> I did set up the subscription under my username identity.I am
> having admin permissions on the report server.It did not generate the
> log immediately.It generated after 6 hours.I just saw the log file it
> said
> Notification f57f14c4-32fa-47eb-84f3-3e75e6aa175e completed.
> Success: False, Status: Error: Error writing to log file: Access to
> the path 'C:\WINDOWS\system32\PrinterDeliveryLog.txt' is denied.,
> DeliveryExtension: Printer Delivery Sample, Report:
> I created a text document with this name.The subscription ran
> successfully and i am getting 0 errors.I checked it did not print the
> report.I saw in the PrinterDeliveryLog in system32,i got this message
> 04/18/2007 08:54:02
> Number of pages: 1046
> The printer \\SYSTEMS\PRN295_3 is not currently installed on the
> server.: at
> Microsoft.Samples.ReportingServices.PrinterDelivery.PrinterDeliveryProvider.PrintReport(Notification
> notification, SubscriptionData data)
> "SYSTEMS" is the server name of all the printers.PRN295_3 is the
> printer name.It is installed on the report server.I added this printer
> to the server personally.Anything i have to do regarding installing
> the printer.
> Thanks
> vkv
>|||I commented out this part of the code
if (!IsValidPrinter(data.Printer))
throw new Exception("The printer " + data.Printer + " is not currently
installed on the server.");
in PrinterDeliveryProvider.cs and its working for now.I have to check
whether i will get any other problem.It always prints in 8.5 * 11 page
irrespective of the settings we give while subscribing.I have to check
the PrinterDeliveryProvider code.
Thanks
vkv|||Thanks for letting me know... but ...
Take a look at the IsValidPrinter function. It checks
PrinterSettings.InstalledPrinters.
*** THE REASON WHY *** this code is failing to find printers is almost
definitely what I said before... I know it says "InstalledPrinters" but the
identity querying for printers has to have printing permission or it's not
going to "see" the installed printers in the list...
Now take a look at the ValidateUserData stuff -- I think it will show you
why the height and width don't change.
>L<
"vamsi" <vamsii@.gmail.com> wrote in message
news:1177005379.609924.169550@.y80g2000hsf.googlegroups.com...
>I commented out this part of the code
> if (!IsValidPrinter(data.Printer))
> throw new Exception("The printer " + data.Printer + " is not currently
> installed on the server.");
> in PrinterDeliveryProvider.cs and its working for now.I have to check
> whether i will get any other problem.It always prints in 8.5 * 11 page
> irrespective of the settings we give while subscribing.I have to check
> the PrinterDeliveryProvider code.
> Thanks
> vkv
>|||I changed the code in PrinterDeliveryProvider for the printer
settings.Now its printing correctly but its not settings the font size
of the report.Its taking its deafult size.I have to search for that
again.Please let me know if you cam eacross this issue.
Thanks
vkv|||I don't quite understand what you mean. As far as I can see there is no
need for the extension code to set a font size. It is not printing text.
It is printing a page image which is handed to it as a metafile.
deviceInfo = String.Format(
System.Globalization.CultureInfo.InvariantCulture,
@."<DeviceInfo><OutputFormat>{0}</OutputFormat><PageHeight>{1}</PageHeight><PageWidth>{2}</PageWidth></DeviceInfo>",
"emf", pageHeight, pageWidth);
// Render report
m_files = notification.Report.Render("IMAGE", deviceInfo);
The font information all comes from the report as rendered by engine code --
the extension isn't sitting around figuring out line height, etc .
The extension only "sees" an image which it proceeds to deliver to the
printer. Why would it pay attention to the printer settings for font
information? Maybe I'm misunderstanding your question...
>L<
"vamsi" <vamsii@.gmail.com> wrote in message
news:1177021179.164488.167590@.q75g2000hsh.googlegroups.com...
>I changed the code in PrinterDeliveryProvider for the printer
> settings.Now its printing correctly but its not settings the font size
> of the report.Its taking its deafult size.I have to search for that
> again.Please let me know if you cam eacross this issue.
> Thanks
> vkv
>|||I thought the same,But it might not happening with my case.When i
print the report from the reportmanager directly i see the font that i
set.When a sheet is printed from printer example font is different so
content is not complete.
This was the reason behind trying to adjust the font size.
Thanks
vkv|||When you print from the report manager, where are you setting the font?
Are you talking about something in the printer setup or something in the
report?
>L<
"vamsi" <vamsii@.gmail.com> wrote in message
news:1177088551.822758.189490@.y80g2000hsf.googlegroups.com...
>I thought the same,But it might not happening with my case.When i
> print the report from the reportmanager directly i see the font that i
> set.When a sheet is printed from printer example font is different so
> content is not complete.
> This was the reason behind trying to adjust the font size.
> Thanks
> vkv
>|||I am not doing anything.i saw other post.that user also complaining
about the image that is rendering to the report.I dont know wat to do
and how to approach|||>>I am not doing anything.
You said:
>>When i print the report from the reportmanager directly i see the font
>>that i set.
So I asked: Where did you set the font? In the report or the printer
setup?
>>i saw other post.that user also complaining about the image that is
>>rendering to the report
I'm not sure which other post you're referring to, but if it's the "printer
delivery sample" thread, it only confirms what I already told you:
This sample extension is printing from an EMF that they get from the engine,
not rendering text. In no way would the sample code, printing an image, be
handling fonts if it is printing a page image. However, the sample code is
not necessarily sizing the image properly, which might look like a font size
issue.
Look: "sizing the image properly" is a non-trivial task. The sample code
has some code stubbed in to decide whether the printer you want to use can
handle the size of the page that the report has been set to, IOW whether
that page size is *valid* on the printer you want. You have commented out
that code right now, I know. But that validation *has* to be done, and is a
small part of the non-trivial task.
The extension code cannot repaginate. It has to decide what to do with the
rendered pages, which were rendered with a certain page size and -- more
significantly -- a certain height to width ratio.
>>I dont know wat to do and how to approach
To handle this task properly:
We know that the report page is already rendered, with a certain height to
width ratio, by the time the extension gets ahold of it. Now the extension
has to decide how to handle any *difference* between the original aspect
ratio and page size and what is available in the user's specified printer
setup.
There are several options the extension has in this situation, and IMHO it
actually should let the user decide which is the best one to use before
proceeding:
* -- scale the EMF and stretch to exactly fit the available page size and
its aspect ratio, even if it might be inappropriate for the current page
aspect ratio as set by the user's chosen printer
* -- scale the EMF but keep the original aspect ratio, fixing the larger of
the two original dimensions to fit the available space and leaving some
white space on the smaller one
* -- scale the EMF but keep the original aspect ratio, fixing the smaller of
the two original dimensions to fit the available space and clipping off
whatever part of the larger one doesn't fit
* -- don't scale the EMF at all -- meaning sometimes you'll have extra
space, more often the page will get clipped in one or both dimensions, but
the aspect ratio and the original intent of the page, as designed in the
report layout, is preserved with fidelity.
Once you have gone this far down the path, and allowed the user a chance to
decide how to handle the current report, you can then add a bunch of other
possibilities, including printing multiple page images per paper page. (I'm
sure you've seen this option in printer driver options, right? Printing two
pages per page, or four pages per page, or whatever? This is how it works.
You have to do the math a little differently than one page per page, but
it's the same basic problem.)
I haven't actually looked to see which decision about scaling the extension
makes. I don't know if there is any dynamic intelligence in the sample code
to handle best-case by comparing the user page size and the original page
size or if it always makes the same decision.
My point here: to approach the problem properly, think about the sizing and
stretching cases above, and how they might play out in your situation. Look
at the sample code to see how it sends the image to the printer.
When you do, you may find (as I believe) that what is going on has NOTHING
to do with "font size" and EVERYTHING to do with image scaling.
If I'm wrong, and it really *does* have to do with font size, then one has
to ask: where did you set the font size that you say the report manager is
respecting but the extension is not?
>L<
"vamsi" <vamsii@.gmail.com> wrote in message
news:1177105049.732348.209160@.b58g2000hsg.googlegroups.com...
>I am not doing anything.i saw other post.that user also complaining
> about the image that is rendering to the report.I dont know wat to do
> and how to approach
>|||I did send email to your personal account of scanned printouts from
report manager and also the printer delivery print out.I am still
trying to scale the EMF.
Thanks
vkv|||Well, I guess I'm glad you told me because it went right in my spam...
... please don't do this again (anybody) unless I ask you to ...
Since you did it this time: It seems pretty clear from the two PDFs that you
sent that what I'm saying is correct: It is an image scaling problem, not a
font size problem.
I know that you don't want an 8.5 x 11 page. But your PDF from the report
manager *is* 8.5 x 11. (look at the properties) I am not sure what the
original report is designed to be but when you scanned the printout and sent
it to a PDF, somewhere along the line it scaled it to 8.5 x11. Do you
understand what I am saying? Somewhere along the line somebody used an
algorithm similar to what I'm saying you have to do.
But the printer extension sample code doesn't do this same thing. You would
have to do it in an adaptation of that code.
In my last message I told you pretty much what decisions have to be made to
scale an image properly. I can't make the choice for you about which case
or which algorithm fits your needs. Even if you wanted to limit it to one
simple case, that case depends on the relationship of the original page size
to the page size you are looking for.
If I were going to write this production-grade/generically, I would try to
cover at least the 4 cases I described to you, and then allow the user some
scaling options, asking which case they wanted for this report. It's not
something you solve one way for every set of page size ratios.
And I don't think that my existing code would help you very much. It's not
.NET code.
But here is pseudocode to show you how you work out the basic problem:
I suspect the overload for doing the drawing is this one:
public void EnumerateMetafile (
Metafile metafile,
Rectangle destRect,
EnumerateMetafileProc callback
)
... IOW, you have to tell the metafile image where it should go, what space
to fill, even if it is going to get stretched or shrunk. (This is pretty
much what IE and Adobe Reader etc do when they offer a "shrink to fit"
option for printing.)
In the simplest case, if you just want to fill the new page size and you
don't care of the new aspect ratio matches the old one, you just set that
destRec to the size of the user-designated (subscription) page size.
(I will skip the part where you interrogate the current printer to find out
what its actual printable page size is like since most printers don't print
all the way to the boundaries of the paper... Sigh. That part probably
applies to all cases.)
IAC, just setting that rectangle to the new page size is not the only or
best way to do it if you want to preserve the aspect ratio of the original
page.
This is something like showing a widescreen film on 4.3 TV. The one thing
you generally *don't* want to do is fill both dimensions and show the
picture stretched to an incorrect aspect ratio, because it looks silly,
everything is out of proportion. OK?
So, how should the film be shown? You have to decide whether you want to fit
the width and have some extra space at the top and/or bottom, or fit the
height and cut off some on each side, etc. Same goes for a widescreen TV
and a "regular" TV show that is broadcase in 4.3. There are several
possible cases, all of which are relevant here. You have no control: the
original page might be landscape while the new page is portrait or the other
way around, you're looking for the best fit in each situation.
So, how you do it: you can figure out the difference between page sizes
(rendered and subscription page) and the approach you will take when you get
ready to print the first page.
You should see a line that looks like this in the code:
// Load the metafile image for this page
m_metafile = new Metafile(m_currentPageStream);
A metafile image is being loaded for each page. On the first page, when you
start the job, you can interrogate this image for its size.
m_originalWidth = m_metafile.Width
m_originalHeight = m_metafile.Height
... with me so far?
Now you have to do the math. You can compare that image's aspect ratio with
the one your user has provided for the page size they want, in the settings
array (SubscriptionData.PAGEHEIGHT/SubscriptionData.PAGEWIDTH), and make any
necessary adjustments in the destRect.
You could start by trying to fill the new Width completely. You know the
original Width and its relationship to the new subscription page width. The
new height has to be the same percentage of the original
m_metafile.Height -- whether bigger or smaller -- as the new width is of the
original Width. That's how the aspect ratio stays correct.
So now you have a possible new height for your destRect. Is that new height
bigger than the available height of the subscription page? Then try it the
other way around: try filling the Height and seeing if you can get the
Width to fit.
(There are ways to decide which to try first, I'm skipping all that. The
result is the same no matter how smart or dumb you make the code.)
If you can't get both dimensions to fit on the page, try cutting down both
dimensions by some percentage (say, 5%) and try again.
I hope you're starting to see what I'm talking about.
See... ** THEY WROTE A SAMPLE **. It's not production-grade. What else
can I say.
>L<
"vamsi" <vamsii@.gmail.com> wrote in message
news:1177117415.975650.74970@.l77g2000hsb.googlegroups.com...
>I did send email to your personal account of scanned printouts from
> report manager and also the printer delivery print out.I am still
> trying to scale the EMF.
> Thanks
> vkv
>|||Thanks for giving really good suggestions from where i have to
start.My fault for sending the email.
I have to make this printer delivery for only this report,so i can
make any changes which fits this report.Thats atleast good part.I dont
have to write generalize code.For this report i am intended to print
8.5 * 11.
As you suggested earlier on this point
* -- scale the EMF and stretch to exactly fit the available page size
and
its aspect ratio, even if it might be inappropriate for the current
page
aspect ratio as set by the user's chosen printer
-- Scale emf means dealing with resolution ' If it is meant
resolution Metafile resolution properties are read only.
And on the Suggestion
You should see a line that looks like this in the code:
// Load the metafile image for this page
m_metafile = new Metafile(m_currentPageStream);
A metafile image is being loaded for each page. On the first page,
when you
start the job, you can interrogate this image for its size.
m_originalWidth = m_metafile.Width
m_originalHeight = m_metafile.Height
There is no line of code like this,but the kept those lines and found
out that width is 817 and height is 1057.
I changed the dest where it has to print from Point destPoint = new
Point(0, 0); to Point destPoint = new Point(-35, -30); There is
little bit improvement on the both horizontal and vertical positions.
I am thinking the only way to get this right is reduce the
resolution.Am i going in right direction.
You are right that it is only a sample.I should extend to make it
compatible for my purpose.
Thanks for giving replies.
Thanks
vkv|||I changed the function ReportDrawPage and it is working as i wanted.
private void ReportDrawPage(Graphics graphics)
{
if (null == m_currentPageStream || 0 ==m_currentPageStream.Length || null == m_metafile)
return;
lock (this)
{
// Set the metafile delegate.
int width = m_metafile.Width;
int height = m_metafile.Height;
m_delegate = new
Graphics.EnumerateMetafileProc(MetafileCallback);
// Draw in the rectangle
//Point destPoint = new Point(0, 0);
System.Drawing.Rectangle rect = new
System.Drawing.Rectangle(0, 0, width, height);
graphics.EnumerateMetafile(m_metafile, rect,
m_delegate);
// Clean up
m_delegate = null;
}
}
Thanks for your help that you responded all this time.
vkv|||Yup -- that will work for your simple case. I'm glad for you!
The reason I gave you the additional, generic information is to explain why
it is hard to do this, for you and for other people reading. <s>
IOW: I would like to help folks here understand why they didn't "just add
the little bit of extra code to make the sample more robust". The answer is
because it wouldn't be "a little bit of extra code" to do it correctly <g>.
Caveat: I really don't understand why they didn't use the overload of
EnumerateMetafileProc that I suggested and that you have used
successfully -- that *would* have been a "little bit of code" and would have
pointed people in the right direction... following that same little bit of
help from me you did just fine! <s>.
To answer something in your other message -- although resolution of the
*EMF* is readonly, we're not adjusting resolution of the EMF (the source).
We are adjusting the dimensions to which the image is being rendered to the
printer (the target). This might be just another way of saying that we need
to adjust the resolution of the *target* but you don't really need to think
it. I think you now understand this, but I want to make sure everybody
reading does.
Also, yes, there was no line of code like this:
m_originalWidth = m_metafile.Width
m_originalHeight = m_metafile.Height
<<
That was code I was suggesting that you *add* after the line in the code
loading the metafile. You do not need to do it in the non-generic case,
but I was suggesting that if one were writing this generically, one would
take those values when interrogating that first image and save them to
member properties. Then they are available to use in math as required.
There are scenarios in which one has to re-evaluate them again after the
first page (which, again, do not concern you at the moment).
Regards,
>L<
"vamsi" <vamsii@.gmail.com> wrote in message
news:1177369963.637449.95000@.y5g2000hsa.googlegroups.com...
>I changed the function ReportDrawPage and it is working as i wanted.
>
> private void ReportDrawPage(Graphics graphics)
> {
> if (null == m_currentPageStream || 0 ==> m_currentPageStream.Length || null == m_metafile)
> return;
> lock (this)
> {
> // Set the metafile delegate.
> int width = m_metafile.Width;
> int height = m_metafile.Height;
> m_delegate = new
> Graphics.EnumerateMetafileProc(MetafileCallback);
> // Draw in the rectangle
> //Point destPoint = new Point(0, 0);
> System.Drawing.Rectangle rect = new
> System.Drawing.Rectangle(0, 0, width, height);
> graphics.EnumerateMetafile(m_metafile, rect,
> m_delegate);
> // Clean up
> m_delegate = null;
> }
>
> }
>
> Thanks for your help that you responded all this time.
> vkv
>|||On Apr 25, 6:14 am, "Lisa Slater Nicholls" <l...@.spacefold.com> wrote:
> Yup -- that will work for your simple case. I'm glad for you!
> The reason I gave you the additional, generic information is to explain why
> it is hard to do this, for you and for other people reading. <s>
> IOW: I would like to help folks here understand why they didn't "just add
> the little bit of extra code to make the sample more robust". The answer is
> because it wouldn't be "a little bit of extra code" to do it correctly <g>.
> Caveat: I really don't understand why they didn't use the overload of
> EnumerateMetafileProc that I suggested and that you have used
> successfully -- that *would* have been a "little bit of code" and would have
> pointed people in the right direction... following that same little bit of
> help from me you did just fine! <s>.
> To answer something in your other message -- although resolution of the
> *EMF* is readonly, we're not adjusting resolution of theEMF(the source).
> We are adjusting the dimensions to which the image is being rendered to the
> printer (the target). This might be just another way of saying that we need
> to adjust the resolution of the *target* but you don't really need to think
> it. I think you now understand this, but I want to make sure everybody
> reading does.
> Also, yes, there was no line of code like this:
>
> m_originalWidth = m_metafile.Width
> m_originalHeight = m_metafile.Height
> <<
> That was code I was suggesting that you *add* after the line in the code
> loading the metafile. You do not need to do it in the non-generic case,
> but I was suggesting that if one were writing this generically, one would
> take those values when interrogating that first image and save them to
> member properties. Then they are available to use in math as required.
> There are scenarios in which one has to re-evaluate them again after the
> first page (which, again, do not concern you at the moment).
> Regards,
> >L<
> "vamsi" <vam...@.gmail.com> wrote in message
> news:1177369963.637449.95000@.y5g2000hsa.googlegroups.com...
>
> >I changed the function ReportDrawPage and it is working as i wanted.
> > private void ReportDrawPage(Graphics graphics)
> > {
> > if (null == m_currentPageStream || 0 ==> > m_currentPageStream.Length || null == m_metafile)
> > return;
> > lock (this)
> > {
> > // Set the metafile delegate.
> > int width = m_metafile.Width;
> > int height = m_metafile.Height;
> > m_delegate = new
> > Graphics.EnumerateMetafileProc(MetafileCallback);
> > // Draw in the rectangle
> > //Point destPoint = new Point(0, 0);
> > System.Drawing.Rectangle rect = new
> > System.Drawing.Rectangle(0, 0, width, height);
> > graphics.EnumerateMetafile(m_metafile, rect,
> > m_delegate);
> > // Clean up
> > m_delegate = null;
> > }
> > }
> > Thanks for your help that you responded all this time.
> > vkv- Hide quoted text -
> - Show quoted text -
Ha Ha !!!
Wasnt expecting it to be so easy
insted of passing the point pass a rectangle ...
Rectangle destRect = new Rectangle(0, 0, m_metafile.Width ,
m_metafile.Height);
graphics.EnumerateMetafile(m_metafile, destRect, m_delegate);
// the original code in the example is passing a point as aopposed to
the rectangle.
Cheers|||On Apr 21, 5:02 am, vamsi <vam...@.gmail.com> wrote:
> I thought the same,But it might not happening with my case.When i
> print the report from the reportmanager directly i see thefontthat i
> set.When a sheet is printed from printer examplefontis different so
> content is not complete.
> This was the reason behind trying to adjust thefontsize.
> Thanks
> vkv
The Reason for the difference in the font size is because of scaling.
All you need to do is to modify two lines of code.
in the ReportDrawPage method insted of passing a Point object to the
EnumerateMetafile method pass a rectangle as shown below...
private void ReportDrawPage(Graphics graphics)
{
.....
Rectangle destRect = new Rectangle(0, 0, m_metafile.Width ,
m_metafile.Height);
graphics.EnumerateMetafile(m_metafile, destRect, m_delegate);
......
}|||>> // the original code in the example is passing a point as aopposed to
> the rectangle.
Yes, I know. That's why I suggested the overload you used. <g>
I still don't understand why they used the one they did...
>L<
>
<anilrawat@.gmail.com> wrote in message
news:1179713963.079135.68760@.z28g2000prd.googlegroups.com...
> On Apr 25, 6:14 am, "Lisa Slater Nicholls" <l...@.spacefold.com> wrote:
>> Yup -- that will work for your simple case. I'm glad for you!
>> The reason I gave you the additional, generic information is to explain
>> why
>> it is hard to do this, for you and for other people reading. <s>
>> IOW: I would like to help folks here understand why they didn't "just add
>> the little bit of extra code to make the sample more robust". The answer
>> is
>> because it wouldn't be "a little bit of extra code" to do it correctly
>> <g>.
>> Caveat: I really don't understand why they didn't use the overload of
>> EnumerateMetafileProc that I suggested and that you have used
>> successfully -- that *would* have been a "little bit of code" and would
>> have
>> pointed people in the right direction... following that same little bit
>> of
>> help from me you did just fine! <s>.
>> To answer something in your other message -- although resolution of the
>> *EMF* is readonly, we're not adjusting resolution of theEMF(the source).
>> We are adjusting the dimensions to which the image is being rendered to
>> the
>> printer (the target). This might be just another way of saying that we
>> need
>> to adjust the resolution of the *target* but you don't really need to
>> think
>> it. I think you now understand this, but I want to make sure everybody
>> reading does.
>> Also, yes, there was no line of code like this:
>>
>> m_originalWidth = m_metafile.Width
>> m_originalHeight = m_metafile.Height
>> <<
>> That was code I was suggesting that you *add* after the line in the code
>> loading the metafile. You do not need to do it in the non-generic case,
>> but I was suggesting that if one were writing this generically, one
>> would
>> take those values when interrogating that first image and save them to
>> member properties. Then they are available to use in math as required.
>> There are scenarios in which one has to re-evaluate them again after the
>> first page (which, again, do not concern you at the moment).
>> Regards,
>> >L<
>> "vamsi" <vam...@.gmail.com> wrote in message
>> news:1177369963.637449.95000@.y5g2000hsa.googlegroups.com...
>>
>> >I changed the function ReportDrawPage and it is working as i wanted.
>> > private void ReportDrawPage(Graphics graphics)
>> > {
>> > if (null == m_currentPageStream || 0 ==>> > m_currentPageStream.Length || null == m_metafile)
>> > return;
>> > lock (this)
>> > {
>> > // Set the metafile delegate.
>> > int width = m_metafile.Width;
>> > int height = m_metafile.Height;
>> > m_delegate = new
>> > Graphics.EnumerateMetafileProc(MetafileCallback);
>> > // Draw in the rectangle
>> > //Point destPoint = new Point(0, 0);
>> > System.Drawing.Rectangle rect = new
>> > System.Drawing.Rectangle(0, 0, width, height);
>> > graphics.EnumerateMetafile(m_metafile, rect,
>> > m_delegate);
>> > // Clean up
>> > m_delegate = null;
>> > }
>> > }
>> > Thanks for your help that you responded all this time.
>> > vkv- Hide quoted text -
>> - Show quoted text -
>
> Ha Ha !!!
> Wasnt expecting it to be so easy
> insted of passing the point pass a rectangle ...
> Rectangle destRect = new Rectangle(0, 0, m_metafile.Width ,
> m_metafile.Height);
> graphics.EnumerateMetafile(m_metafile, destRect, m_delegate);
> // the original code in the example is passing a point as aopposed to
> the rectangle.
> Cheers
>

Saturday, February 25, 2012

Data aggregation, syhcronization, and search

Hello All,
I know that this problem is not SQL Server specific but I decided to
post it here because it is a problem that I am certain many of you
expericenced (or at least thought about).
In my system, I have a central SQL Server Database and number of
remote "data providers". Some of these data providers are other SQL
Servers and others are other databases or other data provider services
that expose a database-like interface.
We provide two levels of search capability in the system. The user can
search either the central database, or search one specific data
provider. One of the new requirements, was to provide a global search,
which would search the central database and all the data providers at
once.
Performing a distributed is prohibitive in our scenario because we
have many data providers and they remotelly located. To minimize the
search time, my first reaction was to create a copy of the data from
the remote providers on the central database and keep it in synch with
the data in the remote data providers. By doing this, I would expect
to simplify the search by having simply a search in the central
database.
However, a number of new question concerning data synchronization
arise:
1. How can I keep the data in the central db in synch with the remote
data providers? (If they all were SQL Server databases, I would use
merger replication...but they aren't?)
2. How to handle disconnects? If the remote provider disconnets and
reconnects, some of the data might be stale. In pronciple, I could
take a new snapshot and keep the data in synch from that point.
However, this is very expensive!! Do you know of any other techniques
for data synchronization that would minimize network traffic?
3. Is this a good approach? What do you think?
Your opinion is gratly appreciated.
Kind regards
CD
Hi
"crbd98@.yahoo.com" wrote:

> Hello All,
> I know that this problem is not SQL Server specific but I decided to
> post it here because it is a problem that I am certain many of you
> expericenced (or at least thought about).
> In my system, I have a central SQL Server Database and number of
> remote "data providers". Some of these data providers are other SQL
> Servers and others are other databases or other data provider services
> that expose a database-like interface.
> We provide two levels of search capability in the system. The user can
> search either the central database, or search one specific data
> provider. One of the new requirements, was to provide a global search,
> which would search the central database and all the data providers at
> once.
> Performing a distributed is prohibitive in our scenario because we
> have many data providers and they remotelly located. To minimize the
> search time, my first reaction was to create a copy of the data from
> the remote providers on the central database and keep it in synch with
> the data in the remote data providers. By doing this, I would expect
> to simplify the search by having simply a search in the central
> database.
> However, a number of new question concerning data synchronization
> arise:
> 1. How can I keep the data in the central db in synch with the remote
> data providers? (If they all were SQL Server databases, I would use
> merger replication...but they aren't?)
> 2. How to handle disconnects? If the remote provider disconnets and
> reconnects, some of the data might be stale. In pronciple, I could
> take a new snapshot and keep the data in synch from that point.
> However, this is very expensive!! Do you know of any other techniques
> for data synchronization that would minimize network traffic?
> 3. Is this a good approach? What do you think?
> Your opinion is gratly appreciated.
> Kind regards
> CD
>
You don't say how you currently search the remote data providers! It may be
more acceptable for the users if the global search initially searched the
central database and returned the results and then searched the remote
databases which would return something to the user quicker and reduce the
need to speed up the remote searches.
If you held the data centrally, you would also need to know how much latency
would be acceptable for the data, if you could get away with uploading once a
day out of hours then this could be an easier solution to implement.
John
|||Answers inline.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
<crbd98@.yahoo.com> wrote in message
news:1176094164.164628.321030@.q75g2000hsh.googlegr oups.com...
> Hello All,
> I know that this problem is not SQL Server specific but I decided to
> post it here because it is a problem that I am certain many of you
> expericenced (or at least thought about).
> In my system, I have a central SQL Server Database and number of
> remote "data providers". Some of these data providers are other SQL
> Servers and others are other databases or other data provider services
> that expose a database-like interface.
> We provide two levels of search capability in the system. The user can
> search either the central database, or search one specific data
> provider. One of the new requirements, was to provide a global search,
> which would search the central database and all the data providers at
> once.
> Performing a distributed is prohibitive in our scenario because we
> have many data providers and they remotelly located. To minimize the
> search time, my first reaction was to create a copy of the data from
> the remote providers on the central database and keep it in synch with
> the data in the remote data providers. By doing this, I would expect
> to simplify the search by having simply a search in the central
> database.
> However, a number of new question concerning data synchronization
> arise:
> 1. How can I keep the data in the central db in synch with the remote
> data providers? (If they all were SQL Server databases, I would use
> merger replication...but they aren't?)
I would use transactional replication to replicate the remote SQL Servers to
the central location. For the non-SQL Server data providers depending on the
amount of changes, the volume of data and whether you can track changes you
should be able to write something that will bring the data locally.
> 2. How to handle disconnects? If the remote provider disconnets and
> reconnects, some of the data might be stale. In pronciple, I could
> take a new snapshot and keep the data in synch from that point.
> However, this is very expensive!! Do you know of any other techniques
> for data synchronization that would minimize network traffic?
You need to implement some method of change tracking so only the changes
will move each time rather than the entire data set.
> 3. Is this a good approach? What do you think?
>
The network hop is always problematic and moving data locally is one
approach to avoid it. Another option might be to move all providers locally
and then have the clients use a remote access solution to access the central
server/repository. This will work well if your links are stable and well
connected.

> Your opinion is gratly appreciated.
> Kind regards
> CD
>

Sunday, February 19, 2012

Damaged backup file?

Hello
When I try to restore database from a specific backup file
using Enterprise Manager I get this error message:
+---+
| Microsoft SQL-DMO (ODBC SQLState: HY000) |
+---+
| Location: recbase.cpp:1378 |
| Expression: m_offBeginVar < m_SizeRec |
| SPID: 51 |
| Process ID: 1544 |
| |
| [ OK ] |
| |
+---+
The backup file contains 2 files: data file and a log file.
Restoring only data file is successful, but leaves the DB
in "Loading" state. Restoring only a log file to this partialy
restored DB is unsuccessful - generates the same error as in
full restore, and leaves DB in "Loading/Suspect" state.
Backup verification (used in SQL Query Analyzer):
RESTORE VERIFYONLY
FROM DISK = '...'
returns "The backup set is valid."
Restoring with SQL Suery Analyzer using statement:
RESTORE DATABASE [db_name]
FROM DISK = '...'
gives:
Processed 2088 pages for database 'db_name', file 'xxx_Data' on file 1.
Processed 1 pages for database 'mf_test', file 'xxx_Log' on file 1.
Server: Msg 3624, Level 20, State 1, Line 1
Location: R:\sql\ntdbms\storeng\drs\include\record.inl:1447
Expression: m_SizeRec > 0 && m_SizeRec <= MAXDATAROW
SPID: 52
Process ID: 1544
Connection Broken
Is there any way to recover any data from this apparently damaged backup
file? Maybe there's a way to ignore the log file and have the DB in
usable state...
Hilarion
> Backup verification (used in SQL Query Analyzer):
> RESTORE VERIFYONLY
> FROM DISK = '...'
> returns "The backup set is valid."
VERIFYONLY doesn't verify internal consistency of the backup. Essentially only that the file is
readable and that it is a SQL Server backup.

> Is there any way to recover any data from this apparently damaged backup
> file? Maybe there's a way to ignore the log file and have the DB in
> usable state...
Yes, do only one restore, from the database backup and specify WITH RECOVERY.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Hilarion" <hilarion@.noemail.nospam> wrote in message news:OkWDob9nEHA.2764@.TK2MSFTNGP11.phx.gbl...
> Hello
> When I try to restore database from a specific backup file
> using Enterprise Manager I get this error message:
> +---+
> | Microsoft SQL-DMO (ODBC SQLState: HY000) |
> +---+
> | Location: recbase.cpp:1378 |
> | Expression: m_offBeginVar < m_SizeRec |
> | SPID: 51 |
> | Process ID: 1544 |
> | |
> | [ OK ] |
> | |
> +---+
> The backup file contains 2 files: data file and a log file.
> Restoring only data file is successful, but leaves the DB
> in "Loading" state. Restoring only a log file to this partialy
> restored DB is unsuccessful - generates the same error as in
> full restore, and leaves DB in "Loading/Suspect" state.
> Backup verification (used in SQL Query Analyzer):
> RESTORE VERIFYONLY
> FROM DISK = '...'
> returns "The backup set is valid."
> Restoring with SQL Suery Analyzer using statement:
> RESTORE DATABASE [db_name]
> FROM DISK = '...'
> gives:
> Processed 2088 pages for database 'db_name', file 'xxx_Data' on file 1.
> Processed 1 pages for database 'mf_test', file 'xxx_Log' on file 1.
> Server: Msg 3624, Level 20, State 1, Line 1
> Location: R:\sql\ntdbms\storeng\drs\include\record.inl:1447
> Expression: m_SizeRec > 0 && m_SizeRec <= MAXDATAROW
> SPID: 52
> Process ID: 1544
> Connection Broken
>
> Is there any way to recover any data from this apparently damaged backup
> file? Maybe there's a way to ignore the log file and have the DB in
> usable state...
> Hilarion
>
|||> > Is there any way to recover any data from this apparently damaged backup[vbcol=seagreen]

> Yes, do only one restore, from the database backup and specify WITH RECOVERY.
Could you supply correct RESTORE statement? Cause:
RESTORE DATABASE [db_name]
FROM DISK = '...'
WITH RECOVERY
gives:
Processed 2088 pages for database 'db_name', file 'xxx_Data' on file 1.
Processed 1 pages for database 'db_name', file 'xxx_Log' on file 1.
Server: Msg 3624, Level 20, State 1, Line 1
Location: recbase.cpp:1378
Expression: m_offBeginVar < m_SizeRec
SPID: 52
Process ID: 3652
Connection Broken
RESTORE DATABASE [db_name]
FILEGROUP = 'PRIMARY'
FROM DISK = '...'
WITH RECOVERY
gives:
Server: Msg 3032, Level 16, State 2, Line 1
One or more of the options (recovery) are not supported for this statement.
Review the documentation for supported options.
RESTORE DATABASE [db_name]
FILEGROUP = 'PRIMARY'
FROM DISK = '...'
WITH PARTIAL, RECOVERY
gives:
Processed 2088 pages for database 'db_name', file 'xxx_Data' on file 1.
Processed 1 pages for database 'db_name', file 'xxx_Log' on file 1.
Server: Msg 3624, Level 20, State 1, Line 1
Location: recbase.cpp:1378
Expression: m_offBeginVar < m_SizeRec
SPID: 52
Process ID: 3652
Connection Broken
Tried also some other statements. Seems like "RECOVERY" forces restore
of all files (also log file, which is damaged).
I do not know how to specify WITH RECOVERY in Enterprise Manager, and
how to specify single file ('xxx_Data' data file) to be restored in
RESTORE WITH RECOVERY statement. "SQL Server Books Online" aren't very
helpful in this case.
Hilarion
|||Seems you indeed have some corruption in your database backup (the log records therein). And SQL
server need those log records to give you a consistent state of the database. I suggest you open a
case with MS Support for this, they *might* have ways to get the database back...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Hilarion" <hilarion@.noemail.nospam> wrote in message
news:%23PcYxrKoEHA.3424@.TK2MSFTNGP12.phx.gbl...
>
> Could you supply correct RESTORE statement? Cause:
> RESTORE DATABASE [db_name]
> FROM DISK = '...'
> WITH RECOVERY
> gives:
> Processed 2088 pages for database 'db_name', file 'xxx_Data' on file 1.
> Processed 1 pages for database 'db_name', file 'xxx_Log' on file 1.
> Server: Msg 3624, Level 20, State 1, Line 1
> Location: recbase.cpp:1378
> Expression: m_offBeginVar < m_SizeRec
> SPID: 52
> Process ID: 3652
> Connection Broken
> RESTORE DATABASE [db_name]
> FILEGROUP = 'PRIMARY'
> FROM DISK = '...'
> WITH RECOVERY
> gives:
> Server: Msg 3032, Level 16, State 2, Line 1
> One or more of the options (recovery) are not supported for this statement.
> Review the documentation for supported options.
>
> RESTORE DATABASE [db_name]
> FILEGROUP = 'PRIMARY'
> FROM DISK = '...'
> WITH PARTIAL, RECOVERY
> gives:
> Processed 2088 pages for database 'db_name', file 'xxx_Data' on file 1.
> Processed 1 pages for database 'db_name', file 'xxx_Log' on file 1.
> Server: Msg 3624, Level 20, State 1, Line 1
> Location: recbase.cpp:1378
> Expression: m_offBeginVar < m_SizeRec
> SPID: 52
> Process ID: 3652
> Connection Broken
>
> Tried also some other statements. Seems like "RECOVERY" forces restore
> of all files (also log file, which is damaged).
>
> I do not know how to specify WITH RECOVERY in Enterprise Manager, and
> how to specify single file ('xxx_Data' data file) to be restored in
> RESTORE WITH RECOVERY statement. "SQL Server Books Online" aren't very
> helpful in this case.
> Hilarion
>
|||> Seems you indeed have some corruption in your database
> backup (the log records therein). And SQL server need
> those log records to give you a consistent state of the
> database. I suggest you open a case with MS Support for
> this, they *might* have ways to get the database back...
I hoped some Microsoft specialist will answer my posts
here, but thanx anyway.
Hilarion
|||> I hoped some Microsoft specialist will answer my posts
> here
What happened to:
MSDN managed newsgroups provide:
- Unlimited on-line technical support - keep your PSS incidents
- A commitment to respond to your post within >>two business days<<
- Over 200 newsgroups to choose from
- Spam protection for your e-mail address when posting items
|||Well, this is an MSDN managed newsgroup so if you are an MSDN subscriber and
had posted from a registered anti-spam posting alias, you would have gotten
a response from someone on the MSDN managed newsgroups team. However,
hilarion@.noemail.nospam doesn't appear to be registered. If you are an MSDN
subscriber, please start at
http://support.microsoft.com/default...am.asp&SD=msdn
and follow the directions to register your anti-spam alias. It may take a
little while to get into the system, but once it is you'll start getting
those responses.
Sincerely,
Stephen Dybing
This posting is provided "AS IS" with no warranties, and confers no rights.
"Hilarion" <hilarion@.noemail.nospam> wrote in message
news:uO21hyVoEHA.2068@.TK2MSFTNGP09.phx.gbl...
> What happened to:
>
> MSDN managed newsgroups provide:
> - Unlimited on-line technical support - keep your PSS incidents
> - A commitment to respond to your post within >>two business days<<
> - Over 200 newsgroups to choose from
> - Spam protection for your e-mail address when posting items
>
|||Oh, and I'm not a file recovery specialist so I didn't address your original
question in my response, but that type of recovery isn't something that they
handle via the newsgroups anyway. If they can do anything, it really does
require that you open a case.
Sincerely,
Stephen Dybing
This posting is provided "AS IS" with no warranties, and confers no rights.
"Stephen Dybing [MSFT]" <stephd@.online.microsoft.com> wrote in message
news:e%231S%23cZoEHA.3792@.TK2MSFTNGP11.phx.gbl...
> Well, this is an MSDN managed newsgroup so if you are an MSDN subscriber
> and had posted from a registered anti-spam posting alias, you would have
> gotten a response from someone on the MSDN managed newsgroups team.
> However, hilarion@.noemail.nospam doesn't appear to be registered. If you
> are an MSDN subscriber, please start at
> http://support.microsoft.com/default...am.asp&SD=msdn
> and follow the directions to register your anti-spam alias. It may take a
> little while to get into the system, but once it is you'll start getting
> those responses.
> --
> Sincerely,
> Stephen Dybing
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> "Hilarion" <hilarion@.noemail.nospam> wrote in message
> news:uO21hyVoEHA.2068@.TK2MSFTNGP09.phx.gbl...
>
|||Hello
I did that (a day or something about) before posting the original post (and
re-registered few minutes ago getting "Please chose a more unique Nickname and
submit again" which means that this alias _is_ registered), so I do not know what
else should I do.
The link you gave is not entirely valid. Under this address:
http://support.microsoft.com/default...am.asp&SD=msdn
one can only find this information:
<info>
For security purposes, we have moved the registration page to the MSDN Subscriber
Downloads site located at:
http://msdn.microsoft.com/subscriptions/downloads/
After you have access to Subscriber Downloads.
1. Select the What's Hot Link.
2. Select the Managed Newsgroup link.
3. Create your no-spam alias.
</info>
Using given address (http://msdn.microsoft.com/subscriptions/downloads/), and
the link "MSDN Managed Newsgroups" leading to http://msdn.microsoft.com/newsgroups/managed/
one gets to a page with "Register" link, which is:
http://support.microsoft.com/default...am.asp&SD=msdn
so we end up circling around.
Only way to register is _not_ to follow the first instruction, and use "here"
link (https://msdn.one.microsoft.com/Subsc...NewsGroups.asp)
on "What's Hot" (in Managed Newsgroups section). Sometimes one has to use this
link twice before getting to the proper webpage.
Hilarion

> Well, this is an MSDN managed newsgroup so if you are an MSDN subscriber and had posted from a registered anti-spam posting alias,
> you would have gotten a response from someone on the MSDN managed newsgroups team. However, hilarion@.noemail.nospam doesn't appear
> to be registered. If you are an MSDN subscriber, please start at
> http://support.microsoft.com/default...am.asp&SD=msdn and follow the directions to register your
> anti-spam alias. It may take a little while to get into the system, but once it is you'll start getting those responses.
|||> Oh, and I'm not a file recovery specialist so I didn't address your original question in my response, but that type of recovery
> isn't something that they handle via the newsgroups anyway. If they can do anything, it really does require that you open a case.
OK. That is the answer I was waiting for. Maybe not very helpful, but concrete
and at least a bit official.
Hilarion

Damaged backup file?

Hello
When I try to restore database from a specific backup file
using Enterprise Manager I get this error message:
+---+
| Microsoft SQL-DMO (ODBC SQLState: HY000) |
+---+
| Location: recbase.cpp:1378 |
| Expression: m_offBeginVar < m_SizeRec |
| SPID: 51 |
| Process ID: 1544 |
| |
| [ OK ] |
| |
+---+
The backup file contains 2 files: data file and a log file.
Restoring only data file is successful, but leaves the DB
in "Loading" state. Restoring only a log file to this partialy
restored DB is unsuccessful - generates the same error as in
full restore, and leaves DB in "Loading/Suspect" state.
Backup verification (used in SQL Query Analyzer):
RESTORE VERIFYONLY
FROM DISK = '...'
returns "The backup set is valid."
Restoring with SQL Suery Analyzer using statement:
RESTORE DATABASE [db_name]
FROM DISK = '...'
gives:
Processed 2088 pages for database 'db_name', file 'xxx_Data' on file 1.
Processed 1 pages for database 'mf_test', file 'xxx_Log' on file 1.
Server: Msg 3624, Level 20, State 1, Line 1
Location: R:\sql\ntdbms\storeng\drs\include\record.inl:1447
Expression: m_SizeRec > 0 && m_SizeRec <= MAXDATAROW
SPID: 52
Process ID: 1544
Connection Broken
Is there any way to recover any data from this apparently damaged backup
file? Maybe there's a way to ignore the log file and have the DB in
usable state...
Hilarion> Backup verification (used in SQL Query Analyzer):
> RESTORE VERIFYONLY
> FROM DISK = '...'
> returns "The backup set is valid."
VERIFYONLY doesn't verify internal consistency of the backup. Essentially only that the file is
readable and that it is a SQL Server backup.
> Is there any way to recover any data from this apparently damaged backup
> file? Maybe there's a way to ignore the log file and have the DB in
> usable state...
Yes, do only one restore, from the database backup and specify WITH RECOVERY.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Hilarion" <hilarion@.noemail.nospam> wrote in message news:OkWDob9nEHA.2764@.TK2MSFTNGP11.phx.gbl...
> Hello
> When I try to restore database from a specific backup file
> using Enterprise Manager I get this error message:
> +---+
> | Microsoft SQL-DMO (ODBC SQLState: HY000) |
> +---+
> | Location: recbase.cpp:1378 |
> | Expression: m_offBeginVar < m_SizeRec |
> | SPID: 51 |
> | Process ID: 1544 |
> | |
> | [ OK ] |
> | |
> +---+
> The backup file contains 2 files: data file and a log file.
> Restoring only data file is successful, but leaves the DB
> in "Loading" state. Restoring only a log file to this partialy
> restored DB is unsuccessful - generates the same error as in
> full restore, and leaves DB in "Loading/Suspect" state.
> Backup verification (used in SQL Query Analyzer):
> RESTORE VERIFYONLY
> FROM DISK = '...'
> returns "The backup set is valid."
> Restoring with SQL Suery Analyzer using statement:
> RESTORE DATABASE [db_name]
> FROM DISK = '...'
> gives:
> Processed 2088 pages for database 'db_name', file 'xxx_Data' on file 1.
> Processed 1 pages for database 'mf_test', file 'xxx_Log' on file 1.
> Server: Msg 3624, Level 20, State 1, Line 1
> Location: R:\sql\ntdbms\storeng\drs\include\record.inl:1447
> Expression: m_SizeRec > 0 && m_SizeRec <= MAXDATAROW
> SPID: 52
> Process ID: 1544
> Connection Broken
>
> Is there any way to recover any data from this apparently damaged backup
> file? Maybe there's a way to ignore the log file and have the DB in
> usable state...
> Hilarion
>|||> > Is there any way to recover any data from this apparently damaged backup
> > file? Maybe there's a way to ignore the log file and have the DB in
> > usable state...
> Yes, do only one restore, from the database backup and specify WITH RECOVERY.
Could you supply correct RESTORE statement? Cause:
RESTORE DATABASE [db_name]
FROM DISK = '...'
WITH RECOVERY
gives:
Processed 2088 pages for database 'db_name', file 'xxx_Data' on file 1.
Processed 1 pages for database 'db_name', file 'xxx_Log' on file 1.
Server: Msg 3624, Level 20, State 1, Line 1
Location: recbase.cpp:1378
Expression: m_offBeginVar < m_SizeRec
SPID: 52
Process ID: 3652
Connection Broken
RESTORE DATABASE [db_name]
FILEGROUP = 'PRIMARY'
FROM DISK = '...'
WITH RECOVERY
gives:
Server: Msg 3032, Level 16, State 2, Line 1
One or more of the options (recovery) are not supported for this statement.
Review the documentation for supported options.
RESTORE DATABASE [db_name]
FILEGROUP = 'PRIMARY'
FROM DISK = '...'
WITH PARTIAL, RECOVERY
gives:
Processed 2088 pages for database 'db_name', file 'xxx_Data' on file 1.
Processed 1 pages for database 'db_name', file 'xxx_Log' on file 1.
Server: Msg 3624, Level 20, State 1, Line 1
Location: recbase.cpp:1378
Expression: m_offBeginVar < m_SizeRec
SPID: 52
Process ID: 3652
Connection Broken
Tried also some other statements. Seems like "RECOVERY" forces restore
of all files (also log file, which is damaged).
I do not know how to specify WITH RECOVERY in Enterprise Manager, and
how to specify single file ('xxx_Data' data file) to be restored in
RESTORE WITH RECOVERY statement. "SQL Server Books Online" aren't very
helpful in this case.
Hilarion|||Seems you indeed have some corruption in your database backup (the log records therein). And SQL
server need those log records to give you a consistent state of the database. I suggest you open a
case with MS Support for this, they *might* have ways to get the database back...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Hilarion" <hilarion@.noemail.nospam> wrote in message
news:%23PcYxrKoEHA.3424@.TK2MSFTNGP12.phx.gbl...
> > > Is there any way to recover any data from this apparently damaged backup
> > > file? Maybe there's a way to ignore the log file and have the DB in
> > > usable state...
> > Yes, do only one restore, from the database backup and specify WITH RECOVERY.
>
> Could you supply correct RESTORE statement? Cause:
> RESTORE DATABASE [db_name]
> FROM DISK = '...'
> WITH RECOVERY
> gives:
> Processed 2088 pages for database 'db_name', file 'xxx_Data' on file 1.
> Processed 1 pages for database 'db_name', file 'xxx_Log' on file 1.
> Server: Msg 3624, Level 20, State 1, Line 1
> Location: recbase.cpp:1378
> Expression: m_offBeginVar < m_SizeRec
> SPID: 52
> Process ID: 3652
> Connection Broken
> RESTORE DATABASE [db_name]
> FILEGROUP = 'PRIMARY'
> FROM DISK = '...'
> WITH RECOVERY
> gives:
> Server: Msg 3032, Level 16, State 2, Line 1
> One or more of the options (recovery) are not supported for this statement.
> Review the documentation for supported options.
>
> RESTORE DATABASE [db_name]
> FILEGROUP = 'PRIMARY'
> FROM DISK = '...'
> WITH PARTIAL, RECOVERY
> gives:
> Processed 2088 pages for database 'db_name', file 'xxx_Data' on file 1.
> Processed 1 pages for database 'db_name', file 'xxx_Log' on file 1.
> Server: Msg 3624, Level 20, State 1, Line 1
> Location: recbase.cpp:1378
> Expression: m_offBeginVar < m_SizeRec
> SPID: 52
> Process ID: 3652
> Connection Broken
>
> Tried also some other statements. Seems like "RECOVERY" forces restore
> of all files (also log file, which is damaged).
>
> I do not know how to specify WITH RECOVERY in Enterprise Manager, and
> how to specify single file ('xxx_Data' data file) to be restored in
> RESTORE WITH RECOVERY statement. "SQL Server Books Online" aren't very
> helpful in this case.
> Hilarion
>|||> Seems you indeed have some corruption in your database
> backup (the log records therein). And SQL server need
> those log records to give you a consistent state of the
> database. I suggest you open a case with MS Support for
> this, they *might* have ways to get the database back...
I hoped some Microsoft specialist will answer my posts
here, but thanx anyway.
Hilarion|||> I hoped some Microsoft specialist will answer my posts
> here
What happened to:
MSDN managed newsgroups provide:
- Unlimited on-line technical support - keep your PSS incidents
- A commitment to respond to your post within >>two business days<<
- Over 200 newsgroups to choose from
- Spam protection for your e-mail address when posting items|||Well, this is an MSDN managed newsgroup so if you are an MSDN subscriber and
had posted from a registered anti-spam posting alias, you would have gotten
a response from someone on the MSDN managed newsgroups team. However,
hilarion@.noemail.nospam doesn't appear to be registered. If you are an MSDN
subscriber, please start at
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp&SD=msdn
and follow the directions to register your anti-spam alias. It may take a
little while to get into the system, but once it is you'll start getting
those responses.
--
Sincerely,
Stephen Dybing
This posting is provided "AS IS" with no warranties, and confers no rights.
"Hilarion" <hilarion@.noemail.nospam> wrote in message
news:uO21hyVoEHA.2068@.TK2MSFTNGP09.phx.gbl...
>> I hoped some Microsoft specialist will answer my posts
>> here
> What happened to:
>
> MSDN managed newsgroups provide:
> - Unlimited on-line technical support - keep your PSS incidents
> - A commitment to respond to your post within >>two business days<<
> - Over 200 newsgroups to choose from
> - Spam protection for your e-mail address when posting items
>|||Oh, and I'm not a file recovery specialist so I didn't address your original
question in my response, but that type of recovery isn't something that they
handle via the newsgroups anyway. If they can do anything, it really does
require that you open a case.
--
Sincerely,
Stephen Dybing
This posting is provided "AS IS" with no warranties, and confers no rights.
"Stephen Dybing [MSFT]" <stephd@.online.microsoft.com> wrote in message
news:e%231S%23cZoEHA.3792@.TK2MSFTNGP11.phx.gbl...
> Well, this is an MSDN managed newsgroup so if you are an MSDN subscriber
> and had posted from a registered anti-spam posting alias, you would have
> gotten a response from someone on the MSDN managed newsgroups team.
> However, hilarion@.noemail.nospam doesn't appear to be registered. If you
> are an MSDN subscriber, please start at
> http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp&SD=msdn
> and follow the directions to register your anti-spam alias. It may take a
> little while to get into the system, but once it is you'll start getting
> those responses.
> --
> Sincerely,
> Stephen Dybing
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> "Hilarion" <hilarion@.noemail.nospam> wrote in message
> news:uO21hyVoEHA.2068@.TK2MSFTNGP09.phx.gbl...
>> I hoped some Microsoft specialist will answer my posts
>> here
>> What happened to:
>>
>> MSDN managed newsgroups provide:
>> - Unlimited on-line technical support - keep your PSS incidents
>> - A commitment to respond to your post within >>two business days<<
>> - Over 200 newsgroups to choose from
>> - Spam protection for your e-mail address when posting items
>|||Hello
I did that (a day or something about) before posting the original post (and
re-registered few minutes ago getting "Please chose a more unique Nickname and
submit again" which means that this alias _is_ registered), so I do not know what
else should I do.
The link you gave is not entirely valid. Under this address:
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp&SD=msdn
one can only find this information:
<info>
For security purposes, we have moved the registration page to the MSDN Subscriber
Downloads site located at:
http://msdn.microsoft.com/subscriptions/downloads/
After you have access to Subscriber Downloads.
1. Select the What's Hot Link.
2. Select the Managed Newsgroup link.
3. Create your no-spam alias.
</info>
Using given address (http://msdn.microsoft.com/subscriptions/downloads/), and
the link "MSDN Managed Newsgroups" leading to http://msdn.microsoft.com/newsgroups/managed/
one gets to a page with "Register" link, which is:
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp&SD=msdn
so we end up circling around.
Only way to register is _not_ to follow the first instruction, and use "here"
link (https://msdn.one.microsoft.com/Subscriber/1033/ManagedNewsGroups.asp)
on "What's Hot" (in Managed Newsgroups section). Sometimes one has to use this
link twice before getting to the proper webpage.
Hilarion
> Well, this is an MSDN managed newsgroup so if you are an MSDN subscriber and had posted from a registered anti-spam posting alias,
> you would have gotten a response from someone on the MSDN managed newsgroups team. However, hilarion@.noemail.nospam doesn't appear
> to be registered. If you are an MSDN subscriber, please start at
> http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp&SD=msdn and follow the directions to register your
> anti-spam alias. It may take a little while to get into the system, but once it is you'll start getting those responses.|||> Oh, and I'm not a file recovery specialist so I didn't address your original question in my response, but that type of recovery
> isn't something that they handle via the newsgroups anyway. If they can do anything, it really does require that you open a case.
OK. That is the answer I was waiting for. Maybe not very helpful, but concrete
and at least a bit official.
Hilarion