Saturday , March 2 2024

How To Change the database id and database name in RAC Databases

This article describes how to change the id and name of a database that is running as RAC, what operations should be done before and after.

In the examples, necessary steps have been performed to change the name of the database named ORCL as TEST.

Step 1

Change the value of the cluster_database parameter to false.

Step 2

Start database in mount mode on a node.

Step 3

Change the database id and name information with the nid tool. We specify the new database name using DBNAME.

Step 4

Change the value of the db_name parameter as the new database name.

Step 5

On all nodes, change the name of the corresponding initSID.ora file under the $ORACLE_HOME/dbs directory to initNEWSID.ora.

Step 6

Create the new password file and distribute it to all nodes.

Step 7

Show the new database name to the listeners on all nodes.

Step 8

Start the database in mount mode with the new SID environment variables and open it as resetlogs.

Step 9

Set the cluster_database parameter to true and open the database on all nodes.

Step 10

Check the current database configuration.

Step 11

Create the pfile from the spfile file that is being used. In this pfile, change the SID values ​​earlier than “*” in the instance-based parameters to the new SID, and then create the new spfile from this pfile.

Step 12

Add new databases and instances to the CRS.

Step 13

Start the database created with the new name.

Step 14

Remove the instance and database registered with the old name in CRS.

Step 15

At this stage, the db_name and db_unique_name parameters must be new, and the directories in the ASM disk groups must be created automatically with the new name.

Open the database in mount mode, ensure that the existing datafiles are created in the new ASM directory, and delete the old ones.

Step 16

Start the database on all nodes.

Step 17

Make sure that the datafiles are under the directory created with the new database name in the ASM disk group.

Step 18

Move the existing controlfiles under the directory created with the new database name in the ASM disk group.

Step 19

Change the current control_files parameter to include one old controlfile and the names of the disk groups.

Step 20

Start the database in nomount mode, and create new controlfiles with the restore controlfile operation.

Step 21

Change the existing control_files parameter with the controlfiles created under the new database directory. (example: test)

Step 22

Start the database to make sure that it uses the new controlfiles.

Step 23

In the previous steps, we created the spfile with new name under the old database in the ASM. In this step, we will re-create the spfile with new name under the new directory.

Step 24

After changing the spfile, change the database configuration so that it uses the new spfile.

Step 25

Stop the database and change the corresponding row in the $ORACLE_HOME/dbs/initSID.ora file on all nodes to show the new spfile.

Step 26

Open the database and make sure that the new spfile is visible in the configuration, and the database opened with the new spfile.

Step 27

Finally, re-create the existing temp tablespace so that it can use the new directory in the ASM.

Step 28

Delete directories created with the old database name in ASM disk groups.

Step 29

Make sure that all datafile and tempfiles are under the new directory in ASM.

NOTE: Because redologs are automatically created under the new directory in the ASM, they are not manually recreated.



About dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

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