Changing the Oracle Database Name
SQL> SELECT DBID,NAME from V$DATABASE;
DBID NAME
---------- ---------
969440921 orcl
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
- Start the database in mount mode.
SQL> startup mount
ORACLE instance started.
Total System Global Area 534462464 bytes
Fixed Size
2215064 bytes
Variable Size
192938856 bytes
Database Buffers 335544320
bytes
Redo Buffers
3764224 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application
Testing options
- DBNEWID utility by specifying the
connection string and a new name for the database. we have to connect as
sys user and sys password, user should have sysdba privilegde
[oracle@sainath admin]$ nid target=sys/sys123@orcl
dbname=orclNew setname=YES
DBNEWID: Release 11.2.0.1.0 - Production on Fri Feb 2 08:25:39 2018
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to database orcl (DBID=969440921)
Connected to server version 11.2.0
Control Files in database:
/u01/app/oracle/oradata/orcl/control01.ctl
/u01/app/oracle/flash_recovery_area/orcl/control02.ctl
Change database name of database orcl to ORCLNEW? (Y/[N]) => Y
Proceeding with operation
Changing database name from orcl to ORCLNEW
Control File
/u01/app/oracle/oradata/orcl/control01.ctl - modified
Control File
/u01/app/oracle/flash_recovery_area/orcl/control02.ctl - modified
Datafile
/u01/app/oracle/oradata/orcl/system01.db - wrote new name
Datafile /u01/app/oracle/oradata/orcl/sysaux01.db
- wrote new name
Datafile
/u01/app/oracle/oradata/orcl/undotbs01.db - wrote new name
Datafile
/u01/app/oracle/oradata/orcl/users01.db - wrote new name
Datafile /u01/app/oracle/oradata/orcl/temp01.db
- wrote new name
Control File /u01/app/oracle/oradata/orcl/control01.ctl
- wrote new name
Control File
/u01/app/oracle/flash_recovery_area/orcl/control02.ctl - wrote new name
Instance shut down
Database name changed to ORCLNEW.
Modify parameter file and generate a new password file before
restarting.
Succesfully changed database name.
DBNEWID - Completed succesfully.
[oracle@sainath admin]$ sqlplus '/as sysdba'
sqlplus '/as sysdba'
SQL*Plus: Release 11.2.0.1.0 Production on Fri Feb 2 08:25:58 2018
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 534462464 bytes
Fixed Size
2215064 bytes
Variable Size
192938856 bytes
Database Buffers 335544320
bytes
Redo Buffers
3764224 bytes
ORA-01103: database name 'ORCLNEW' in control file is not
'orcl'
SQL> show parameter db_name
NAME TYPE VALUE
--------- -------------- -----------
db_name string
orcl
SQL> alter system set db_name=ORCLNEW scope=spfile;
System altered.
- Create a new password file
orapwd file=orapwMYNEWDB password=MYPASS
SQL> shut immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 534462464 bytes
Fixed Size
2215064 bytes
Variable Size
192938856 bytes
Database Buffers 335544320
bytes
Redo Buffers
3764224 bytes
Database mounted.
SQL> select name ,open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
ORCLNEW MOUNTED
SQL> SELECT DBID,NAME from V$DATABASE;
DBID NAME
---------- ---------
969440921 ORCLNEW
SQL> alter database open;
Database altered.
SQL> select name ,open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
ORCLNEW READ WRITE
No comments:
Post a Comment