Question

How to unmix data and log segments on same device SYBASE??

Asked by: Veneno

We recently have a disk crash, where we were running our SYBASE ASE 12.5 server, we had the dump files for databases and we could recover in other installed server, the issue is found out that we have the log and data spaces mixed on the same devices and we now have to be able to make dump of the transaction log, so I have to questions:

1. Is it possible to make dumps of the transaction under this database structure?
2. How does this strcuture affects the performance?
3. What detaled procedure should we follow in order to umix the log and data segments on same device?

I paste results for sysusages and helpdb:

dbid   segmap      lstart      size        vstart      pad    unreservedpgs crdate                      
------ ----------- ----------- ----------- ----------- ------ ------------- ---------------------------          
4      3           0           12800       33554432    (null) 0             Apr 7 2009  7:00AM          
4      4           12800       3840        50331648    (null) 3825          Apr 7 2009  7:00AM          
4      3           16640       28160       50362368    (null) 0             Apr 7 2009  7:00AM          
4      3           44800       64000       67108864    (null) 24058         Apr 7 2009  7:00AM          
4      3           108800      6400        570425344   (null) 6375          Apr 7 2009  7:00AM          
4      4           115200      3840        570476544   (null) 3825          Apr 7 2009  7:00AM          
7      3           0           25600       167772160   (null) 0             Apr 7 2009  6:26AM          
7      4           25600       6400        184549376   (null) 6375          Apr 7 2009  6:26AM          
7      3           32000       25600       184600576   (null) 0             Apr 7 2009  6:26AM          
7      3           57600       64000       201326592   (null) 0             Apr 7 2009  6:26AM          
7      3           121600      64000       218103808   (null) 0             Apr 7 2009  6:26AM          
7      3           185600      6400        234881024   (null) 0             Apr 7 2009  6:26AM          
7      4           192000      6400        234932224   (null) 6375          Apr 7 2009  6:26AM          
7      3           198400      51200       234983424   (null) 0             Apr 7 2009  6:26AM          
7      3           249600      12800       251658240   (null) 0             Apr 7 2009  6:26AM          
7      4           262400      25600       251760640   (null) 25500         Apr 7 2009  6:26AM          
7      3           288000      25600       251965440   (null) 0             Apr 7 2009  6:26AM          
7      3           313600      64000       268435456   (null) 0             Apr 7 2009  6:26AM          
7      3           377600      64000       285212672   (null) 0             Apr 7 2009  6:26AM          
7      3           441600      102400      301989888   (null) 40020         Apr 7 2009  6:26AM          
7      3           544000      15872       318767104   (null) 15810         Apr 7 2009  6:26AM

name                     db_size       owner                    dbid   created        status                                                                                                
------------------------ ------------- ------------------------ ------ -------------- ------------------------------------------------------------------------------------------------------
cobis                        1860.0 MB sa                       4      Apr 01, 2009   select into/bulkcopy/pllsort, trunc log on chkpt                                                      
device_fragments               size          usage                created             free kbytes                    
------------------------------ ------------- -------------------- ------------------- ------------------------------
cobis_dat                      200.0 MB      data only            Apr  7 2009  7:00AM              128              
cobis_dat1                     440.0 MB      data only            Apr  7 2009  7:00AM                0              
cobis_dat1                     60.0 MB       log only             Apr  7 2009  7:00AM not applicable                
cobis_dat2                     1000.0 MB     data only            Apr  7 2009  7:00AM           364528              
cobis_log1                     100.0 MB      data only            Apr  7 2009  7:00AM           102000              
cobis_log1                     60.0 MB       log only             Apr  7 2009  7:00AM not applicable                
                                                               
--------------------------------------------------------------
log only free kbytes = 122512    

name                     db_size       owner                    dbid   created        status                                                                                                
------------------------ ------------- ------------------------ ------ -------------- ------------------------------------------------------------------------------------------------------
cob_cartera                  8748.0 MB sa                       7      Apr 01, 2009   select into/bulkcopy/pllsort, trunc log on chkpt                                                      
device_fragments               size          usage                created             free kbytes                    
------------------------------ ------------- -------------------- ------------------- ------------------------------
cob_cartera_dat                400.0 MB      data only            Apr  7 2009  6:26AM                0              
cob_cartera_dat1               400.0 MB      data only            Apr  7 2009  6:26AM                0              
cob_cartera_dat1               100.0 MB      log only             Apr  7 2009  6:26AM not applicable                
cob_cartera_dat2               1000.0 MB     data only            Apr  7 2009  6:26AM                0              
cob_cartera_dat3               1000.0 MB     data only            Apr  7 2009  6:26AM                0              
cob_cartera_dat4               100.0 MB      data only            Apr  7 2009  6:26AM                0              
cob_cartera_dat4               800.0 MB      data only            Apr  7 2009  6:26AM                0              
cob_cartera_dat4               100.0 MB      log only             Apr  7 2009  6:26AM not applicable                
cob_cartera_dat5               200.0 MB      data only            Apr  7 2009  6:26AM                0              
cob_cartera_dat5               400.0 MB      data only            Apr  7 2009  6:26AM                0              
cob_cartera_dat5               400.0 MB      log only             Apr  7 2009  6:26AM not applicable                
cob_cartera_dat6               1000.0 MB     data only            Apr  7 2009  6:26AM                0              
cob_cartera_dat7               1000.0 MB     data only            Apr  7 2009  6:26AM                0              
cob_cartera_dat8               1600.0 MB     data only            Apr  7 2009  6:26AM           527104              
cob_cartera_log                248.0 MB      data only            Apr  7 2009  6:26AM           252960              
                                                               
--------------------------------------------------------------
log only free kbytes = 611968                                  

Any help would be really appreciated

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-04-16 at 13:26:42ID24329635
Tags

SYBASE 12.5.0.3

Topic

Sybase Database

Participating Experts
2
Points
500
Comments
5

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Rollback segments
    Hi, I'm having an SQL error "ORA- 01555- Snapshot too old. Rollback segment number 7 with name RB5 too small". This error comes when updating a table. In this procedure it delete records in the table and then inserts new records to the table. Using this data it upd...
  2. converting bytes to kbytes and mbytes
    hi, this might be a stupid question but anwyways... i'm ready the size of a directory (the sum of all the file sizes) and the function is returning byte, which is ok, but i need also to show the results in kb's and mb's i converted the results but they usually come wrong, i ...
  3. Log only free kbytes shows lesser space
    We are using Sybase ASE 12.0. sp_helpdb <databasename> gives me the following result: Name: pammfn db_size: 2500 MB Owner : sa dbid : 6 Created: Feb 16, 2001 Status: select into/bulkcopy/pllsort device_fragments, size, usage, free kbytes pamdb, 300 MB, data only, 425...
  4. SYBA sil680 ata 133 controller card installation
    I am trying to add two new IDE channels to my desktop as my motherboard's channels are filled up. I am trying to attach a CD-ROM drive to this new card but the system does not boot after I power it on. It gives me the F3 prompt (like the one you get for BIOS config) when I tr...
  5. Question on TRUNC
    Hello guys. I started wondering how strong I'm with basics. Is the function TRUNC on dates use indexes on the table or not? If they dont, whats an alternatve to that? Any simple example please. I suspect to_date is supposed to use the index but I see in explain plan its a...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: Jan_FranekPosted on 2009-04-17 at 01:43:43ID: 24165804

Ad 1
I'm not 100% sure but I think, that dump transaction shuld be possible

Ad 2  
Log needs mainly sequential writes while data is access more randomly, so mixing them on one device will probably have some negative effect - mainly if you don't have some RAID cache on the way to disks. I have seen situations like this and I didn't see any visible slowdown so I guess that the performace impact will not be too big

Ad 3
To "unmix" data and log you need to 1 dump database, 2 drop database, 3 create database with correct order of data and log segments a then 4 load database. I suppose steps 1,2 and 4 are trivial, only step 3 is little bit tricky.

sp_helpdb output shows, that your cobis database has following structure:
640 MB data
60 MB log
1100 MB data
60 MB log

So you have to create it like this:
create database cobis on DATA = 640 log on LOG = 60
alter database cobis on DATA = 1100
alter database cobis log on LOG = 60

where DATA and LOG has to be replaced by your data and log devices. And if your devices are smaller then needed size, you can create it in more steps -

alter database cobis on DATA = 1100

can be replaced by

alter database cobis on DATA1 = 1000
alter database cobis on DATA2 = 100

 

by: Joe_WoodhousePosted on 2009-04-17 at 01:56:06ID: 24165855

You are able to take transaction dumps of this database.

Your data and log are physically mixed, in that data fragments and log fragments appear on the same Sybase devices, but they are not logically mixed, in that no fragment has both data and log on it. (You can see this confirmed in sysusages - you have no fragment with segmap & 7 = 7 , ie. logical OR of bitmap 3 and bitmap 4.)

That's all that's required for dumps of the transaction log (ie incremental backups). If your recovery targets for this database are "recover to last incremental backup" then you already have everything you need.

Physical mixing does cost you the opportunity to perform up to the instant recovery. The idea with this is that so long as your log device(s) are intact, you can survive the loss of one or more data devices. Of course, if you aren't especially protecting your log devices then it's up to pure chance as to whether a disk crash kills data vs log.

To fix your physical mixing is simple but possibly tedious. The easiest (not necessarily fastest) method is to drop & recreate the database correctly - this is why they got mixed in the first place, you didn't create the database correctly when you recreated it.

The idea is when you load a database the pages must be written out in the order they appear in the database (ie in order of sysusages.lstart). Let's look at the rows from sysusages for dbid 4:

4      3           0           12800       33554432    (null) 0             Apr 7 2009  7:00AM          
4      4           12800       3840        50331648    (null) 3825          Apr 7 2009  7:00AM          
4      3           16640       28160       50362368    (null) 0             Apr 7 2009  7:00AM          
4      3           44800       64000       67108864    (null) 24058         Apr 7 2009  7:00AM          
4      3           108800      6400        570425344   (null) 6375          Apr 7 2009  7:00AM          
4      4           115200      3840        570476544   (null) 3825          Apr 7 2009  7:00AM          


We're interested in segmap, lstart and size. Ordering by lstart (which it is) gives us the order the database fragments were originally created. Segmap tells us data or log. Size is in pages, and you seem to be using 16Kb pages so we divide size by 64 to give us a size in Mb.

That tells us dbid 4 was created as:

data = 200Mb
log = 60Mb
data = 440 Mb
data = 1000Mb
data = 100Mb
log = 60Mb

Note this is not the order reported by sp_helpdb! sp_helpdb is useless for this - it sorts the fragments in alphabetical order of device name!! You must go by sysusages ordered by lstart.

So all you have to do is dump your database, drop it, and recreate it to match the above. Remember you can only combine fragments in a single CREATE or ALTER DATABASE statement for consecutive data fragments up to the first log fragment, and then consecutive log fragments up to the next data fragment. Eg

create database cobis
on cobis_dat = 200
log on cobis_log1  = 60
go

alter database cobis
on cobis_dat1 = 440
, cobis_dat2 = 1000
, cobis_dat1=100
log on cobis_log1 = 60
go

The moral of the story is you cannot properly recreate a database unless you know what its original sysusages looks like. But! If you get it wrong (or you simply don't have access to it), you can always reconstruct what it is supposed to look like with a similar method to what I've used above.

This is a common DBA mistake, everyone is always confused about why this happens. Think of a database backup as writing out all the database pages one by one in the order they exist in the original database. When you load the database, Sybase says, ok, I see a data page in the backup so that's what I have to write now. In fact I see 200Mb of data pages, so that's what I'll write. And the next page is... uh oh, a log page. But the database I'm loading into says the next page gets written into a data device! Oh well, it can't be helped, the next page is a log page so that's what I have to write, even though that means I'm putting a log page on a data device.

At least in your case it was able to cleanly divide the fragments so data and log were not mixed on any one fragment.

It's a good idea when you take your database backups to also reverse-engineer the SQL needed to recreate them. That way you never ever run into this mess again. There are any number of scripts to do this, have a look on Sybase CodeXchange (needs registration but is free), or there is the generally good dbschema.pl Perl scripts. (They don't handle everything correctly but they get devices and databases right.)

Good luck!

 

by: Jan_FranekPosted on 2009-04-17 at 02:02:39ID: 24165894

OK, Joe is right, I'm not. I didn't notice that sysusages shows different order of data and log segments.

 

by: Joe_WoodhousePosted on 2009-04-17 at 02:05:59ID: 24165910

Hi Jan,

Yeah, I've been bitten by that before. It's easy to just look at sp_helpdb but it can be very misleading. Always go to the source rows in master..sysusages. :)

 

by: VenenoPosted on 2009-04-17 at 07:57:19ID: 31571485

Thanks for the response I usually tried to be more clean in my process of dump and load of databases so the log and data don't get myxed on same device when you load. But like a year ago I was on vacations and a system crash occured I never get to know what the person who reinstalled did in detail and we have had the mixing since then, now we are trying now to implement an incremental bakcup plan and thought it was just about time to strar learning about this SYBASE intrincate.

TYVM

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...