Sybase ASE
11.0 11.5 11.9 12.0 12.5 15.x
Last updated: 11 June 1999
Checking free disk space before running DISK INIT
This is a demo of how you can use CIS & XP features in ASE.

The stored procedure "sp_disk_init" takes the same parameters as the "DISK INIT" command, but it first checks if there is enough free space available on the target disk before it attempts the create the device.

This works because of a CIS-related trick, in combination with XP server; through xp_cmdshell, you can execute an OS-level command to determine how much diskspace there is left. Using CIS, you can get this information back into the server using a proxy table. Finally, you can check if there's enough free space for the device you're about to create.

You'll need ASE 11.5 or later to do this. However, even if you're running ASE 11.0, or if you're not using CIS, it may still be interesting to use this stored procedure. Even if won't do the check on free disk space, it's still a lot more convenient than using the plain "disk init" command, for the following reasons:
  • you can specify the device size in pages, Kbytes, Mbytes or Gbytes, while "DISK INIT" only allows you to specify pages;

  • if you don't specify a 'vdevno', the first one that's free will be used.
Hopefully, these two features should make a DBA's life a bit easier...

Installation instructions
  • Now you should run two setup scripts to prepare your server for using CIS: run SETUP1.SQL, restart your server and then run SETUP2.SQL. Note that you should ensure your @@servername matches your servername in the interfaces file. Your XP server name should also be in the interfaces file.
  • Next, you can run the script SP_DISK_INIT.SQL, and you're ready to execute "sp_disk_init".

Note: ASE 12.5 (released June 2001) has some of the above functionality (automatically choosing the vdevno) already built in. Details are here.

 This document is located at