Home

Tuesday, 14 October 2014

Steps to Rename a Datafile

Renaming the datafile :


There are 2 methods to rename the datafile

     1.Shutdown database
     2.Alter status OFFLINE

Method 1 :

Step 1:
shutdown the database
sys>>shutdown immediate

Step 2:
At the o/s level copy the datafiles to new location

    $cd disk1/oradata/ORCL
    $mkdir backup
    $cp * backup/

Step 3:
sys>>startup mount

Step 4 :
alter database rename file '/disk1/oradata/ORCL/user01.dbf' to '/disk1/oradata/ORCL/user01.dbf'

Step 5:
open the database
  sys>>alter database open;


check the status :

sys>> select filename,tablespace_name from dba_data_files;

Method 2 :

Step 1: Make the particular tablespace offline taht the datafile belogs to..
   
    sys>>alter tablespace users OFFLINE;

Step 2: At the o/s level copy the datafiles to new location
  
  $cd disk1/oradata/ORCL
    $mkdir backup
    $cp * backup/

Step 3: 
alter tablespace users rename datafile '/disk1/oradata/ORCL/user01.dbf' to '/disk1/oradata/ORCL/user01.dbf'

Step 4: 
Make the particular tablespace ONLINE

  sys>>alter tablespace users ONLINE;


check the status:
sys>> select filename,tablespace_name from dba_data_files;


No comments:

Post a Comment