Dropping dbspaces from a multiplex database

The following procedures describe how to drop multiplex dbspaces using Sybase Central.

StepsDropping a local dbspace from a multiplex database

If your database has multiple local dbspaces, follow this procedure to drop all but the last remaining local dbspace. When there is only one local dbspace, follow the steps in “Dropping the last local dbspace on query server.”

  1. Connect to the multiplex query server.

  2. Open the dbspaces container.

  3. Right-click the local dbspace and choose Properties.

  4. On the Usage tab, choose Relocate from the Mode dropdown list. Click Apply and OK.

  5. Use sp_iqrelocate to relocate all data on the dbspace, then commit.

  6. Use sp_iqdbspace to make sure no one is using the dbspace.

  7. Right-click the local dbspace and choose Delete. If the delete dbspace fails, issue a checkpoint and repeat this step.

StepsDropping the last local dbspace on query server

When a dbspace is created, IQ needs to save some checkpoint information for the transaction control. If the dbspace is the only one for the type of store (IQ Local Store, in this case), the checkpoint data is saved in the very same dbspace. This makes the dbspace “in use,” even though nothing has been done yet from a user’s point of view. The dbspace is therefore protected from being dropped.

To release the checkpoint information saved in the dbspace, a DBA needs to issue a CHECKPOINT statement to force IQ to flush out the checkpoint data. If there are multiple connections to the server, only the CHECKPOINT statement — which executes after the completion of all transactions temporarily overlapping with the transaction of creating the dbspace — will flush the checkpoint data. Therefore a DBA may have to issue CHECKPOINT several times to drop the dbspace.

A stored procedure, sp_iqdbspace, reports the current status of all IQ dbspaces, including whether or not a dbspace is ready to be dropped. See “Dropping a dbspace,” in Chapter 5, “Working with Database Objects” in Sybase IQ System Administration Guide for details on the sp_iqdbspace returned results.

If the IQ Local Store to be dropped is not empty, you must do the following before you can drop it:

  1. Alter the database to relocate mode. For details, see “Altering dbspaces” in Chapter 6, “Managing Dbspaces” in Introduction to Sybase IQ.

  2. Run sp_iqrelocate on the database. For details, see Chapter 9, “System Procedures” in Sybase IQ Reference Manual.

For more information on dropping dbspaces, see “DROP statement” in Chapter 6, “SQL Statements” in Sybase IQ Reference Manual.

StepsDropping a main dbspace from a multiplex database

If you have created multiple main dbspaces, you can drop the IQ_SYSTEM_MAIN dbspace as long as you do not drop the last main dbspace remaining.

  1. Connect to the multiplex write server.

  2. Open the dbspaces container.

  3. Right-click the main dbspace and choose Properties.

  4. On the Usage tab, choose read-only from the Mode dropdown list. Click Apply and OK.

  5. In Interactive SQL, run sp_iqtransaction. Check the version_ID column and make sure that no query servers are running with old version IDs. You must make sure that transactions on the query servers have caught up to the current state of the main dbspace. Check the Version ID column to make sure that none are running with old version IDs.

  6. Reopen the dbspaces container on the write server.

  7. Right-click the main dbspace and choose Properties.

  8. On the Usage tab, choose Relocate from the Mode dropdown list. Click Apply and OK.

  9. Use sp_iqrelocate to relocate all data on the dbspace, then commit.

  10. After all objects and user data are relocated to other dbspaces, the dbspace is ready to drop using the DROP DBSPACE command. Before executing the DROP DBSPACE command, check the block type information on the dbspace Properties tab to be sure the dbspace does not have blocks of type ‘A’ or ‘O’ (blocks with data from active table versions or old versions that may still be in use). (You may instead run sp_iqdbspace, as shown in “Dbspace management example”.)

  11. Right-click the main dbspace and choose Delete. If the delete dbspace fails, issue a checkpoint and repeat this step.

StepsDropping a temporary dbspace from a multiplex database

  1. Open the dbspaces container.

  2. Right-click the temporary dbspace and choose Properties.

  3. On the Usage tab, choose Relocate from the Mode dropdown list. Click Apply and OK.

  4. Use sp_iqdbspace to make sure no one is using the dbspace.

    Note: You may have to disconnect users or possibly restart the server to free all temporary space.

  5. Make sure the write server is running. (If it is not, the dbspace will appear to return after you synchronize query servers.)

  6. Connect to the server that owns the dbspace.

  7. Open the dbspaces container.

  8. Right-click the temporary dbspace and choose Delete.