Maintenance plan and job in SQL Server 2008 R2 - sql-server-2008-r2

Attached image copy of SQL Server 2008 R2 database table. In that table daily updated huge amount of data for Syslog, Security log, Application, System log
so our database is growing very rapidly.
Is there any maintenance plan or job so I can purge data automatically which older than 180 days.

delete from tableX where DATEADD(month, -6, GETDATE()) > timestampfield
This will purge all fields older than 6 months.

Related

PostgreSQL - long running procedure reasumes after 30 minutes

Enviroment:
Cluster with 3 DB servers managed with Patroni.
PostgreSQL 14.
I have procedure without parameteres which archive some data and works a long time.
When I running it, after exactly 30 minutes this procedure start again. I know it because on the beginnig I insert record into control table with information about start date.
Do you know what process can responsible for it ?

SQL Server 2012 database stored and need to be restored on SQL Server 2008R2

As the title says, I need to restore a SQL Server 2012 database (express) to a SQL Server 2008 R2 production database.
I cannot find a way to do so.
The scripting seems to fail due to the size of one of the tables having about 300.000 records.
Any way to "downgrade" the 2012 database?
Thanks
Michael
You CANNOT do this - you cannot attach/detach or backup/restore a database from a newer version of SQL Server (2012) down to an older version (2008 R2) - the internal file structures are just too different to support backwards compatibility. There's no way, no trick, no hack, no magic to make this happen. Period.
You can either get around this problem by
using the same version of SQL Server on all your machines - then you can easily backup/restore databases between instances
otherwise you can create the database scripts for both structure (tables, view, stored procedures etc.) and for contents (the actual data contained in the tables) either in SQL Server Management Studio (Tasks > Generate Scripts) or using a third-party tool
or you can use a third-party tool like Red-Gate's SQL Compare and SQL Data Compare to do "diffing" between your source and target, generate update scripts from those differences, and then execute those scripts on the target platform; this works across different SQL Server versions.

Can't restore compatible database back to SQL Server 2008 R2

We have client with SQL Server 2008 R2 and database created on same server. So the compatibility is set as 10.
We're running mostly on SQL 2012. In event we backup database from 2008 and restore in 2012, make some data changes (no schema change), and then back it up again, we can't restore back to 2008.
It would prompt "No backupset selected to be restored". But seems that the compatibility is retained. Opening Management Studio as Administrator doesn't work either.
This method use to work fine with one previous client, but they have upgraded to 2012 now.
You are having a compatibility issue.
Just set compatibility mode and try to restore database again.
ALTER DATABASE Databasename SET COMPATIBILITY_LEVEL = 80
You have to set COMPATIBILITY_LEVEL as per your database is
suppose if backup database COMPATIBILITY_LEVEL is 90 than set COMPATIBILITY_LEVEL = 90.
Now restore database and if database restored successfully than again set previous COMPATIBILITY_LEVEL to the level it was before restore.

Export 13 million records from SQL Server DB1 to another SQL Server DB2

I have been asked to dump about 13 million rows from a SQL Server 2008 R2 database to another SQL Server 2008 R2 database, but both are on different database servers, and they have no common login.
It seems writing a C# program that uses ADO.NET SqlBulkCopy class is the only option and even with this, the program needs to run repeatedly every 'x' minutes till all data is copied.
Is there any other better way to do this huge data transfer?

Unable to update records - SQL Server 2008 R2 Server/Express and MS Sync Framework 2.1

I am using MS Sync Framework 2.1 and syncing multiple SQL Express 2008 R2 express clients with SQL Express 2008 R2 server. It has been working fine for many months until recently. One of the table with 3000 records is not getting synced any more. I populated the table with Bulk Insert. I cannot even update those records through query analyser using SQL Management Studio.
When I run the T-Sql Update query as
Update myTable set modifiedDate ='sa'
It returns the following message.
(0) records updated
(3000) records updated
The first message is for myTable and second is for myTable_Tracking. So the records are not getting updated in myTable but they are in myTable_Tracking. But when I do Select query I am getting 3000 rows returned.
The same result is found on both Server and Express.
I checked size of transaction log. The Space Used is 94% on SQL Server 2008 R2 Server but on SQL Express Space Used is 17% only.
Any idea people?
Please let me know if you need more information.
I recomend that you take a look on this link:
https://jtabadero.wordpress.com/2012/08/23/things-you-need-to-know-about-sql-data-sync-service/