Commit 7d1955bcc356360a8f6502678addd3be10d1a630
1 parent
e0e1335e
Exists in
master
and in
1 other branch
Indicador 2 - Correcoes para funcionar com Oracle e obtendo versao do Oracle
Showing
2 changed files
with
27 additions
and
6 deletions
Show diff stats
docker-compose.yml
rn/MdEstatisticasColetarRN.php
... | ... | @@ -253,8 +253,13 @@ class MdEstatisticasColetarRN extends InfraRN { |
253 | 253 | $query = "SELECT table_schema, SUM(data_length + index_length) as tamanho FROM information_schema.TABLES WHERE table_schema = 'sei' GROUP BY table_schema"; |
254 | 254 | } elseif ($sgbd == 'SqlServer') { |
255 | 255 | $query = "SELECT SUM(Total_Pages * 8 * 1000) As tamanho FROM sys.partitions As P INNER JOIN sys.allocation_units As A ON P.hobt_id = A.container_id INNER JOIN sys.tables t on t.object_id = p.object_id"; |
256 | + } elseif ($sgbd == 'Oracle') { | |
257 | + $query = ""; | |
258 | + } | |
259 | + $rs = array(); | |
260 | + if($query) { | |
261 | + $rs = BancoSEI::getInstance()->consultarSql($query); | |
256 | 262 | } |
257 | - $rs = BancoSEI::getInstance()->consultarSql($query); | |
258 | 263 | $tamanho = (count($rs) && isset($rs[0]['tamanho'])) ? $rs[0]['tamanho'] : 0; |
259 | 264 | |
260 | 265 | InfraDebug::getInstance()->gravar('SEI03 - Tamanho do SGBD: ' . $tamanho, InfraLog::$INFORMACAO); |
... | ... | @@ -273,8 +278,13 @@ class MdEstatisticasColetarRN extends InfraRN { |
273 | 278 | " INNER JOIN sys.allocation_units As A ON P.hobt_id = A.container_id " . |
274 | 279 | " INNER JOIN sys.tables t on t.object_id = p.object_id " . |
275 | 280 | " GROUP BY t.name ORDER BY t.name"; |
281 | + } elseif ($sgbd == 'Oracle') { | |
282 | + $query = ""; | |
283 | + } | |
284 | + $tabelas = array(); | |
285 | + if($query) { | |
286 | + $tabelas = BancoSEI::getInstance()->consultarSql($query); | |
276 | 287 | } |
277 | - $tabelas = BancoSEI::getInstance()->consultarSql($query); | |
278 | 288 | |
279 | 289 | InfraDebug::getInstance()->gravar('SEI15 - Tamanho das tabelas: ' . json_encode($tabelas), InfraLog::$INFORMACAO); |
280 | 290 | return $tabelas; |
... | ... | @@ -361,7 +371,13 @@ class MdEstatisticasColetarRN extends InfraRN { |
361 | 371 | } |
362 | 372 | |
363 | 373 | private function obterSistemasOperacionaisUsuarios(){ |
364 | - $query = "select distinct user_agent as nome from infra_auditoria"; | |
374 | + $sgbd = $this->obterTipoSGBD(); | |
375 | + if ($sgbd == 'Oracle') { | |
376 | + $query = "select distinct to_char(user_agent) as nome from infra_auditoria"; | |
377 | + } else { | |
378 | + $query = "select distinct user_agent as nome from infra_auditoria"; | |
379 | + } | |
380 | + InfraDebug::getInstance()->gravar('query: ' . json_encode($query), InfraLog::$INFORMACAO); | |
365 | 381 | $sistemas = BancoSEI::getInstance()->consultarSql($query); |
366 | 382 | InfraDebug::getInstance()->gravar('SEI26 - Sistemas Operacionais dos Clientes: ' . json_encode($sistemas), InfraLog::$INFORMACAO); |
367 | 383 | return $sistemas; |
... | ... | @@ -390,8 +406,13 @@ class MdEstatisticasColetarRN extends InfraRN { |
390 | 406 | $query = "SELECT version() as versao"; |
391 | 407 | } elseif ($sgbd == 'SqlServer') { |
392 | 408 | $query = "SELECT SERVERPROPERTY('productversion') as versao"; |
409 | + } elseif ($sgbd == 'Oracle') { | |
410 | + $query = "select version AS versao from product_component_version WHERE product LIKE 'Oracle%'"; | |
411 | + } | |
412 | + $rs = array(); | |
413 | + if ($query) { | |
414 | + $rs = BancoSEI::getInstance()->consultarSql($query); | |
393 | 415 | } |
394 | - $rs = BancoSEI::getInstance()->consultarSql($query); | |
395 | 416 | $versao = (count($rs) && isset($rs[0]['versao'])) ? $rs[0]['versao'] : null; |
396 | 417 | InfraDebug::getInstance()->gravar('SEI02 - Versao do SGBD: ' . $versao, InfraLog::$INFORMACAO); |
397 | 418 | return $versao; | ... | ... |