RenameDB

How To Rename A Database - Version 9.2 Or Later

BACKGROUND & OVERVIEW

This document provides a step-by-step guide to renaming a database. This is not valid for databases prior to version 9.2. Instead, for databases prior to 9.2. use the following guide.

ASSUMPTIONS & PRE_REQUISITES

This document expects and assumes the following:
  • The instructions are carried out by a qualified DBA, fully conversant with Oracle.
  • All necessary client software, e.g. Telnet and X-Server is available.
  • There is a working Oracle database up and running;
  • The Oracle user-id '/ AS SYSDBA' is user to stop and start your database;
  • There is a full backup of your current database;
  • If using this procedure for an Oracle RAC database, the database must be mounted inNOPARALLEL mode.
  • The database must be opened with the RESETLOGS option after changing the DBID. This is not necessary if only changing the database name.
  • Datafiles must not be in need of recovery
  • All read-only tablespaces must be writable at the operating system level.
  • The DBNEWID utility does not change global database names.
For the purpose of this document the following names and values are used:
  • The current database name will be OLDD
  • The new database name will be NEWDB
  • The database $ORACLE_HOME definitions location will be /var/opt/oracle/oratab

STEP-BY-STEP GUIDE

1. Ensure there is a complete full backup of OLDDB.
2. Set the oracle environment to OLDDB.
  • . oraenv
  • ORACLE_SID = [oracle] ? OLDDB
3. Stop the OLDDB
  • sqlplus '/ as sysdba'
  • SQL> shutdown immediate
4. Bring up the OLDDB to mount mode.
  • sqlplus '/ as sysdba'
  • SQL> startup mount
5. Run the NEWDBID utility
  • nid TARGET=sys/enter_sys_password@OLDDB DBNAME=NEWDB
6. Once NEWDBID has completed successfully, bring up the NEWDB to mount mode.
  • SQL> startup mount
7. Open the NEWDB with a resetlogs
  • SQL> alter database open resetlogs;
8. Change the global DB name.
  • alter database rename global_name to newname.domain;
9. Take a full backup of the database.

EXAMPLE OUTPUT

No comments: