Posted in 2017

Call me Expert

Yeees, I got my Expert level recently on community.oracle.com ..
I would like to thank everyone who believes in me, it was a hard path to get 10 correct answers and 10 Helpful 😀 with this mission I finally moved to the Expert level. Thanks again

Advertisements
Posted in 2017

Multiple networks for DBs

srvctl add network -netnum 2 -subnet 192.168.1.0/255.255.255.0/bond0.2 -nettype static
srvctl add vip -node rac-01 -address rac-01-vip.example.com/255.255.255.0 -netnum 2
srvctl add vip -node rac-02 -address rac-02-vip.example.com/255.255.255.0 -netnum 2

srvctl add listener -listener LISTENER_BANK -netnum 2 -endpoints TCP:1521

srvctl add scan -scanname bank-of-europe-scan.example.com -netnum 2
srvctl add scan_listener -netnum 2 -listener LISTENER_BANK -endpoints TCP:1521 -invitednodes rac-01,rac-02

Here we can start everything and check:

 ps -ef| grep tns |grep -v grep| awk '{print $9}' | sort | uniq > /tmp/listener.txt

Generate listener.ora:

for i in $(cat /tmp/listener.txt  | sort | uniq); do
  echo "${i} =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = ${i}))
    )
  )
" | tee -a listener.ora
done
for i in $(cat /tmp/listener.txt  | sort | uniq); do
  echo "ENABLE_GLOBAL_DYNAMIC_ENDPOINT_${i} = ON" | tee -a listener.ora
done
echo
for i in $(cat /tmp/listener.txt  | sort | uniq); do
  echo "VALID_NODE_CHECKING_REGISTRATION_${i} = SUBNET" | tee -a listener.ora
done
echo

for i in $(cat /tmp/listener.txt  | sort | uniq); do
  echo "REGISTRATION_INVITED_NODES_${i}=(rac-01,rac-02)" | tee -a listener.ora
done
echo
for i in $(cat /tmp/listener.txt  | sort | uniq); do
  echo "ADR_BASE_${i} = /products/oracle" | tee -a listener.ora
done
Posted in 2017

Knowledge Window

select
     path
  from v$asm_disk
  where (disk_number, group_number) in
     (select
            distinct DISK_KFFXP,
            group_kffxp
            from x$kffxp where (group_kffxp,NUMBER_kffxp) in 
(SELECT f.group_number, f.file_number FROM v$asm_file f where f.type='ONLINELOG'))
order by 1
/

! Add the following options to the boot loader (grub) configuration
• iommu=soft elevator=noop apm=off transparent_hugepage=never numa=off powersaved=off

! For very high performance database systems add the following options to the boot loader (grub) configuration in addition to those listed above (PVSCSI required)
• vmw_pvscsi.cmd_per_lun=256 vmw_pvscsi.ring_pages=32

root@oel63ebs lv02]# iozone -a -I -s 256m -r 8192 -g 2G -i 0 -i 1
        Iozone: Performance Test of File I/O
                Version $Revision: 3.414 $
                Compiled for 64 bit mode.
                Build: linux

        Run began: Tue Oct 14 17:47:44 2014

        Auto Mode
        O_DIRECT feature enabled
        File size set to 262144 KB
        Record Size 8192 KB
        Using maximum file size of 2097152 kilobytes.

        Command line used: iozone -a -I -s 256m -r 8192 -g 2G -i 0 -i 1
        Output is in Kbytes/sec
        Time Resolution = 0.000002 seconds.
        Processor cache size set to 1024 Kbytes.
        Processor cache line size set to 32 bytes.
        File stride size set to 17 * record size.
                                                            random  random    bkwd   record   stride                                  
              KB  reclen   write rewrite    read    reread    read   write    read  rewrite     read   fwrite frewrite   fread  freread
          262144    8192 1052943 1359337  1657157  1713078                                                                         
          524288    8192 1357404 1531524  1728982  1745811                                                                         
         1048576    8192 1378301 1626261  1497152  1650120                                                                         
         2097152    8192 1267582 1455948  1531769  1525500                                                                         

iozone test complete.

ost_physical:~ # dd if=/dev/zero of=/lv01/test1 bs=2G count=1 oflag=dsync
0+1 records in
0+1 records out
2147479552 bytes (2.1 GB) copied, 3.53109 s, 608 MB/s
ost_physical:~ # dd if=/lv01/test1 of=/dev/null bs=2G count=1 oflag=dsync
0+1 records in
0+1 records out
2147479552 bytes (2.1 GB) copied, 1.44924 s, 1.5 GB/s

host_physical:/lv01 # hdparm -t --direct /dev/sda3

/dev/sda3:
Timing O_DIRECT disk reads: 1132 MB in  3.00 seconds = 376.96 MB/sec
host_physical:/lv01 # hdparm -t --direct /dev/sdb1

/dev/sdb1:

Timing O_DIRECT disk reads: 7010 MB in  3.00 seconds = 2336.51 MB/sec
host_physical:/lv01 #

https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2069356&customTheme=otn

https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2053145&customTheme=otn

http://www.vmware.com/content/dam/digitalmarketing/vmware/en/pdf/partners/oracle/oracle-databases-on-vmware-best-practices-guide.pdf

https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1010398

Posted in Programming

Resource Usage when allocating RAM

[root@serv-1 dev]# g++ getrusage.c -o get_resource_usage
[root@serv-1 dev]# time ./get_resource_usage
RAM size[MB]: 12
        User CPU: 0.005881
        System CPU: 0.011762
RAM size[MB]: 22
        User CPU: 0.008497
        System CPU: 0.01605
RAM size[MB]: 32
        User CPU: 0.008659
        System CPU: 0.022129
RAM size[MB]: 42
        User CPU: 0.010456
        System CPU: 0.026617
RAM size[MB]: 52
        User CPU: 0.011487
        System CPU: 0.032548
RAM size[MB]: 62
        User CPU: 0.013506
        System CPU: 0.035694
RAM size[MB]: 72
        User CPU: 0.013506
        System CPU: 0.039341
RAM size[MB]: 82
        User CPU: 0.014366
        System CPU: 0.041182
RAM size[MB]: 92
        User CPU: 0.014366
        System CPU: 0.043871
RAM size[MB]: 102
        User CPU: 0.015425
        System CPU: 0.045312

real    0m0.069s
user    0m0.015s
sys     0m0.051s
[root@serv-1 dev]# cat getrusage.c
#include <sys/resource.h>
#include <sys/time.h>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <unistd.h>

#define TO_SEC 1000000

int main() {
  int i = 0;
  struct rusage r_usage;
  struct timeval t_utime, t_stime ;
  while (++i <= 10) {
    void *m = malloc(10*1024*1024);
    memset(m,0,10*1024*1024);
//    usleep(2000000);
    getrusage(RUSAGE_SELF,&r_usage);
    std::cout << "RAM size[MB]: " << r_usage.ru_maxrss/1024 << std::endl ;
    t_utime = r_usage.ru_utime ;
    t_stime = r_usage.ru_stime ;
    std::cout << "\tUser CPU: "
        << (float) t_utime.tv_usec/TO_SEC
        << "\n"
        << "\tSystem CPU: "
        << (float) t_stime.tv_usec/TO_SEC
        << std::endl ;
  }
  return 0;
}