Sunday, December 18, 2011

HOW TO CREATE ORACLE INSTANCE IN WINDOWS 7

How to create oracle instance in windows 7:
----------------------------------------------
Add entry into listener.ora , the new db being created is clonedb1

listener.ora file content:
------------------------------

 # listener.ora Network Configuration File: F:\app\HOME\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = F:\app\HOME\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:F:\app\HOME\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
(SID_DESC =
(GLOBAL_DBNAME=CLONEDB1)
(SID_NAME = CLONEDB1)
(ORACLE_HOME = F:\app\HOME\product\11.2.0\dbhome_1)
)
(SID_DESC =
(GLOBAL_DBNAME=CLONET)
(SID_NAME = CLONET)
(ORACLE_HOME = F:\app\HOME\product\11.2.0\dbhome_1)
)

)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)

ADR_BASE_LISTENER = F:\app\HOME

2. Add entry into tnsnames.ora
tnsnames.ora:
-------------------

 # tnsnames.ora Network Configuration File: F:\app\HOME\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

CLONET =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = CLONET)
)
)

ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)

LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))


ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)


clonedb1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = clonedb1)
)
)

3. login into existing DB i.e. orcl

 create pfile='path/name.ora' from spfile;
exit;

open newly created pfile for db name change,

modify orcl with new db i.e. clonedb1 in pfile, save and exit..

ensure all the ../clonedb1/... directories are created in file system

4. create instance, reload listener and tests the newly created instance..

  C:\Users\HOME>lsnrctl status

LSNRCTL for 32-bit Windows: Version 11.2.0.1.0 - Production on 18-DEC-2011 14:01
:20

Copyright (c) 1991, 2010, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
32-bit Windows Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
32-bit Windows Error: 61: Unknown error

C:\Users\HOME>set ORACLE_SID=CLONEDB1

C:\Users\HOME>oradim -new -sid clonedb1 -intpwd password=oracle -startmode a -pf
ile D:\TESTDELETE\initclonedb1.ora
Instance created.

C:\Users\HOME>
C:\Users\HOME>orapwd file=F:\app\HOME\product\11.2.0\dbhome_1\database\PWDcloned
b1.ora password=oracle entries=50

OPW-00005: File with same name exists - please delete or rename

C:\Users\HOME>
C:\Users\HOME>lsnrctl start

LSNRCTL for 32-bit Windows: Version 11.2.0.1.0 - Production on 18-DEC-2011 14:03
:17

Copyright (c) 1991, 2010, Oracle. All rights reserved.

Starting tnslsnr: please wait...

TNSLSNR for 32-bit Windows: Version 11.2.0.1.0 - Production
System parameter file is F:\app\HOME\product\11.2.0\dbhome_1\network\admin\liste
ner.ora
Log messages written to f:\app\home\diag\tnslsnr\HOME-PC\listener\alert\log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521
ipc)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 11.2.0.1.0 - Produ
ction
Start Date 18-DEC-2011 14:03:23
Uptime 0 days 0 hr. 0 min. 7 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File F:\app\HOME\product\11.2.0\dbhome_1\network\admin\list
ener.ora
Listener Log File f:\app\home\diag\tnslsnr\HOME-PC\listener\alert\log.xm
l
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "CLONEDB1" has 1 instance(s).
Instance "CLONEDB1", status UNKNOWN, has 1 handler(s) for this service...
Service "CLONET" has 1 instance(s).
Instance "CLONET", status UNKNOWN, has 1 handler(s) for this service...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

C:\Users\HOME>sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Sun Dec 18 14:03:48 2011

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

Connected to an idle instance.

SQL>
SQL> startup nomount pfile='D:\TESTDELETE\initclonedb1.ora'
ORACLE instance started.

Total System Global Area 640286720 bytes
Fixed Size 1376492 bytes
Variable Size 314576660 bytes
Database Buffers 318767104 bytes
Redo Buffers 5566464 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Pr
oduction
With the Partitioning, OLAP, Data Mining and Real Application Testing options

C:\Users\HOME>lsnrctl reload

LSNRCTL for 32-bit Windows: Version 11.2.0.1.0 - Production on 18-DEC-2011 14:04
:29

Copyright (c) 1991, 2010, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully

C:\Users\HOME>lsnrctl status

LSNRCTL for 32-bit Windows: Version 11.2.0.1.0 - Production on 18-DEC-2011 14:04
:33

Copyright (c) 1991, 2010, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 11.2.0.1.0 - Produ
ction
Start Date 18-DEC-2011 14:03:23
Uptime 0 days 0 hr. 1 min. 14 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File F:\app\HOME\product\11.2.0\dbhome_1\network\admin\list
ener.ora
Listener Log File f:\app\home\diag\tnslsnr\HOME-PC\listener\alert\log.xm
l
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "CLONEDB1" has 1 instance(s).
Instance "CLONEDB1", status UNKNOWN, has 1 handler(s) for this service...
Service "CLONET" has 1 instance(s).
Instance "CLONET", status UNKNOWN, has 1 handler(s) for this service...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully


C:\Users\HOME>tnsping orcl

TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 18-DEC-2
011 14:06:35

Copyright (c) 1997, 2010, Oracle. All rights reserved.

Used parameter files:
F:\app\HOME\product\11.2.0\dbhome_1\network\admin\sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhos
t)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
OK (20 msec)

C:\Users\HOME>tnsping clonedb1

TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 18-DEC-2
011 14:06:37

Copyright (c) 1997, 2010, Oracle. All rights reserved.

Used parameter files:
F:\app\HOME\product\11.2.0\dbhome_1\network\admin\sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhos
t)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = clonedb1))
)
OK (0 msec)

C:\Users\HOME>
C:\Users\HOME>
C:\Users\HOME>sqlplus sys@orcl as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sun Dec 18 14:06:55 2011

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

Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Pr
oduction
With the Partitioning, OLAP, Data Mining and Real Application Testing options

C:\Users\HOME>sqlplus sys@clonedb1 as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sun Dec 18 14:07:07 2011

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

Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
SQL>

No comments:

Post a Comment