This article presents how to quickly install Oracle Database 12C Release 2 (12.2.0.1) on Windows.
Software used:
Binaries Database 12C Release 2(12.2.0.1)
winx64_12201_database.zip - database software
Hardware and software requirements:
- at least 2GB ram as minimum at least 10G space
Oracle Database for Windows x64 is supported on the following operating system versions:
-
Windows 7 x64 – Professional, Enterprise, and Ultimate editions
-
Windows 8 x64 and Windows 8.1 x64 – Pro and Enterprise editions
-
Windows 8.1 x64 – Pro and Enterprise editions
-
Windows 10 x64 – Pro, Enterprise, and Education editions
-
Windows Server 2012 x64 – Standard, Datacenter, Essentials, and Foundation editions
-
Windows Server 2012 R2 x64 – Standard, Datacenter, Essentials, and Foundation editions
-
Windows Server 2016 x64 – Standard, Datacenter, and Essentials editions
I installed database software on Windows 10 Home Edition. Grid 12C is not supported for Windows 10 Home Edition.
Install database software
Unzip file in c:\download
cd c:\download unzip winx64_12201_database.zip
It will create subdirectory c:\download\database with following structure.Just run setup.exe as administrator
1. Uncheck checkbox “I wish to receive security updates via My Oracle Support” and then click “Next” button.
2. Ignore following message and click “Yes” button.
3. Select “Create and configure a database” and click “Next” button.
4. Select “Server class” option and click “Next” button.
5. Select “Single instance database installation” option and click “Next”. Other options are available if you have grid software 12C installed.
6. Select “Advanced install” to have more options during installation of a new database. Click “Next” button.
7. Accept default “Enterprise Edition” and click “Next” button.
8. On this screen you can select account which will be used to install and use of new database software. I used “Use Windows Built-in Account”. Click “Next” button.
9. In such case ignore next message by clicking “Yes” button.
10. On the screen you can select directory for new binaries. Click “Next” button. I recommend to use:
- ORACLE_BASE – c:\app\oracle
- ORACLE_HOME – c:\app\oracle\product\12.2.0\dbhome_1
11. Accept default “General Purpose/Transaction Processing” and click “Next” button.
12. Enter “Global database name”, “Oracle system identifier (SID)” for your new database which will be created. If you check checkbox “Create as Container database” your database will be able to consolidate many databases. In such case you need to enter name of your first pluggable database “Pluggable database name”. Click “Next” button.
13. Specify more details about your database on 3 tabs where you can define memory settings, character set and if to install sample schemas on your database. Once you are happy with your settings click “Next” button.
14. On this screen you can select place where database files will be created. Select “File system” option and click “Next” button.
15. On this screen you can register your new database in Oracle Enterprise Cloud. Click “Next” button to continue.
16. Check checkbox “Enable Recovery” to specify recovery area where backups will be stored. Click “Next” button to continue.
17. Specify password for each user or enter the same for all. Once it’s done click “Next” button.
18. Checks are started to verify if OS is ready to install database software.
19. If everything is right click “Install” button. It’s the last moment to come back to each of previous point and make changes.
20. Installation in progress … go play football 🙂. BE PATIENT it can take 1h.
21. Installation is completed. Click “Close” button.
Following components are configured after installation:
- Listener – required to connect to database using remote connection. All configuration details can be found for it in $ORACLE_HOME/network/admin/listener.ora file
- Basic tnsnames entry to use remote network connection. All details can be found in $ORACLE_HOME/network/admin/tnsnames.ora file
ORACLE_HOME was defined in point 10 as c:\app\oracle\product\12.2.0\dbhome_1
Listener
Basics commands can be used to manage listener:
- lsnrctl status – check status
- lsnrctl start – start listener
- lsnrctl stop – stop listener
NOTE – the commands will work from only if you started cmd.exe as adminitrator. cmd.exe is windows command interpreter
With lsnrctl status you can see my listener is listing on host laptop port 1521:
- (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=laptop)(PORT=1521)))
and has got registered following important services – will be used to connect from such tools like sqlplus, sqldeveloper and others:
- ORA12C.dbaora.com – service to root database
- pora12c1.dbaora.com – service to pluggable database
c:\app\oracle\product\12.2.0\dbhome_1\bin>lsnrctl status
LSNRCTL for 64-bit Windows: Version 12.2.0.1.0 - Production on 13-JUL-2019 09:25:43
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=laptop)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 12.2.0.1.0 - Production
Start Date 13-JUL-2019 00:08:50
Uptime 0 days 9 hr. 16 min. 55 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File c:\app\oracle\product\12.2.0\dbhome_1\network\admin\listener.ora
Listener Log File c:\app\oracle\diag\tnslsnr\laptop\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=laptop)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=laptop)(PORT=5500))(Security=(my_wallet_directory=C:\APP\ORACLE\admin\ORA12C\xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "1208cda6b50d4ecb90ebaca5b1c238fa.dbaora.com" has 1 instance(s).
Instance "ora12c", status READY, 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 "ORA12C.dbaora.com" has 1 instance(s).
Instance "ora12c", status READY, has 1 handler(s) for this service...
Service "ORA12CXDB.dbaora.com" has 1 instance(s).
Instance "ora12c", status READY, has 1 handler(s) for this service...
Service "pora12c1.dbaora.com" has 1 instance(s).
Instance "ora12c", status READY, has 1 handler(s) for this service...
The command completed successfully
If you stop/start listener you can be surprised services are missing for a while. It takes some time before database re-register the entries in listener.
C:\WINDOWS\system32>lsnrctl
LSNRCTL for 64-bit Windows: Version 12.2.0.1.0 - Production on 13-JUL-2019 10:02:30
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=laptop)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 12.2.0.1.0 - Production
Start Date 13-JUL-2019 10:01:34
Uptime 0 days 0 hr. 1 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File c:\app\oracle\product\12.2.0\dbhome_1\network\admin\listener.ora
Listener Log File c:\app\oracle\diag\tnslsnr\laptop\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=laptop)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=laptop)(PORT=5500))(Security=(my_wallet_directory=C:\APP\ORACLE\admin\ORA12C\xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "1208cda6b50d4ecb90ebaca5b1c238fa.dbaora.com" has 1 instance(s).
Instance "ora12c", status READY, 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 "ORA12C.dbaora.com" has 1 instance(s).
Instance "ora12c", status READY, has 1 handler(s) for this service...
Service "ORA12CXDB.dbaora.com" has 1 instance(s).
Instance "ora12c", status READY, has 1 handler(s) for this service...
Service "pora12c1.dbaora.com" has 1 instance(s).
Instance "ora12c", status READY, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL> stop
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=laptop)(PORT=1521)))
The command completed successfully
LSNRCTL> start
Starting tnslsnr: please wait...
TNSLSNR for 64-bit Windows: Version 12.2.0.1.0 - Production
System parameter file is c:\app\oracle\product\12.2.0\dbhome_1\network\admin\listener.ora
Log messages written to c:\app\oracle\diag\tnslsnr\laptop\listener\alert\log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=laptop)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=laptop)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 12.2.0.1.0 - Production
Start Date 13-JUL-2019 10:02:45
Uptime 0 days 0 hr. 0 min. 4 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File c:\app\oracle\product\12.2.0\dbhome_1\network\admin\listener.ora
Listener Log File c:\app\oracle\diag\tnslsnr\laptop\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=laptop)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL>
After 20 seconds you shoud see all services registered once again in listener
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=laptop)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 12.2.0.1.0 - Production
Start Date 13-JUL-2019 10:02:45
Uptime 0 days 0 hr. 2 min. 59 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File c:\app\oracle\product\12.2.0\dbhome_1\network\admin\listener.ora
Listener Log File c:\app\oracle\diag\tnslsnr\laptop\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=laptop)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=laptop)(PORT=5500))(Security=(my_wallet_directory=C:\APP\ORACLE\admin\ORA12C\xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "1208cda6b50d4ecb90ebaca5b1c238fa.dbaora.com" has 1 instance(s).
Instance "ora12c", status READY, 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 "ORA12C.dbaora.com" has 1 instance(s).
Instance "ora12c", status READY, has 1 handler(s) for this service...
Service "ORA12CXDB.dbaora.com" has 1 instance(s).
Instance "ora12c", status READY, has 1 handler(s) for this service...
Service "pora12c1.dbaora.com" has 1 instance(s).
Instance "ora12c", status READY, has 1 handler(s) for this service...
The command completed successfully
As default LISTENER doesn’t know any services because $ORACLE_HOME/network/admin/listener.ora is configured in following way
# listener.ora Network Configuration File: c:\app\oracle\product\12.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 = c:\app\oracle\product\12.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:c:\app\oracle\product\12.2.0\dbhome_1\bin\oraclr12.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = laptop)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
you can modify it and permanently add services then no matter if database is down or up listener will always know about the services
# listener.ora Network Configuration File: c:\app\oracle\product\12.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 = c:\app\oracle\product\12.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:c:\app\oracle\product\12.2.0\dbhome_1\bin\oraclr12.dll")
)
(SID_DESC =
(GLOBAL_DBNAME = ORA12C.dbaora.com)
(ORACLE_HOME = c:\app\oracle\product\12.2.0\dbhome_1)
(SID_NAME = ora12c)
)
(SID_DESC =
(GLOBAL_DBNAME = pora12c1.dbaora.com)
(ORACLE_HOME = c:\app\oracle\product\12.2.0\dbhome_1)
(SID_NAME = ora12c)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = laptop)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
Direct connection to database
You can connect directly to your root database even if listener is down with OS authentication from sqlplus and switch to your pluggable database. As extra I have created user tomasz in my pluggable database.
c:\app\oracle\product\12.2.0\dbhome_1\bin>set ORACLE_SID=ORA12C
c:\app\oracle\product\12.2.0\dbhome_1\bin>sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Sat Jul 13 09:23:59 2019
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show con_id
CON_ID
------------------------------
1
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> ALTER SESSION SET container=PORA12C1;
Session altered.
SQL> show con_id
CON_ID
------------------------------
3
SQL> show con_name
CON_NAME
------------------------------
PORA12C1
SQL>
SQL> CREATE USER tomasz IDENTIFIED BY oracle;
User created.
SQL> GRANT connect, resource TO tomasz;
Grant succeeded.
Remote connection to database
You can remotely connect to your database using sqlplus and aliases properly defined in file $ORACLE_HOME/network/admin/tnsnames.ora and properly running LISTENER with registered services !!!. I try to connect to my pluggable database with alias pora12c1. It fails because it’s not defined in the file.
C:\Windows\System32>sqlplus tomasz@pora12c1
SQL*Plus: Release 12.2.0.1.0 Production on Sat Jul 13 10:36:32 2019
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Enter password:
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Enter user-name:
After installation tnsnames.ora file should look like this. No defined alias pora12c1.
# tnsnames.ora Network Configuration File: c:\app\oracle\product\12.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORA12C =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = laptop)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORA12C.dbaora.com)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
LISTENER_ORA12C =
(ADDRESS = (PROTOCOL = TCP)(HOST = laptop)(PORT = 1521))
I added two aliases both pointing to the same service. Alias name can have any name:
- pora12c1
- bear
# tnsnames.ora Network Configuration File: c:\app\oracle\product\12.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORA12C =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = laptop)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORA12C.dbaora.com)
)
)
PORA12C1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = laptop)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pora12c1.dbaora.com)
)
)
BEAR =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = laptop)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pora12c1.dbaora.com)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
LISTENER_ORA12C =
(ADDRESS = (PROTOCOL = TCP)(HOST = laptop)(PORT = 1521))
Now remote connections using sqlplus works. You can test defined aliases with oracle tool tnsping to verify them
C:\Windows\System32>tnsping pora12c1
TNS Ping Utility for 64-bit Windows: Version 12.2.0.1.0 - Production on 13-JUL-2019 10:48:12
Copyright (c) 1997, 2016, Oracle. All rights reserved.
Used parameter files:
c:\app\oracle\product\12.2.0\dbhome_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = laptop)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pora12c1.dbaora.com)))
OK (20 msec)
C:\Windows\System32>tnsping bear
TNS Ping Utility for 64-bit Windows: Version 12.2.0.1.0 - Production on 13-JUL-2019 10:48:17
Copyright (c) 1997, 2016, Oracle. All rights reserved.
Used parameter files:
c:\app\oracle\product\12.2.0\dbhome_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = laptop)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pora12c1.dbaora.com)))
OK (0 msec)
finally connect from sqlplus
C:\Windows\System32>sqlplus /nolog
SQL*Plus: Release 12.2.0.1.0 Production on Sat Jul 13 10:46:22 2019
Copyright (c) 1982, 2016, Oracle. All rights reserved.
SQL> connect tomasz/oracle@pora12c1
Connected.
SQL> connect tomasz/oracle@bear
Connected.
SQL>
Sqldeveloper connection
I want to show two methods how to connect from sqldeveloper to your database. Both require LISTENER up and running with proper services registered.
Basic
It’s default method specify proper Username, Password,Connection Type-Basic, Hostname, Port, Service name. If you click button “Test” it will show if your settings are correct. This method doesn’t require any extra entry in tnsnames.ora.
TNS
It uses alias defined in tnsnames.ora in my case BEAR ;). Just select Connection Type: TNS and Network Alias:BEAR. If you click button “Test” it will show if your settings are correct.
Have a fun 🙂
Tomasz