I have an SQL server database containing 7 tables, 15 stored procedures, and 2 views I detached it and copied it then I reset my computer and I installed SQL server software again.when I attached the database I didn't get my tables and stored procedures I got many unknown tables whose names start with mdm.xxx as shown in the attached picture
Related
I have a configurations database with a lot of stored procedures and then I have a large number of databases, all are part of one system and on the same database server.
When the stored procedures in the config database are executing, they often query other databases as well and it is possible to do so because the configuration and all the other database are on the same database server.
But with time, as the data is growing, customers are growing, databases are growing, this one database server is slowing down. So now we want to take some of our databases and put them on a different database server but we are unable to do so because these databases and the configuration database are tightly coupled to each other because many of the stored procedures in the config database query other databases as well.
Is there some way I can execute a stored procedure present in config database / Server A, but this stored procedure is also querying database 2 on Server B?
If not then what could be the best approach to decouple all the other databases from the configurations database? I know getting rid of the stored procedures by implementing an ORM or something could be an option but that would be very time taking as we 1000+ stored procedures.
Let's say your configure database is Server A and all your user databases are on Server A and your SP are using 3 part naming to query multiple databases.
Now you want to migration one of the databases (DB1) to Servers B. Now DB1 does not exist on Server A, it is now on Server B. You can then Create a place holder DB on Server A called DB1. Then you will create a linked server to Server B and in the Place holder DB1, you will create alias which uses the linked server object with the same table name. This way, no changes is required on your thousands of SP and its configuration.
However, Linked Server may introduce performance problems as joining and indexing is less efficient.
I have about 250 stored procedures in database A in SQL Server. I have a solution containing several projects in Visual Studio. One project inside that solution saves/source controls about 200 stored procedures. These 200 stored procedures are from database A.
I would like to source control all the 250 stored procedures, my questions now are:
How can I add the remaining 50 stored procedures from database A to the project inside that solution? I can do it manually but is there any quicker way or easier way to do it?
How can I synchronize stored procedures in SQL Server and stored procedures in a solution in Visual Studio? For example, if I make a change to a stored procedure in SQL Server, then Visual Studio should detect the change and let me save the new version easily in SQL Server and Visual Studio.
I have a production SQL instance and database using SQL Server 2012 Express. I need to archive (on demand) from this database to a different database on a different SQL Server 2012 instance (on a different machine). The archiving process requires that the original data is deleted after successful archiving.
I need to execute in real time and for it to be meaningfully quick to the user. Not much to ask really! The archiving is performed by a user from a browser screen calling a .Net service (in C#).
I am limited to Javascript client (Sencha ExtJS), C# on the back end server and SQLExpress2012 on both database servers.
I have been using a stored procedure on the source database which is called from a .Net service (C#).
The source data to be archived resides on a parent table and 1 or more child tables. The destination database contains tables of the same format. I am currently using Linked Servers to point from source server to destination server. I am using a stored procedure on the source database to execute a distributed transaction between the two databases but the transaction can take 30 seconds to 90 seconds to transfer 5000 parent rows and 10000 to 15000 child rows.
Is there a better and faster way of doing this?
I have considered using table parameters on both servers but I have read that I cannot write to a table parameter within a stored procedure and I that cannot pass them between SQL instances.
I have an Oracle linked server in SQL Server and would like to copy the contents of a number of views to a database in SQL Server, these views from Oracle are to become tables in SQL Server. I have done this one at a time but am looking for a solution to be able to refresh these views, 104 of them, overnight every night.
I am fine with setting the job running manually but am looking for a solution that will either drop and recreate the tables from the views or that will just refresh the data in the SQL Server tables that exist.
Hope I have explained this well enough!
Many thanks in advance for any help on this one.
If you don't already have the table structures in the MSSQL database, I'd say go through one time for all 104 views, and say the following:
SELECT *
INTO MSSQLNewTable (this will be the name of your new table)
FROM <However you reference your Oracle view from within MS SQL Server>
After you do that, then create a SQL Script that says:
TRUNCATE TABLE MSSQLTable_Name
INSERT INTO MSSQLTable_Name
SELECT * FROM OracleTable_Name
.....for each table. Create a job in the database instance that runs on a schedule you set.
use the sys. tables to generate the statements so you don't have to type everything 104 times.
In SQL Server, I have a data source server which has 22 databases and in each database there are 5 tables. Every db has the same table includes different data separated through years.
I want to collect all this data into one single database. Destination database will have only 5 tables, while source has 22 x 5 = 110 tables. I'm using import-export wizard to transfer data but it takes too long and really annoying stuff. For 110 tables I'm going to have to start import-export wizard.
Is there a simple way, tool to do this? There is no linked server between servers.
Here is a simple figure that explains my situation.
Posting my comment as an answer:
Back up each database, restore it to server 2 and then insert the records across using a simple INSERT .. SELECT statement, then drop the restored database and restore the next? You should be able to script this to work unattended, even the creation of all the backups could be scripted to only need a single 'run' which will run for all databases
Your other option (if space permits) is to create a new database on server 1 (potentially a restore of the database on server 2 if it has data already in it), then import all records across into this new database, then backup this database and restore it on server 2.
It depends on several thing like how often do you want the data to be moved, will it be changed on the destinations DB's?
There are 4 methods of High Availability on SQL Server. One of them will surely fits to your scenario (probably a merge replication)
http://msdn.microsoft.com/en-us/library/ms190202.aspx