Rename RAC database using NID utility !!!

Home »  ORACLE »  Rename RAC database using NID utility !!!

On September 23, 2015, Posted by , In ORACLE, By ,, , With 7 Comments

In this article, we will see the steps to rename RAC database using NID utility of Oracle.

======================================================================================================

 

We will be renaming an existing database emrepdb to rcatdb using the below steps.

• Stop the RAC database

$ srvctl stop database -d emrepdb

 

• Remove the database from cluster

$ srvctl remove database -d emrepdb
Remove the database emrepdb? (y/[n]) y

 

• Start one instance in mount mode and disable the cluster parameters

$ export ORACLE_SID=emrepdb1
$ sqlplus / as sysdba

 

• Rename database using nid utility

$ sqlplus / as sysdba

SQL> startup mount;
SQL> exit

 

• Create parameter file for new database (rcatdb)

$ cd $ORACLE_HOME/dbs
$ sqlplus / as sysdba

SQL> create pfile=’initrcatdb1.ora’ from spfile=’+DATAGRP/emrepdb/spfileemrepdb.ora’;

 

• Edit the file and change old database name with new one

$ vi initrcatdb1.ora
[:%s/emrepdb/rcatdb/g] – Save and Exit

 

• Create adump directory on all RAC nodes for new database

$ mkdir -p /u01/app/oracle/admin/rcatdb/adump

 

• Create directories in ASM diskgroup for new database

Login as GRID user or set ASM instance environmental variables

$ sqlplus / as sysasm

 

• Create an alias with new path and filename

We need to create alias for the target datafiles, tempfiles, redo logfiles and control files as shown below.

 

• Start the new database in mount mode and rename the files

$ export ORACLE_SID=rcatdb1
$ sqlplus / as sysdba

 

• Open the database using resetlogs option

SQL> alter database open resetlogs;

 

• Check location of all files once the database is opened

SQL> select name from v$datafile;
SQL> select name from v$tempfile;
SQL> select name from v$controlfile;
SQL> select member from v$logfile;

 

• Confirm that no data files are showing in Recovery mode and all datafiles are in ONLINE status

SQL> select * from v$recover_file;
SQL> select distinct status from v$datafile;

 

• Create SPFILE and start database using SPFILE

SQL> create spfile from pfile;
SQL> shutdown immediate;

 

• Enable the cluster parameter

SQL> show parameter cluster
SQL> alter system set cluster_database=TRUE scope=spfile;
SQL> alter system set cluster_database_instances=2 scope=spfile;

 

• Add database and instances to cluster

 

• Create spfile on central location

 

• Modify the database parameters using srvctl

 

• Stop the instance and create init parameter file on both nodes as shown below

$ sqlplus / as sysdba
SQL> shutdown immediate

[Rename exisitng init parameter file and spfile]
$ mv initrcatdb1.ora initrcatdb1.ora_orig
$ mv spfilercatdb1.ora spfilercatdb1.ora_orig

$ vi initrcatdb1.ora
SPFILE=’+DATAGRP/rcatdb/spfilercatdb.ora’
[Save and Exit]

[SCP the file on node2]
$ scp initrcatdb1.ora rac2:$ORACLE_HOME/dbs/initrcatdb2.ora

 

• Start the database using srvctl utility

 

That’s it, we have completed renaming of RAC database.

======================================================================================================

Tags : ,, ,

7 Comments so far:

  1. raymond says:

    Hi I am getting an ora-01523 ” cannot rename data file to …. file already part of database” when renaming data files
    alter database rename file ‘+DATAGRP/EMREPDB/DATAFILE/SYSAUX.264.890438103’ to ‘+DATAGRP/RCATDB/DATAFILE/SYSAUX.dbf’

    • TJ says:

      Hi Raymond,

      The control file must be having the information of new datafile that you are about to change. You can execute “select name from v$datafile;” and check if the file name is coming or not.

      Thanks,
      Tejas Tulaskar

  2. user says:

    I cant
    alter database rename file ‘+DATAGRP/OLD/DATAFILE/SYSAUX.264.890438103’ to ‘+DATAGRP/NEW/DATAFILE/SYSAUX.dbf’;

    because i have an error: ORA-01511: and ORA-01516. Why?
    When in asmcmd i list files ls -l then i see my files

    • TJ says:

      Hi,

      Please check whether the database contains the info of the file for which you are getting error either in v$datafile or dba_data_files. The file may be present at disk level, but the database control file might not be having the information.

      Thanks,
      TJ

  3. user says:

    It is strange, because:

    SQL> select name from v$datafile;
    NAME
    ——————————————————————————–
    +DATAC1/telnotet/datafile/system01.dbf
    …..

    but:
    ASMCMD [+] > ls -l +DATAC1/telnotet/datafile
    Type Redund Striped Time Sys Name
    DATAFILE HIGH COARSE JAN 16 09:00:00 N SYSAUX.dbf => +DATAC1/TELNOTE/DATAFILE/SYSAUX.334.924596867

    So in path +DATAC1/telnotet/datafile i have an aliases to datafiles located in path: +DATAC1/TELNOTE/DATAFILE

    So why I cant do rename?

    • TJ says:

      Hi,

      In ASM, the files are OMF i.e. Oracle Managed Files. The names are automatically given as per Oracle ASM standards. Even if you manually assign a name to a datafile, ASM will automatically create a pointer to that file and will give system generated name for its own reference. But still if you want to rename the datafiles, then you can do so by re-creating the control file or create an alias for the datafile, mount the database and rename the datafile.
      In both the case, you will need to open the database using resetlogs option.

      Thanks,
      TJ

Leave a Reply

Your email address will not be published. Required fields are marked *