Guob 2014
Oracle Data Guard 11g com VirtualBox – Parte 2
janeiro 30, 2013

Introdução

Parte 1

Parte 2

Parte 3

Parte 4

Parte 5

Parte 6

Na primeira parte da nossa série, foi criada a máquina virtual chamada de “DB Primary”, ela será nosso Primary Database (está lembrado?). Temos somente o Oracle Linux instalado nessa máquina, precisamos hoje criar as configurações do pré-requisitos e instalarmos o Oracle Database 11g nessa máquina.

Após essa máquina virtual está totalmente configurada e instalada, iremos criar um clone desse disco para a criação do Dataguard Database, mais isso faremos juntos na parte 3.

Hoje nossa missão é realizar os pré requisitos e instalar o Oracle Database 11gR2, para isso tenha em mãos o binário de instalação do Oracle 11g R2. Vou utilizar aqui a versão 11.2.0.3, porém fica a seu critério que release 11g R2 utilizar.

Com a máquina virtual ligada, clique no disco vazio que fica na barra de status da VM (veja o marco em vermelho).

Após ter clicado, irá mostrar os discos ISO disponíveis, provavelmente o Oracle Linux estará, caso não esteja selecione através da opção “Choose a virtual CD/DVD disk file …”

Feito isso, você verá a ISO do Oracle Linux sendo montada como um CDROM na máquina Virtual:

Veja que a ISO está apontando para o diretório /media/Enterprise Linux dvd 20100405.

[root@bancodg ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 19G 3.0G 15G 17% /
tmpfs 502M 0 502M 0% /dev/shm
/dev/hda 3.4G 3.4G 0 100% /media/Enterprise Linux dvd 20100405

Entre no diretório da ISO.

[root@bancodg ~]# cd /media/Enterprise\ Linux\ dvd\ 20100405/Server/
[root@bancodg Server]#

É  necessário agora realizar a instalação dos pacotes rpm Linux. Seja abaixo a instalação de cada um deles.

[root@bancodg Server]# rpm -ivh binutils-2.17.50.0.6-14.el5.x86_64.rpm
warning: binutils-2.17.50.0.6-14.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package binutils-2.17.50.0.6-14.el5.x86_64 is already installed

[root@bancodg Server]# rpm -ivh compat-libstdc++-33-3.2.3-61.x86_64.rpm
warning: compat-libstdc++-33-3.2.3-61.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package compat-libstdc++-33-3.2.3-61.x86_64 is already installed

[root@bancodg Server]# rpm -ivh compat-libstdc++-33-3.2.3-61.i386.rpm
warning: compat-libstdc++-33-3.2.3-61.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package compat-libstdc++-33-3.2.3-61.i386 is already installed

[root@bancodg Server]# rpm -ivh elfutils-libelf-0.137-3.el5.x86_64.rpm
warning: elfutils-libelf-0.137-3.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package elfutils-libelf-0.137-3.el5.x86_64 is already installed

[root@bancodg Server]# rpm -ivh glibc-2.5-49.x86_64.rpm
warning: glibc-2.5-49.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package glibc-2.5-49.x86_64 is already installed

[root@bancodg Server]# rpm -ivh glibc-2.5-49.i686.rpm
warning: glibc-2.5-49.i686.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package glibc-2.5-49.i686 is already installed

[root@bancodg Server]# rpm -ivh glibc-common-2.5-49.x86_64.rpm
warning: glibc-common-2.5-49.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package glibc-common-2.5-49.x86_64 is already installed

[root@bancodg Server]# rpm -ivh ksh-20100202-1.el5.x86_64.rpm
warning: ksh-20100202-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package ksh-20100202-1.el5.x86_64 is already installed

[root@bancodg Server]# rpm -ivh libaio-0.3.106-5.x86_64.rpm
warning: libaio-0.3.106-5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package libaio-0.3.106-5.x86_64 is already installed

[root@bancodg Server]# rpm -ivh libaio-0.3.106-5.i386.rpm
warning: libaio-0.3.106-5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package libaio-0.3.106-5.i386 is already installed

[root@bancodg Server]# rpm -ivh libgcc-4.1.2-48.el5.x86_64.rpm
warning: libgcc-4.1.2-48.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package libgcc-4.1.2-48.el5.x86_64 is already installed

[root@bancodg Server]# rpm -ivh libgcc-4.1.2-48.el5.i386.rpm
warning: libgcc-4.1.2-48.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package libgcc-4.1.2-48.el5.i386 is already installed

[root@bancodg Server]# rpm -ivh libstdc++-4.1.2-48.el5.x86_64.rpm
warning: libstdc++-4.1.2-48.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package libstdc++-4.1.2-48.el5.x86_64 is already installed

[root@bancodg Server]# rpm -ivh libstdc++-4.1.2-48.el5.i386.rpm
warning: libstdc++-4.1.2-48.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package libstdc++-4.1.2-48.el5.i386 is already installed

[root@bancodg Server]# rpm -ivh make-3.81-3.el5.x86_64.rpm
warning: make-3.81-3.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package make-3.81-3.el5.x86_64 is already installed

[root@bancodg Server]# rpm -ivh unixODBC-2.2.11-7.1.x86_64.rpm
warning: unixODBC-2.2.11-7.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:unixODBC ########################################### [100%]

[root@bancodg Server]# rpm -ivh unixODBC-2.2.11-7.1.i386.rpm
warning: unixODBC-2.2.11-7.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:unixODBC ########################################### [100%]

[root@bancodg Server]# rpm -ivh unixODBC-devel-2.2.11-7.1.x86_64.rpm
warning: unixODBC-devel-2.2.11-7.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:unixODBC-devel ########################################### [100%]

[root@bancodg Server]# rpm -ivh unixODBC-devel-2.2.11-7.1.i386.rpm
warning: unixODBC-devel-2.2.11-7.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:unixODBC-devel ########################################### [100%]

[root@bancodg Server]# rpm -ivh elfutils-libelf-devel-static-0.137-3.el5.x86_64.rpm
warning: elfutils-libelf-devel-static-0.137-3.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package elfutils-libelf-devel-static-0.137-3.el5.x86_64 is already installed

[root@bancodg Server]# rpm -ivh gcc-4.1.2-48.el5.x86_64.rpm
warning: gcc-4.1.2-48.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package gcc-4.1.2-48.el5.x86_64 is already installed

[root@bancodg Server]# rpm -ivh gcc-c++-4.1.2-48.el5.x86_64.rpm
warning: gcc-c++-4.1.2-48.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package gcc-c++-4.1.2-48.el5.x86_64 is already installed

[root@bancodg Server]# rpm -ivh glibc-devel-2.5-49.x86_64.rpm
warning: glibc-devel-2.5-49.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package glibc-devel-2.5-49.x86_64 is already installed

[root@bancodg Server]# rpm -ivh glibc-devel-2.5-49.i386.rpm
warning: glibc-devel-2.5-49.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package glibc-devel-2.5-49.i386 is already installed

[root@bancodg Server]# rpm -ivh glibc-headers-2.5-49.x86_64.rpm
warning: glibc-headers-2.5-49.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package glibc-headers-2.5-49.x86_64 is already installed

[root@bancodg Server]# rpm -ivh kernel-headers-2.6.18-194.el5.x86_64.rpm
warning: kernel-headers-2.6.18-194.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package kernel-headers-2.6.18-194.el5.x86_64 is already installed

[root@bancodg Server]# rpm -ivh libgomp-4.4.0-6.el5.x86_64.rpm
warning: libgomp-4.4.0-6.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package libgomp-4.4.0-6.el5.x86_64 is already installed

[root@bancodg Server]# rpm -ivh libstdc++-devel-4.1.2-48.el5.x86_64.rpm
warning: libstdc++-devel-4.1.2-48.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package libstdc++-devel-4.1.2-48.el5.x86_64 is already installed

[root@bancodg Server]# rpm -ivh sysstat-7.0.2-3.el5.x86_64.rpm
warning: sysstat-7.0.2-3.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package sysstat-7.0.2-3.el5.x86_64 is already installed

Com todos os pacotes instalados, vamos as configurações de kernel do sistema operacional. Faça as seguintes operações:

[root@bancodg ~]# vi /etc/sysctl.conf
#Oracle Settings
kernel.shmmni = 4096 
kernel.sem = 250 32000 100 128 
fs.file-max = 6815744 
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500 
net.core.rmem_default = 262144 
net.core.rmem_max = 4194304 
net.core.wmem_default = 262144 
net.core.wmem_max = 1048576

Para ativa-lós execute o sysctl como abaixo:

[root@bancodg ~]# sysctl -p

Hora de configurar os limits do Oracle, para isso adicione as seguintes linhas no arquivo /etc/security/limits.conf

[root@bancodg ~]# vi /etc/security/limits.conf
#Oracle Settings
oracle soft nproc 2047 
oracle hard nproc 16384 
oracle soft nofile 1024 
oracle hard nofile 65536 
oracle soft stack 10240

Edite também as limites do arquivo /etc/profile.

[root@bancodg ~]# vi /etc/profile
if [ $USER = "oracle" ]; then 
     if [ $SHELL = "/bin/ksh" ]; then 
         ulimit -u 16384 
         ulimit -n 65536 
     else 
         ulimit -u 16384 -n 65536 
     fi 
fi

Configure agora o arquivo /etc/pam.d/login com a linha abaixo:

[root@bancodg ~]# vi /etc/pam.d/login
session    required     pam_limits.so

Pronto, limites e demais configurações feitas. Vamos a validação do host que é muito importante para um ambiente DataGuard.

[root@bancodg ~]# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1	localhost.localdomain localhost
::1		localhost6.localdomain6 localhost6
20.0.0.10 bancodg.oracle.com bancodg

Checando o hostname:

[root@bancodg ~]# hostname
bancodg.oracle.com
[root@bancodg ~]# hostname -i
20.0.0.10

Com as configurações acima, vamos agora criar o usuário oracle:

[root@bancodg ~]# groupadd oinstall 
[root@bancodg ~]# groupadd dba 
[root@bancodg ~]# useradd -g oinstall -G dba oracle

Altere a senha do usuário também:

[root@bancodg ~]# passwd oracle
Changing password for user oracle.
New UNIX password: oracle
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password: oracle
passwd: all authentication tokens updated successfully.

Vamos agora a criação do diretório. Faça os seguintes comandos:

[root@bancodg ~]# mkdir -p /u01/app/oracle 
[root@bancodg ~]# chown -R oracle:oinstall /u01/

Pronto! As configurações todas ok.

Precisamos agora transferir o binário do Oracle para a máquina virtual. Caso você estiver em um ambiente windows, você pode utilizar o winscp. No meu caso vou utilizar o utilitário scp.

$ scp p10404530_112030_Linux-x86-64_1of7.zip p10404530_112030_Linux-x86-64_2of7.zip oracle@20.0.0.10:/u01/app/oracle/.
oracle@20.0.0.10's password: ***********
p10404530_112030_Linux-x86-64_1of7.zip                              100%   01:28 ETA
p10404530_112030_Linux-x86-64_2of7.zip                              100%   01:45 ETA

Antes de instalar, precisamos é claro, descompactar os arquivos de instalação na máquina virtual.

Acesse novamente a VM do VirtualBox, e entre no caminho /u01/app/oracle (ou onde você deixou os binários) e utilize o unzip para descompactar os arquivos. Faça primeiro no arquivo 1 depois no arquivo 2, como abaixo:

[oracle@bancodg ~]$ cd /u01/app/oracle/
[oracle@bancodg oracle]$ ll
total 2444440
-rwxr-xr-x 1 oracle oinstall 1358454646 Jan 16 22:44 p10404530_112030_Linux-x86-64_1of7.zip
-rwxr-xr-x 1 oracle oinstall 1142195302 Jan 16 22:45 p10404530_112030_Linux-x86-64_2of7.zip

[oracle@bancodg oracle]$ unzip p10404530_112030_Linux-x86-64_1of7.zip 
  ...
  inflating: database/stage/properties/oracle.server_PE.properties  
  inflating: database/stage/properties/sshConnectivity-usage.txt  
  inflating: database/stage/properties/oracle.server_Custom.properties  
  inflating: database/stage/properties/sPaths.properties  
  inflating: database/stage/properties/ssh_system.properties  
  inflating: database/stage/properties/oracle.server_SE.properties  
  inflating: database/stage/properties/userPaths.properties  
  inflating: database/welcome.html   
  inflating: database/readme.html 
[oracle@bancodg oracle]$ unzip p10404530_112030_Linux-x86-64_2of7.zip
  ...
  inflating: database/stage/Components/oracle.sysman.console.db/11.2.0.3.0/1/DataFiles/filegroup10.jar  
  inflating: database/stage/Components/oracle.sysman.console.db/11.2.0.3.0/1/DataFiles/filegroup11.jar  
  inflating: database/stage/Components/oracle.sysman.console.db/11.2.0.3.0/1/DataFiles/filegroup7.jar  
  inflating: database/stage/Components/oracle.sysman.console.db/11.2.0.3.0/1/DataFiles/filegroup5.jar  
  inflating: database/stage/Components/oracle.sysman.console.db/11.2.0.3.0/1/DataFiles/filegroup3.jar  
  inflating: database/stage/Components/oracle.sysman.console.db/11.2.0.3.0/1/DataFiles/filegroup1.jar  
  inflating: database/stage/Components/oracle.sysman.console.db/11.2.0.3.0/1/DataFiles/filegroup13.jar  
  inflating: database/stage/Components/oracle.sysman.console.db/11.2.0.3.0/1/DataFiles/filegroup2.jar

Feito os passos acima, uma pasta chamada “database” será criada no atual diretório. Ela contém os binários de instalação do software Oracle Database 11gR2.

Vamos então para esse diretório, que no meu caso é o /u01/app/oracle/database:

LEMBRE-SE VOCÊ DEVE ESTAR COM O USUÁRIO ORACLE CONECTADO NA MÁQUINA VIRTUAL

Dispare o runInstaller, como na Imagem acima.

O runInstaller irá abrir uma janela de utilitário de passo a passo de instalação do software. Seguiremos os passos:

Primeiro, desmarque a opção de receber updates via My Oracle Support.

Um aviso será mostrado, pode ignora-ló e continue.

Por ser um ambiente totalmente feito para teste, vamos novamente ignorar os updates. Para isso clique em Skip software updates

Aqui, temos que selecionar o tipo da instalação. Vamos por enquanto somente instalar somente o software Oracle Database 11gR2.

Selecione opção Enterprise. Lembrando para usar o Oracle Dataguard, é obrigatório e imprescindível que a versão seja Enterprise Edition. Por isso ATENÇÃO, selecione a versão ENTERPRISE EDITION para essa instalação.

Define aqui a localização das variáveis ORACLE BASE e ORACLE_HOME.

Nesse momento é realizado um checklist completo do ambiente Oracle sobre as possíveis falhas de pré requisitos. No nosso caso, ele informou somente a falta de memória. Por ser um ambiente criado somente com a finalidade de estudo, podemos deixar a memória da máquina baixa (por motivos óbvios), porém em ambientes de produção nunca ignore tais erros.

 

Aqui é informado um resume de todas as configurações selecionadas.

 

Início da instalação …

 

É informado agora, para rodarmos dois scripts com o usuário root. Simplesmente assim: conecte como root e execute os dois.


[root@bancodg ~]# whoami
root
[root@bancodg ~]# /u01/app/oraInventory/orainstRoot.sh 
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.

Agora o segundo

[root@bancodg ~]# whoami 
root
[root@bancodg ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh 
Performing root user operation for Oracle 11g 

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/11.2.0/dbhome_1

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.
Finished product-specific root actions.

Fim da instalação

 

Com a conclusão da parte 2, temos a máquina virtual criada com o Oracle Database e todos os pré-requisitos feitos.

Vamos somente agora, adicionar as variáveis de ambiente da máquina DB Primary. Com o usuário oracle conectado, edite o arquivo ˜/.bash_profile e adicione as seguintes linhas:

[oracle@bancodg ~]$ vi ~/.bash_profile 
# .bash_profile

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

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH
[oracle@bancodg ~]$

Agora ative as variáveis com o comando:

[oracle@bancodg ~]$ . ~/bash_profile

Na próxima parte, estarei realizando a cópia dessa VM ponta, para poder criar a máquina em um outro projeto.

 

Deixe um Comentário

O seu endereço de email não será publicado Campos obrigatórios são marcados *

*

Você pode usar estas tags e atributos de HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*