Web Development

General discussion


Resizing Database

By SMOR27 ·
Any one here use SQL Anywhere 5. I want to resize a database that has grown up to 2Gb in size. I have implemented a database purge that will purge out information older than a year. Even though the database has been purged the database size remains at 2GB. Is there a way that I can shrink the database down to a normal 450-600MB file? I could not find any information on the web about a resizing or compacting. Options that were given to me were to replace the old large database with a new smaller database. This would allow a database that would not grow to that size again. Any one have any suggestions? This Database is running on a WIN2K server.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by wynander In reply to Resizing Database

In Sybase 5 (SQL Anywhere), you will need to follow three stages. These are

1) Unload the old database (use dbunload.exe or 'unload database' in Sybase Central). You will need a DBA login and password to do this.

2) Create a new empty database (use dbinit.exe or 'Create database' in Sybase Central)

3) Reload the new database

A suggested template for a command line script, assuming that your database is not running when you begin is:

dbsrv -x none <pathspec1>\yourdb.db <CR>
dbunload -xx
-c "uid=xxx;pwd=yyy;eng=yourdb;dbn=yourdb" <pathspec2> <CR>
dbinit -p4096 newDBname <CR>
dbisql -c "uid=dba;pwd=sql;dbf=newDBname.db" read <pathspec2>\reload.sql

1) <Substitute your actual paths for <pathspec2> and <pathspec2>
2) Substitute your DBA account uid and password for 'xxx' and 'yyy'
3) I would recommend you use a different name for the reloaded database. This avoids any possibility of corrupting your old one before you verify that the new one is OK

Collapse -

by wynander In reply to Resizing Database

Type a backslash where a smiley appears in the previous answer

Related Discussions

Related Forums