Search This Blog

Sunday, June 3, 2007

Change ORACLE_SID

Oracle Database : 10.1.0.2.0
OS : Windows XP sp2
Archivelog : Enable
OEM : DBCONSOLE configured


HGC@TAJ>select name from v$database;

NAME
---------
ORCLDB

HGC@TAJ>select instance_name from v$instance;

INSTANCE_NAME
----------------
sidorcl



STEP 1

shutdown database


HGC@TAJ>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.


STEP 2

STOP SERVICES


C:\>set ORACLE_SID=sidorcl

C:\>net stop oracleservicesidorcl
The following services are dependent on the OracleServiceSIDORCL service.
Stopping the OracleServiceSIDORCL service will also stop these services.

OracleDBConsolesidorcl

Do you want to continue this operation? (Y/N) [N]: Y
The OracleDBConsolesidorcl service is stopping...
The OracleDBConsolesidorcl service was stopped successfully.

The OracleServiceSIDORCL service is stopping.
The OracleServiceSIDORCL service was stopped successfully.


STEP 3

DROP OLD ORACLE_SID service


C:\>ORADIM -DELETE -SID sidorcl
Instance deleted.


STEP 4

set new oracle_sid


C:\>set ORACLE_SID=orclsid


STEP 5

Recreate Password File


C:\>ORAPWD FILE=c:\oracle\product\10.1.0\db_1\database\pwdorclsid.ora PASSWORD=o
racle ENTRIES=5 FORCE=y


STEP 6

Create New Oracle Services with new ORACLE_SID name


C:\>ORADIM -new -sid ORCLSID -startmode manual -spfile
Instance created.

C:\>oradim -edit -sid ORCLSID -startmode auto


STEP 7

RENAME PFILE (INIT[OLDSID].ORA TO INIT[NEW].ORA


C:\>rename c:\oracle\product\10.1.0\db_1\database\initSIDORCL.ORA initORCLSID.ORA


STEP 8

Recreate SPFILE from PFILE


C:\>sqlplus/nolog

SQL*Plus: Release 10.1.0.2.0 - Production on Sun Jun 3 12:07:42 2007

Copyright (c) 1982, 2004, Oracle. All rights reserved.

HGC@TAJ>conn sys as sysdba
Enter password:
Connected to an idle instance.
HGC@TAJ>create spfile from pfile;

File created.


STEP 9

STARTUP database and check !!!


HGC@TAJ>startup
ORACLE instance started.

Total System Global Area 171966464 bytes
Fixed Size 787988 bytes
Variable Size 145488364 bytes
Database Buffers 25165824 bytes
Redo Buffers 524288 bytes
Database mounted.
Database opened.
HGC@TAJ>select name from v$database;

NAME
---------
ORCLDB

HGC@TAJ>select instance_name from v$instance;

INSTANCE_NAME
----------------
orclsid


STEP 10

Drop EM repository


HGC@TAJ>ed
Wrote file afiedt.buf

1 DECLARE
2 CURSOR c1 IS
3 SELECT owner, synonym_name name
4 FROM dba_synonyms
5 WHERE table_owner = 'SYSMAN';
6 BEGIN
7 FOR r1 IN c1
8 LOOP
9 IF r1.owner = 'PUBLIC' THEN
10 EXECUTE IMMEDIATE 'DROP PUBLIC SYNONYM '||r1.name;
11 ELSE
12 EXECUTE IMMEDIATE 'DROP SYNONYM '||r1.owner||'.'||r1.name;
13 END IF;
14 END LOOP;
15* END;
16 /

PL/SQL procedure successfully completed.

HGC@TAJ>drop role mgmt_user;

Role dropped.

HGC@TAJ>drop user mgmt_view cascade;

User dropped.

HGC@TAJ>drop user sysman cascade;

User dropped.


STEP 11

Create New EM repository





C:\>emca

STARTED EMCA at Sun Jun 03 13:09:14 GST 2007
Enter the following information about the database to be configured
Listener port number: 1521
Database SID: orclsid
Service name: orclsid
Email address for notification:
Email gateway for notification:
Password for dbsnmp:
Password for sysman:
Password for sys: :

-----------------------------------------------------------------

You have specified the following settings

Database ORACLE_HOME ................ C:\oracle\product\10.1.0\Db_1
Enterprise Manager ORACLE_HOME ................ C:\oracle\product\10.1.0\Db_1

Database host name ................ taj.domainname.local
Listener port number ................ 1521
Database SID ................ orclsid
Service name ................ orclsid
Email address for notification ...............
Email gateway for notification ...............

-----------------------------------------------------------------
Do you wish to continue? [yes/no]:

Jun 3, 2007 1:10:06 PM oracle.sysman.emcp.EMConfig updateReposVars
INFO: Updating file C:\oracle\product\10.1.0\Db_1\sysman\emdrep\config\repositor
y.variables ...
Jun 3, 2007 1:16:19 PM oracle.sysman.emcp.EMConfig createRepository
INFO: Creating repository ...
Jun 3, 2007 1:16:19 PM oracle.sysman.emcp.EMConfig perform
INFO: Repository was created successfully
Jun 3, 2007 1:16:29 PM oracle.sysman.emcp.util.PortQuery findUsedPorts
INFO: Searching services file for used port
Jun 3, 2007 1:16:30 PM oracle.sysman.emcp.EMConfig addPortEntries
INFO: Updating file C:\oracle\product\10.1.0\Db_1\install\portlist.ini ...
Jun 3, 2007 1:16:30 PM oracle.sysman.emcp.EMConfig updateEmdProps
INFO: Updating file C:\oracle\product\10.1.0\Db_1\sysman\config\emd.properties .
..
Jun 3, 2007 1:16:31 PM oracle.sysman.emcp.EMConfig updateConfigFiles
INFO: targets.xml file is updated successfully
Jun 3, 2007 1:16:31 PM oracle.sysman.emcp.EMConfig updateEmomsProps
INFO: Updating file C:\oracle\product\10.1.0\Db_1\sysman\config\emoms.properties
...
Jun 3, 2007 1:16:31 PM oracle.sysman.emcp.EMConfig updateConfigFiles
INFO: emoms.properties file is updated successfully
Jun 3, 2007 1:16:34 PM oracle.sysman.emcp.EMConfig startOMS
INFO: Starting the DBConsole ...
Jun 3, 2007 1:18:14 PM oracle.sysman.emcp.EMConfig perform
INFO: DBConsole is started successfully
Jun 3, 2007 1:18:14 PM oracle.sysman.emcp.EMConfig perform
INFO: >>>>>>>>>>> The Enterprise Manager URL is http://taj.domainname.lo
cal:5502/em <<<<<<<<<<<
Enterprise Manager configuration is completed successfully
FINISHED EMCA at Sun Jun 03 13:18:14 GST 2007

C:\>emctl status dbconsole
Oracle Enterprise Manager 10g Database Control Release 10.1.0.2.0
Copyright (c) 1996, 2004 Oracle Corporation. All rights reserved.
http://taj.domainname.local:5502/em/console/aboutApplication
Oracle Enterprise Manager 10g is running.
------------------------------------------------------------------
Logs are generated in directory C:\oracle\product\10.1.0\Db_1/taj.domainname.local_orclsid/sysman/log

No comments: