jeudi 26 mars 2015

Deploying SSRS reports on an "Air Gapped" report server without SSDT?


Whats the simplest way to deploy multiple reports (.rdl) alongwith the respective data sources to a machine which cannot be connected to from Visual Studio?


I can only place files at a given location, connect to the report server via remote desktop and execute them.I am not permitted to open firewall ports, or establish any other sort of connectivity between my machine and the report server


One way is to manually upload the files one at a time, which I wish to avoid.





Normalization for three somehow identical tables


These three tables are nearly identical. But, there are some exceptions.


But, I can't find best normalized structure. Could you please help me?


Here is the informations must be hold in database:



1) APARTMENTS
CITY_ID
VILLAGE_ID
STREET_NAME
BUILDING
APARTMENT
LIVING_SPACE
ELECTRIC_SUBSCRIBER_NUMBER
GAS_SUBSCRIBER_NUMBER
WATER_SUBSCRIBER_NUMBER

2) GARDENES
CITY_ID
VILLAGE_ID
STREET_NAME
BUILDING

LIVING_SPACE
ELECTRIC_SUBSCRIBER_NUMBER
GAS_SUBSCRIBER_NUMBER
WATER_SUBSCRIBER_NUMBER

TOTAL_GARDEN_SPACE

3) PLOT_OF_LAND
CITY_ID
VILLAGE_ID
STREET_NAME
BUILDING
LAND_SPACE


What is the best structure for this tables?


Yet, I have made two structures:


FIRST ONE:


enter image description here


But, it seems not the best to me. So, i have made second choice:

SECOND ONE:

May be I must make on table with the name POSSESSİONS? And inside this:



POSSESSIONS
ID
TYPE (1-APARTMENT, 2-GARDEN, 3-PLOT_OF_LAND)
SUBSCRIBER_ID
ADDRESS_ID

LIVING_SPACE
TOTAL_GARDEN_SPACE
LAND_SPACE


What is your recomendations?





oracle database - sql for counting the columns with the same id with the one in current row


I have an oracle database and a few tables and with this query:



select rap.DENUMIRE,a3.ID,op.FK_ID,
(SELECT COUNT(*) FROM ANEXA3_TABEL1_ROWS) AS count
from ANEXA3_TABEL1_ROWS a3
inner join RAPORTORI_AMB rap on rap.id = ch.FK_ID_RAPORTOR
inner join ANEXA3_TABEL1_OP op on op.FK_ID = a3.ID


the result is:



DENUMIRE ID FK_ID COUNT
SC AAA 720 720 7
SC AAA 720 720 7
SC AAA 720 720 7
SC AAA 741 741 7
SC AAA 720 720 7
SC AAA 720 720 7
SC AAA 742 742 7


and I'd want to select in COUNT the number of columns with FK_ID equals to the ID in the current row. In this example, I'd want the following result:



DENUMIRE ID FK_ID COUNT
SC AAA 720 720 5
SC AAA 720 720 5
SC AAA 720 720 5
SC AAA 741 741 1
SC AAA 720 720 5
SC AAA 720 720 5
SC AAA 742 742 1


Thanks in advance!





DB space vs query complexity tradeoff


I have a dilemma - Right now I have a query that I do constantly - joining 5 tables on different columns, calculate stuff per row, distinct on that, and do that with offset and limit (pagination). I try to use result caching as much as I can so I wouldn't hit the DB too much.


But now I am thinking, to simplify all this, I can create another table which will ease the joining (since its already joined with the relevant data) and extracting rows for that should be simpler since there is only one table. However, that table will be as big as N x M where N and M are 2 of the largest tables in the above query. (right now, its about 50,000 and 600,000, which yields a 30 billion row table...)


In the long run, are complex queries that strain the DB (and how can I handle them with ease) better or would it be better to strive for simpler queries on larger tables?





Recovering from a partial recover/migration


I migrated my database with a simple



pg_dump -p <port> -U <user> <database> | psql -p <other port> -U <user> <other database>


and was kindly interrupted by a failing internet connection that killed the process. Now I am stuck with a half-migrated database. What is the easiest way to recover from here without having to delete all data and do it all over again?





How do you repair a 'Suspect' MS SQL (2008) database


My database has gone offline, it is highlighted as 'Suspect'.


Foolishly, i haven't got a recent back up.


Is there a way of quickly restoring the database?


Thank you





mercredi 25 mars 2015

Amazon rds read-replica, use as archive database


I have hosted my database (MySql) on Amazon RDS service and also created read-replica in the same availability zone. I have send my read queries on that read-replica. Now a days my database is become a very huge with data (about 10gb) and growing on. So I have decided to remove old data from master, but not from read-replica. Is it possible? somewhere I have read that "sql_log_bin" set off while removing old records from master, (so, it can't be replication on slave/read-replica), but when I have tried, it can't worked. Can someone show me how to archive old data from master to other database, and How to handle foreign key on master?


In my case, many old records has relation with currently using records. So How do I handle this kind of situation?