Transactional Replication - sql-server

We have transaction replication between two server (production and staging) which is running on SQL Server 2008 R2. The distributor is running on the staging server. Now my management is asking to create a copy of database on the production environment and replication few tables to that database. Is it possible to replicate twice? Could you please help me on this. If not possible through replication, is there any other way to do it?

You sure can. Create another publication, add the subset of tables to that, and subscribe the other database to the new publication. NB, this will create another copy of changes for this table at the distributor so take that into account.

Related

Sql Server replication - add articles without using wizard

I have done transnational replication to my SQL Server 2014 instance.
There are two db servers subscribing to it. Currently I have added
only some of the tables (10 tables) as articles to replicate. However, in the future there will be new tables added to the distributor database that needs to be included as replication articles.
I know that whenever I want to add a new article to the replication, I can go to the Properties of publication and add new articles through the wizard.
However, my problem is that there are some tables added by an application through T-SQL queries.Those tables need to be replicated. So there is no way
I can go to the wizard and add those to articles.
Is there a way that I can add articles to the replication through a T-SQL? or Is there any system stored procedure or anything we can use to add articles to replication.

Automatically update SQL Server database from tables in MS Access

I'm new to SQL Server and trying to automatically update tables in SQL Server from tables in MS Access.
I have an Access database of metadata that must be kept updated for sending records to other groups. I also have a database in SQL Server which also has these same metadata tables. Currently these tables in the SQL Server database get updated manually by exporting the Access tables as Excel files, and then importing them into the SQL Server tables.
It's not the most efficient process and could lead to errors in the SQL Server database if someone forgets to check that they are using the most recent data from Access. So I would like to integrate some of the tables from Access to my database in SQL Server. Ideally I would like for the tables in my SQL Server database to be updated whenever Access is updated or at least update the tables automatically in the SQL Server database when I open it.
Would replicating the Access tables be the best? I am using SQL Server 2014 Developer so I think I have this capability. From my understanding, mirroring is for an entire database not just pieces of it. However, I do not want to be able to alter the metadata from SQL Server and have it reflected in Access. I cannot tell if reflecting the tables would do this...?
I also looked at this post about writing multiple insert statements but was confused (What is the best way to auto-generate INSERT statements for a SQL Server table?). Someone else suggested importing all the data into SQL Server and then using an ODBC driver to connect the two, but I'm also not sure how this would update the database in SQL Server anytime Access is updated.
If you have any suggestion and a link to easy to follow tutorial I would really appreciate it!
Thanks
In Access, go to 'External Data', ODBC Database, and connect to the SQL Server database directly - make sure you select 'Link to the data source by creating a linked table' on the first page of the wizard. Now, this linked table is available in Access, but is actually the SQL Server table.
Get rid of the local Access tables, using the new linked tables in their place in whatever queries, forms, reports, etc that you have in Access.
Now, any changes to the tables you see in this Access db ARE changes to the SQL Server database.

Issue with migration of Azure sql and sql server

Fist of all sorry for my bad English.
I am new for azure.We are planning to move some selected tables from our SQL database to azure SQL database because of it getting to much load.But existing stored procedure have joined with these tables in SQL server. So what is the best solution to get a result from both databases.
For example booking table right now in Azure database. But customer details, office details, courier details are in our existing SQL database.
Updated
Initially, we have only one database in sql server which contains all tables booking, customer details, office details, courier details etc. Due to heavy load, the client has decided to move some of the tables from sql server to Azure. So we have moved booking related tables into Azure. The issue is the database contains many stored procedures joined between all these tables. If I move some tables to Azure this won't work. I know there are methods to link multiple sql server to write stored procedures by adding those databases as 'Linked Servers' and access through [Server Name].[Database Name].[Table Name]. I think the same is possible between two Azure Sql databases.
My question is this cross-database querying is possible between two databases one is situated in SQL server and other is in Azure.
Thank you.
Azure supports cross database queries if both databases are in Azure ..In your case,it seems some of will be in OnPremises..
So the only option,which i can think of is to use is linked servers to azure..these queries can perform worse,depending on the data you want from them..
In General,you have to follow below steps to create Linked server to AZure..
1.Run odbcad32.exe to setup a system DSN using SQL Server Native Client.
2.Now create a linked server..
EXEC master.dbo.sp_addlinkedserver
#server = N’Can be any name′,
#srvproduct=N’Any’,
#provider=N’MSDASQL’,
#datasrc=N’name of DSN you created′
Now you can query azure from your local server like below
select * from [#datasrc name(dsn name)],db.schema.table
this blog explains step by step and goes into some details on what are the pitfalls
https://blogs.msdn.microsoft.com/sqlcat/2011/03/07/linked-servers-to-sql-azure/

SQL Server replication / mirroring without transaction logging?

I'm new to SQL Server replication options.
I want to set up a system such that a backup database at a remote location is used for data analysis over some large set of data in the primary database. The analysis does not need to have access to live data, and I want to run this analysis daily.
I don't have access to transaction logging on the primary SQL Server 2008 database.
What is the best way to synchronize a primary database to a secondary one in SQL Server without using transaction logging?
Is there maybe another option I'm not seeing?
Thanks,
You could do one of the following:
Some sort of automated backup, copy and restore.
Use a SSIS job to transfer the data from one to the other.
Use a linked SQL Server, and copy/update as appropriate.
The best solution though, is to use log shipping, scheduled once a day, if you can sort out your access to the primary database.

How can I copy data records between two instances of an SQLServer database

I need to copy some records from our SQLServer 2005 test server to our live server. It's a flat lookup table, so no foreign keys or other referential integrity to worry about.
I could key-in the records again on the live server, but this is tiresome. I could export the test server records and table data in its entirety into an SQL script and run that, but I don't want to overwrite the records present on the live system, only add to them.
How can I select just the records I want and get them transferred or otherwise into the live server? We don't have Sharepoint, which I understand would allow me to copy them directly between the two instances.
If your production SQL server and test SQL server can talk, you could just do in with a SQL insert statement.
first run the following on your test server:
Execute sp_addlinkedserver PRODUCTION_SERVER_NAME
Then just create the insert statement:
INSERT INTO [PRODUCTION_SERVER_NAME].DATABASE_NAME.dbo.TABLE_NAME (Names_of_Columns_to_be_inserted)
SELECT Names_of_Columns_to_be_inserted
FROM TABLE_NAME
I use SQL Server Management Studio and do an Export Task by right-clicking the database and going to Task>Export. I think it works across servers as well as databases but I'm not sure.
An SSIS package would be best suited to do the transfer, it would take literally seconds to setup!
I would just script to sql and run on the other server for quick and dirty transferring. If this is something that you will be doing often and you need to set up a mechanism, SQL Server Integration Services (SSIS) which is similar to the older Data Transformation Services (DTS) are designed for this sort of thing. You develop the solution in a mini-Visual Studio environment and can build very complex solutions for moving and transforming data.

Resources