Recording dbspace names

In the event that you ever need to use the RENAME option of RESTORE to move a database or one of its dbspaces, you need to know the name of every dbspace in the database. The dbspace names are in the SYSFILE table of every database, but you do not have this table available when you are restoring. For this reason, you should execute the sp_iqdbspace stored procedure or issue the following statement any time you back up your database:

select * from SYSFILE

Keep the results of this query some place other than the disk where the database resides, so that you have a complete list of dbspace names if you need them.

You can also run the following script in DBISQL. This script produces an output file that contains the set of rename clauses you use, if you do not actually change the location of any files. You can substitute any new file locations, and use the resulting file in your RESTORE statement.

NoteBecause the database may not exist when you need to restore, you may want to run this script after you back up your database.

 -- This select statement will get names of IQ dbspaces and file names
 -- and add rename syntax including quotes   

select 'rename' , dbspace_name , 'to' ,'''' +  file_name + ''''  
from SYSFILE where store_type ='IQ';

 -- output to file in proper format
 -- no delimiters and no additional quotes  

output to restore.tst delimited by ' ' quote ''; 

 --this produces a file  restore.tst looking like this:
 --rename IQ_SYSTEM_MAIN to '/dev/rdsk/c2t0d1s7'
 --rename IQ_SYSTEM_TEMP to '/dev/rdsk/c2t1d1s7'
 --rename IQ_SYSTEM_MSG to 'all_types.iqmsg'