Code:
$ awk -F, -v OFS=, '/cube/{a=$3} /minutes/{$NF=$NF","a}1' a.txt
Wed,Database,ABC_cube,loaded
Wed,Logging,out,user,302002654,active,for,0,minutes,ABC_cube
Wed,Logging,out,user,109000151,active,for,8,minutes,ABC_cube
Wed,Logging,out,user,302002654,active,for,0,minutes,ABC_cube
Wed,Logging,out,user,302002654,active,for,60,minutes,ABC_cube
Wed,Database,XYZ_cube,loaded
Wed,Logging,out,user,302002654,active,for,0,minutes,XYZ_cube
Wed,Logging,out,user,109000151,active,for,8,minutes,XYZ_cube
Wed,Logging,out,user,302002654,active,for,0,minutes,XYZ_cube
Wed,Logging,out,user,302002654,active,for,60,minutes,XYZ_cube
Wed,Database,DBC_cube,loaded
Wed,Logging,out,user,302002654,active,for,0,minutes,DBC_cube
Wed,Logging,out,user,109000151,active,for,8,minutes,DBC_cube
Wed,Logging,out,user,302002654,active,for,0,minutes,DBC_cube
Wed,Logging,out,user,302002654,active,for,60,minutes,DBC_cube