How to Change Dbname Dbid and Instance Name

September 6, 2017 | Author: G.R.THIYAGU ; Oracle DBA | Category: Oracle Database, Databases, Digital Technology, Digital & Social Media, Computer Data
Share Embed Donate


Short Description

Download How to Change Dbname Dbid and Instance Name...

Description

HOW TO CHANGE DBID DBNAME INSTANCE NAME | LINUX

CHANGING THE (DBID) USING NID UTILITY WHAT IS DBID AND WHY WE NEED TO CHANGE IT ? DBID stands for DATABASE IDENTIFIER. If the database is open , we can directly querying with the v$database and find the DBID. The DBID is an internal, unique identifier for a database. Because Recovery Manager (RMAN) distinguishes databases by DBID. When we clone the database, the DBID remains same as the source database, We need to change to the DBID, This is very much useful as in the case of working with RMAN.

SQL> startup mount; ORACLE instance started.

WE CAN FIND DBID AT MOUNT STAGE TOO

... Database mounted. SQL> select dbid , name from v$database; DBID 1028461173

NAME CLONE

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

HOW TO CHANGE DBID DBNAME INSTANCE NAME | LINUX

LETS START TO CHANGE DBID OF THE CLONE DATABASE IDENTIFY THE DBID OF THE DATABASE SQL> alter database open; Database altered. SQL> select dbid , name from v$database; DBID 1028461173

NAME CLONE

SHUTDOWN THE CLONE DATABASE SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. START THE CLONE DATABASE AT MOUNT STAGE SQL> startup mount; ORACLE instance started. Total System Global Area 608174080 bytes .. .. [ Trimmed ] Database mounted.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

HOW TO CHANGE DBID DBNAME INSTANCE NAME | LINUX

SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

HOW TO CHANGE DBID DBNAME INSTANCE NAME | LINUX

BOUNCE BACK THE DATABASE TO MOUNT STAGE $ sqlplus / as sysdba SQL*Plus:Release 10.2.0.4.0 -Production on Thu Oct 24 13:34:28 2013 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. Connected to an idle instance. SQL> startup mount; ORACLE instance started. Total System Global Area 608174080 bytes Fixed Size

1268920 bytes

Variable Size

188744520 bytes

Database Buffers

415236096 bytes

Redo Buffers

2924544 bytes

Database mounted. SQL> alter database open resetlogs; Database altered.

SQL> select dbid , name from v$database; DBID

NAME

1028484554 CLONE ************** *******

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

HOW TO CHANGE DBID DBNAME INSTANCE NAME | LINUX CHANGING THE DATABASE NAME USING NID UTILITY First , make a whole database backup. The SETNAME parameter tells the DBNEWID utility to only alter the database name. When opening the database the RESETLOGS option is not needed. Database can be started STARTUP command. LOGIN AS 'SYS' USER SQL> show user; USER is "SYS" SQL> select name from v$database; NAME CLONE SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount ORACLE instance started. .... [ Trimmed ] Database mounted. Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

HOW TO CHANGE DBID DBNAME INSTANCE NAME | LINUX

SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

HOW TO CHANGE DBID DBNAME INSTANCE NAME | LINUX

POINTS TO NOTE If validation is not successful, then DBNEWID terminates and leaves the target database intact, You can open the database, fix the error, and then either resume the DBNEWID operation or continue using the database without changing its DBID. EDIT THE PFILE (db_name) $ cd $ORACLE_BASE/admin/clone/pfile/ $ vi initclone.ora change the db_name parameter in the pfile to the new database name Change this parameter db_name=clonedb

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

HOW TO CHANGE DBID DBNAME INSTANCE NAME | LINUX

CREATE A NEW PASSWORD FILE USING THE ORAPWD UTILITY $ ORAPWD FILE=filename PASSWORD=password ENTRIES=n $ ORAPWD FILE=orapwclonedb PASSWORD=secret ENTRIES=06 START THE DATABASE USING PFILE SQL>startup pfile='/u01/app/oracle/admin/clone/pfile/initclone.ora'; ORACLE instance started. Total System Global Area 608174080 bytes .. ... [ Trimmed ] Database mounted. Database opened. SQL> select name from v$database; NAME CLONEDB SQL> create spfile from pfile; File created. SQL> startup force; ORACLE instance started. .. Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

HOW TO CHANGE DBID DBNAME INSTANCE NAME | LINUX

CHANGING BOTH DBNAME & DBID WITH THE DBNEWID My preference is to change both DBNAME and DBID at the same time as a best practice during creation of test environments. CHECK DBID AND DBNAME SQL> SELECT NAME , DBID FROM V$DATABASE; NAME CLONEDB

DBID 916366170

$ORACLE_SID parameter should be same with the INSTANCE_NAME

parameter. Then, shut the instance and startup with mount option.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

HOW TO CHANGE DBID DBNAME INSTANCE NAME | LINUX

SHUT THE DATABASE AND STARTUP WITH MOUNT PHASE

SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount ORACLE instance started. .... [ Trimmed ] Database mounted. SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options LETS START .. $ nid target=/ dbname=CLONE logfile=/tmp/file1.log $ cat /tmp/file1.log http://www.scribd.com/doc/187554898/NID-Log-for-Changing-Dbid-Dbname

Change the db_name to CLONE then Startup instance with nomount option and now the instance activate with new db_name. At last, open database with resetlogs option. Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

HOW TO CHANGE DBID DBNAME INSTANCE NAME | LINUX Changing db_name=clone $ vi /u01/app/oracle/admin/clone/pfile/initclone.ora

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

HOW TO CHANGE DBID DBNAME INSTANCE NAME | LINUX

DATABASE IS OPENED WITH RESETLOGS

CHECK DBID AND DBNAME SQL> SELECT NAME , DBID FROM V$DATABASE; NAME

DBID

CLONE

1028515186

SQL> Create spfile from pfile= 'path of the pfile '; SQL> startup force; ORACLE instance started. .. [ Trimmed ] Database mounted. Database opened. Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

HOW TO CHANGE DBID DBNAME INSTANCE NAME | LINUX

POINTS TO REMEMBER DBNEWID is a database utility that can change the internal database identifier (DBID) and the database name (DBNAME) for an operational database. The DBNEWID utility solves following things. Only the DBID of a database Only the DBNAME of a database Both the DBNAME and DBID of a database. We can not register CLONE database to recovery catalog due to duplication of

DBID since RMAN recovery catalog uses DBID to

distinguish one database from another. HOW TO CHANGE INSTANCE NAME We know by default , $ORACLE_SID will be instance_name. So i am going to change Instance_name and $ORACLE_SID. $ echo $ORACLE_SID clonedb SQL> select instance_name from v$instance; INSTANCE_NAME clonedb SQL> alter system reset instance_name scope=spfile sid='*'; System altered.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

HOW TO CHANGE DBID DBNAME INSTANCE NAME | LINUX

SQL> shutdown; Database closed. Database dismounted. ORACLE instance shut down. Lets check parameter file .. $ vi /u01/app/oracle/admin/clone/pfile/initclone.ora

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

HOW TO CHANGE DBID DBNAME INSTANCE NAME | LINUX

I remove 'spinitclone.ora' from $ORACLE_HOME/dbs location and going to add new value to instance_name parameter in the pfile.

$ cd $ORACLE_HOME/dbs $ pwd /u01/app/oracle/product/10.2.0/db_1/dbs $ ls -l spfile* -rw-r----- 1 oracle oinstall 3584 Oct 26 01:23 spfileclonedb.ora -rw-r----- 1 oracle oinstall 2560 Oct 24 07:47 spfiletestdb.ora $ rm -rf spfileclonedb.ora $ ls -l spfile* -rw-r----- 1 oracle oinstall 2560 Oct 24 07:47 spfiletestdb.ora

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

HOW TO CHANGE DBID DBNAME INSTANCE NAME | LINUX

Lets small check

FIANL STEP ** Create spfile from pfile ** Now , Instance_name successfully changed ..

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF