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

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

Re: renaming datafiles

From: <DBarbour_at_austin.isd.tenet.edu>
Date: Wed, 13 Feb 2002 10:20:52 -0800
Message-ID: <F001.0040E385.20020213095401@fatcity.com>

Think about it for just a minute. Focus on the parts:

     If the database is open.............

     If the database is mounted but closed .................



David A. Barbour
Oracle DBA, OCP
AISD
512-414-1002

                                                                                       
                            
                    Bill Becker                                                        
                            
                    <beckerb_at_mfldc       To:     Multiple recipients of list ORACLE-L 
<ORACLE-L_at_fatcity.com>       
                    lin.edu>             cc:                                           
                            
                    Sent by:             Subject:     renaming datafiles               
                            
                    root_at_fatcity.c                                                     
                            
                    om                                                                 
                            
                                                                                       
                            
                                                                                       
                            
                    02/13/2002                                                         
                            
                    10:58 AM                                                           
                            
                    Please respond                                                     
                            
                    to ORACLE-L                                                        
                            
                                                                                       
                            
                                                                                       
                            




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). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: DBarbour_at_austin.isd.tenet.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 - 12:20:52 CST

Original text of this message

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