cancel
Showing results for 
Search instead for 
Did you mean: 

Changing dbfile names

Former Member
0 Kudos

What is the process for changing dbfile names? For example, if we have dbfiles defined on the o/s

as follows:

lrwxrwxrwx .........main1a-> /dev/zvol/rdsk/M_ANCHOR/m1

lrwxrwxrwx .........main2a-> /dev/zvol/rdsk/M_ANCHOR/m2

which are stored in the iq_main (user dbspace) as main1a and main2a

We want to rename them to main1, main2 (drop th 'a') in the file system and in the database.

I think this could be done with a restore (even a virtual restore). But is there a way to do this using

alter <dbspace> alter file main1a rename to main1?

What would the order be in this case?

We're on IQ 15.4, Solaris 10, do not have VLDB.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

jong-kil_park
Employee
Employee
0 Kudos

Hi Steve,

The order of changing the path is as follows.

1. Create the new symbolic links

ln -s /dev/zvol/rdsk/M_ANCHOR/m1 main1

ln -s /dev/zvol/rdsk/M_ANCHOR/m2 main2

2. Change the property of the dbspace to readonly and offline using "alter dbspace .." command.

   Connect to the IQ server with DBA account.

   Let's say that the directory path of the symbolic links is '/SAPIQ/DEV/'.

  

   alter dbspace iq_main readonly;

   alter dbspace iq_main offline;

  

3. Run the "alter dbspace ...alter file .. rename path..." command

   alter dbspace iq_main alter file main1a rename path '/SAPIQ/DEV/main1';

   alter dbspace iq_main alter file main2a rename path '/SAPIQ/DEV/main2';

  

4. Revert the property of the dbspace back to readwrite and online.

   alter dbspace iq_main online;

   alter dbspace iq_main readwrite;

HTH

Jerry

Answers (1)

Answers (1)

0 Kudos

Hi Steve,

   As per Alter DBSPACE syntax, you should be able to change logical as well as physical path/name of a dbfile.

Sybase IQ 15.4 > Reference: Statements and Options > SQL Statements

RENAME PATH is to provide new physical path and RENAME TO is for changing logical name.

HTH

ALTER DBSPACE Statement

Changes the read/write mode, changes the size, or extends an existing dbspace.

Syntax

ALTER DBSPACE dbspace-name { ADD new-file-spec  [, new-file-spec ... ] | DROP FILE logical-file-name [, FILE logical-file-name ... ]   |  RENAME TO newnameRENAME 'new-file-pathname'  |  READONLY |  READWRITE  |  ONLINE  |  OFFLINE  |  STRIPING{ ONOFF }  | STRIPESIZEKB size-in-KB ALTER FILE file-name { READONLY  |  [ FORCE ] READWRITE }  | SIZE file-size [ KB | MB | GB | TB | PAGES ]  | ADD file-size  [ KB  |  MB  |  GB |  TB  | PAGES ] } RENAME PATH  'new-file-pathname' RENAME TO newname