Getting today’s Errors and Warnings from MySQL log

Quick one!

# Warnings

cat /var/log/mysqld.log |grep `date +%y%m%d` | grep "\[Warning\]"

# Errors

cat /var/log/mysqld.log |grep `date +%y%m%d` | grep "\[ERROR\]"

And a Bonus!
To get entries from X days ago:

cat /var/log/mysqld.log |grep `date --date="46 days ago" +%y%m%d`

Matheus.

AIX: NTP Service Basics

Hi all,
I always forget the command and have to search it again. For further searches, I expect to found in my own posts… 🙂

> To start Service

startsrc -s xntpd

> To stop Service

stopsrc -s xntpd

> Configuration File

/etc/ntpd.conf

Expect it be useful to you too.
See ya!
Matheus.

VMWare: Adding Shared Disks for Clustered Oracle Database

Hi folks!
Today a friend asked about how to configure disks on VMWare to create a virtualized cluster database. I revisited my old notes and decided to share. Here it goes…

First, I really have some constraints about it:
– Fake “high availability”: To have HA with VM it’s not needed 2 vms, if a host fail VMWare should make a VMotion (if well configured), and no services will be affected. So, one VM is ok.
– Not real “horizontally scallated”: It probably would be better to use one server as physical than have two vms on it. Not make sense to do it…

So, why?
To prove concept, evaluate RAC configuration (caches on sequences, etc) and labs, to learn and practice RAC stuffs…

Ok, now how to make it happen?

1. Add new disk to one of the machines. Some way, one will be the “primary” and share disks with another.
add1.jpg

2. Set Mode Thick Eager Zeroed

add2.jpg

3. Create a specific controller to this “shared disks”

add3.jpg

4. Set controller to virtual sharing

add4.jpg

# Other Machine
5. Adding the existent disk to other VM (not primary, but from primary)

add5.jpg
6. Select disk from primary

add6.jpg

add7.jpg

7. Create a new controller, as you made on primary and select it:

add8.jpgadd9.jpg

8. Set controller to virtual sharing
add10

OBS:
If this error happen, one of your controller is not in sharing mode. Please check it.
add11

 

And here we are! 🙂
Good lab!
Matheus.

Linux: Resizing Swap Online

Hi all!
Quick one to resize swap online:

[root@server-db ~]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/mapper/rootvg-lvswap              partition       5242872 373624  -1
[root@server-db ~]# vgs
VG                #PV #LV #SN Attr   VSize   VFree
[...]
rootvg              1   6   0 wz--n- 135.69G 5.69G
[...]
[root@server-db ~]# lvextend -L +2048M /dev/mapper/rootvg-lvswap
Extending logical volume lvswap to 7.00 GB
Logical volume lvswap successfully resized
[root@server-db ~]# vgs
VG                #PV #LV #SN Attr   VSize   VFree
[...]
rootvg              1   6   0 wz--n- 135.69G 3.69G
[...]
[root@server-db ~]# mkswap /dev/mapper/rootvg-lvswap
Setting up swapspace version 1, size = 7516188 kB
[root@server-db ~]# swapoff /dev/mapper/rootvg-lvswap
[root@server-db ~]# swapon /dev/mapper/rootvg-lvswap
[root@server-db ~]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/mapper/rootvg-lvswap              partition       7516188 373624  -1

See ya!
Matheus.

Monitoring MySQL with Nagios – Quick View

Hi all!
As you know, we have some commercial solutions to monitoring/alerting MySQL, like MySQL Enterprise Monitor or Oracle Grid/Cloud Control.

But, regarding we are using MySQL instead of Oracle Database, we can assume it’s probably a decision taken based on cost. So, considering Open Source solutions, we basically have Nagios, Zabbix, OpenNMS…

MangagedMonitoringConsole

 

Thinking on Nagios, in my opinion the “supra sumo” is mysql_health_check.pl.
Below whitepaper and presentation:
White Paper
Presentation
Code
Good one by Sheeri Cabral and posted here!

Any way, with theese two we can make lots of magic:

1. check_mysql.pl
– Check status of MySql server (slow queries, etc)
– Queries per second graph

2. check_db_query.pl
– Allowes to run SQL Queries and setting thresholds for warning e critical. Ex:

check_db_query.pl -d database -q query [-w warn] [-c crit] [-C conn_file] [-p placeholder]

Ex for Nagios call:

define command{
command_name    check_db_entries
command_line    /usr/local/bin/perl $USER1$/check_db_query.pl -d "$ARG1$" -q "$ARG2$" $ARG3$
}

So, now it’s just make your queries and implement your free monitoring on MySQL! 🙂
Matheus.

Linux Basic: Creating a Filesystem

From disk to filesystem:

> Rescan on scisi controller to detect the disk (controller id 0, in  this example)

echo "- - -" > /sys/class/scsi_host/host0/scan

– List disks

fdisk -l

> Fdisk choosing options n -> new p->partition 1-> partition number

fdisk /dev/sdm

> Create physcal volume

pvcreate /dev/sdm1

> Create Volume Group

vgcreate oracle /dev/sdb1

> Rename Volume Group

vgrename oracle vgoracle

> Create LV

lvcreate -L 19G -n lvoracle vgoracle

> Extend LV

lvextend -L +990M /dev/vgoracle/lvoracle

> Make FileSystem

mkfs.ext3 -m 0 -v /dev/vgoracle/lvoracle

OBS: m 0 is the journal (for recovery in case of crash).  “0” because I don’t want it now. So, 100% of disco will be available for using on fs.

> Mount filesystem on Directory

mount -t ext3 /dev/vgoracle/lvoracle /oracle/

> Just to check:

$ df -h
/dev/mapper/vgoracle-lvoracle
20G  173M   20G   1% /oracle

 

Have a nice day!
Matheus.

PRCR-1079 CRS-2674 CRS-5017 ORA-27102: out of memory Linux-x86_64 Error: 28: No space left on device

# Problem

myserver:/home/oracle>srvctl start database -d mydb
PRCR-1079 : Failed to start resource ora.mydb.db
CRS-5017: The resource action "ora.mydb.db start" encountered the following error:
ORA-27102: out of memory
Linux-x86_64 Error: 28: No space left on device
. For details refer to "(:CLSN00107:)" in "/grid/product/11.2.0/log/myserver/agent/crsd/oraagent_oracle/oraagent_oracle.log".
CRS-2674: Start of 'ora.mydb.db' on 'myserver' failed
CRS-5017: The resource action "ora.mydb.db start" encountered the following error:
ORA-27102: out of memory
Linux-x86_64 Error: 28: No space left on device
. For details refer to "(:CLSN00107:)" in "/grid/product/11.2.0/log/myserver2/agent/crsd/oraagent_oracle/oraagent_oracle.log".
CRS-2674: Start of 'ora.mydb.db' on 'myserver2' failed
CRS-2632: There are no more servers to try to place resource 'ora.mydb.db' on that would satisfy its placement policy
myserver:/home/oracle>

# Solution

On /etc/sysctl.conf ajust as below and then reload sysctl (“sysctl -p” as root):

#Old
#kernel.shmall = 24641536
#New
kernel.shmall = 4294967296

Matheus.

Is My Linux Server Physical or Virtual?

Supposing you are in a server shell and don’t know if you machine is virtualized (a VM)?
One way to check that (supposing VMWare as hypervisioning solution) is:

[root@mydbsrvr ~]# dmidecode | grep -i vmware
Manufacturer: VMware, Inc.
Product Name: VMware Virtual Platform
Serial Number: VMware-xx xx xx xx xx xx xx xx-xx xx xx xx xx xx xx xx
Description: VMware SVGA II

If you had an answer like this, yes, it’s a VM. 🙂

Matheus.