I write a python code to check mysql service open or close. It is simple and you can change service_name parameter in the code to check another services. You can download from here check_service_status.py Below code maybe can not run because of python language format is tab structure. You can use with download original code check_service_status.py
Check MySQL Service Status
#-*- coding: utf-8 -*-
service_name = "mysql"
status = os.system('systemctl status '+service_name+ ' > /dev/null')
if (check_service_status(service_name) == 0):
Continue reading “Check Service Status With Python on OEL 7 / Centos 7”
786 total views, 20 views today
If you want to do update another column when execute an update on table, you can use before update trigger. If you use after update trigger, you can get some errors. if you use pragma autonomous_transaction parameter as declare in trigger you can get errors like that are “ORA-00060: deadlock detected while waiting for resource”, “ORA-06512: at “trigger_name” line 7″,”ORA-04088:error during execution of trigger “trigger_name”” if you don’t use, you can get errors like that are “ORA-04091: table tablename is mutating, trigger/function may not see it”,”ORA-06512: at trigger_name”, line 6″,”ORA-04088: error during execution of trigger trigger_name”
You can resolve this problem with using before update trigger. You can update another column of updating the same table.
My example is about that If status column of table1 change from 0 to 1, I will write another columns that are name, surname and studentno at the same table table1.
create table table1 (id number, status number, name varchar2(100), surname varchar2(100), studentno varchar2(100),address varchar2(500),city varchar2(100));
create or replace trigger trg_trigger_name_upt
before update of status on table1
referencing OLD as old NEW as new
for each row
IF :old.status = 0 AND :new.status = 1 and UPDATING THEN
:new.name := ‘Fatih’;
:new.surname := ‘Acar’;
v_studentno := seq_studentno.nextval;
:new.studentno := v_studentno;
875 total views, 20 views today
pg_upgrade (formerly called pg_migrator) allows data stored in PostgreSQL data files to be upgraded to a later PostgreSQL major version without the data dump/reload typically required for major version upgrades, e.g. from 8.4.7 to the current major release of PostgreSQL. It is not required for minor version upgrades, e.g. from 9.0.1 to 9.0.4.
Major PostgreSQL releases regularly add new features that often change the layout of the system tables, but the internal data storage format rarely changes. pg_upgrade uses this fact to perform rapid upgrades by creating new system tables and simply reusing the old user data files. If a future major release ever changes the data storage format in a way that makes the old data format unreadable, pg_upgrade will not be usable for such upgrades. (The community will attempt to avoid such situations.)
pg_upgrade does its best to make sure the old and new clusters are binary-compatible, e.g. by checking for compatible compile-time settings, including 32/64-bit binaries. It is important that any external modules are also binary compatible, though this cannot be checked by pg_upgrade.
pg_upgrade supports upgrades from 8.4.X and later to the current major release of PostgreSQL, including snapshot and alpha releases.
Source : postgresql.org
Steps Of Upgrade
- Install PostgreSQL new release packages
- Create new directory for 9.6
- Initialize 9.6 version in 9.6 directory
- Configure pg_hba.conf and postgresql.conf regarding to changed parameters of 9.5 version
- Stop 9.5 PostgreSQL service
- Start pg_upgrade
- Change PostgreSQL service name and start PostgreSQL 9.6
OS : Centos 7 x64
PG : 9.5
DIR : /pgdata/9.5/data/
SERVICE : postgresql.service
Install PostgreSQL new release packages
[root@testdb /tmp]# yum install postgresql96-libs.x86_64 postgresql96.x86_64 postgresql96-server.x86_64 postgresql96-contrib.x86_64 postgresql96-devel.x86_64 postgresql96-python.x86_64 postgresql96-plpython.x86_64
Create new directory for 9.6
Continue reading “PostgreSQL Upgrade From 9.5 Version To 9.6 Version With PG_UPGRADE”
2,060 total views, 50 views today
Changing hostname is different from RHEL 6 version in RHEL 7. You can use few method to change hostname. I will demonstrate useful and easy method that is hostnamectl command.
Show Current Hostname
[root@localhost ~]# hostname
[root@localhost ~]# hostnamectl status
Static hostname: localhost.localdomain
Icon name: computer-vm
Machine ID: 418f684e1a5c45c9a22f76065c732de3
Boot ID: 9b07d8a45e60437e9ef31164d394ad17
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.36.3.el7.x86_64
Continue reading “Change Hostname in RHEL 7”
1,191 total views, 5 views today
What is firewalld
Firewalld provides a dynamically managed firewall with support for network/firewall zones that define the trust level of network connections or interfaces. It has support for IPv4, IPv6 firewall settings, ethernet bridges and IP sets. There is a separation of runtime and permanent configuration options. It also provides an interface for services or applications to add firewall rules directly.
Benefits of using firewalld
Changes can be done immediately in the runtime environment. No restart of the service or daemon is needed.
With the firewalld D-Bus interface it is simple for services, applications and also users to adapt firewall settings. The interface is complete and is used for the firewall configuration tools firewall-cmd, firewallctl, firewall-config and firewall-applet.
The separation of the runtime and permanent configuration makes it possible to do evaulation and tests in runtime. The runtime configuration is only valid up to the next service reload and restart or to a system reboot. Then the permanent configuration will be loaded again. With the runtime environment it is possible to use runtime for settings that should only be active for a limited amount of time. If the runtime configuration has been used for evaluation, and it is complete and working, then it is possible to save this configuration to the permanent environment.
Add a Port to Firewalld as temporary
[root@test ~]# firewall-cmd –add-port=1521/tcp
Add a Port to Firewalld as permanent
Continue reading “Firewalld Add New Port, List All Ports, Remove Port with firewall-cmd command in Oracle Linux 7”
2,055 total views, 30 views today
If primary side of Availability Groups (AG) is down and can not be online, you can perform failover operation. When primary side is down, probably, you can see state of Availability Groups at the secondary side like below.
If you get an error after click Failover button, probably your AG has a problem. You can use force manual failover steps. Steps is here : http://www.fatihacar.com/blog/mssql-server-2012-availability-groups-ag-force-manual-failover/
Continue reading “MsSQL Server 2012 Availability Groups (AG) Manual Failover”
790 total views, 15 views today
When you can not access primary side of AG and you can not run failover on second side (disaster side), you can perform force manual failover operation on second side. You have to know that force manual failover operation can cause loss data which is able to last some database operation.
When primary side is down, you can see your Availability Groups and database on SQL Server Management Studio at the secondary (disaster side) like below.
Failover Cluster Manager is down. Probably, you can not see any failover cluster on Failover Cluster Manager.
Force Manual Failover
You can use the forced quorum procedure on a WSFC cluster node to override the safety controls that took the cluster offline. This effectively tells the cluster to suspend the quorum voting checks, and lets you bring the WSFC cluster resources and SQL Server back online on any of the nodes in the cluster.
You have to restart your WSFC (Quorum) with below commands.
Open a command prompt and execute below commands.
net.exe stop clussvc
net.exe start clussvc /forcequorum
Continue reading “MsSQL Server 2012 Availability Groups (AG) Force Manual Failover”
875 total views, 30 views today
If you have a column with full name data and you want to split this data, you can use below function to split operation.
Split Name ve Surname
Table : test
Data1 : Emin Fatih Acar
Data2 : Fatih Acar
SQL> select fullname,
substr(fullname,0,instr(fullname,’ ‘,Instr(fullname,’ ‘,-1))-1) name,
substr(fullname,Instr(fullname,’ ‘,-1)+1) surname
name : Emin Fatih
surname : Acar
name : Fatih
surname : Acar
Split Name,Midname and Surname
SQL> select fullname,
substr(fullname,0,instr(fullname,’ ‘)-1) name,
substr(fullname,instr(fullname,’ ‘)+1,Instr(fullname,’ ‘,-1,1)- instr(fullname,’ ‘)-1) midname,
substr(fullname,Instr(fullname,’ ‘,-1)+1) surname,
name : Emin
midname : Fatih
surname : Acar
name : Fatih
midname : null
surname : Acar
831 total views, 15 views today
Turkey is breaking step with Europe and keeping summer time through the winter. Instead of turning clocks back an hour as they do in the European Union in the autumn, Turkey will keep the clocks as they are and effectively change the country’s time zone. You have to implement new tzdata-2016g package on your systems to accommodate new decision.
You can install from Red Hat yum repository if you use Red Hat system. (Red Hat, Centos, Oracle Linux)
yum install tzdata*2016g*
Both tzdata-java-2016g and tzdata-2016g package installation will be useful.
Check New Adjustment
You check new time zone status with zdump command like below.
zdump -c 2016,2017 -v “Europe/Istanbul”
You have not to see Oct 30 date and gmtoff value 7200. You have to see gmtoff value 10800.
3,886 total views, 20 views today
Error: Checkpoint not complete, Cannot Allocate New Log Warning
Thread 1 cannot allocate new log, sequence 125487
Checkpoint not complete
Solution: Checkpoint not complete messages are generated due to the logs are switching so fast that the checkpoint associated with the log switch isn’t complete. You should increase redo log file size and amount to resolve. Also, If you use archive_lag_target parameter as near zero for example like 1 or 2 minutes, you should change this parameter zero (no lag) or more than 10-15 min. Oracle recommends that redo log switch operation interval should be between 15-30 minutes.
Show and change archive_lag_target parameter
SQL> show parameter archive_lag_target;
SQL> alter system set archive_lag_target=0 scope=both;
SQL> alter system set archive_lag_target=1800 scope=both;
1800 is 15 minutes. Parameter value as second.
If your archive_lag_target parameter is normal and you get checkpoint not complete error, you have to look your redo log file size and amount.
Continue reading “Oracle 11g Oracle Checkpoint Not Complete, Cannot Allocate New Log Warning”
1,936 total views, 10 views today