Thursday, August 14, 2008

How to rename instance name?

method to rename instance
1. shutdown DB
2.prepare the following settings
prx06:DASP2:/software/oradas/product/9.2.0/dbs> ls -l
lrwxrwxr-x 1 oradas dba 46 Sep 22 17:21 initDASP.ora -> /software/oradas/admin/DASP/pfile/initDASP.ora
lrwxr-xr-x 1 oradas dba 46 Oct 13 11:51 initDASP2.ora -> /software/oradas/admin/DASP/pfile/initDASP.ora
-rwSr----- 1 oradas dba 3072 Oct 11 15:53 orapwDASP
-rwSr----- 1 oradas dba 3072 Oct 11 15:53 orapwDASP2
3. export ORACLE_SID=DASP2
4. change listener and tnsname.ora accordingly
5. change service_name inside init.ora

6. bring up and verify v$instance and v$database



db_name
DB_NAME specifies a database identifier of up to 8 characters. This parameter must be specified and must correspond to the name specified in the CREATE DATABASE statement.

db_unique_name
DB_UNIQUE_NAME specifies a globally unique name for the database. Databases with the same DB_NAME within the same DB_DOMAIN (for example, copies of a database created for reporting or a physical standby) must have a unique DB_UNIQUE_NAME. Every database's DB_UNIQUE_NAME must be unique within the enterprise.

instance_name
In a Real Application Clusters environment, multiple instances can be associated with a single database service. Clients can override Oracle's connection load balancing by specifying a particular instance by which to connect to the database. INSTANCE_NAME specifies the unique name of this instance.

In a single-instance database system, the instance name is usually the same as the database name.


service_names
SERVICE_NAMES specifies one or more names by which clients can connect to the instance. The instance registers its service names with the listener. When a client requests a service, the listener determines which instances offer the requested service and routes the client to the appropriate instance.

--before

SQL> show parameter name

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string CMSPT42g
db_unique_name string CMSPT42g
global_names boolean FALSE
instance_name string CMSPT42g
lock_name_space string
log_file_name_convert string
service_names string CMSPT42g

--Follow above steps to rename current instance CMSPT42g to CMSPT42G2
--after

SQL> show parameter _name

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string CMSPT42g
db_unique_name string CMSPT42g
global_names boolean FALSE
instance_name string CMSPT42G2
lock_name_space string
log_file_name_convert string
service_names string CMSPT42G2


psdev03:CMSPT42G2:/software/oracle/admin/CMSPT42g/pfile> ps -ef |grep CMSPT42G
oracle 25062 1 0 14:24:58 ? 0:00 ora_lgwr_CMSPT42G2
oracle 25058 1 0 14:24:58 ? 0:00 ora_mman_CMSPT42G2
oracle 25068 1 0 14:24:58 ? 0:00 ora_reco_CMSPT42G2
oracle 25094 1 0 14:25:19 ? 0:00 ora_q000_CMSPT42G2
oracle 25070 1 0 14:24:59 ? 0:00 ora_cjq0_CMSPT42G2
oracle 25064 1 0 14:24:58 ? 0:00 ora_ckpt_CMSPT42G2
oracle 25054 1 0 14:24:58 ? 0:00 ora_pmon_CMSPT42G2
oracle 25074 1 0 14:24:59 ? 0:00 ora_mmnl_CMSPT42G2
oracle 25141 24354 0 14:27:02 pts/2 0:00 grep CMSPT42G
oracle 25072 1 0 14:24:59 ? 0:00 ora_mmon_CMSPT42G2
oracle 25078 1 0 14:24:59 ? 0:00 ora_s000_CMSPT42G2
oracle 25120 1 0 14:25:59 ? 0:00 ora_q001_CMSPT42G2
oracle 25086 1 0 14:25:09 ? 0:00 ora_qmnc_CMSPT42G2
oracle 25056 1 0 14:24:58 ? 0:00 ora_psp0_CMSPT42G2
oracle 25066 1 0 14:24:58 ? 0:00 ora_smon_CMSPT42G2
oracle 25060 1 0 14:24:58 ? 0:00 ora_dbw0_CMSPT42G2
oracle 25076 1 0 14:24:59 ? 0:00 ora_d000_CMSPT42G2