Wednesday, September 19, 2012

License Report

Hi folks,

I could not write since long time. Today I would like to help you that you can generate your own license report on database level. ARS keeps licenses in tables "AR System Current License Usage" and "AR System Historical License Usage". According to the Configuration Guide, a license record is inserted into the Current License Usage when a user is logged in and occupy a license and it is archived to Historical License Usage after some time. If you have assigned Fixed licenses to many users and you do not know which accounts are really used, then you can generate a license report by combining these two tables on database. In this way, you can save some Fixed licenses. First you can start by storing the combination on a temporary table:


create table tmp_recent_license_usage as
select user_name, license_type, timeofaction last_used
from ar_system_current_license_usag
where timeofaction > <some_timestamp>
UNION ALL
select user_name, type_of_license license_type, time last_used
from ar_system_historical_license_u lic
where time > <some_timestamp>

Then you can group records by "user_name" and "license_type" because one user might have logged in with different license type in this time period:


create table tmp_recent_license_usage_user as
select user_name, license_type, unixts_to_date(max(last_used)) last_used
from tmp_recent_license_usage lic
group by user_name, license_type


In the last step, you can take the difference between your Fixed licensed users in Technician Profile form and users recently logged in:


select u.technician_login, u.first_name, u.last_name, u.email_address, gid, t.site user_site
from user_x u
left join technician_profile t on (u.technician_login = t.technician_login)
where node_license_type = 1
  and not exists (select * from tmp_recent_license_usage_user where user_name = u.technician_login and license_type = 'Fixed')
order by u.technician_login

Take care till next time.