Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Dynamically Growing Sybase Database

Posted on 2013-11-11
3
Medium Priority
?
476 Views
Last Modified: 2013-11-13
I am building a little installation/packaging script that deploys various database schema items and procedures. Right now, I just use this to make the database:

CREATE DATABASE dbname
GO

However,
when i point my little package at my larger databases, they quickly fill up the allotted space.

I am not clear how to create a database that has space to grow on sybase....is there some sort of parameter CREATE DATABASE parameter that allows it room to grow, or do I have to supply a specific size per database?
0
Comment
Question by:Jay Redd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 24

Accepted Solution

by:
Joe Woodhouse earned 2000 total points
ID: 39641415
Depending on your ASE version, you can indeed set your databases to automatically grow.

When you don't specify a size like you've done here, you get the default size which again depending on your ASE version is either 2MB or 3MB - hardly enough for any serious work.

You also don't have any control over where the database gets placed which may have effects you don't want... by default the "master" device is available for creating and extending ("altering") user/application databases onto, and this for many reasons is poor practice.

Strongly recommend you create your databases with an explicit size, explicitly on one or more devices. I myself am not a fan of auto-growing databases as I think that causes more trouble than it's worth... if there's a run-away process, without auto-grow it eventually fills the database, which is bad, but with auto-grow it eventually fills all your devices and potentially your file system... which I think is worse.

The chapters in the ASE System Admin Guide about devices and databases are pretty clear on how this works. Well worth taking a look at. The full syntax you might benefit from is:

CREATE DATABASE [name]
ON [device_D1] = [size]
[, [device_D2] = [size], ... ]
LOG ON [device_L1] = [size]
[, [device_L2] = [size], ...]
GO

If you specify size as an integer is is interpreted as megabytes. Because there is so much confusion even in the IT industry about how many megabytes are in a gigabyte, I suggest you instead specify size as a string, i.e. "2G" which is unambiguous.

The above syntax also separates data from log in the database. This is important for any serious production database, and I again refer you to the manuals for the details on why. For now I'll say you can't do incremental backups without this.
0
 

Author Comment

by:Jay Redd
ID: 39642311
Thanks joe,
I ended up doing something like this (for the benefit of those who are looking, i had a hard time figuring out the device part..)

-- Data Device
disk init
name              = 'do02_data',
physname        = 'C:\sybase\data\do02data.dat',
size        = '15G',
directio    = true,
skip_alloc  = true
go

-- Log Device
disk init
name              = 'do02_log',
physname        = 'C:\sybase\data\do02log.dat',
size        = '7G',
directio    = true,
skip_alloc  = true
CREATE DATABASE do02 on do02_data = '15G' LOG ON  do02_log = '7G'             -- will take some time
GO
sp_dboption do02, 'select into/bulkcopy', true
GO


The  'select into/bulkcopy' was also needed if you're going to use BCP right afterwards.

I just put instructions in my package for the end user to modify these values as needed.
0
 
LVL 24

Expert Comment

by:Joe Woodhouse
ID: 39644629
Ooh, you went gourmet and included some of the optional arguments too. Nicely done. :)
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

While opting for any web-to-print solution, you need to discuss with your team and some of your end users and know their opinions about your decisions. In this article we list down some questions you need to ask yourself.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question