Discussion Locked

Resizing Database

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
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.

2 replies

by wynander

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 \yourdb.db
dbunload -xx
-c "uid=xxx;pwd=yyy;eng=yourdb;dbn=yourdb"
dbinit -p4096 newDBname
dbisql -c "uid=dba;pwd=sql;dbf=newDBname.db" read \reload.sql

NOTES
1) and
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

This discussion is closed to new replies.