Log shipping for few tables in SQL Server 2012 - sql-server

Is it possible to log shipping for few tables only in SQL Server 2012?
Thanks

SImple answer: NO. THere is no per table log. THere is ONE log per database. SImple like that.
You want partial table stuff - only chance is replication.

You can manually configure this using FileGroups (ie. put tables into a different FILEGROUP), and manually manage the restore process.
Initially only restoring the tables you require
Lookup Partial Restore.
This is a currently working.

Related

Automate sql server profiler to record data then save data to a table continuously

Is there a way to automate sql server profiler to record data then save data to a table continuously?
The reason, I am supporting a fragile SQL Server application and there is no auditing. I receive a lot of support calls regarding the deletion of records. I want a quick way to be able to view who has changed what data.
You can configure your profiler to save the trace directly to table as described here: How To Save a SQL Server Trace Data to a Table
But it's not a good idea for 2 reasons: first, profiler itself will be loading up your server, second, writing to table is the most costly option and you can even loose some events.
Maybe if you are on Enterprise edition you can use SQL Server database audit
that is more light weight
And here you can find a complete example of setting up database audit that audits the DELETE events
Here are few articles for your reference.
Save trace results to a database table
https://learn.microsoft.com/en-us/sql/tools/sql-server-profiler/save-trace-results-to-a-table-sql-server-profiler
Save Trace Results to a Table
https://technet.microsoft.com/en-us/library/ms191276(v=sql.110).aspx
9 Steps to an Automated Trace
http://sqlmag.com/t-sql/9-steps-automated-trace
alternatively, you may try this automated solution ( https://www.lepide.com/lepideauditor/sql-server-auditing.html ) to accomplish this task.

How to deploy/replicate/copy a SQL Server 2005 database including CLR objects to multiple servers

We maintain a generic tools database at work that contains useful stored procedures, functions, and the odd lookup table. It also contains some CLR objects which need to be included.
We have around 10 servers and want to have a copy of this database available on each instance inclusding CLR functions..
I plan to nominate one DB as the master and then replicate/logship the db to other instances on a nightly basis. I would also like to be able to kick off the replication by hand if necessary.
Any advice on how this can be achieved?
Thanks : )
I kept this thread open in hopes that someone would come up with something clever. Here's what I came up with:
1) You could implement the log shipping you're talking about and create a read-only snapshot of the log shipping target database on the non-master servers. You'd drop and re-create the snapshot every day.
2) Back up to a location that's available to all the servers and just do a straight restore every day.

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.

Is there an elegant way to track the modification of all columns of one table in SQL Server 2008

There is a table in my database containing 100 columns. I want to create a trigger to audit the modification for every update operation.
What I can think is to create the update clause for all columns but they are all similar scripts. So is there any elegant way to do that?
Check Change Data Capture
Update
CDC provides tracking of all details of changes. Available since SQL Server 2008.
(Change data capture is available only on the Enterprise, Developer, and Evaluation editions of SQL Server.
Source: http://msdn.microsoft.com/en-us/library/bb522489.aspx)
More lightweight solution is Change Tracking (Sync Framework), the one code4life mentioned before, available since SQL Server 2005.
Update2:
Related questions (with a lot of sublinks):
History tables pros, cons and gotchas - using triggers, sproc or at application level
History tables pros, cons and gotchas - using triggers, sproc or at application level
Suggestions for implementing audit tables in SQL Server?
Suggestions for implementing audit tables in SQL Server?
Are soft deletes a good idea?
Are soft deletes a good idea?
How do I version my MS SQL database in SVN?
Versioning SQL Server database
Thomas LaRock. SQL Server Audit: Magic without a Wizard
http://www.simple-talk.com/sql/database-administration/sql-server-audit-magic-without-a-wizard/
There's this resource on MSDN which you might find helpful:
Tracking Changes in the Server Database (including SQL Server 2008)
I'm not sure if you're using SQL Server 2008 though.
Code generation?
Have you looked at the techniques which http://autoaudit.codeplex.com/ uses?
Theoretically, you can use 1 trigger and check COLUMNS_UPDATED() to know which columns has changed.
(not be tested)
See more here

backup data for reporting

What is the best method to transfer data from sales table to sales history table in sql server 2005. sales history table will be used for reporting.
Take a look at SSAS. OLAP is built for reporting and is easy to query with tools like excel pivot tables.
Bulkcopy is fast and it will not use the transaction log. One batch run at the end of the day.
Deleting the copied records from your production server is a different situation that needs to be planed on that server's maintenance approach/plans. Your reporting server solution should not interfere with or affect the production server.
Keep in mind that your reporting server is not meant to be a backup of the data but rather a copy made exclusively for reporting purposes.
Also check on the server settings of your reporting server to be on Simple recovery model.
Most solutions will require 2 steps;
-copy the records from source to target
-delete records from source.
It is essential that your source table have a primary key.
The "best" method depends on a lot of things.
How many records?
Is this a production environment?
What tools do you have?
Unless you are moving a large amount of data, a simple stored procedure should do the trick.
A sql server job can manage the timing of when to call the proc.
if you just want to move the data to another table, use BulkCopy/BulkInsert. if you want to build reporting I would suggest a BI solution such as MS Analysis Service (OLAP).
It is difficult and in my opinion ugly to maintain two or more history/archive tables in the same database. For a reporting solution you will be considering all the tables for that piece of information anyway. History/Archive tables should only be used if you are going to put the data away and not touch it for a long period of time, ie. archive it away outside the operational DB.

Resources