How to Install Oracle Database 12.1 Standalone on CentOS 6.5 Minimal (5/5) - Postinstallation and Verification

  • by
How to Install Oracle Database 12.1 Standalone on CentOS 6.5 Minimal (4/5) - Install Oracle Database 12c Software
After installation, we need to configure the environment of oracle in order to manage the database. You need to add some environmental variables into .bash_profile.
[oracle@primary01 ~]$ vi .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1
ORACLE_UNQNAME=compdb
ORACLE_SID=primdb

PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

export PATH ORACLE_BASE ORACLE_HOME ORACLE_UNQNAME ORACLE_SID

As you can see, I set $ORACLE_HOME, $ORACLE_SID, etc after installation, not necessarily before installation.

Make the file effective right away.
[oracle@primary01 ~]$ . .bash_profile
Startup the LISTENER.
[oracle@primary01 ~]$ lsnrctl start

LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 18-JUL-2014 19:01:45

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

Starting /u01/app/oracle/product/12.1.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.1.0.1.0 - Production
System parameter file is /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/primary01/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=primary01)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date                18-JUL-2014 19:01:46
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/primary01/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=primary01)(PORT=1521)))
The listener supports no services
The command completed successfully

Connect to the server by OS authentication and startup the database, then unlock a test account hr.
[oracle@primary01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Fri Jul 18 19:01:55 2014

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

Connected to an idle instance.


SQL> startup;
ORACLE instance started.

Total System Global Area 1603411968 bytes
Fixed Size                  2288872 bytes
Variable Size            1040188184 bytes
Database Buffers          553648128 bytes
Redo Buffers                7286784 bytes
Database mounted.
Database opened.
SQL> alter user hr account unlock;

User altered.

SQL> alter user hr identified by hr;

User altered.

SQL> exit;
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

Make sure tnsnames.ora is configured correctly.
[oracle@primary01 ~]$ cat /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

COMPDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = primary01)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = compdb)
    )
  )

Try to connect the database by the test account hr.
[oracle@primary01 ~]$ sqlplus hr/hr@compdb

SQL*Plus: Release 12.1.0.1.0 Production on Fri Jul 18 19:11:31 2014

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

Last Successful login time: Fri Jul 18 2014 19:11:17 +08:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> desc employees;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 EMPLOYEE_ID                               NOT NULL NUMBER(6)
 FIRST_NAME                                         VARCHAR2(20)
 LAST_NAME                                 NOT NULL VARCHAR2(25)
 EMAIL                                     NOT NULL VARCHAR2(25)
 PHONE_NUMBER                                       VARCHAR2(20)
 HIRE_DATE                                 NOT NULL DATE
 JOB_ID                                    NOT NULL VARCHAR2(10)
 SALARY                                             NUMBER(8,2)
 COMMISSION_PCT                                     NUMBER(2,2)
 MANAGER_ID                                         NUMBER(6)
 DEPARTMENT_ID                                      NUMBER(4)

SQL>

Open Port 1521

Open port 1521 in the firewall for remote users by root.

[root@primary01 ~]# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 1521 -j ACCEPT
[root@primary01 ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
...
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:1521
...
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Don't forget to save the change.
[root@primary01 ~]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]

The postinstallation is complete.

How to Install Oracle Database 12.1 Standalone on CentOS 6.5 Minimal (0/5) - An Overview

Leave a Reply

Your email address will not be published. Required fields are marked *