Search This Blog

Sunday, 29 September 2024

How to rename a data file of an Oracle database or move it to a different location

 How to rename a data file of an Oracle database or move it to a different location


 Share

Data file has a different name and / or is in a different location (e.g. partition or directory)


Procedure:

(1)

Shut down the Ex Libris application.

(2)

Log on to the server where the Oracle database of the Ex Libris application is running as the UNIX user that owns the Oracle software (e.g. UNIX user oracle).

3()

Shut down the Oracle database by entering the following commands as UNIX user oracle:


$ echo $ORACLE_SID

(make sure that the value of this variable specifies the correct Oracle database)

$ sqlplus / as sysdba

SQL> shutdown immediate

SQL> exit

(3)

Copy the data file to the new name / location at the operating system level (as UNIX user oracle).


(4)

Start the database and bring it into status MOUNTED by entering the following commands as UNIX user oracle:

$ sqlplus / as sysdba

SQL> startup mount

(5)

Rename the data file within the Oracle database by entering the following SQL statement:


SQL> > ALTER DATABASE RENAME FILE

'/<full_path_of_old_location>/<old_datafile_name.dbf>'

TO

'/<full_path_of_new_location>/<new_datafile_name.dbf>';

(6)

Bring the database into status OPEN by entering the following SQL statement:


SQL> ALTER DATABASE OPEN;

(7)

Verify that the data file is at the correct location and has the correct name by entering the following SQL statement:


SQL> SELECT * FROM V$DBFILE;

8)

Start the Ex Libris application.

(9)

Remove the data file from the old location at the operating system level.

No comments:

Post a Comment