#Dica - Removendo um database via linha de comando

A pedido de um leitor, estarei criando este breve artigo com o processo de remoção de um database via linha de comando.
O processo é bastante simples porém como todo processo é preciso muita cautela.

O primeiro passa é "setar" o ORACLE_SID da instância que vamos realizar a atividade
[oracle@lamimtst files]$ export ORACLE_SID=lamimtst
Após definir o SID, vamos conectar na mesma e inicia-la em modo exclusive restrict.
[oracle@lamimtst files]$  sqlplus

SQL*Plus: Release 12.2.0.1.0 Production on Mon Oct 29 15:30:52 2018

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

Enter user-name: / as sysdba
Connected to an idle instance.

SQL> startup mount exclusive restrict;
ORACLE instance started.

Total System Global Area 1.4764E+10 bytes
Fixed Size                 15809624 bytes
Variable Size            6979322792 bytes
Database Buffers         7751073792 bytes
Redo Buffers               17743872 bytes
Database mounted.
SQL>
SQL> show parameter db_name;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      lamimtst


SQL>
SQL> drop database;

Database dropped.

Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL>
Simples, rápido, prático. Sempre é recomendada uma validação antes da execução de qualquer atividade. Principalmente em ambientes produtivos.


#Dica- Erros ORA-31693, ORA-02354, ORA-39776, ORA-00600 durante import de tabela com campo long no Oracle 12.1

Durante um processo de import de um owner via datapump, tive a ocorrência de vários erros em tabelas que continham campo do tipo long.

Abaixo apresento o cenário do processo:

  • Export owner via datapump na versão Oracle 12.2;
  • Import owner via datapump na versão Oracle 12.1;
O export era gerado com sucesso e os erros ocorriam apenas no import.

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
ORA-31693: Table data object "LAMIM"."LONGRAWTABLE" failed to load/unload and is being skipped due to error:
ORA-02354: error in exporting/importing data
ORA-39776: fatal Direct Path API error loading table "LAMIM"."LONGRAWTABLE"
ORA-00600: internal error code, arguments: [6965], [10], [21], [], [], [], [], [], [], [], [], []
Para contornar este erro o workaraound recomendado pela Oracle via chamado é adicionar a condição ACCESS_METHOD=CONVENTIONAL  no processo de import.
Após adicionar a condição recomendada pela Oracle o processo seguiu sem erro. Porém vale destacar que de forma mais lenta.

#Dica - Alterando o gateway default no Oracle Linux


Para realizarmos a alteração do gateway default em um ambiente Oracle Linux devemos alterar o arquivo de configuração da interface de rede.

É possível consultar o gateway default em uso através do comando route.

[root@lamimtst files]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         172.22.0.3      0.0.0.0         UG    0      0        0 em1
172.22.0.0      *               255.255.254.0   U     0      0        0 em1
No exemplo abaixo, estaremos alterado o default gateway de 172.22.0.3 para 172.22.0.2 da interface de rede em1.
[root@lamimtst files]# ifconfig
em1       Link encap:Ethernet  HWaddr 18:66:DA:99:2C:42
          inet addr:172.22.0.20  Bcast:172.22.1.255  Mask:255.255.254.0
          inet6 addr: fe80::1a66:daff:fe99:2c42/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:20138355375 errors:0 dropped:2593782 overruns:27391 frame:0
          TX packets:20880226435 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3410493372618 (3.1 TiB)  TX bytes:6995001982923 (6.3 TiB)
          Memory:91c00000-91cfffff

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:41663998 errors:0 dropped:0 overruns:0 frame:0
          TX packets:41663998 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:10264674852 (9.5 GiB)  TX bytes:10264674852 (9.5 GiB)

[root@lamimtst files]# cat /etc/sysconfig/network-scripts/ifcfg-em1
DEVICE=em1
TYPE=Ethernet
UUID=6ee8aafe-4256-4179-b8bb-80f0415bcad6
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
HWADDR=18:66:DA:99:2C:42
IPADDR=172.22.0.20
PREFIX=23
GATEWAY=172.22.0.3
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System em1"
DNS1=172.22.0.3
Para isso basta alterar o GATEWAY de 172.22.0.3 para 172.22.0.2 e realizar um restart da interface de rede para que a alteração seja aplicada.
[root@lamimtst files]# service network restart
Shutting down interface em1:                               [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface em1:  Determining if ip address 172.22.0.20 is already in use for device em1...
                                                           [  OK  ]
[root@lamimtst files]#
[root@lamimtst files]#
[root@lamimtst files]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         172.22.0.2      0.0.0.0         UG    0      0        0 em1
172.22.0.0      *               255.255.254.0   U     0      0        0 em1
Caso não exista um GATEWAY definido para a interface de rede específica, o ambiente pode estar utilizando um gateway "global" que é configurado em /etc/sysconfig/network.

Exímio Soluções em TI

A Exímio Soluções em TI é uma empresa de Brusque - SC, especializada em entregar projetos de TI e Sustentação de ambientes de Banco de Dados e Middleware.

Surgiu com o propósito de prestar serviços de alta qualidade com profissionais especializados, comprometidos e inovadores que proporcionem satisfação e qualidade em seus entregáveis.

Apostamos na certificação e capacitação de nossos profissionais para nos destacarmos no mercado e prestar serviços que superem as expectativas de nossos clientes.

Atualmente contamos com mais de 10 anos de experiência e mais de 20 certificações que comprovam nossas competências técnicas

Exímio:

"Que revela perfeição em tudo o que faz; excelente.
 Que ultrapassa os demais em qualidade, mérito, capacidade; superior."


www.eximioti.com.br

Oracle 18.3 Standalone on premise part 3 - Instalando o Oracle Database 18.3

No terceiro e último artigo, vamos realizar a instalação do Oracle Database 18.3 no ambiente que criamos anteriormente e instalamos o Grid Infrastructure 18.3.
  1.  Oracle 13.3 Standalone on premise part1 - Instalando o Oracle Linux 7.5 no Oracle Virtual Box.
  2. Oracle 13.3 Standalone on premise part 2 - Instalando o Grid Infrastructure 18.3
  3. Oracle 13.3 Standalone on premise part 3 - Instalando o Oracle Database 18.3
Primeiramente, vamos transferir o arquivo de instalação do Oracle Database 18.3 para o ORACLE_HOME, depois descompacta-lo e remover o arquivo .zip.


[oracle@tst-oracle183c ~]$ . /etc/ambiente_db.sh
[oracle@tst-oracle183c:cdbprd1 ~]$ cd $ORACLE_HOME
[oracle@tst-oracle183c:cdbprd1 dbhome_1]$ pwd
/orabin01/app/oracle/product/18.3/dbhome_1
[oracle@tst-oracle183c:cdbprd1 dbhome_1]$ ls
[oracle@tst-oracle183c:cdbprd1 dbhome_1]$ ls
LINUX.X64_180000_db_home.zip
[oracle@tst-oracle183c:cdbprd1 dbhome_1]$
[oracle@tst-oracle183c:cdbprd1 dbhome_1]$ unzip LINUX.X64_180000_db_home.zip
...
[oracle@tst-oracle183c:cdbprd1 dbhome_1]$
[oracle@tst-oracle183c:cdbprd1 dbhome_1]$ rm LINUX.X64_180000_db_home.zip
[oracle@tst-oracle183c:cdbprd1 dbhome_1]$

Após a descompactação, vamos exportar as variáveis de ambiente do database e executar o runInstaller.
[oracle@oracle18c ~]$ . /etc/ambiente_db.sh
[oracle@oracle18c:cdbprd1 ~]$
[oracle@oracle18c:cdbprd1 ~]$ cd $ORACLE_HOME/
[oracle@oracle18c:cdbprd1 dbhome_1]$ ls
addnode      clone  data       diagnostics  has            javavm  lib      nls     oracore  oui      QOpatch   root.sh        sdk           sqlplus   utl
apex         crs    dbjava     dmu          hs             jdbc    log      odbc    ord      owm      R         root.sh.old    slax          srvm      wwg
assistants   css    dbs        drdaas       install        jdk     md       olap    ordim    perl     racg      root.sh.old.1  sqldeveloper  suptools  xdk
bin          ctx    deinstall  dv           instantclient  jlib    mgw      OPatch  ords     plsql    rdbms     runInstaller   sqlj          ucp
cfgtoollogs  cv     demo       env.ora      inventory      ldap    network  opmn    oss      precomp  relnotes  schagent.conf  sqlpatch      usm
[oracle@oracle18c:cdbprd1 dbhome_1]$
[oracle@oracle18c:cdbprd1 dbhome_1]$ ./runInstaller
Launching Oracle Database Setup Wizard...

The response file for this session can be found at:
 /orabin01/app/oracle/product/18.3/dbhome_1/install/response/db_2018-09-30_11-31-31AM.rsp

You can find the log of this install session at:
 /orabin01/app/oraInventory/logs/InstallActions2018-09-30_11-31-31AM/installActions2018-09-30_11-31-31AM.log

Na primeira tela, selecionaremos a opção Set Up Software Only.


Na segunda tela, será utilizada a opção Songle instance database installation.


Na terceira tela, será escolhida a opção standard edition 2.


Na quarta tela, tendo em vista que exportamos as variáveis de ambiente, não será necessário alterar o diretório.


Na quinta tela, não serão alterados os grupos definidos.


Na quinta tela, vamos ignorar a advertencia relacionada a memória pois nossa maquina tem apenas 3GB e o requisito mínimo é de 8 GB.


Por ultimo, antes da instalação temos o sumário.



Durante a instalação será solicitada a execução do script root.sh.



[root@tst-oracle183c ~]# [root@tst-oracle183c ~]# sh /orabin01/app/oracle/product/18.3/dbhome_1/root.sh Performing root user operation. The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /orabin01/app/oracle/product/18.3/dbhome_1 Enter the full pathname of the local bin directory: [/usr/local/bin]: The contents of "dbhome" have not changed. No need to overwrite. The contents of "oraenv" have not changed. No need to overwrite. The contents of "coraenv" have not changed. No need to overwrite. Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed. Do you want to setup Oracle Trace File Analyzer (TFA) now ? yes|[no] : no Oracle Trace File Analyzer (TFA - Non Daemon Mode) is available at : /orabin01/app/oracle/product/18.3/dbhome_1/suptools/tfa/release/tfa_home/bin/tfactl Note : 1. tfactl will use TFA Daemon Mode if TFA already running in Daemon Mode and user has access to TFA 2. tfactl will configure TFA Non Daemon Mode only if user has no access to TFA Daemon mode or TFA Daemon mode is not installed OR Oracle Trace File Analyzer (TFA - Daemon Mode) can be installed by running this script : /orabin01/app/oracle/product/18.3/dbhome_1/suptools/tfa/release/tfa_home/install/roottfa.sh [root@tst-oracle183c ~]# 
Apos a execução do script root.sh e clicando em ok o processo de instalação finalizará.


Concluída instalação do produto. Podemos executar o dbca para a criação do database.
[oracle@tst-oracle183c:cdbprd1 dbhome_1]$
[oracle@tst-oracle183c:cdbprd1 dbhome_1]$ dbca
Na primeira tela, iremos selecionar a opção create a database.


Na segunda tela, vamos selecionar a opção advanced configuration.


Na terceira tela, vamos selecionar opção Oracle Single Instance database, e cusom database.


Na quarta tela, vamos definir o nome da instancia e do pdb que serão criados.


Na quinta tela, vamos selecionar a opção use following for the database storage attributes e vamos desmarcar a opção use Oracle-Managed Files OMF.



Na sexta tela, não será marcada nenhuma das opções. Posteriormente de acordo com a utilização do ambiente, o mesmo deve ser configurado de acordo com as melhores práticas de mercado.


Na sétima tela - não serão realizadas alterações também. Vamos utilizar o listener padrão criado no momento da configuração do grid.


Na oitava tela, na aba de memória, estaremos selecionando a opção Use Manual Memory Management e definindo 700MB de Shared Pool size, 400MB de Buffer Cache size, 128MB de Java pool size, e 200MB de PGA.


Na nona tela, desmarcaremos a opção Configure Enterprise Manager (EM) database express.


Na décima tela, vamos selecionar a opção Use the same administrative password for all accounts. Desta forma definiremos a mesma senha para as contas de sys. system e pdbadmin.


Na décima primeira tela, não faremos alterações.


Na décima segunda tela, temos o sumário da instalação.


Ao clicar em Finish o processo de criação do database é iniciado.


Gostaria de destacar que esta série de artigos possuem propósito educativo, podendo apresentar divergências nas configurações para um ambiente produtivo.

Oracle 18.3 Standalone on premise part 2 - Instalando o Grid Infrastructure 18.3

Dando continuidade em nosso artigo, após a criação da maquina virtual e instalação do Oracle Linux 7.5 no artigo anterior - Oracle 13.3 Standalone on premise part1 - Instalando o Oracle Linux 7.5 no Oracle Virtual Box. Vamos realizar a preparação e configuração do SO e posteriormente realizaremos a instalação do Grid Infrastructure 18.3.
  1.  Oracle 13.3 Standalone on premise part1 - Instalando o Oracle Linux 7.5 no Oracle Virtual Box.
  2. Oracle 13.3 Standalone on premise part 2 - Instalando o Grid Infrastructure 18.3
  3. Oracle 13.3 Standalone on premise part 3 - Instalando o Oracle Database 18.3
Primeiramente, estaremos executando o oracle-database-preinstall-18c que irá instalar os pacotes necessários, criar o usuário oracle, grupos e ajustar os parametros de kernel default.
[root@tst-oracle183c ~]#
[root@tst-oracle183c ~]# yum install -y oracle-database-preinstall-18c
Loaded plugins: langpacks, ulninfo
ol7_UEKR4                                                                                                                                        | 1.2 kB  00:00:00
ol7_latest                                                                                                                                       | 1.4 kB  00:00:00
(1/5): ol7_UEKR4/x86_64/updateinfo                                                                                                               |  79 kB  00:00:00
(2/5): ol7_latest/x86_64/updateinfo                                                                                                              | 563 kB  00:00:00
(3/5): ol7_latest/x86_64/group                                                                                                                   | 659 kB  00:00:00
(4/5): ol7_UEKR4/x86_64/primary                                                                                                                  | 2.0 MB  00:00:01
(5/5): ol7_latest/x86_64/primary                                                                                                                 | 7.7 MB  00:00:00
ol7_UEKR4                                                                                                                                                       103/103
ol7_latest                                                                                                                                                    8680/8680
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-preinstall-18c.x86_64 0:1.0-1.el7 will be installed
--> Processing Dependency: ksh for package: oracle-database-preinstall-18c-1.0-1.el7.x86_64
--> Processing Dependency: libaio-devel for package: oracle-database-preinstall-18c-1.0-1.el7.x86_64
--> Running transaction check
---> Package ksh.x86_64 0:20120801-137.0.1.el7 will be installed
---> Package libaio-devel.x86_64 0:0.3.109-13.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
 Package                                              Arch                         Version                                       Repository                        Size
========================================================================================================================================================================
Installing:
 oracle-database-preinstall-18c                       x86_64                       1.0-1.el7                                     ol7_latest                        18 k
Installing for dependencies:
 ksh                                                  x86_64                       20120801-137.0.1.el7                          ol7_latest                       881 k
 libaio-devel                                         x86_64                       0.3.109-13.el7                                ol7_latest                        12 k

Transaction Summary
========================================================================================================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 911 k
Installed size: 3.2 M
Downloading packages:
warning: /var/cache/yum/x86_64/7Server/ol7_latest/packages/libaio-devel-0.3.109-13.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY  --:--:-- ETA
Public key for libaio-devel-0.3.109-13.el7.x86_64.rpm is not installed
(1/3): libaio-devel-0.3.109-13.el7.x86_64.rpm                                                                                                    |  12 kB  00:00:00
(2/3): ksh-20120801-137.0.1.el7.x86_64.rpm                                                                                                       | 881 kB  00:00:00
(3/3): oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm                                                                                       |  18 kB  00:00:04
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                   197 kB/s | 911 kB  00:00:04
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Importing GPG key 0xEC551F03:
 Userid     : "Oracle OSS group (Open Source Software group) <build@oss.oracle.com>"
 Fingerprint: 4214 4123 fecf c55b 9086 313d 72f9 7b74 ec55 1f03
 Package    : 7:oraclelinux-release-7.5-1.0.3.el7.x86_64 (@anaconda/7.5)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : ksh-20120801-137.0.1.el7.x86_64                                                                                                                      1/3
  Installing : libaio-devel-0.3.109-13.el7.x86_64                                                                                                                   2/3
  Installing : oracle-database-preinstall-18c-1.0-1.el7.x86_64                                                                                                      3/3
  Verifying  : oracle-database-preinstall-18c-1.0-1.el7.x86_64                                                                                                      1/3
  Verifying  : libaio-devel-0.3.109-13.el7.x86_64                                                                                                                   2/3
  Verifying  : ksh-20120801-137.0.1.el7.x86_64                                                                                                                      3/3

Installed:
  oracle-database-preinstall-18c.x86_64 0:1.0-1.el7

Dependency Installed:
  ksh.x86_64 0:20120801-137.0.1.el7                                                 libaio-devel.x86_64 0:0.3.109-13.el7

Complete!
[root@tst-oracle183c ~]#
Estaremos ajustando o SELINUX para permissive e desativando o firewall.
[root@tst-oracle183c ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=enforcing # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted [root@tst-oracle183c ~]# vi /etc/selinux/config [root@tst-oracle183c ~]# [root@tst-oracle183c ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=permissive # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted [root@tst-oracle183c ~]# systemctl stop firewalld [root@tst-oracle183c ~]# systemctl disable firewalld Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. [root@tst-oracle183c ~]# [root@tst-oracle183c ~]# 
Estaremos realizando a criação dos diretórios, ajustando a permissão e criando as variáveis de ambiente para o grid e database.
[root@tst-oracle183c ~]#
[root@tst-oracle183c ~]# mkdir -p /orabin01/app/grid
[root@tst-oracle183c ~]# mkdir -p /orabin01/app/18.3/grid
[root@tst-oracle183c ~]# mkdir -p /orabin01/app/oracle
[root@tst-oracle183c ~]# mkdir -p /orabin01/app/oracle/product/18.3/dbhome_1
[root@tst-oracle183c ~]# chown oracle:oinstall /orabin01/ -R
[root@tst-oracle183c ~]# chmod 775 /orabin01/ -R
[root@tst-oracle183c ~]#
[root@tst-oracle183c ~]# vi /etc/ambiente_grid.sh
[root@tst-oracle183c ~]# cat /etc/ambiente_grid.sh
# Oracle Settings
export ORACLE_BASE=/orabin01/app/grid
export ORACLE_HOME=/orabin01/app/18.3/grid
export ORACLE_SID=+ASM1
export ORACLE_TERM=xterm
export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252
export PS1="[\u@\h:$ORACLE_SID \W]$ "
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
[root@tst-oracle183c ~]#
[root@tst-oracle183c ~]# vi /etc/ambiente_db.sh
[root@tst-oracle183c ~]#
[root@tst-oracle183c ~]# ^C
[root@tst-oracle183c ~]# cat /etc/ambiente_db.sh
# Oracle Settings
export ORACLE_BASE=/orabin01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/18.3/dbhome_1
export ORACLE_SID=cdbprd1
export ORACLE_TERM=xterm
export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252
export PS1="[\u@\h:$ORACLE_SID \W]$ "
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
[root@tst-oracle183c ~]# chown oracle:oinstall /etc/ambiente_grid.sh
[root@tst-oracle183c ~]# chown oracle:oinstall /etc/ambiente_db.sh
[root@tst-oracle183c ~]#
Agora vamos criar as partições dos discos /orabackup, DGRECO e DGDATA.
[root@tst-oracle183c ~]# fdisk -l

Disk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000c281b

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   104857599    51379200   8e  Linux LVM

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdd: 5368 MB, 5368709120 bytes, 10485760 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdc: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/ol_tst--oracle183c-root: 49.5 GB, 49517953024 bytes, 96714752 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/ol_tst--oracle183c-swap: 3087 MB, 3087007744 bytes, 6029312 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@tst-oracle183c ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x12e385f0.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-20971519, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519):
Using default value 20971519
Partition 1 of type Linux and of size 10 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@tst-oracle183c ~]#
[root@tst-oracle183c ~]# fdisk /dev/sdd
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x1db84b69.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-10485759, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-10485759, default 10485759):
Using default value 10485759
Partition 1 of type Linux and of size 5 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@tst-oracle183c ~]#
[root@tst-oracle183c ~]# fdisk /dev/sdc
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xf0842d45.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-20971519, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519):
Using default value 20971519
Partition 1 of type Linux and of size 10 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@tst-oracle183c ~]#
[root@tst-oracle183c ~]# fdisk -l

Disk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000c281b

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   104857599    51379200   8e  Linux LVM

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x12e385f0

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    20971519    10484736   83  Linux

Disk /dev/sdd: 5368 MB, 5368709120 bytes, 10485760 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x1db84b69

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1            2048    10485759     5241856   83  Linux

Disk /dev/sdc: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xf0842d45

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048    20971519    10484736   83  Linux

Disk /dev/mapper/ol_tst--oracle183c-root: 49.5 GB, 49517953024 bytes, 96714752 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/ol_tst--oracle183c-swap: 3087 MB, 3087007744 bytes, 6029312 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@tst-oracle183c ~]#
Apos criar as partições, será necessário formata-las.
[root@tst-oracle183c ~]#
[root@tst-oracle183c ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2621184 blocks
131059 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2151677952
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

[root@tst-oracle183c ~]#  mkfs.ext4 /dev/sdd1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
327680 inodes, 1310464 blocks
65523 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

[root@tst-oracle183c ~]# mkfs.ext4 /dev/sdc1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2621184 blocks
131059 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2151677952
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

[root@tst-oracle183c ~]#
Apos a formatação das partições, vamos pegar a partição /dev/sdb1 que tem 10GB e monta-la como /orabackup. Posteriormente adicionaremos a entrada no arquivo fstab para que seja montada automaticamente.
[root@tst-oracle183c ~]#
[root@tst-oracle183c ~]# mkdir /orabackup
[root@tst-oracle183c ~]# chown oracle:oinstall /orabackup
[root@tst-oracle183c ~]# mount /dev/sdb1 /orabackup
[root@tst-oracle183c ~]# df -h
Filesystem                           Size  Used Avail Use% Mounted on
devtmpfs                             1.3G     0  1.3G   0% /dev
tmpfs                                1.4G     0  1.4G   0% /dev/shm
tmpfs                                1.4G  9.5M  1.3G   1% /run
tmpfs                                1.4G     0  1.4G   0% /sys/fs/cgroup
/dev/mapper/ol_tst--oracle183c-root   47G  4.1G   43G   9% /
/dev/sda1                           1014M  216M  799M  22% /boot
tmpfs                                268M   32K  268M   1% /run/user/1000
tmpfs                                268M     0  268M   0% /run/user/0
/dev/sdb1                            9.8G   37M  9.2G   1% /orabackup
[root@tst-oracle183c ~]# vi /etc/fstab
[root@tst-oracle183c ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Sun Sep 30 23:30:47 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/ol_tst--oracle183c-root /                       xfs     defaults        0 0
UUID=81aa0983-a0f4-46a5-bae1-b9e53b34c592 /boot                   xfs     defaults        0 0
/dev/mapper/ol_tst--oracle183c-swap swap                    swap    defaults        0 0
/dev/sdb1       /orabackup      defaults         0 0
[root@tst-oracle183c ~]#
Agora vamos realizar a instalação do oracleasm lib.
[root@tst-oracle183c ~]#
[root@tst-oracle183c ~]# yum install oracleasm-support.x86_64
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package oracleasm-support.x86_64 0:2.1.11-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
 Package                                       Arch                               Version                                  Repository                              Size
========================================================================================================================================================================
Installing:
 oracleasm-support                             x86_64                             2.1.11-2.el7                             ol7_latest                              85 k

Transaction Summary
========================================================================================================================================================================
Install  1 Package

Total download size: 85 k
Installed size: 266 k
Is this ok [y/d/N]: y
Downloading packages:
oracleasm-support-2.1.11-2.el7.x86_64.rpm                                                                                                        |  85 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : oracleasm-support-2.1.11-2.el7.x86_64                                                                                                                1/1
Note: Forwarding request to 'systemctl enable oracleasm.service'.
Created symlink from /etc/systemd/system/multi-user.target.wants/oracleasm.service to /usr/lib/systemd/system/oracleasm.service.
  Verifying  : oracleasm-support-2.1.11-2.el7.x86_64                                                                                                                1/1

Installed:
  oracleasm-support.x86_64 0:2.1.11-2.el7

Complete!
[root@tst-oracle183c ~]#
Feita a instalação, iremos configurar e iniciar o oracleasm.
[root@tst-oracle183c ~]#
[root@tst-oracle183c ~]# oracleasm configure -i
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting <ENTER> without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface []: oracle
Default group to own the driver interface []: oinstall
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
[root@tst-oracle183c ~]#
[root@tst-oracle183c ~]# oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Configuring "oracleasm" to use device physical block size
Mounting ASMlib driver filesystem: /dev/oracleasm
[root@tst-oracle183c ~]#
[root@tst-oracle183c ~]# oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes
[root@tst-oracle183c ~]#
A proxima etapa é a criação dos discos DGDATA e DGRECO com o oracleasm.
[root@tst-oracle183c ~]#
[root@tst-oracle183c ~]# oracleasm createdisk ASMDISK001 /dev/sdd1
Writing disk header: done
Instantiating disk: done
[root@tst-oracle183c ~]# oracleasm createdisk ASMDISK002 /dev/sdc1
Writing disk header: done
Instantiating disk: done
[root@tst-oracle183c ~]# 
[root@tst-oracle183c ~]# oracleasm listdisks
ASMDISK001
ASMDISK002
[root@tst-oracle183c ~]#
Apos as configurações acima, podemos transferir o arquivo de instalação do grid 18.3 para /orabin01/app/18.3/grid (ORACLE_HOME do GRID) e descompacta-lo.
[oracle@tst-oracle183c ~]$ . /etc/ambiente_grid.sh
[oracle@tst-oracle183c:+ASM1 ~]$
[oracle@tst-oracle183c:+ASM1 ~]$ cd /orabin01/app/18.3/grid
[oracle@tst-oracle183c:+ASM1 grid]$
[oracle@tst-oracle183c:+ASM1 grid]$ pwd
/orabin01/app/18.3/grid
[oracle@tst-oracle183c:+ASM1 grid]$ ls -ltr
total 0
[oracle@tst-oracle183c:+ASM1 grid]$ ls -ltr
total 5256120
-rw-r--r--. 1 oracle oinstall 5382265496 Sep 27 15:33 LINUX.X64_180000_grid_home.zip
[oracle@tst-oracle183c:+ASM1 grid]$ unzip LINUX.X64_180000_grid_home.zip
Archive:  LINUX.X64_180000_grid_home.zip
   creating: instantclient/
  inflating: instantclient/libsqlplusic.so
   creating: opmn/
   creating: opmn/logs/
   creating: opmn/conf/
  inflating: opmn/conf/ons.config
   creating: opmn/admin/
  inflating: opmn/admin/libons.def 
...
[oracle@tst-oracle183c:+ASM1 grid]$
[oracle@tst-oracle183c:+ASM1 grid]$ rm LINUX.X64_180000_grid_home.zip
[oracle@tst-oracle183c:+ASM1 grid]$
Feita a descompactação, devemos executar o arquivo gridSetup.sh em um client com suporte a interface grafica (no exemplo estou utilizando o mobaxterm).
[oracle@tst-oracle183c ~]$ . /etc/ambiente_grid.sh 
[oracle@tst-oracle183c:+ASM1 grid]$
[oracle@tst-oracle183c:+ASM1 grid]$ ./gridSetup.sh
Launching Oracle Grid Infrastructure Setup Wizard...
Na primeira tela Oracle Grid Infrastructure Installer, selecionaremos a opção Configure Oracle Grid Infrastructure for a Standalone Server (Oracle Restart).
Na etapa de criação dos discos, vamos criar inicialmente o disco DGDATA. Para isso deverá ser ajustado o Disk Group Name, redundancy e o Disk Discovery Path. Posteriormente vamos selecionar o disco de 10GB para o DGDATA.

Apos a criação do DGDATA, definiremos uma senha para o sys. Optei por usar uma senha comum entre as contas de sys e asmsnmp.
Na próxima tela não estarei realizando alterações.
Na tela de privilégios, definiremos conforme abaixo.
Não estaremos alterando a localização do oracle base pois como exportarmos as variáveis antes de executar o instalador ele será preenchido automaticamente.



Na etapa de pre requisitos, podemos clicar em Fix & Check Again para que a instalação gere o runfixup e depois ignoramos o alerta de memória.

[root@tst-oracle183c ~]# sh /tmp/GridSetupActions2018-10-01_10-01-22AM/CVU_18.0.0.0.0_oracle/runfixup.sh
All Fix-up operations were completed successfully.
[root@tst-oracle183c ~]#
Por último, antes da instalação ser iniciada. Temos o sumario.
Durante a instalação será necessário executar os scripts orainstRoot.sh e root.sh com o usuário root.
[root@tst-oracle183c ~]#
[root@tst-oracle183c ~]# sh /orabin01/app/18.3/grid/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /orabin01/app/18.3/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]:
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /orabin01/app/18.3/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /orabin01/app/grid/crsdata/tst-oracle183c/crsconfig/roothas_2018-10-01_10-26-59AM.log
2018/10/01 10:27:12 CLSRSC-363: User ignored prerequisites during installation
LOCAL ADD MODE
Creating OCR keys for user 'oracle', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node tst-oracle183c successfully pinned.
2018/10/01 10:27:25 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'tst-oracle183c'
CRS-2673: Attempting to stop 'ora.evmd' on 'tst-oracle183c'
CRS-2677: Stop of 'ora.evmd' on 'tst-oracle183c' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'tst-oracle183c' has completed
CRS-4133: Oracle High Availability Services has been stopped.
CRS-4123: Oracle High Availability Services has been started.

tst-oracle183c     2018/10/01 10:29:31     /orabin01/app/18.3/grid/cdata/tst-oracle183c/backup_20181001_102931.olr     70732493
2018/10/01 10:29:32 CLSRSC-327: Successfully configured Oracle Restart for a standalone server
[root@tst-oracle183c ~]#
Instalação do Grid Infrastructura 18.3c realizada com sucesso. No próximo post vamos realizar a instalação do Oracle Database 18.3 - Oracle 13.3 Standalone on premise part 3 - Instalando o Oracle Database 18.3.


Oracle 18.3 Standalone on premise part 1 - Instalando o Oracle Linux 7.5 no Oracle Virtual Box

Esta será a primeira de 3 postagens que irão compôr o artigo de instalação do Oracle 13.3 Standalone em um ambiente virtualizado com o Oracle Virtual Box.

  1.  Oracle 13.3 Standalone on premise part1 - Instalando o Oracle Linux 7.5 no Oracle Virtual Box.
  2. Oracle 13.3 Standalone on premise part 2 - Instalando o Grid Infrastructure 18.3
  3. Oracle 13.3 Standalone on premise part 3 - Instalando o Oracle Database 18.3

Nesta primeira etapa, será criada uma máquina virtual com o Oracle Linux 7.5 64 bits, para que posteriormente possamos instalar um Oracle Standalone 18.3c.

A maquina criada terá 3GB de memória RAM, 50GB para /, 10GB para orabackup, 10 GB para DGDATA e 5 GB para DGRECO.

O download da versão 7.5 pode ser realizada diretamente do Oracle Software Delivery Cloud. Basta pesquisar por Oracle Linux e então selecionar a versão 7.5. Posteriormente clicar no carrinho de compras.
Na etapa seguinte, vamos selecionar a plataforma e então clicar em continuar.
Posteriormente é preciso aceitar os termos de licença e clicar em continuar.
Apos aceitar os termos de licença, deverá ser selecionada a mídia de instalação para download. Bastará efetuar o download da mídia Oracle Linux Release 7 Update 5 for x86 (64 bit), 4.1 GB.
Agora, será criada a máquina virtual que será utilizada para a instalação. No virtual box deverá ser clicado na opção novo.
Para o nome da máquina, estarei utilizando o nome tst-oracle183c.
Será definido 3GB de memória RAM.
Na próxima etapa, será criado o disco utilizado no ambiente, onde será criado um disco de 50GB para instalação do SO, binário do Grid e Database.



Criadas as configurações básicas da maquina, devemos ir em configurações/armazenamento e então adicionar os discos para o DGDATA, DGRECO e /orabackup.



Posteriormente, deverá ser repetido o mesmo procedimento para criação do disco DGRECO e /orabackup com os tamanhos mencionados no inicio do artigo.
Apos a criação dos discos, vamos selecionar a mídia de instalação do Oracle Linux 7.5 que baixamos anteriormente para que nossa maquina possa utiliza-la para o boot.

Por último vamos configurar a placa de rede da maquina virtual para modo Bridge.
Apos as configurações acima, podemos iniciar a maquina virtual que ela irá dar boot na mídia do Oracle Linux 7.5. Derá ser escolhida a opção Install Oracle Linux 7.5.
Após carregar a instalação, será selecionada a linguagem do Sistema Operacional. Neste exemplo, estaremos usando Inglês Americano (United States).
Feita a escolha do idioma seremos direcionados ao sumário de instalação. Onde poderemos realizar todas as configurações que dizem respeito ao processo de instalação do Sistema Operacional.

  • Na opção DATE & TIME, será escolhido o timezone referente ao Brasil (Americas/Sao Paulo timezone).


  • Na opção keyboard, estaremos ajustando o idioma do teclado (em meu caso, português Brasil).
  • Na opção Software Selection vamos marcar a opção Server with GUI na seção Base Environment e na seção Add-On for Selected Environment vamos selecionar Compatibility Libraries e Development Tools.
  • Em Network & Hostname, vamos definir um IP fixo e o hostname da maquina.


  • Por ultimo, em Istallation Destination, vamos selecionar o disco de 50GB e a opção I will configure partitioning.
  • Apos clicar em Done, vamos escolher a opção click here to create them automatically. Posteriormente clicamos em done e accept changes na janela que aparecerá.




Concluídas as configurações acima, podemos iniciar a instalação do SO. Durante a instalação, vamos definir a senha de root e criar um usuário comum.





 Ao concluir a instalação, será informada a necessidade de restart da maquina. Assim que reiniciada o boot será feito no SO instalado.

Após o reboot, será necessário aceitar os termos de licenciamento.




Concluídos os passos acima, o ambiente estará pronto para a o segundo artigo - Oracle 13.3 Standalone on premise part2 - Instalando o Grid Infrastructure 18.3.