Click here to e-mail your resume and cover letter to 1000's of Top Employers and Recruiters!

Sunday, September 21, 2008

Renaming and Relocating Datafiles for a Single Tablespace

Renaming Datafiles in a Single Tablespace

To rename datafiles from a single tablespace, complete the following steps:

  1. Take the non-SYSTEM tablespace that contains the datafiles offline.

    For example:

    ALTER TABLESPACE users OFFLINE NORMAL;

  2. Rename the datafiles using the operating system.
  3. Use the ALTER TABLESPACE statement with the RENAME DATAFILE clause to change the filenames within the database.

    For example, the following statement renames the datafiles /u02/oracle/rbdb1/user1.dbf and /u02/oracle/rbdb1/user2.dbf to/u02/oracle/rbdb1/users01.dbf and /u02/oracle/rbdb1/users02.dbf, respectively:

    ALTER TABLESPACE users
    RENAME DATAFILE '/u02/oracle/rbdb1/user1.dbf',
    '/u02/oracle/rbdb1/user2.dbf'
    TO '/u02/oracle/rbdb1/users01.dbf',
    '/u02/oracle/rbdb1/users02.dbf';

    The new files must already exist; this statement does not create the files. Also, always provide complete filenames (including their paths) to properly identify the old and new datafiles. In particular, specify the old datafile name exactly as it appears in the DBA_DATA_FILES view of the data dictionary.

  4. Back up the database. After making any structural changes to a database, always perform an immediate and complete backup.

No comments:

Blog Archive