Use Nid to change dbname

Source: Internet
Author: User
Tags log modify reserved windows 5


Link


Http://www.eygle.com/faq/Use.Nid.to.Change.Your.dbname.htm

Nid is a tool that Oracle has provided from 9IR2 and can be used to change the database name without having to go through the cumbersome ways of rebuilding control files before.
It should be explained that although this tool comes from 9IR2, it can still be used for oracle8i.

First look at the help:

C:\>nid-helpdbnewid:release 10.1.0.2.0-productioncopyright (c) 2001, Oracle. All rights reserved. Keyword description (default)----------------------------------------------------TARGET username/password (none) dbname New database name (none) LOGFILE output log (none) REVERT restore failed change no setname only set new database name append append to output log no help displaying these messages

Let's take a look at usage by example:

1. Database Current settings



Sql> select * from V$version; BANNER----------------------------------------------------------------oracle9i Enterprise Edition Release 9.2.0.1.0-productionpl/sql release 9.2.0.1.0-productioncore 9.2.0.1.0 productiontns for 32-bit windows:version 9.2.0. 1.0-productionnlsrtl Version 9.2.0.1.0-productionsql> Show parameter namename TYPE VALUE-------------------------- ---------------------------------------------------db_file_name_convert stringdb_name string eyglevglobal_names Boolean falseinstance_name string Eyglevlock_name_space stringlog_file_name_convert stringoracle_trace_collection_ Name Stringoracle_trace_facility_name string Oracledplsql_native_make_file_name stringservice_names string Eyglev

2. Shutdown database

Sql> Connect Sys/orasys as sysdbaconnected.sql> shutdown immediatedatabase closed. Database dismounted. ORACLE instance shut down.



3. Startup Mount



Sql> Startup Mount
ORACLE instance started.

Total System Global area 135338868 bytes
Fixed Size 453492 bytes
Variable Size 109051904 bytes
Database buffers 25165824 bytes
Redo buffers 667648 bytes
Database mounted.




4. Use Nid to change

 SQL> Hostmicrosoft [Version 5.00.2195] (C) All rights reserved 1985-2000 Microsoft Corp.c:\>nid target=sys/ Orasys dbname=eyglendbnewid:release 9.2.0.1.0-productioncopyright (c) 1995, 2002, Oracle Corporation. All rights reserved. Connected to Database Eyglev (dbid=677189177) control the Files in Database:e:\oracle\oradata\eyglen\control01. CTL E:\ORACLE\ORADATA\EYGLEN\CONTROL02. CTL E:\ORACLE\ORADATA\EYGLEN\CONTROL03. Ctlchange database ID and database name Eyglev to Eyglen? (Y/[n]) => yproceeding with operationchanging database ID from 677189177 to 3955758099Changing database name from Eygle V to Eyglen control File E:\ORACLE\ORADATA\EYGLEN\CONTROL01. Ctl-modified control File E:\ORACLE\ORADATA\EYGLEN\CONTROL02. Ctl-modified control File E:\ORACLE\ORADATA\EYGLEN\CONTROL03. Ctl-modified datafile E:\ORACLE\ORADATA\EYGLEN YSTEM01. Dbf-dbid changed, wrote new name DataFile E:\ORACLE\ORADATA\EYGLEN\UNDOTBS01. Dbf-dbid changed, wrote new name DataFile E:\ORACLE\ORADATA\EYGLEN\CWMLITE01. Dbf-dbid changed, wrote new name DataFile E:\ORACLE\ORADATA\EYGLEN\DRSYS01. Dbf-dbid changed, wrote new name DataFile E:\ORACLE\ORADATA\EYGLEN\INDX01. Dbf-dbid changed, wrote new name DataFile E:\ORACLE\ORADATA\EYGLEN\ODM01. Dbf-dbid changed, wrote new name DataFile E:\ORACLE\ORADATA\EYGLEN\TOOLS01. Dbf-dbid changed, wrote new name DataFile E:\ORACLE\ORADATA\EYGLEN\USERS01. Dbf-dbid changed, wrote new name DataFile E:\ORACLE\ORADATA\EYGLEN\XDB01. Dbf-dbid changed, wrote new name DataFile E:\ORACLE\ORADATA\EYGLEN\EYGLE. Dbf-dbid changed, wrote new name DataFile E:\ORACLE\ORADATA\EYGLEN\TEMP01. Dbf-dbid changed, wrote new name control File E:\ORACLE\ORADATA\EYGLEN\CONTROL01. Ctl-dbid changed, wrote new name control File E:\ORACLE\ORADATA\EYGLEN\CONTROL02. Ctl-dbid changed, wrote new name control File E:\ORACLE\ORADATA\EYGLEN\CONTROL03. Ctl-dbid changed, wrote new namedatabase name changed to Eyglen. Modify parameter file and generate a new password file before RestartiNg. The database ID for the database Eyglen changed to 3955758099.All previous backups and archived redo the for this database logs UN Usable. Shut down the database and open with RESETLOGS option. succesfully changed database name and ID. dbnewid-completed succesfully.



5. Shutdown Database



sql> shutdown Immediate
Ora-01109:database not open


Database dismounted.
ORACLE instance shut down.


6. Modifying initialization parameter files, spfile files (init.ora/spfile)



###########################################
Instance_name=eyglen
#instance_name =eyglev

###########################################
Db_domain= ""
Db_name=eyglen
# Db_name=eyglev
###########################################




7. Rebuilding SPFile files
If you don't use SPFile, of course you don't need to rebuild, jump to 8


Sql> Startup Pfile=e:\oracle\admin\eyglen\pfile\init.oraoracle instance started. Total System Global area 135338868 bytesfixed size 453492 bytesvariable size 109051904 bytesdatabase buffers 25165824 byte Sredo buffers 667648 bytesora-01991:invalid password file ' E:\oracle\Ora9iR2\DATABASE\PWDeyglen.ORA ' sql> CREATE Spfile= ' E:\Oracle\Ora9iR2\database Pfileeyglen. ORA ' from 2 pfile= ' E:\Oracle\admin\eyglen\pfile\init.ora '; File created.



8. Rebuilding password files



Sql> Host
Microsoft Windows 5.00.2195 [Version]
(C) Copyright 1985-2000 Microsoft Corp.

C:\>orapwd File=e:\oracle\ora9ir2\database\pwdeyglen.ora password=oracle entries=5




9.shutdown Database
If you do not use SPFile, you can skip to 10




sql> shutdown Immediate
Ora-01109:database not open


Database dismounted.
ORACLE instance shut down.



10. Startup Mount,resetlogs Open



Sql> Startup Mountoracle instance started. Total System Global area 135338868 bytesfixed size 453492 bytesvariable size 109051904 bytesdatabase buffers 25165824 byte Sredo buffers 667648 bytesdatabase mounted. sql> ALTER DATABASE open Resetlogs 2/database altered. Sql>

11. Modified parameters

Sql> Show parameter NameName TYPE VALUE------------------------------------------------------------------------- ----Db_file_name_convert Stringdb_name String Eyglenglobal_names boolean falseinstance_name string eyglenlock_name_ Space Stringlog_file_name_convert stringoracle_trace_collection_name Stringoracle_trace_facility_name string Oracledplsql_native_make_file_name Stringservice_names String Eyglen



12. Make a full backup of the database

Attached: Use NID to change 817 database


1. Before you change

Svrmgr> startup Mount has started an ORACLE instance. The system global Zone Total has 61,970,460 bytes fixed Size 75,804 bytes Variable size 17,645,568 bytes database buffers 44,171,264 bytes Redo Buffers 77,824 bytes have been loaded into the database. Svrmgr> Show parameter NameName TYPE VALUE---------------------------------------------------------------------- --db_file_name_convert string Db_name string Vilenglobal_names boolean trueinstance_name string Vilenlock_name_space string Log_file_ Name_convert string Oracle_trace_collection_name string Oracle_trace_facility_name string Oracledservice_names string VilenSVRMGR >



2. Modify

C:\>nid Target=sys/orasys@vilen dbname=vilenedbnewid:release 9.2.0.1.0-productioncopyright (c) 1995, 2002, Oracle C Orporation. All rights reserved. Connected to Database VILEN (dbid=1535443189) control the Files in Database:c:\oracle\oradata\vilen\control01. CTL C:\ORACLE\ORADATA\VILEN\CONTROL02. CTL C:\ORACLE\ORADATA\VILEN\CONTROL03. Ctlchange database ID and database name VILEN to Vilene? (Y/[n]) => yproceeding with operationchanging database ID from 1535443189 to 681857412Changing database name from VILEN To Vilene control File C:\ORACLE\ORADATA\VILEN\CONTROL01. Ctl-modified control File C:\ORACLE\ORADATA\VILEN\CONTROL02. Ctl-modified control File C:\ORACLE\ORADATA\VILEN\CONTROL03. Ctl-modified datafile C:\ORACLE\ORADATA\VILEN YSTEM01. Dbf-dbid changed, wrote new name DataFile C:\ORACLE\ORADATA\VILEN\RBS01. Dbf-dbid changed, wrote new name DataFile C:\ORACLE\ORADATA\VILEN\USERS01. Dbf-dbid changed, wrote new name DataFile C:\ORACLE\ORADATA\VILEN\TEMP01. Dbf-dbid changed, WROTe new name DataFile C:\ORACLE\ORADATA\VILEN\TOOLS01. Dbf-dbid changed, wrote new name DataFile C:\ORACLE\ORADATA\VILEN\INDX01. Dbf-dbid changed, wrote new name DataFile C:\ORACLE\ORADATA\VILEN\EQSP01. Dbf-dbid changed, wrote new name DataFile C:\ORACLE\ORADATA\VILEN\PERFSTAT. Dbf-dbid changed, wrote new name control File C:\ORACLE\ORADATA\VILEN\CONTROL01. Ctl-dbid changed, wrote new name control File C:\ORACLE\ORADATA\VILEN\CONTROL02. Ctl-dbid changed, wrote new name control File C:\ORACLE\ORADATA\VILEN\CONTROL03. Ctl-dbid changed, wrote new namedatabase name changed to Vilene. Modify parameter file and generate a new password file before restarting. The database ID for the database Vilene changed to 681857412.All previous backups and archived redo the for this database logs are Sable. Shut down the database and open with RESETLOGS option. succesfully changed database name and ID. dbnewid-completed succesfully.



3. Close Database



svrmgr> shutdown Immediate
ORA-01109: Database not open
The database has been removed.
The ORACLE instance has been closed.



4. Modify parameter file

db_name = "Vilene"
#db_name = "Vilen"

instance_name = Vilene
#instance_name = Vilen

5. Rebuilding password files



C:\oracle\database>orapwd File=pwdvilen.ora password=oracle entries=5

C:\oracle\database>


6. Mount Database

Svrmgr> Startup Mountoracle instance started. Total System Global area 61970460 bytesfixed size 75804 bytesvariable size 17645568 bytesdatabase buffers 44171264 Do buffers 77824 bytesdatabase mounted.



7. Open Database

svrmgr> ALTER DATABASE open Resetlogs
2>/
Statement processed.




8. Modified parameters

Svrmgr> Show parameter NameName TYPE VALUE---------------------------------------------------------------------- --db_file_name_convert Stringdb_name String Vileneglobal_names boolean trueinstance_name string vilenelock_name_space Stringlog_file_name_convert stringoracle_trace_collection_name Stringoracle_trace_facility_name String Oracledservice_names string Vilen






Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.