Posted in 2016

Docker with 12c SE2, step by step

Hi all,
maybe you are interrested in docker or you want to learn new things like me, I have created a docker guide to a point where you can tnsping the listener. To create a database would be just uninterresting. Everything is in the documentation too, but there is always someone who wants it faster. So you will find it there too.. serv-1 is my virtualbox machine for hosting the containers which I call host-[1,2,3] in this text. I have downloaded 12c SE2 zip files and stored them in /software in serv-1.

  1. find a device for btrfs
    [root@serv-1 ~]# lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda 8:0 0 30G 0 disk
    ├─sda1 8:1 0 500M 0 part /boot
    └─sda2 8:2 0 29.5G 0 part
    ├─ol-root 251:0 0 28.5G 0 lvm /
    └─ol-swap 251:1 0 1G 0 lvm [SWAP]
    sdb 8:16 0 50G 0 disk
    sr0 11:0 1 1024M 0 rom
    

  2. create a btrfs on a disk
    [root@serv-1 ~]# mkfs.btrfs /dev/sdb -f
    

  3. define a target to mount btrfs

    [root@serv-1 ~]# cat /etc/systemd/system/var-lib-docker.mount
    [Unit]
    Description = Docker Image Store
    
    [Mount]
    What = UUID=b1d40d65-f3c8-4774-9b70-ac3a73d49339
    Where = /var/lib/docker
    Type = btrfs
    
    [Install]
    WantedBy = multi-user.target
    
    [root@serv-1 ~]# systemctl enable var-lib-docker.mount
    [root@serv-1 ~]# systemctl start var-lib-docker.mount
    

  4. Install the docker engine

    [root@serv-1 ~]# yum install docker-engine
    Installed:
    docker-engine.x86_64 0:1.12.2-1.0.1.el7
    

  5. Filesystem starts first
    [root@serv-1 docker]# cat /etc/systemd/system/docker.service.d/var-lib-docker-mount.conf
    [Unit]
    Requires=var-lib-docker.mount
    After=var-lib-docker.mount
    
  6. Start docker

    [root@serv-1 ~]# systemctl start docker
    [root@serv-1 ~]# systemctl enable docker
    Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to
    /usr/lib/systemd/system/docker.service.
    

  7. Pull an oraclelinux image

    [root@serv-1 ~]# docker pull oraclelinux:7
    

  8. Now you can start a container

    [root@serv-1 ~]# docker run -i -t -d --name guest1 --restart=always oraclelinux:7
    

  9. To login you can either “docker attach” or “docker exec”, I learned that exec is better with starting a container with -d

    [root@serv-1 ~]# docker exec -i -t guest1 /bin/bash
    

  10. Preparing the docker image (oraclelinux) for Oracle software, for this I created a script and mount a readonly directory to the container

    [root@serv-1 software]# pwd
    /software
    [root@serv-1 software]# cat define_oracle.sh
    export http_proxy=http://172.X.X.X:8080
    echo "Preparing environment..."
    mkdir -p /products/oracle/install && \
    groupadd dba && \
    useradd -g dba -d /home/oracle -m -s /bin/bash oracle && \
    echo oracle:oracle | chpasswd
    sleep 2
    echo "Installing necessary packages..."
    yum -y install unzip tar openssl wget binutils.x86_64 \
    compat-libcap1.x86_64 \
    compat-libstdc++-33.i686 \
    compat-libstdc++-33.x86_64 \
    gcc.x86_64 \
    gcc-c++.x86_64 \
    glibc.i686 \
    glibc.x86_64 \
    glibc-devel.i686 \
    glibc-devel.x86_64 \
    ksh \
    libaio.i686 \
    libaio.x86_64 \
    libaio-devel.i686 \
    libaio-devel.x86_64 \
    libgcc.i686 \
    libgcc.x86_64 \
    libstdc++.i686 \
    libstdc++.x86_64 \
    libstdc++-devel.i686 \
    libstdc++-devel.x86_64 \
    libXi.i686 \
    libXi.x86_64 \
    libXtst.i686 \
    libXtst.x86_64 \
    make.x86_64 \
    sysstat.x86_64 | tee -a /tmp/install_packages.log > /dev/null 2>&1
    
    yum clean all > /dev/null 2>&1
    mkdir /products/oracle/oradata
    unzip -d /products/oracle/install/ /media/software/linuxamd64_12102_database_se2_1of2.zip | tee -a /tmp/unzip.log > /dev/null 2>&1
    
    unzip -d /products/oracle/install/ /media/software/linuxamd64_12102_database_se2_2of2.zip | tee -a /tmp/unzip.log > /dev/null 2>&1
    
    chown -R oracle:dba /products
    echo "Preparation finished..."
    

With this command I mount the /software directory with the oracle zip files and my script

[root@serv-1 software]# docker run -i -t --hostname host-01 --name guest1 --restart=always --shm-size 1GB -v /software/:/media/software:ro oraclelinux:7
[root@host-01 /]#
[root@host-01 /]# /media/software/define_oracle.sh
Preparing environment...
Installing necessary packages...
Preparation finished...
[oracle@host-01 /]$ cd /products/oracle/install/database/response
  1. Here you are already in the part where you can define the response file for the installation, once you modified it, you can run the installation
    [oracle@host-01 database]$ ./runInstaller -silent -responseFile
    /products/oracle/install/database/response/db_install.rsp -ignorePrereq
    Starting Oracle Universal Installer...
    Checking Temp space: must be greater than 500 MB. Actual 45844 MB Passed
    Checking swap space: must be greater than 150 MB. Actual 964 MB Passed
    
    Preparing to launch Oracle Universal Installer from /tmp/OraInstall2016-12-30_12-27-32PM. Please
    wait ...[oracle@host-01 database]$ [WARNING] [INS-32055] The Central Inventory is located in the
    Oracle base.
    
    ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
    
    You can find the log of this install session at:
    
    /products/oracle/oraInventory/logs/installActions2016-12-30_12-27-32PM.log
    
    The installation of Oracle Database 12c was successful.
    Please check '/products/oracle/oraInventory/logs/silentInstall2016-12-30_12-27-32PM.log' for more details.
    
    As a root user, execute the following script(s):
    1. /products/oracle/oraInventory/orainstRoot.sh
    2. /products/oracle/dbhome/12.1.0.2/root.sh
    
    Successfully Setup Software.
    [oracle@host-01 database]$ exit
    exit
    [root@host-01 /]# /products/oracle/oraInventory/orainstRoot.sh
    Changing permissions of /products/oracle/oraInventory.
    Adding read,write permissions for group.
    Removing read,write,execute permissions for world.
    Changing groupname of /products/oracle/oraInventory to dba.
    The execution of the script is complete.
    
    [root@host-01 /]# /products/oracle/dbhome/12.1.0.2/root.sh
    Check /products/oracle/dbhome/12.1.0.2/install/root_host-01_2016-12-30_12-35-10.log for the
    output of root script
    
  2. Remove the installation files so your image is not big

    [root@host-01 /]# cd /products/oracle/install/
    [root@host-01 install]# ll
    total 0
    drwxr-xr-x 1 oracle dba 110 Jul 6 2015 database
    [root@host-01 install]# rm -rf database/
    [root@host-01 install]#
    
  3. Login to the serv-1 and stop the container

    login as: root
    root@192.168.56.102's password:
    Last login: Fri Dec 30 07:29:54 2016 from 192.168.56.1
    [root@serv-1 ~]# docker stop guest1
    guest1
    [root@serv-1 ~]#
  4. Create your image, this takes time..

    [root@serv-1 ~]# docker commit -m "Oracle 12c SE2" -a "Peter Sorger" `docker ps -l -q` oracledb12c/se2:v1.0
    
  5. Create your first host for the database, I define the port mapping (serv-1:host-1)

    [root@serv-1 ~]# docker run -i -t -d --hostname host-01 --name guest1 --restart=always --shm-size 1GB 
    -p 1521:1521 oracledb12c/se2:v1.0
  6. Login and start the listener, int this step you could create the database too, but that’s another story or even create the database, define everything, commit and deploy, as you want

    [root@serv-1 ~]# docker exec -it guest1 /bin/bash
    [root@host-01 /]# su oracle
    [oracle@host-01 /]$ . oraenv
    ORACLE_SID = [oracle] ?
    ORACLE_HOME = [/home/oracle] ? /products/oracle/dbhome/12.1.0.2
    The Oracle base has been set to /products/oracle
    [oracle@host-01 /]$ lsnrctl start
    LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 30-DEC-2016 12:59:21
    Starting /products/oracle/dbhome/12.1.0.2/bin/tnslsnr: please wait...
    TNSLSNR for Linux: Version 12.1.0.2.0 - Production
    
    Log messages written to /products/oracle/diag/tnslsnr/host-01/listener/alert/log.xml
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host-01)(PORT=1521)))
    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
    STATUS of the LISTENER
    ------------------------
    Alias LISTENER
    Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
    Start Date 30-DEC-2016 12:59:21
    Uptime 0 days 0 hr. 0 min. 0 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Log File /products/oracle/diag/tnslsnr/host-01/listener/alert/log.xml
    
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host-01)(PORT=1521)))
    The listener supports no services
    The command completed successfully
    [oracle@host-01 /]$ exit
    [root@host-01 /]# exit 
  7. Install a client or any application that can connect to the listener or database if you created it. I have installed a client.

    [oracle@serv-1 client]$ ./runInstaller -silent -responseFile /software/client/response/client_install.rsp -ignorePrereq
    
    You can find the log of this install session at:
    /products/oracle/oraInventory/logs/installActions2016-12-30_08-43-47AM.log
    The installation of Oracle Client 12c was successful.
    
    Please check '/products/oracle/oraInventory/logs/silentInstall2016-12-30_08-43-47AM.log' for more details.
    
    As a root user, execute the following script(s):
    1. /products/oracle/oraInventory/orainstRoot.sh
    Successfully Setup Software.
    [oracle@serv-1 client]$ exit
    [root@serv-1 client]# /products/oracle/oraInventory/orainstRoot.sh
    Changing permissions of /products/oracle/oraInventory.
    Adding read,write permissions for group.
    Removing read,write,execute permissions for world.
    Changing groupname of /products/oracle/oraInventory to dba.
    The execution of the script is complete. 
  8. Connect to the database

    [root@serv-1 client]# su oracle
    [oracle@serv-1 client]$ export ORACLE_HOME=/products/oracle/client
    [oracle@serv-1 client]$ export LD_LIBRARY_PATH=/products/oracle/client/lib
    [oracle@serv-1 client]$ export PATH=$PATH:/products/oracle/client/bin
    [oracle@serv-1 client]$ tnsping localhost:1521/test
    
    TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 30-DEC-2016 08:47:54
    Copyright (c) 1997, 2014, Oracle. All rights reserved.
    
    Used parameter files:
    Used HOSTNAME adapter to resolve the alias
    
    Attempting to contact
    (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=test))(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))
    OK (370 msec)
    

And now you can work with your database in a container.

Advertisements
Posted in 2016

How to Update data 10 at a time..

SYS> create user test identified by test default tablespace users ;

User created.

SYS> grant connect, resource to test ;

Grant succeeded.

SYS> grant execute on dbms_lock to test ;

Grant succeeded.

SYS> alter user test quota unlimited on users ;

User altered.

TEST> create table data (laenge number, breite number, shape number) ;

Table created.

TEST> insert into data (laenge,breite) select dbms_random.value(1,100),dbms_random.value(100,200) from dual connect by level<=100;
commit;

CREATE or REPLACE procedure EXECUTE_GEOMETRY_BUILDING_TEST
IS
CURSOR c_geodata IS SELECT LAENGE, BREITE, SHAPE FROM data ;
TYPE t_geodata_table IS TABLE OF c_geodata%rowtype INDEX by PLS_INTEGER ;
values_geodata t_geodata_table ;
BEGIN
open c_geodata ;
loop
    fetch c_geodata BULK COLLECT INTO values_geodata LIMIT 10 ;

EXIT WHEN
    values_geodata.COUNT = 0;  

for idx in 1..values_geodata.count
LOOP
    UPDATE data
    SET SHAPE = 1000 where laenge=values_geodata(idx).laenge and breite=values_geodata(idx).breite ;
/* here I update only that rows which I selected */
END LOOP ;
commit ; /* commit so I can see them in a second session, and maybe reuse them */
dbms_lock.sleep(20) ; 

END LOOP ;
close c_geodata ;

END EXECUTE_GEOMETRY_BUILDING_TEST;
/
Posted in 2016

Dataguard Sandbox – like never before

I decided to create a dataguard config using iscsi from orcl-store that will provide 20GB disks to 2 servers.. first of all I would like to create a RAID device on “physical discs” (I created 4 virtual disks, dynamically allocated and attached them to my VM).. Edit: the services are bad. don’t use them..

[root@orcl-store ~]# mdadm --create md0 --level=10 --raid-devices=2 /dev/sd[bc]
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md/md0 started.
[root@orcl-store ~]# mdadm --create md1 --level=10 --raid-devices=2 /dev/sd[de]
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md/md1 started.
[root@orcl-store ~]# mdadm --detail --brief /dev/md/md0 >> /etc/mdadm.conf
[root@orcl-store ~]# mdadm --detail --brief /dev/md/md1 >> /etc/mdadm.conf
[root@orcl-store ~]# cat /etc/mdadm.conf
ARRAY /dev/md/md0 metadata=1.2 name=orcl-store.example.com:md0 UUID=7a39d490:3652ccb7:1f20bc39:853de558
ARRAY /dev/md/md1 metadata=1.2 name=orcl-store.example.com:md1 UUID=f8b85c79:d0a0158d:b47b0430:dd0eb0af
[root@orcl-store ~]# exporthttp 
[root@orcl-store ~]# yum install scsi-target-utils

In the /etc/tgt/targets.conf I define:

<target iqn.2016-12.com.example.orcl-store:orcl-site1>
	direct-store	/dev/md0
</target>

<target iqn.2016-12.com.example.orcl-store:orcl-site2>
        direct-store    /dev/md1
</target>

and check if it’s running

[root@orcl-store ~]# service tgtd start
[root@orcl-store ~]# 
[root@orcl-store ~]# service tgtd status
tgtd (pid 2785 2782) is running...
[root@orcl-store ~]# chkconfig tgtd on
[root@orcl-store ~]# tgtadm -o show -m target
Target 1: iqn.2016-12.com.example.orcl-store:orcl-site1
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00010000
            SCSI SN: beaf10
            Size: 0 MB, Block size: 1
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            Backing store type: null
            Backing store path: None
            Backing store flags: 
        LUN: 1
            Type: disk
            SCSI ID: IET     00010001
            SCSI SN: beaf11
            Size: 21458 MB, Block size: 512
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            Backing store type: rdwr
            Backing store path: /dev/md0
            Backing store flags: 
    Account information:
    ACL information:
        ALL
Target 2: iqn.2016-12.com.example.orcl-store:orcl-site2
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00020000
            SCSI SN: beaf20
            Size: 0 MB, Block size: 1
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            Backing store type: null
            Backing store path: None
            Backing store flags: 
        LUN: 1
            Type: disk
            SCSI ID: IET     00020001
            SCSI SN: beaf21
            Size: 21458 MB, Block size: 512
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            Backing store type: rdwr
            Backing store path: /dev/md1
            Backing store flags: 
    Account information:
    ACL information:
        ALL

Finished.. now let’s go to the initiators

[root@orcl-site-01 ~]# yum install iscsi-initiator-utils
[root@orcl-site-01 ~]# iscsiadm -m discovery --type sendtargets -p 192.168.2.100
Starting iscsid:                                           [  OK  ]
192.168.2.100:3260,1 iqn.2016-12.com.example.orcl-store:orcl-site1
192.168.2.100:3260,1 iqn.2016-12.com.example.orcl-store:orcl-site2
[root@orcl-site-01 ~]# iscsiadm -m node --targetname iqn.2016-12.com.example.orcl-store:orcl-site1 -p 192.168.2.100:3260 -l
Logging in to [iface: default, target: iqn.2016-12.com.example.orcl-store:orcl-site1, portal: 192.168.2.100,3260] (multiple)
Login to [iface: default, target: iqn.2016-12.com.example.orcl-store:orcl-site1, portal: 192.168.2.100,3260] successful.
[root@orcl-site-01 ~]# iscsiadm -m session -P 3
iSCSI Transport Class version 2.0-870
version 6.2.0-873.22.el6
Target: iqn.2016-12.com.example.orcl-store:orcl-site1 (non-flash)
    Current Portal: 192.168.2.100:3260,1
    Persistent Portal: 192.168.2.100:3260,1
        **********
        Interface:
        **********
        Iface Name: default
        Iface Transport: tcp
        Iface Initiatorname: iqn.1988-12.com.oracle:39d373a698b8
        Iface IPaddress: 192.168.2.10
        Iface HWaddress: 
        Iface Netdev: 
        SID: 1
        iSCSI Connection State: LOGGED IN
        iSCSI Session State: LOGGED_IN
        Internal iscsid Session State: NO CHANGE
        *********
        Timeouts:
        *********
        Recovery Timeout: 120
        Target Reset Timeout: 30
        LUN Reset Timeout: 30
        Abort Timeout: 15
        *****
        CHAP:
        *****
        username: 
        password: ********
        username_in: 
        password_in: ********
        ************************
        Negotiated iSCSI params:
        ************************
        HeaderDigest: None
        DataDigest: None
        MaxRecvDataSegmentLength: 262144
        MaxXmitDataSegmentLength: 8192
        FirstBurstLength: 65536
        MaxBurstLength: 262144
        ImmediateData: Yes
        InitialR2T: Yes
        MaxOutstandingR2T: 1
        ************************
        Attached SCSI devices:
        ************************
        Host Number: 3  State: running
        scsi3 Channel 00 Id 0 Lun: 0
        scsi3 Channel 00 Id 0 Lun: 1
            Attached scsi disk sdb      State: running

and do the same on the second node… Partition it

[root@orcl-site-01 ~]# fdisk /dev/sdb 
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x380174ee.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-20463, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-20463, default 20463): 
Using default value 20463

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

Calling ioctl() to re-read partition table.
Syncing disks.

And now my persistent naming with udev, because it’s too much to download asmlib 😀 I make it on both sides, but don’t forget the scsi_id is on second node other, the result is other…

[root@orcl-site-01 dev]# cat /etc/udev/rules.d/99-oracle.rules
KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="1IET_00010001", SYMLINK+="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
[root@orcl-site-01 dev]# udevadm trigger
[root@orcl-site-01 dev]# ls -l /dev/asm-disk1 
lrwxrwxrwx. 1 root root 4 Dec  2 14:19 /dev/asm-disk1 -> sdb1

Well, now I have everything ready for my ASM…. I don’t want to bother you with pictures (I mean myself with creating photos and preparing it) I simply install the grid infrastructure for standalone on both nodes, create a diskgroup data with external redundancy from the /dev/asm-disk1, install the database home and then I create a Container DB with 1 Pluggable DB..

I defined a service on the primary as this stupid ./runInstaller defined the db_unique_name = db_name:

[oracle@orcl-site-01 ~]$ srvctl add service -db condb -service condb_site1.example.com -role primary
[oracle@orcl-site-01 ~]$ srvctl start service -db condb 

Now it’s important to define everything right…First I decided to create all network/admin files as a softlink to the grid/network/admin so I administer only one set of files.. it looks like this, the auxiliary instance needs a static listener entry:

[oracle@orcl-site-02 admin]$ cat tnsnames.ora
condb_site1=(DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=condb_site1.example.com)(SERVER=DEDICATED))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.2.10)(PORT=1521)))
condb_site2=(DESCRIPTION=(CONNECT_DATA=(SID=condb)(SERVER=DEDICATED))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.2.11)(PORT=1521)))
[oracle@orcl-site-02 admin]$ cat /products/grid/12.1.0.2/network/admin/listener.ora
# listener.ora Network Configuration File: /products/grid/12.1.0.2/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = orcl-site-02.example.com)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = CONDB_SITE2_DGMGRL)
      (ORACLE_HOME = /products/oracle/12.1.0.2)
      (SID_NAME = condb)
    )
  )

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON		# line added by Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER=SUBNET		# line added by Agent

As we see I changed the definition of the listener and restarted them and defined the _DGMGRL thing..

I create a pfile from spfile and change it to have everything OK, it means I create the audit directory, remove the control_files parameter as it will be created in +DATA anyway, create a password file and start the instance in nomount, create spfile from pfile, restart to nomount… If you have all this, you can connect to the rman…

[oracle@orcl-site-02 admin]$ rman target sys/oracle@condb_site1 auxiliary sys/oracle@condb_site2

Recovery Manager: Release 12.1.0.2.0 - Production on Fri Dec 2 16:42:44 2016

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CONDB (DBID=1185408016)
connected to auxiliary database: CONDB (not mounted)

RMAN> duplicate target database for standby from active database ;

Starting Duplicate Db at 02-DEC-16
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=22 device type=DISK

contents of Memory Script:
{
   backup as copy reuse
   targetfile  '/products/oracle/12.1.0.2/dbs/orapwcondb' auxiliary format 
 '/products/oracle/12.1.0.2/dbs/orapwcondb'   ;
}
executing Memory Script

Starting backup at 02-DEC-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=28 device type=DISK
Finished backup at 02-DEC-16

contents of Memory Script:
{
   sql clone "alter system set  control_files = 
  ''+DATA/CONDB_SITE2/CONTROLFILE/current.257.929551397'', ''+DATA/CONDB_SITE2/CONTROLFILE/current.258.929551397'' comment=
 ''Set by RMAN'' scope=spfile";
   restore clone from service  'condb_site1' standby controlfile;
}
executing Memory Script

sql statement: alter system set  control_files =   ''+DATA/CONDB_SITE2/CONTROLFILE/current.257.929551397'', ''+DATA/CONDB_SITE2/CONTROLFILE/current.258.929551397'' comment= ''Set by RMAN'' scope=spfile

Starting restore at 02-DEC-16
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service condb_site1
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:27
output file name=+DATA/CONDB_SITE2/CONTROLFILE/current.261.929551415
output file name=+DATA/CONDB_SITE2/CONTROLFILE/current.262.929551417
Finished restore at 02-DEC-16

contents of Memory Script:
{
   sql clone 'alter database mount standby database';
}
executing Memory Script

sql statement: alter database mount standby database

contents of Memory Script:
{
   set newname for clone tempfile  1 to new;
   set newname for clone tempfile  2 to new;
   set newname for clone tempfile  3 to new;
   switch clone tempfile all;
   set newname for clone datafile  1 to new;
   set newname for clone datafile  3 to new;
   set newname for clone datafile  4 to new;
   set newname for clone datafile  5 to new;
   set newname for clone datafile  6 to new;
   set newname for clone datafile  7 to new;
   set newname for clone datafile  8 to new;
   set newname for clone datafile  9 to new;
   set newname for clone datafile  10 to new;
   restore
   from service  'condb_site1'   clone database
   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to +DATA in control file
renamed tempfile 2 to +DATA in control file
renamed tempfile 3 to +DATA in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 02-DEC-16
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service condb_site1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to +DATA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:36
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service condb_site1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to +DATA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:15
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service condb_site1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to +DATA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:16
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service condb_site1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00005 to +DATA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:17
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service condb_site1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00006 to +DATA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:11
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service condb_site1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00007 to +DATA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:27
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service condb_site1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00008 to +DATA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:47
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service condb_site1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00009 to +DATA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:26
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service condb_site1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00010 to +DATA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:09
Finished restore at 02-DEC-16

sql statement: alter system archive log current

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=12 STAMP=929551755 file name=+DATA/CONDB_SITE2/DATAFILE/system.263.929551481
datafile 3 switched to datafile copy
input datafile copy RECID=13 STAMP=929551757 file name=+DATA/CONDB_SITE2/DATAFILE/sysaux.264.929551549
datafile 4 switched to datafile copy
input datafile copy RECID=14 STAMP=929551761 file name=+DATA/CONDB_SITE2/DATAFILE/undotbs1.265.929551593
datafile 5 switched to datafile copy
input datafile copy RECID=15 STAMP=929551764 file name=+DATA/CONDB_SITE2/42AF23EB61132764E0530A02A8C04ADB/DATAFILE/system.266.929551611
datafile 6 switched to datafile copy
input datafile copy RECID=16 STAMP=929551766 file name=+DATA/CONDB_SITE2/DATAFILE/users.267.929551627
datafile 7 switched to datafile copy
input datafile copy RECID=17 STAMP=929551768 file name=+DATA/CONDB_SITE2/42AF23EB61132764E0530A02A8C04ADB/DATAFILE/sysaux.268.929551635
datafile 8 switched to datafile copy
input datafile copy RECID=18 STAMP=929551770 file name=+DATA/CONDB_SITE2/42AF665748852E95E0530A02A8C02DF5/DATAFILE/system.269.929551693
datafile 9 switched to datafile copy
input datafile copy RECID=19 STAMP=929551772 file name=+DATA/CONDB_SITE2/42AF665748852E95E0530A02A8C02DF5/DATAFILE/sysaux.270.929551709
datafile 10 switched to datafile copy
input datafile copy RECID=20 STAMP=929551775 file name=+DATA/CONDB_SITE2/42AF665748852E95E0530A02A8C02DF5/DATAFILE/users.271.929551735
Finished Duplicate Db at 02-DEC-16

RMAN> 

I change the tnsnames.ora to:

[oracle@orcl-site-02 admin]$ cat tnsnames.ora 
condb_site1=(DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=condb_site1.example.com)(SERVER=DEDICATED))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.2.10)(PORT=1521)))
condb_site2=(DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=condb_site2.example.com)(SERVER=DEDICATED))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.2.11)(PORT=1521)))

set parameters fal_server=[condb_site1|condb_site2], dg_broker_start=true and standby_file_management=auto on both instances and create the dgmgrl configuration:

[oracle@orcl-site-01 ~]$ dgmgrl sys/oracle@condb_site1
DGMGRL for Linux: Version 12.1.0.2.0 - 64bit Production

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

Welcome to DGMGRL, type "help" for information.
Connected as SYSDBA.
DGMGRL> create configuration myconfig as primary database is condb connect identifier is condb_site1 ;
Configuration "myconfig" created with primary database "condb"
DGMGRL> add database condb_site2 as connect identifier is condb_site2 maintained as physical ;
Database "condb_site2" added
DGMGRL> enable configuration ;
Enabled.

DGMGRL> show configuration ;

Configuration - myconfig

  Protection Mode: MaxPerformance
  Members:
  condb       - Primary database
    condb_site2 - Physical standby database 

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 47 seconds ago)

Voila, the dataguard is created… So it means I need 1 day to configure 3 machines, install software, create a database, duplicate it and create the dataguard broker configuration (7 hours)