Install Oracle Database 12.2 SE2 on Windows

This post shows the steps to install Oracle Database 12.2 Standard Edition 2 (SE2) on Windows Server 2008 R2.

Preparation

To be able to install Oracle 12.2 SE2 we need a Windows Server 2008 R2 Virtual Machine. The process to create this VM is described here. The Oracle Database software can be downloaded from edelivery.oracle.com. Then we need the 7 ZIP tool to unzip the software. We download the file from here.

Install Oracle 12.2 SE2 on Windows

The following commands can be pasted in a command window in the VM and the Oracle Database will be installed in silent mode.

(rem perform a silent installation of 7 ZIP
s:\7z2409-x64.exe /S
timeout /T 2 /NOBREAK
rem unpack the database software
"C:\Program Files\7-Zip\7z" x -oc:\orainst s:\oracle\db\122_SE2_win_x64\db.zip
rem create the silent installation response file
(
echo oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0
echo oracle.install.option=INSTALL_DB_AND_CONFIG
echo ORACLE_HOME=C:\app\user1\product\12.2.0\dbhome_1
echo ORACLE_BASE=C:\app\user1
echo oracle.install.db.InstallEdition=SE2
echo oracle.install.db.isRACOneInstall=false
echo oracle.install.db.rac.serverpoolCardinality=0
echo oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
echo oracle.install.db.config.starterdb.globalDBName=orcl.fritz.box
echo oracle.install.db.config.starterdb.SID=orcl
echo oracle.install.db.ConfigureAsContainerDB=false
echo oracle.install.db.config.starterdb.characterSet=AL32UTF8
echo oracle.install.db.config.starterdb.memoryOption=false
echo oracle.install.db.config.starterdb.memoryLimit=3277
echo oracle.install.db.config.starterdb.installExampleSchemas=false
echo oracle.install.db.config.starterdb.managementOption=DEFAULT
echo oracle.install.db.config.starterdb.omsPort=0
echo oracle.install.db.config.starterdb.enableRecovery=true
echo oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
echo oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=C:\app\user1\oradata
echo oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=C:\app\user1\recovery_area
echo oracle.install.db.config.asm.ASMSNMPPassword=
echo oracle.install.IsBuiltInAccount=false
echo oracle.install.IsVirtualAccount=true
echo oracle.install.OracleHomeUserName=oracle
echo SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
echo DECLINE_SECURITY_UPDATES=true
echo oracle.install.db.config.starterdb.password.ALL=changeme
)>c:\orainst\db.rsp
rem install the database software
C:\orainst\database\setup.exe -silent -responseFile c:\orainst\db.rsp)

The error:

ERROR: Cannot add user to application launch ACL.
No mapping between account names and security IDs was done.
(534)

is expected and can be ignored (s.a. Oracle Doc ID 433374.1). After the installation is finished press Enter to close the installer window. The database is now installed and can be used.

Allow incoming connections (Windows Firewall)

The next two commands allow incoming connections to the Oracle Listener (port 1521) and to the Enterprise Manager (port 5500):

netsh advfirewall firewall add rule name="Oracle TCP port 1521" dir=in action=allow protocol=TCP localport=1521
netsh advfirewall firewall add rule name="Oracle TCP port 5500" dir=in action=allow protocol=TCP localport=5500

Access Oracle Enterprise Manager Database Express 12c

To be able to access the Oracle Enterprise Manager with a URL similar to this we need a browser that supports shockwave flash content. Take a look here on how to install one.

Basic Administration Tasks

By default statistics are gathered by the ‘Automated Maintenance Tasks’ in the maintenance windows.

# confirm that statistic gathering is enabled
select client_name, status from dba_autotask_client where client_name = 'auto optimizer stats collection';
# display maintenance windows (start date and duration)
set lines 123 pages 66
col next_start_date for a45
col window_name for a25
select window_name,next_start_date,extract(hour from duration) dur_hours,active from dba_scheduler_windows where enabled='TRUE' order by next_start_date;
# display the status of past statistic collection runs
select log_date, status, run_duration, error#, additional_info, errors from dba_scheduler_job_run_details where job_name like 'ORA$AT_OS%' and log_date>sysdate-2 order by log_date desc;
Sample Output
SQL> select client_name, status from dba_autotask_client where client_name = 'auto optimizer stats collection';

CLIENT_NAME                                                      STATUS
---------------------------------------------------------------- --------
auto optimizer stats collection                                  ENABLED

SQL> select window_name,next_start_date,extract(hour from duration) dur_hours,active from dba_scheduler_windows where enabled='TRUE' order by next_start_date;

WINDOW_NAME               NEXT_START_DATE                                DUR_HOURS ACTIV
------------------------- --------------------------------------------- ---------- -----
SUNDAY_WINDOW             16-MAR-25 06.00.00.000000 AM EUROPE/BERLIN            20 TRUE
MONDAY_WINDOW             17-MAR-25 10.00.00.000000 PM EUROPE/BERLIN             4 FALSE
TUESDAY_WINDOW            18-MAR-25 10.00.00.000000 PM EUROPE/BERLIN             4 FALSE
WEDNESDAY_WINDOW          19-MAR-25 10.00.00.000000 PM EUROPE/BERLIN             4 FALSE
THURSDAY_WINDOW           20-MAR-25 10.00.00.000000 PM EUROPE/BERLIN             4 FALSE
FRIDAY_WINDOW             21-MAR-25 10.00.00.000000 PM EUROPE/BERLIN             4 FALSE
SATURDAY_WINDOW           22-MAR-25 06.00.00.000000 AM EUROPE/BERLIN            20 FALSE

SQL> select log_date, status, run_duration, error#, additional_info, errors from dba_scheduler_job_run_details where job_name like 'ORA$AT_OS%' and log_date>sys
date-2 order by log_date desc;

LOG_DATE                                                                    STATUS                      RUN_DURATION
                   ERROR#
--------------------------------------------------------------------------- ------------------------------ -----------------------------------------------------
---------------------- ----------
ADDITIONAL_INFO
----------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------
ERRORS
----------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------
31-MAR-25 11.29.29.135000 PM +02:00                                         FAILED                      +000 00:00:10
                    20001
ORA-20001: Statistics Advisor: Invalid task name for the current user
ORA-06512: at "SYS.DBMS_STATS", line 47207
ORA-06512: at "SYS.DBMS_STATS_ADVISOR", line 882
ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 20059
ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 22201
ORA-06512: at "SYS.DBMS_STATS", line 47197
ORA-20001: Statistics Advisor: Invalid task name for the current user
ORA-06512: at "SYS.DBMS_STATS", line 47207
ORA-06512: at "SYS.DBMS_STATS_ADVISOR", line 882
ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 20059
ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 22201
ORA-06512: at "SYS.DBMS_STATS", line 47197

31-MAR-25 11.19.21.181000 PM +02:00                                         FAILED                      +000 00:00:03
                    20001
ORA-20001: Statistics Advisor: Invalid task name for the current user
ORA-06512: at "SYS.DBMS_STATS", line 47207
ORA-06512: at "SYS.DBMS_STATS_ADVISOR", line 882
ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 20059
ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 22201
ORA-06512: at "SYS.DBMS_STATS", line 47197
ORA-20001: Statistics Advisor: Invalid task name for the current user
ORA-06512: at "SYS.DBMS_STATS", line 47207
ORA-06512: at "SYS.DBMS_STATS_ADVISOR", line 882
ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 20059
ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 22201
ORA-06512: at "SYS.DBMS_STATS", line 47197

ORA-20001: Statistics Advisor: Invalid task name for the current user

This error was caused by Bug 27774706. After applying the fixes (installing Oracle Patch 27774706 (+ datapatch) and running SQL statements from Oracle Doc ID 2453673.1) the automatic statistic gather job runs without errors:

Output
SQL> select log_date, status, run_duration, error#, additional_info, errors from dba_scheduler_job_run_details where job_name like 'ORA$AT_OS%' and log_date>sys
date-2 order by log_date desc;

LOG_DATE                            STATUS          RUN_DURATION        ERROR# ADDITIONAL_INFO      ERRORS
----------------------------------- --------------- --------------- ---------- -------------------- --------
16-APR-25 10.04.03.667000 PM +02:00 SUCCEEDED       +000 00:04:01            0