Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> renaming datafiles

renaming datafiles

From: Bill Becker <beckerb_at_mfldclin.edu>
Date: Wed, 13 Feb 2002 09:35:12 -0800
Message-ID: <F001.0040E21E.20020213085848@fatcity.com>

Hello,

Oracle 8.1.6 on Solaris 2.7.
Our test database is not available to play with for a while, and I was wondering about the following:
What is the difference between ALTER TABLESPACE RENAME DATAFILE... and ALTER DATABASE RENAME DATAFILE...? The administrator's guide says "If the tablespace is offline but the database is open, use the ALTER TABLESPACE...RENAME DATAFILE statement. If the database is mounted but closed, use the ALTER DATABASE...RENAME DATAFILE statement."
While researching this issue, I came across Doc ID: Note:115424.1 on metalink, which contains an example of renaming/relocating datafiles while the database is open using the ALTER DATABASE command. This appears to contradict the administrator's guide.

Which is correct?
Can ALTER DATABASE be used in either case (database open, tblspace offline, or database in starup mount mode), while ALTER TABLESPACE can only be used if the database is open and the tblspc is offline?

Also, the same note referenced above lists the following steps for moving datafiles while the database is up:

1) alter tablespace tbname read only;
2) copy the datafile(s) with os utility
3) alter tablespace tbname offline;
4) alter database rename datafile '...' to '...'; 
5) alter tablespace tbname online;
6) alter tablespace read write;

Would the following also work? I am thinking that the only reason the note lists the above method is to minimize the time the tablespace is offline.

  1. alter tablespace tbname offline;
  2. copy the datafile(s) with os utility
  3. alter database rename datafile '...' to '...'; (or, alter tablespace rename datafile '...' to '...', not sure which should be used)
  4. alter tablespace tbname online;

Thanks to any responders.
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Bill Becker
  INET: beckerb_at_mfldclin.edu

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Wed Feb 13 2002 - 11:35:12 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US