Requirement description: It is required to change the database instance name of the windows platform from orcl to haha
refer to:
https://www.cnblogs.com/junnor/archive/2013/03/05/2945245.html
https://www.cnblogs.com/tomatoes-/p/6130615.html
http://blog.itpub.net/114562/viewspace-820776/
1. View the current database instance name
2. Create the trace file of the control file
Find the trace file just produced
The trace file is in the e:\app\administrator\diag\rdbms\orcl\orcl\trace directory
The trace file is e:\app\administrator\diag\rdbms\orcl\orcl\trace\orcl_ora_2668.trc
View e:\app\administrator\diag\rdbms\orcl\orcl\trace\orcl_ora_2668.trc, and extract the control file to create a script for backup.
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO01.LOG' SIZE 50M BLOCKSIZE 512,
GROUP 2 'E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO02.LOG' SIZE 50M BLOCKSIZE 512,
GROUP 3 'E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO03.LOG' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'E:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF',
'E:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF',
'E:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF',
'E:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF'
CHARACTER SET ZHS16GBK
;
3. Modify dbname
close the database
Start the database to mount state
modify dbname
Fourth, modify db_name
Start the database to mount state
Modify db_name
Generate pfile from current spfile
close the database
Modify the generated pfile file, replace all orcls with haha, and after saving, copy the file to the E:\app\Administrator\product\11.2.0\dbhome_1\database directory
Create a haha folder in the E:\app\Administrator\admin file directory
Modify the orcl folder under E:\app\Administrator\oradata\ to haha
5. Create orapwd file
6. Open the database to view the current database name
7. Modify instance_name
delete the old instance name
Create new instance name
Eight, modify tnsname.ora and listener.ora
tnsname.ora file
listener.ora file
Restart the monitor and check the monitor status
Nine, modify the ORACLE_SID of the registry
Registry path: HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE/KEY_OraDb11g_home1/ORACLE_SID
10. Generate spfile from previously modified pfile
11. Rebuild the control file
Rename or delete the previous control file before resetting the control file
Change ORCL to HAHA, REUSE to set, NORESETLOGS to resetlogs
CREATE CONTROLFILE set DATABASE "HAHA" resetlogs NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'E:\APP\ADMINISTRATOR\ORADATA\HAHA\REDO01.LOG' SIZE 50M BLOCKSIZE 512,
GROUP 2 'E:\APP\ADMINISTRATOR\ORADATA\HAHA\REDO02.LOG' SIZE 50M BLOCKSIZE 512,
GROUP 3 'E:\APP\ADMINISTRATOR\ORADATA\HAHA\REDO03.LOG' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'E:\APP\ADMINISTRATOR\ORADATA\HAHA\SYSTEM01.DBF',
'E:\APP\ADMINISTRATOR\ORADATA\HAHA\SYSAUX01.DBF',
'E:\APP\ADMINISTRATOR\ORADATA\HAHA\UNDOTBS01.DBF',
'E:\APP\ADMINISTRATOR\ORADATA\HAHA\USERS01.DBF'
CHARACTER SET ZHS16GBK
;
12. Start the database and view the current instance name