Skip to content

Commit c63324e

Browse files
committed
Refresh info about existing PanoramaSampler tables at each login
1 parent 59800b5 commit c63324e

File tree

9 files changed

+35
-32
lines changed

9 files changed

+35
-32
lines changed

Gemfile.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ GEM
109109
prism (>= 1.3.0)
110110
rdoc (>= 4.0.0)
111111
reline (>= 0.4.2)
112-
jar-dependencies (0.5.5)
112+
jar-dependencies (0.5.7)
113113
jbuilder (2.14.1)
114114
actionview (>= 7.0.0)
115115
activesupport (>= 7.0.0)
@@ -120,7 +120,7 @@ GEM
120120
rb-fsevent (~> 0.10, >= 0.10.3)
121121
rb-inotify (~> 0.9, >= 0.9.10)
122122
logger (1.7.0)
123-
loofah (2.25.0)
123+
loofah (2.25.1)
124124
crass (~> 1.0.2)
125125
nokogiri (>= 1.12.0)
126126
mail (2.9.0)
@@ -133,7 +133,7 @@ GEM
133133
mime-types (3.7.0)
134134
logger
135135
mime-types-data (~> 3.2025, >= 3.2025.0507)
136-
mime-types-data (3.2026.0303)
136+
mime-types-data (3.2026.0317)
137137
mini_mime (1.1.5)
138138
minitest (6.0.2)
139139
drb (~> 2.0)
@@ -148,7 +148,7 @@ GEM
148148
net-smtp (0.5.1)
149149
net-protocol
150150
nio4r (2.7.5-java)
151-
nokogiri (1.19.1-java)
151+
nokogiri (1.19.2-java)
152152
racc (~> 1.4)
153153
playwright-ruby-client (1.58.1)
154154
base64
@@ -240,7 +240,7 @@ GEM
240240
sprockets (>= 3.0.0)
241241
thor (1.5.0)
242242
tilt (2.7.0)
243-
timeout (0.6.0)
243+
timeout (0.6.1)
244244
tsort (0.2.0)
245245
tzinfo (2.0.6)
246246
concurrent-ruby (~> 1.0)
@@ -319,24 +319,24 @@ CHECKSUMS
319319
i18n (1.14.8) sha256=285778639134865c5e0f6269e0b818256017e8cde89993fdfcbfb64d088824a5
320320
io-console (0.8.2-java) sha256=837efefe96084c13ae91114917986ae6c6d1cf063b27b8419cc564a722a38af8
321321
irb (1.17.0) sha256=168c4ddb93d8a361a045c41d92b2952c7a118fa73f23fe14e55609eb7a863aae
322-
jar-dependencies (0.5.5) sha256=2972b9fcba4b014e6446a84b5c09674a3e8648b95b71768e729f0e8e40568059
322+
jar-dependencies (0.5.7) sha256=013ce5f4639414ac8cf1169cdbe763da164b81e2d2c983d11042b5ff7bfcce80
323323
jbuilder (2.14.1) sha256=4eb26376ff60ef100cb4fd6fd7533cd271f9998327e86adf20fd8c0e69fabb42
324324
jwt (3.1.2) sha256=af6991f19a6bb4060d618d9add7a66f0eeb005ac0bc017cd01f63b42e122d535
325325
listen (3.10.0) sha256=c6e182db62143aeccc2e1960033bebe7445309c7272061979bb098d03760c9d2
326326
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
327-
loofah (2.25.0) sha256=df5ed7ac3bac6a4ec802df3877ee5cc86d027299f8952e6243b3dac446b060e6
327+
loofah (2.25.1) sha256=d436c73dbd0c1147b16c4a41db097942d217303e1f7728704b37e4df9f6d2e04
328328
mail (2.9.0) sha256=6fa6673ecd71c60c2d996260f9ee3dd387d4673b8169b502134659ece6d34941
329329
marcel (1.1.0) sha256=fdcfcfa33cc52e93c4308d40e4090a5d4ea279e160a7f6af988260fa970e0bee
330330
mime-types (3.7.0) sha256=dcebf61c246f08e15a4de34e386ebe8233791e868564a470c3fe77c00eed5e56
331-
mime-types-data (3.2026.0303) sha256=164af1de5824c5195d4b503b0a62062383b65c08671c792412450cd22d3bc224
331+
mime-types-data (3.2026.0317) sha256=77f078a4d8631d52b842ba77099734b06eddb7ad339d792e746d2272b67e511b
332332
mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef
333333
minitest (6.0.2) sha256=db6e57956f6ecc6134683b4c87467d6dd792323c7f0eea7b93f66bd284adbc3d
334334
net-imap (0.6.3) sha256=9bab75f876596d09ee7bf911a291da478e0cd6badc54dfb82874855ccc82f2ad
335335
net-pop (0.1.2) sha256=848b4e982013c15b2f0382792268763b748cce91c9e91e36b0f27ed26420dff3
336336
net-protocol (0.2.2) sha256=aa73e0cba6a125369de9837b8d8ef82a61849360eba0521900e2c3713aa162a8
337337
net-smtp (0.5.1) sha256=ed96a0af63c524fceb4b29b0d352195c30d82dd916a42f03c62a3a70e5b70736
338338
nio4r (2.7.5-java) sha256=d14779d2a9b012ec0148a53344fbb2ed2a3c4d90c5dd923bf281135ab983b2c9
339-
nokogiri (1.19.1-java) sha256=1e0bda88b1c6409f0edb9e0c25f1bf9ff4fa94c3958f492a10fcf50dda594365
339+
nokogiri (1.19.2-java) sha256=e9d67034bc80ca71043040beea8a91be5dc99b662daa38a2bfb361b7a2cc8717
340340
playwright-ruby-client (1.58.1) sha256=0678b227eb469c551858784441891577b402163e9b2d50bddce4a5a904e3a5ca
341341
pp (0.6.3) sha256=2951d514450b93ccfeb1df7d021cae0da16e0a7f95ee1e2273719669d0ab9df6
342342
prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193
@@ -370,7 +370,7 @@ CHECKSUMS
370370
sprockets-rails (3.5.2) sha256=a9e88e6ce9f8c912d349aa5401509165ec42326baf9e942a85de4b76dbc4119e
371371
thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73
372372
tilt (2.7.0) sha256=0d5b9ba69f6a36490c64b0eee9f6e9aad517e20dcc848800a06eb116f08c6ab3
373-
timeout (0.6.0) sha256=6d722ad619f96ee383a0c557ec6eb8c4ecb08af3af62098a0be5057bf00de1af
373+
timeout (0.6.1) sha256=78f57368a7e7bbadec56971f78a3f5ecbcfb59b7fcbb0a3ed6ddc08a5094accb
374374
tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
375375
tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
376376
tzinfo-data (1.2026.1) sha256=4ea36519ae5ae2cf0fad471207a519be006daf42e3b2359ee9e9c53f113609fd

app/controllers/env_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ def set_database_by_id
289289
# TODO: encrypt password with session specific key
290290
raise "No saved login info found at position #{params[:saved_logins_id]}" if params[:database].nil?
291291
params[:database][:query_timeout] = 360 unless params[:database][:query_timeout] # Initialize if stored login dies not contain query_timeout
292-
params.delete(:cached_panorama_object_sizes_exists) # Reset cached info so first access reads new state from database
293292
raise "env_controller.set_database_by_id: No database found to login! Please use direct login!" unless params[:database]
294293
set_database
295294
end

app/helpers/application_helper.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,6 @@ def get_cached_time_selection_end
118118
@buffered_time_selection_end
119119
end
120120

121-
def get_cached_panorama_object_sizes_exists
122-
current_database = get_current_database
123-
if current_database[:cached_panorama_object_sizes_exists].nil?
124-
current_database[:cached_panorama_object_sizes_exists] = PanoramaSamplerStructureCheck.panorama_table_exists?('Panorama_Object_Sizes')
125-
set_current_database(current_database) # write back to store
126-
end
127-
current_database[:cached_panorama_object_sizes_exists]
128-
end
129-
130-
131121
# Genutzt zur Anzeige im zentralen Screen
132122
def current_tns
133123
get_current_database[:tns] if get_current_database

app/helpers/menu_helper.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def menu_content
1616
{class: 'menu', caption: 'DB-Locks', content: [
1717
{class: 'item', caption: t(:menu_current_caption, :default => 'Current'), controller: :dba, action: 'show_locks', hint: t(:menu_dba_locks_hint, :default => 'shows current locking state incl. blocking sessions')},
1818
{class: 'item', caption: t(:menu_dba_blocking_locks_historic_caption, :default => 'Blocking locks historic from ASH'), controller: 'active_session_history', action: 'show_blocking_locks_historic', hint: t(:menu_dba_blocking_locks_historic_hint, :default => 'Show historic blocking locks information from Active Session History')},
19-
{class: 'item', caption: t(:menu_dba_blocking_locks_historic_panorama_caption, :default => 'Blocking locks historic from Panorama-Sampler'), controller: :addition, action: :show_blocking_locks_history, hint: t(:menu_dba_blocking_locks_historic_panorama_hint, :default => 'Show historic blocking locks information from Panorama-Sampler'), condition: PanoramaSamplerStructureCheck.panorama_table_exists?('Panorama_Blocking_Locks')},
19+
{class: 'item', caption: t(:menu_dba_blocking_locks_historic_panorama_caption, :default => 'Blocking locks historic from Panorama-Sampler'), controller: :addition, action: :show_blocking_locks_history, hint: t(:menu_dba_blocking_locks_historic_panorama_hint, :default => 'Show historic blocking locks information from Panorama-Sampler'), condition: PanoramaConnection.panorama_table_exists?('Panorama_Blocking_Locks')},
2020
]
2121
},
2222
{:class => 'menu', :caption => 'Redo-Logs', :content => [
@@ -82,7 +82,7 @@ def menu_content
8282
{:class=> 'item', :caption=>t(:menu_current_caption, :default=> 'Current'), :controller=>:dba, :action=> 'show_session_waits', :hint=>t(:menu_wait_session_current_hint, :default=> 'All current session waits') },
8383
{:class=> 'item', :caption=>t(:menu_historic_caption, :default=> 'Historic'), :controller=> 'active_session_history', :action=> 'show_session_statistics_historic', :hint=>t(:menu_wait_session_historic_hint, :default=> 'Prepared active session history from DBA_Hist_Active_Sess_History') },
8484
{:class=> 'item', :caption=>'CPU-Usage / DB-Time', :controller=> :dba_waits, :action=> :show_cpu_usage_historic, :hint=>t(:menu_wait_session_cpu_hint, :default=> "Historic CPU-Usage and DB-Time from DBA_Hist_Active_Sess_History.\nShows you the difference between real CPU-usage and waiting for CPU\nif you don't have Resource Manager activated.\nDifference means you have more sessions waiting for CPU than your system's number of CPU-cores.") },
85-
{class: 'item', caption: t(:menu_wait_longterm_trend_caption, :default=>'Long-term trend'), controller: :longterm_trend, action: :show_longterm_trend, hint: t(:menu_wait_longterm_trend_hint, :default=>'Long-term trend recording of session waits'), condition: PanoramaSamplerStructureCheck.panorama_table_exists?('LongTerm_Trend')},
85+
{class: 'item', caption: t(:menu_wait_longterm_trend_caption, :default=>'Long-term trend'), controller: :longterm_trend, action: :show_longterm_trend, hint: t(:menu_wait_longterm_trend_hint, :default=>'Long-term trend recording of session waits'), condition: PanoramaConnection.panorama_table_exists?('LongTerm_Trend')},
8686
]
8787
},
8888
{ :class=> 'menu', :caption=> 'Segment Statistics', :content=>[
@@ -155,7 +155,7 @@ def menu_content
155155
]
156156
},
157157
{:class=> 'item', :caption=> 'Tablespace-Objects', :controller=>:dba_schema, :action=>:show_object_size, :hint=>t(:menu_dba_schema_ts_objects_hint, :default=> 'DB-objects by size, utilization and wastage') },
158-
{class: 'item', caption: t(:menu_addition_size_evolution_caption, :default => 'Object size evolution'), controller: 'addition', action: 'show_object_increase', hint: t(:menu_addition_size_evolution_hint, :default => 'Evolution of object sizes in considered time period'), condition: get_cached_panorama_object_sizes_exists},
158+
{class: 'item', caption: t(:menu_addition_size_evolution_caption, :default => 'Object size evolution'), controller: 'addition', action: 'show_object_increase', hint: t(:menu_addition_size_evolution_hint, :default => 'Evolution of object sizes in considered time period'), condition: PanoramaConnection.panorama_object_sizes_exists?},
159159
{:class=> 'item', :caption=> 'Describe object', :controller=>:dba_schema, :action=>:describe_object, :hint=>'Describe database object (table, index, materialized view ...)' },
160160
{:class=> 'item', :caption=> 'Invalid objects', :controller=>:dba_schema, :action=>:invalid_objects, :hint=>'List invalid objects (from DBA_Objects and DBA_Indexes)' },
161161
{:class=> 'item', :caption=> 'Recycle bin', :controller=>:storage, :action=>:list_recycle_bin, :hint=>'Show content of recycle bin' },
@@ -215,7 +215,7 @@ def menu_content
215215
{ :class=> 'menu', :caption=> 'DB-Cache', :content=>[
216216
{:class=> 'item', :caption=>t(:menu_sga_pga_cache_usage_caption, :default=> 'DB-cache usage current'), :controller=> 'dba_sga', :action=> 'db_cache_content', :hint=>t(:menu_sga_pga_cache_usage_hint, :default=> 'Current content of DB-cache') },
217217
{:class=> 'item', :caption=>t(:menu_sga_pga_cache_advice_caption, :default=> 'DB-cache advice'), :controller=> 'dba_sga', :action=> 'show_db_cache_advice_historic', :hint=>t(:menu_sga_pga_cache_advice_hint, :default=>"Historic view on what-happens-if-analysis for change of cache size") },
218-
{:class=> 'item', :caption=>t(:menu_sga_pga_cache_usage_historic_caption, :default=>'DB-cache usage historic'), :controller=> 'addition', :action=> 'db_cache_ressourcen', :hint=>t(:menu_sga_pga_cache_usage_historic_hint, :default=>'Historic view on DB-cache usage by Panorama_Cache_Objects'), condition: PanoramaSamplerStructureCheck.panorama_table_exists?('Panorama_Cache_Objects') }
218+
{:class=> 'item', :caption=>t(:menu_sga_pga_cache_usage_historic_caption, :default=>'DB-cache usage historic'), :controller=> 'addition', :action=> 'db_cache_ressourcen', :hint=>t(:menu_sga_pga_cache_usage_historic_hint, :default=>'Historic view on DB-cache usage by Panorama_Cache_Objects'), condition: PanoramaConnection.panorama_table_exists?('Panorama_Cache_Objects') }
219219
]
220220
},
221221
{ :class=> 'menu', :caption=>t(:menu_sga_pga_object_usage_caption, :default=> 'Object usage by SQL'), :content=>[

app/models/panorama_connection.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,23 @@ def self.get_connection_pool #
483483
@@connection_pool
484484
end
485485

486+
# Check for existence and readability of a table
487+
def self.panorama_table_exists?(table_name)
488+
return false if PanoramaConnection.get_threadlocal_config[:panorama_sampler_schema].nil?
489+
PanoramaConnection.sql_select_one(["SELECT COUNT(*) FROM All_Tables WHERE Table_Name=? and Owner = '#{PanoramaConnection.get_threadlocal_config[:panorama_sampler_schema].upcase}'", table_name.upcase]) > 0
490+
end
491+
492+
493+
# Check existence and readability of the sampler table
494+
# Execute only once per connection
495+
def panorama_object_sizes_exists?
496+
unless defined?(@panorama_object_sizes_exists) && !@panorama_object_sizes_exists.nil?
497+
@panorama_object_sizes_exists = PanoramaConnection.panorama_table_exists?('Panorama_Object_Sizes')
498+
end
499+
@panorama_object_sizes_exists
500+
end
501+
502+
486503
def self.all_awr_dbids; check_for_open_connection.all_awr_dbids; end
487504
def self.autonomous_database?; check_for_open_connection.autonomous_database?; end
488505
def self.block_common_header_size; check_for_open_connection.block_common_header_size; end
@@ -503,6 +520,7 @@ def self.login_container_dbid; check_for_open_connection(false).login
503520
# Use PackLicense.tuning_pack_licensed? etc. instead of this method
504521
def self.management_pack_license; PanoramaConnection.get_threadlocal_config[:management_pack_license]; end
505522
def self.min_awr_interval; check_for_open_connection.min_awr_interval; end
523+
def self.panorama_object_sizes_exists?; check_for_open_connection.panorama_object_sizes_exists?; end
506524
def self.pdbs; check_for_open_connection.pdbs; end
507525
def self.pid; check_for_open_connection.pid; end
508526
def self.rac?; check_for_open_connection.cluster_database.upcase == 'TRUE'; end

app/models/panorama_sampler_structure_check.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,6 @@ def self.panorama_sampler_schemas(option = nil)
146146
panorama_sampler_data
147147
end
148148

149-
def self.panorama_table_exists?(table_name)
150-
return false if PanoramaConnection.get_threadlocal_config[:panorama_sampler_schema].nil?
151-
PanoramaConnection.sql_select_one(["SELECT COUNT(*) FROM All_Tables WHERE Table_Name=? and Owner = '#{PanoramaConnection.get_threadlocal_config[:panorama_sampler_schema].upcase}'", table_name.upcase]) > 0
152-
end
153149

154150
def initialize(sampler_config)
155151
@sampler_config = sampler_config

app/views/dba_schema/_list_indexes.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
}, :title => "Show segment statistics from #{PanoramaConnection.adjust_table_name('DBA_Hist_Seg_Stat')} for all recorded AWR snapshots for #{@owner}.#{rec.index_name}"
108108
)}</div>"
109109

110-
if get_cached_panorama_object_sizes_exists
110+
if PanoramaConnection.panorama_object_sizes_exists?
111111
retval <<
112112
"<div style=\"float:left\">#{
113113
ajax_submit('Size evolution', {

app/views/dba_schema/_list_lobs.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
}, :title => "Show segment statistics from #{PanoramaConnection.adjust_table_name('DBA_Hist_Seg_Stat')} for all recorded AWR snapshots for #{@owner}.#{rec.segment_name}"
5757
)}</div>"
5858

59-
if get_cached_panorama_object_sizes_exists
59+
if PanoramaConnection.panorama_object_sizes_exists?
6060
retval <<
6161
"<div style=\"float:left\">#{
6262
ajax_submit('Size evolution', {

app/views/dba_schema/_list_object_description.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ So the real value would be #{fn rec.avg_row_len} - #{fn rec.sum_col_len_metadata
631631
%>
632632
</div>
633633

634-
<% if get_cached_panorama_object_sizes_exists %>
634+
<% if PanoramaConnection.panorama_object_sizes_exists? %>
635635
<div class="flex-row-element">
636636
<%= ajax_submit('Size evolution', {
637637
update_area: @update_area,

0 commit comments

Comments
 (0)