Commit d585ea845db9f8f43f99119f480bd1249333f86b
1 parent
3bf8bbb1
Exists in
master
and in
1 other branch
SQLServer - Versao do banco e tamanho das tabelas
Showing
2 changed files
with
16 additions
and
10 deletions
Show diff stats
docker-compose.yml
... | ... | @@ -24,17 +24,17 @@ services: |
24 | 24 | ports: |
25 | 25 | - "3306:3306" |
26 | 26 | |
27 | -# oracle: | |
28 | -# image: guilhermeadc/sei3_oracle-11g | |
29 | -# container_name: oracle | |
30 | -# ports: | |
31 | -# - "1521:1521" | |
27 | + oracle: | |
28 | + image: guilhermeadc/sei3_oracle-11g | |
29 | + container_name: oracle | |
30 | + ports: | |
31 | + - "1521:1521" | |
32 | 32 | |
33 | -# sqlserver: | |
34 | -# image: guilhermeadc/sei3_sqlserver-2017 | |
35 | -# container_name: sqlserver | |
36 | -# ports: | |
37 | -# - "1433:1433" | |
33 | + sqlserver: | |
34 | + image: guilhermeadc/sei3_sqlserver-2017 | |
35 | + container_name: sqlserver | |
36 | + ports: | |
37 | + - "1433:1433" | |
38 | 38 | |
39 | 39 | solr: |
40 | 40 | image: guilhermeadc/sei3_solr-6.1 | ... | ... |
rn/MdEstatisticasColetarRN.php
... | ... | @@ -251,6 +251,8 @@ class MdEstatisticasColetarRN extends InfraRN { |
251 | 251 | $query = ''; |
252 | 252 | if ($sgbd == 'MySql') { |
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 | + } elseif ($sgbd == 'SqlServer') { | |
255 | + $query = "SELECT 'a' as table_schema, 1 as tamanho"; | |
254 | 256 | } |
255 | 257 | $rs = BancoSEI::getInstance()->consultarSql($query); |
256 | 258 | $tamanho = (count($rs) && isset($rs[0]['tamanho'])) ? $rs[0]['tamanho'] : 0; |
... | ... | @@ -264,6 +266,8 @@ class MdEstatisticasColetarRN extends InfraRN { |
264 | 266 | $query = ''; |
265 | 267 | if ($sgbd == 'MySql') { |
266 | 268 | $query = "SELECT table_name as tabela, data_length + index_length as tamanho FROM information_schema.TABLES WHERE table_schema = 'sei'"; |
269 | + } elseif ($sgbd == 'SqlServer') { | |
270 | + $query = "SELECT OBJECT_NAME(object_id) As tabela, 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 GROUP BY OBJECT_NAME(object_id) ORDER BY tabela"; | |
267 | 271 | } |
268 | 272 | $tabelas = BancoSEI::getInstance()->consultarSql($query); |
269 | 273 | |
... | ... | @@ -379,6 +383,8 @@ class MdEstatisticasColetarRN extends InfraRN { |
379 | 383 | $query = ''; |
380 | 384 | if ($sgbd == 'MySql') { |
381 | 385 | $query = "SELECT version() as versao"; |
386 | + } elseif ($sgbd == 'SqlServer') { | |
387 | + $query = "SELECT SERVERPROPERTY('productversion') as versao"; | |
382 | 388 | } |
383 | 389 | $rs = BancoSEI::getInstance()->consultarSql($query); |
384 | 390 | $versao = (count($rs) && isset($rs[0]['versao'])) ? $rs[0]['versao'] : null; | ... | ... |