Ensure that you have a recoverable whole database backup.
Ensure that the target database is mounted but not open, and that it was shut down consistently prior to mounting.
For example:
SQL> select name from v$database;
NAME
---------
DBA
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 26286964 bytes
Fixed Size 453492 bytes
Variable Size 20971520 bytes
Database Buffers 4194304 bytes
Redo Buffers 667648 bytes
Database mounted.
Invoke the utility on the command line, specifying a valid user with the SYSDBA privilege. You must specify both the DBNAME and SETNAME parameters. This example changes the name to DBA2:
C:\>nid target=sys/sys dbname=dba2 setname=yes
DBNEWID: Release 9.2.0.3.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
Connected to database DBA (DBID=976473392)
Control Files in database:
C:\ORACLASS\ORADATA\U01\CTRL01.CTL
The following datafiles are read-only:
C:\ORACLASS\ORADATA\U01\QUERYDATA01.DBF (6)
These files must be writable by this utility.
Change database name of database DBA to DBA2? (Y/[N]) => y
Proceeding with operation
Changing database name from DBA to DBA2
Control File C:\ORACLASS\ORADATA\U01\CTRL01.CTL - modified
Datafile C:\ORACLASS\ORADATA\U01\SYSTEM01.DBF - wrote new name
Datafile C:\ORACLASS\ORADATA\U02\UNDOTBS.DBF - wrote new name
Datafile C:\ORACLASS\ORADATA\U03\USERS01.DBF - wrote new name
Datafile C:\ORACLASS\ORADATA\U03\INDX01.DBF - wrote new name
Datafile C:\ORACLASS\ORADATA\U02\SAMPLE01.DBF - wrote new name
Datafile C:\ORACLASS\ORADATA\U01\QUERYDATA01.DBF - wrote new name
Datafile C:\TBS1.DBF - wrote new name
Datafile C:\ORACLASS\ORADATA\U02\TEMP01.DBF - wrote new name
Control File C:\ORACLASS\ORADATA\U01\CTRL01.CTL - wrote new name
Database name changed to DBA2.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID - Completed succesfully.
Set the DB_NAME initialization parameter in the initialization parameter file to the new database name.Shut down the database. Create a new password file
C:\>sqlplus /nolog
SQL*Plus: Release 9.2.0.3.0 - Production on Thu Feb 5 23:46:37 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> conn / as sysdba;
Connected.
SQL> alter system set db_name=DBA2 SCOPE=SPFILE;
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
C:\>orapwd file=D:\oracle\ora92\database\PWDDBA.ORA password=sys entries=20
Start up the database
SQL> STARTUP
rename the global database name
SQL> select * from global_name;
GLOBAL_NAME
-----------------------------------
DBA.WORLD
SQL> alter database rename global_name to dba2.world
SQL> select * from global_name;
GLOBAL_NAME
----------------------------------------
DBA2.WORLD
没有评论:
发表评论