Vous êtes sur la page 1sur 745

Fvoidf+vo dfvdf

Vd

Fv

Dsfv

Dsfovjdafv

Adfvpásjvojadv

Pja

Spvjas´

Pjdv

Pásj v

Pásj

V´pjas

´pvj

Pjv

´pasj

V´p jas

´pvj

Ap´s
#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y
#Crear los siguientes usuarios
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY
#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip

#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora

[oracle@ora12c ~]$ echo $ORACLE_SID


cdb1

[oracle@ora12c ~]$ export ORACLE_SID=orcl


[oracle@ora12c ~]$ echo $ORACLE_SID
orcl

[oracle@ora12c ~]$ ls -latr


/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'

oracle@ora12c ~]$ vi /etc/oratab


#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator. A new line terminates


# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 662700032 bytes


Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@ora12c ~]$ lsnrctl start

#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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

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

SQL> alter user hr identified by Jspp2006 account unlock;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017

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

Enter user-name: hr
Enter password:

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

SQL> column OBJECT_NAME format a20


SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X

LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER

34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip

#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora

[oracle@ora12c ~]$ echo $ORACLE_SID


cdb1

[oracle@ora12c ~]$ export ORACLE_SID=orcl


[oracle@ora12c ~]$ echo $ORACLE_SID
orcl

[oracle@ora12c ~]$ ls -latr


/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'

oracle@ora12c ~]$ vi /etc/oratab


#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator. A new line terminates


# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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


Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 662700032 bytes


Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@ora12c ~]$ lsnrctl start

#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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

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

SQL> alter user hr identified by Jspp2006 account unlock;


User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017

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

Enter user-name: hr
Enter password:

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

SQL> column OBJECT_NAME format a20


SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X

LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER

34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe
[root@localhost ~]# cat /etc/hostname
ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip

#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora

[oracle@ora12c ~]$ echo $ORACLE_SID


cdb1

[oracle@ora12c ~]$ export ORACLE_SID=orcl


[oracle@ora12c ~]$ echo $ORACLE_SID
orcl
[oracle@ora12c ~]$ ls -latr
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'

oracle@ora12c ~]$ vi /etc/oratab


#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 662700032 bytes


Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@ora12c ~]$ lsnrctl start


#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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

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

SQL> alter user hr identified by Jspp2006 account unlock;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017

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

Enter user-name: hr
Enter password:

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

SQL> column OBJECT_NAME format a20


SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X

LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER

34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@localhost ~]# vi /etc/hosts
#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo
# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip

#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017


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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora

[oracle@ora12c ~]$ echo $ORACLE_SID


cdb1

[oracle@ora12c ~]$ export ORACLE_SID=orcl


[oracle@ora12c ~]$ echo $ORACLE_SID
orcl

[oracle@ora12c ~]$ ls -latr


/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'

oracle@ora12c ~]$ vi /etc/oratab


#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator. A new line terminates


# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 662700032 bytes


Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12


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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@ora12c ~]$ lsnrctl start

#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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

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

SQL> alter user hr identified by Jspp2006 account unlock;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017

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

Enter user-name: hr
Enter password:

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

SQL> column OBJECT_NAME format a20


SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X

LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER

34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip

#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora

[oracle@ora12c ~]$ echo $ORACLE_SID


cdb1

[oracle@ora12c ~]$ export ORACLE_SID=orcl


[oracle@ora12c ~]$ echo $ORACLE_SID
orcl

[oracle@ora12c ~]$ ls -latr


/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'

oracle@ora12c ~]$ vi /etc/oratab


#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator. A new line terminates


# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 662700032 bytes


Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@ora12c ~]$ lsnrctl start

#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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

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

SQL> alter user hr identified by Jspp2006 account unlock;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017

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

Enter user-name: hr
Enter password:

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

SQL> column OBJECT_NAME format a20


SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X

LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER

34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle


#Cambiar la contraseña del usuario oracle
[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip

#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c ~]$ echo $ORACLE_SID
cdb1

[oracle@ora12c ~]$ export ORACLE_SID=orcl


[oracle@ora12c ~]$ echo $ORACLE_SID
orcl

[oracle@ora12c ~]$ ls -latr


/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'
oracle@ora12c ~]$ vi /etc/oratab
#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator. A new line terminates


# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 662700032 bytes


Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@ora12c ~]$ lsnrctl start

#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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

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

SQL> alter user hr identified by Jspp2006 account unlock;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017

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

Enter user-name: hr
Enter password:

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

SQL> column OBJECT_NAME format a20


SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X

LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER

34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip

#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora

[oracle@ora12c ~]$ echo $ORACLE_SID


cdb1

[oracle@ora12c ~]$ export ORACLE_SID=orcl


[oracle@ora12c ~]$ echo $ORACLE_SID
orcl

[oracle@ora12c ~]$ ls -latr


/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#
# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'

oracle@ora12c ~]$ vi /etc/oratab


#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator. A new line terminates


# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 662700032 bytes


Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@ora12c ~]$ lsnrctl start

#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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

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

SQL> alter user hr identified by Jspp2006 account unlock;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017


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

Enter user-name: hr
Enter password:

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

SQL> column OBJECT_NAME format a20


SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X

LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER
34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip
#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora

[oracle@ora12c ~]$ echo $ORACLE_SID


cdb1

[oracle@ora12c ~]$ export ORACLE_SID=orcl


[oracle@ora12c ~]$ echo $ORACLE_SID
orcl

[oracle@ora12c ~]$ ls -latr


/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'

oracle@ora12c ~]$ vi /etc/oratab


#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator. A new line terminates


# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 662700032 bytes


Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@ora12c ~]$ lsnrctl start

#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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

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

SQL> alter user hr identified by Jspp2006 account unlock;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017

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

Enter user-name: hr
Enter password:

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

SQL> column OBJECT_NAME format a20


SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X

LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER

34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip

#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected
[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/
[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora

[oracle@ora12c ~]$ echo $ORACLE_SID


cdb1

[oracle@ora12c ~]$ export ORACLE_SID=orcl


[oracle@ora12c ~]$ echo $ORACLE_SID
orcl

[oracle@ora12c ~]$ ls -latr


/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'

oracle@ora12c ~]$ vi /etc/oratab


#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator. A new line terminates


# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 662700032 bytes


Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@ora12c ~]$ lsnrctl start

#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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

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

SQL> alter user hr identified by Jspp2006 account unlock;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017

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

Enter user-name: hr
Enter password:

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

SQL> column OBJECT_NAME format a20


SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X

LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER

34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip

#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora

[oracle@ora12c ~]$ echo $ORACLE_SID


cdb1

[oracle@ora12c ~]$ export ORACLE_SID=orcl


[oracle@ora12c ~]$ echo $ORACLE_SID
orcl

[oracle@ora12c ~]$ ls -latr


/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'

oracle@ora12c ~]$ vi /etc/oratab


#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator. A new line terminates


# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.
Total System Global Area 662700032 bytes
Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@ora12c ~]$ lsnrctl start

#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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

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

SQL> alter user hr identified by Jspp2006 account unlock;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017

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

Enter user-name: hr
Enter password:

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

SQL> column OBJECT_NAME format a20


SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X

LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE
OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER

34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c


[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip

#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora

[oracle@ora12c ~]$ echo $ORACLE_SID


cdb1

[oracle@ora12c ~]$ export ORACLE_SID=orcl


[oracle@ora12c ~]$ echo $ORACLE_SID
orcl

[oracle@ora12c ~]$ ls -latr


/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'

oracle@ora12c ~]$ vi /etc/oratab


#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator. A new line terminates


# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 662700032 bytes


Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@ora12c ~]$ lsnrctl start

#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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

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

SQL> alter user hr identified by Jspp2006 account unlock;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017

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

Enter user-name: hr
Enter password:

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

SQL> column OBJECT_NAME format a20


SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X

LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER

34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip

#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.


SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora

[oracle@ora12c ~]$ echo $ORACLE_SID


cdb1

[oracle@ora12c ~]$ export ORACLE_SID=orcl


[oracle@ora12c ~]$ echo $ORACLE_SID
orcl

[oracle@ora12c ~]$ ls -latr


/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'

oracle@ora12c ~]$ vi /etc/oratab


#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator. A new line terminates


# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 662700032 bytes


Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@ora12c ~]$ lsnrctl start

#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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

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

SQL> alter user hr identified by Jspp2006 account unlock;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017

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

Enter user-name: hr
Enter password:

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
SQL> column OBJECT_NAME format a20
SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X

LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER

34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico


Server with GUI
• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip

#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora

[oracle@ora12c ~]$ echo $ORACLE_SID


cdb1

[oracle@ora12c ~]$ export ORACLE_SID=orcl


[oracle@ora12c ~]$ echo $ORACLE_SID
orcl

[oracle@ora12c ~]$ ls -latr


/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'

oracle@ora12c ~]$ vi /etc/oratab


#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator. A new line terminates


# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N

[oracle@ora12c ~]$ sqlplus / as sysdba


SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 662700032 bytes


Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@ora12c ~]$ lsnrctl start

#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
SQL> alter user hr identified by Jspp2006 account unlock;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017

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

Enter user-name: hr
Enter password:

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

SQL> column OBJECT_NAME format a20


SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X
LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER

34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle
#Cambiar por este valor
[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost ~]$ pwd
/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip

#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora

[oracle@ora12c ~]$ echo $ORACLE_SID


cdb1
[oracle@ora12c ~]$ export ORACLE_SID=orcl
[oracle@ora12c ~]$ echo $ORACLE_SID
orcl

[oracle@ora12c ~]$ ls -latr


/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'

oracle@ora12c ~]$ vi /etc/oratab


#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator. A new line terminates


# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 662700032 bytes


Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@ora12c ~]$ lsnrctl start

#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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

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

SQL> alter user hr identified by Jspp2006 account unlock;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017

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

Enter user-name: hr
Enter password:

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

SQL> column OBJECT_NAME format a20


SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X

LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER

34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre
[root@localhost ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022
envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip

#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba


SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora

[oracle@ora12c ~]$ echo $ORACLE_SID


cdb1

[oracle@ora12c ~]$ export ORACLE_SID=orcl


[oracle@ora12c ~]$ echo $ORACLE_SID
orcl

[oracle@ora12c ~]$ ls -latr


/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'

oracle@ora12c ~]$ vi /etc/oratab


#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator. A new line terminates


# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 662700032 bytes


Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status


LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@ora12c ~]$ lsnrctl start

#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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

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

SQL> alter user hr identified by Jspp2006 account unlock;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017

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

Enter user-name: hr
Enter password:
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options

SQL> column OBJECT_NAME format a20


SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X

LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER

34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip
#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora

[oracle@ora12c ~]$ echo $ORACLE_SID


cdb1

[oracle@ora12c ~]$ export ORACLE_SID=orcl


[oracle@ora12c ~]$ echo $ORACLE_SID
orcl

[oracle@ora12c ~]$ ls -latr


/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'

oracle@ora12c ~]$ vi /etc/oratab


#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator. A new line terminates


# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 662700032 bytes


Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@ora12c ~]$ lsnrctl start

#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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


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

SQL> alter user hr identified by Jspp2006 account unlock;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017

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

Enter user-name: hr
Enter password:

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

SQL> column OBJECT_NAME format a20


SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X

LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER

34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd
[root@localhost ~]# cat /etc/hostname
localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin
useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd
#Entrar al directorio Setup donde están los intaladores
[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip

#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora

[oracle@ora12c ~]$ echo $ORACLE_SID


cdb1

[oracle@ora12c ~]$ export ORACLE_SID=orcl


[oracle@ora12c ~]$ echo $ORACLE_SID
orcl

[oracle@ora12c ~]$ ls -latr


/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'
oracle@ora12c ~]$ vi /etc/oratab
#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator. A new line terminates


# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 662700032 bytes


Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@ora12c ~]$ lsnrctl start

#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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

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

SQL> alter user hr identified by Jspp2006 account unlock;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017

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

Enter user-name: hr
Enter password:

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

SQL> column OBJECT_NAME format a20


SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X

LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER

34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y

#Actualizar e ingresar los siguientes paquetes


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip

#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs]$ cp init.ora ./initcdb1.ora
[oracle@ora12c dbs]$ ls
hc_orcl.dat initcdb1.ora init.ora lkORCL orapworcl spfileorcl.ora

[oracle@ora12c ~]$ echo $ORACLE_SID


cdb1

[oracle@ora12c ~]$ export ORACLE_SID=orcl


[oracle@ora12c ~]$ echo $ORACLE_SID
orcl

[oracle@ora12c ~]$ ls -latr


/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora
-rw-r--r--. 1 oracle oinstall 2998 Dec 27 21:01
/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora

[oracle@ora12c dbs]$ vi initcdb1.ora


# danderso 02/26/92 - change db_block_cache_protect to
_db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
# You might also consider using the Database Configuration Assistant
# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
##############################################################################
#

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='12.1.0'

oracle@ora12c ~]$ vi /etc/oratab


#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator. A new line terminates


# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/12.1.0.2/db_1:N

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 21:17:07 2017

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 662700032 bytes


Fixed Size 2927912 bytes
Variable Size 285213400 bytes
Database Buffers 369098752 bytes
Redo Buffers 5459968 bytes
Database mounted.
Database opened.
SQL> exit

[oracle@ora12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 21:19:12

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 27-DEC-2017 21:19:08
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.unitsystem.pe)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@ora12c ~]$ lsnrctl start

#Habilitar el usuario HR
Last login: Wed Dec 27 22:34:35 2017
ORACLE_UNQNAME=cdb1
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:48:28 2017

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

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

SQL> alter user hr identified by Jspp2006 account unlock;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[oracle@ora12c ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 22:49:11 2017


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

Enter user-name: hr
Enter password:

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

SQL> column OBJECT_NAME format a20


SQL> column OBJECT_TYPE format a20
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
COUNTRIES TABLE
COUNTRY_C_ID_PK INDEX
JOB_HISTORY TABLE
EMPLOYEES TABLE
JOBS TABLE
DEPARTMENTS TABLE
LOCATIONS TABLE
REGIONS TABLE
REG_ID_PK INDEX
LOC_ID_PK INDEX
DEPT_ID_PK INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JOB_ID_PK INDEX
EMP_EMP_ID_PK INDEX
JHIST_EMP_ID_ST_DATE INDEX
_PK

EMP_DEPARTMENT_IX INDEX
EMP_JOB_IX INDEX
EMP_MANAGER_IX INDEX
EMP_NAME_IX INDEX
DEPT_LOCATION_IX INDEX
JHIST_JOB_IX INDEX

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
JHIST_EMPLOYEE_IX INDEX
JHIST_DEPARTMENT_IX INDEX
LOC_CITY_IX INDEX
LOC_STATE_PROVINCE_I INDEX
X

LOC_COUNTRY_IX INDEX
EMP_EMAIL_UK INDEX
LOCATIONS_SEQ SEQUENCE
DEPARTMENTS_SEQ SEQUENCE
EMPLOYEES_SEQ SEQUENCE

OBJECT_NAME OBJECT_TYPE
-------------------- --------------------
EMP_DETAILS_VIEW VIEW
SECURE_DML PROCEDURE
SECURE_EMPLOYEES TRIGGER
ADD_JOB_HISTORY PROCEDURE
UPDATE_JOB_HISTORY TRIGGER

34 rows selected.

#Copiar una consulta a un archivo txt


SQL> spool /u01/setup/hr.txt
SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS;
SQL> spool off;

#Consideraciones para el entorno grafico

Server with GUI


• File and Storage Server
• Java Plataform
• Network Fiel System Client
• Perfomance Tools
• Compatibility Libraries
• Development Tools

#Consideraciones para el entorno consola


To install Java SE 7
• yum install yum-plugin-ulninfo
• yum repolist
• sudo yum install jre
• sudo yum update jre

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@localhost ~]# vi /etc/hosts


#agregar
192.168.1.151 ora12c.unitsystem.pe ora12c

[root@localhost ~]# cat /etc/hosts


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.151 ora12c.unitsystem.pe ora12c

#Visualiza grupos
[root@localhost ~]# cat /etc/Group

#Visualiza usuarios
[root@localhost ~]# cat /etc/passwd

[root@localhost ~]# cat /etc/hostname


localhost.localdomain

[root@localhost ~]# vi /etc/hostname


#cambiar
ora12c.unitsystem.pe

[root@localhost ~]# cat /etc/hostname


ora12c.unitsystem.pe

[root@localhost ~]# ping ora12c

[root@localhost ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

#Actualizar
[root@localhost ~]# yum update -y
#Actualizar e ingresar los siguientes paquetes
yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

#Crear los siguientes usuarios


groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper oracle

#Cambiar la contraseña del usuario oracle


[root@localhost ~]# passwd oracle

#Cambiar por este valor


[root@localhost ~]# vi /etc/selinux/config
SELINUX=permissive

#Reinicio del servidor


[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

#Crear los siguientes directorios


[root@localhost ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1
[root@localhost ~]# mkdir -p /u01/setup
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# yum install xhost -y

[root@localhost ~]# su – oracle

#Agregar valores
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ora12c.unitsystem.pe
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'


alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo

# Oracle Settings
DISPLAY=<machine-name>:0.0;
export DISPLAY

#Ejecutar
[oracle@localhost ~]$ . .bash_profile

#Visualizar valores
[oracle@localhost ~]$ env

#Entrar a la raiz
[oracle@localhost ~]$ pwd

#Entrar al directorio Setup donde están los intaladores


[oracle@localhost ~]$ cd /u01/setup

[oracle@localhost ~]$ pwd


/home/oracle
[oracle@localhost ~]$ cd /u01/setup
[oracle@localhost setup]$ ll
total 2625080
-rw-r--r--. 1 oracle oinstall 1673544724 Dec 26 13:46
linuxamd64_12102_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1014530602 Dec 26 13:47
linuxamd64_12102_database_2of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@localhost setup]$ unzip linuxamd64_12102_database_2of2.zip
#Configuración de listener
Netca

#Crear una base de datos


Dbca

#Error SWAP
swapon
dd if=/dev/zero of=/home/swapfile bs=6048 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
vi /etc/fstab

#Solucion post-instalacion
ORACLE_UNQNAME=cdb1
ORACLE_SID=cdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ora12c.unitsystem.pe
ORACLE_HOME=/u01/app/oracle/product/12.1/db_1

[oracle@ora12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 20:42:07 2017

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb1.ora'
SQL> exit
Disconnected

[oracle@ora12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs/


[oracle@ora12c dbs]$ ls
hc_orcl.dat init.ora lkORCL orapworcl spfileorcl.ora
[oracle@ora12c dbs