Category Archives: Allgemein

Downtime Query WinCC OA with RDB-Manager…

Example how to query the downtime of a device which has an alert configuration on the state of the machine (state 0/1):

select element_name, sum(downtime) downtime from (
select e.element_name,
h.ts,
h.VALUE_NUMBER,
h.direction,
case
when h.DIRECTION = 0 then
CAST((h.ts + 0) - ((lag(h.ts, 1, h.ts) OVER(ORDER BY ts)) + 0) AS FLOAT)*24*60*60
else
null
end as downtime
from elements e
join alerthistory h
on e.element_id = h.ELEMENT_ID
where e.element_name like
'Device_%.Status'
and ts between to_date('01.07.2014','DD.MM.YYYY') and to_date('31.07.2014','DD.MM.YYYY')
) group by element_name

Oracle 12c unified audit trail fills up SYSAUX tablespace (schema AUDSYS)


-- clean audit trail for the current container
BEGIN
DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL(
AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,
USE_LAST_ARCH_TIMESTAMP => FALSE,
CONTAINER => DBMS_AUDIT_MGMT.CONTAINER_CURRENT );
END;

-- drop purge job
BEGIN
DBMS_AUDIT_MGMT.DROP_PURGE_JOB(
AUDIT_TRAIL_PURGE_NAME => 'Audit_Trail_PJ');
END;
/

-- create purge job for current container
BEGIN
DBMS_AUDIT_MGMT.CREATE_PURGE_JOB (
AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,
AUDIT_TRAIL_PURGE_INTERVAL => 12,
AUDIT_TRAIL_PURGE_NAME => 'Audit_Trail_PJ',
USE_LAST_ARCH_TIMESTAMP => FALSE,
CONTAINER => DBMS_AUDIT_MGMT.CONTAINER_CURRENT);
END;
/
/

Windows uninstall nonpresent devices…

When you want to rename a network adapter and you go “Cannot rename this connection. A connection with the name you specified already exists. Specify a different name.” You get this message for examle exwhen you changed the network card and you want to change the name of the new one to the same name the old one had.

Solution is to remove the old unused network adapter:

1.Click Start, click Run, type cmd.exe, and then press ENTER.
2.Type set devmgr_show_nonpresent_devices=1, and then press ENTER.
3.Type Start DEVMGMT.MSC, and then press ENTER.
4.Click View, and then click Show Hidden Devices.
5.Expand the Network Adapters tree.
6.Right-click the dimmed network adapter, and then click Uninstall

Windows VPN connection with local default gateway…

 

 

If you have created a VPN connection then as default the network configuration will be changed so that the gateway is set to the remote network. Then you will not be able to access the local network and also you will not have access to the local internet.

This can be changed by removing the setting “Use default gateway on remote network”:vpn-gateway

WinCC OA Android App…

I now also built an Android App to visualize my Home-Automation data (powered by WinCC OA – www.etm.at).

Because i did the same for iOS and used C# for coding (Xamarin Framework) i was able to share about 70% of the code between both Apps (iOS and Android). So there was no need to re-implement the communication and business logic!! All i had to do is to get familiar with the Android-UI…

App: http://www.rocworks.at/wordpress/rocvmobile/

Android-App:

2013-09-23 12.55.05 Screenshot_2013-09-23-16-26-26 2013-09-22 07.09.00 test1 Screenshot_2013-09-22-14-09-48