Showing posts with label article. Show all posts
Showing posts with label article. Show all posts

Wednesday, March 21, 2012

How to create a torn page.

I want to write a magazine article about torn pages. Is there an easy way to create a torn page? Or does anybody have a backup of a sample database such as AdventureWorks that has a torn page?

I suppose you have to simulate a disk failure at the right moment. I don't think it is very easy to simulate tbh.

But do keep us informed if you find a way to do so.

|||

To simulate a torn page, you'll have to "corrupt" a database page on disk.

This can be done with a hex editor, or other tool.

Our pages are 8K in size, so 16 sectors of 512bytes.

We have 2 kinds of validation: checksum or torn page.

For the torn page, you'll want to corrupt bytes at 0 mod 512 in sectors 1..15 of a page. You could write 0x00 at offset 512, and 0xFF at offset 1024, for example.

Checksums are more robust, so you should be able to change any bit on the page to cause the corruption to be detected.

In order for this corruption to cause any problem, you'd have to pick a page that actually holds data, and then cause the engine to try to read that page.

Hope that gives you some ideas.

|||

Aah, think out of the box :-)

Great tip.

Monday, March 19, 2012

How to create a SAPConnection in .Net Code with .NET Data Provider

In the SQL Server Technical Article Microsoft .NET Data Provider for mySAP? Business Suite

is a Code example of how to invoke a BAPI in .Net Code. First line shows how to create a Connection to SAP, but there is no information in which lib the SAPConnection type is stored:

SAPConnection con = new SAPConnection("ASHOST=<SAPserver>; CLIENT=<client>;SYSNR=<sysnr>;USER=<user>;PASSWD=<password>;LANG=<logon

language>");
con.Open();

Does somebody can help me?Assembly Microsoft.Adapter.SAP.SAPProvider|||Correct! That really helped me out! Thanks.