Large database migration 120GB with downgrade of MS SQL - sql-server

I've got a large database of around 120GB that was migrated to temporary server a couple of weeks ago in a hurry. I should add I'm not a DBA by any stretch.
Unfortunately it was SQL 2017 rather than the original 2016 which has then caused an issue when trying to migrate it back to 2016. i.e it's not possible to migrate with drop/reattach or backup/restore.
I've tried scripting the database but as a couple of tables are 80% the size of the database it fails to import.
I've also tried APEX SQL Data Diff but I get "transaction log full" fail messages, even though transaction logging is set to simple.
Does anyone have any ideas on how to migrate this database back to the original server in a timely fashion.

You can use SSIS or Export/Import wizard in SSMS to transfer the data from the old database to the new one. Or to export the data from 2017 to flat files and use bulk insert or bcp to import these filat files into 2016.

Related

Restore from SQL Server database and replicate to another database

We have a SQL Server database that is hosted by a 3rd party. We have access to the backup files of that SQL Server database which we grab daily and restore to an "in-house" SQL Server for the purpose of creating reports and looking at the data without the chance of affecting the "live" data on the hosted server.
At the moment our restore process only allows us to access day old data, but we would like to increase the frequency of backup/restore processes so our "sandbox" database is more up to date, like maybe 2 or 3 hours old. One issue is that during the restore process everyone has to be out of the database so restoring every couple of hours might be cumbersome.
Is it possible to setup a 3rd SQL Server for the "sandbox" database to replicate to so that when we restore the data to it, that data will then replicate to the "user" database.
Is there a better way to get the data from the actual production server?

What is the best way to migrate a large SQL Database to Azure SQL?

I have to migrate an existing database in Azure SQL. Currently the db is ~400 Gb large. I've tried using the SQL Database Migration Wizard from codeplex (https://sqlazuremw.codeplex.com/), due to the fact that my database isn't quite compatible with SQL Azure (missing cluster indexes, index fill factors, etc. ) which the tool manages to 'fix' somehow. The problem with this tool is that I've started it about 10 days ago and it is still copying (one thing to mention is that the database is stored on a VM in Azure in the same zone). This won't work for me. Any possible solutions?
I've tried exporting a .bacpac from the SQL Server Management Studio (2014), but even if I try fixing all the incompatibilities I still get new ones. It's a never ending process so I gave up this solution.
Thank you in advance for your help.

Transferring a SQL Database on AWS

We have a SQL Server 2005 database on our local server.
Here it is (ofc i've to repeat the proceder for the other databases):
I've to transfer it to our SQL server 2012 instance on Amazon RDS.
I right clicked the database and selected Generate Scripts - All tables - Copy Schema and Data and saved everything as a sql file
At this point I attempted to use the SQL Azure MW v5.15 (in a question here I saw that it works with AWS too, way to go Microsoft!) to transfer the database on AWS.
However it crashes.
No problem, I try to use SQL Management studio to import the file but as soon the RAM consumed by the program reaches 1gb (as you can see that DB is 3,4gb) BOOM - out of memory error!
What should I do now?
You'll need to do part-by-part of your creation. I'd faced that problem some time before, my scripts reaches like 4 GB, only with the schemas, tables, etc. So, I think you should first of all, generate your scripts of creating schemas, users and logins. After that, tables, views and procedures. Then, another objects, like jobs, functions... To conclude, all the data you have, you should export to the RDS through the IMPORT/EXPORT Wizard in SSMS.
I've followed that steps and it worked for me.
Good luck!

Create a Live Replica Database

Our Company is developing a website and it pulls information from our internal production servers. for added security I was asked if we could set up a new server and pull from that. I know I can have a nightly load done to populate the replica server but they want it updated at least every 15 minutes. does anyone have a good solution to keep a replica database as up to date as possible while the database is still in full use?
Note we are using SQL Server 2008 R2
You can set up replication if you have Enterprise Edition of SQL Server.
Otherwise, you can run a job every 15 minutes that uses SSIS to update the latest info. Your source tables will need to have some kind "UpdatedOn" datetime column so you will know what data you need to import/update.

Restore SQL Server 2008 database to SQL Server 2000

I have to move an entire database from a SQL Server 2008 machine to a SQL Server 2000 machine.
I created a backup using Management Studio 2008, copied it to the hard drive of the 2000 box, and from withing Management Studio 2008, I choose Restore Database to the 2000 box.
I get an error message stating, "The media family on device ... is incorrectly formed. SQL Server cannot restore this media family".
If I use Enterprise Manager 2000 I get the same error.
Is there a way to move a whole database from the newer SQL server to the older?
The only thing I can think of is to recreate the whole structure and then copy data from a live database. So, create scripts that will create the tables, views, and sp's, and then create scripts to copy the data from the existing database.
As others already said there is no default way to do this. It’s just not supported. Here are more extensive details on how to do this properly and avoid any migration issues.
You need to generate scripts for structure and data and then execute these on SQL 2000 (like others already said) but there are couple things to take into account.
Generate scripts in SSMS
Make sure to check option for scripting data for SQL 2000 to avoid issues when trying to create something like geography type column on SQL 2000.
Make sure to review execution order of scripts to avoid dependency based errors
This is a great option for small to medium size databases and requires some knowledge of SQL Server (dependencies, differences between versions and such)
Third party tools
Idea is to use third party database comparison tools such as ApexSQL Diff or Data Diff
Good side is that these will take care of script execution and differences between versions
Not so good is the fact that you’ll need to pay for these after trial ends
I’ve used these two tools successfully but you can’t go wrong with any other tool on the market. Here is a list of other tools in this category.
you can't move backups from a newer version to an older, in that case you can script your database, execute it in the 2000 box, then you can use the standard data transfer to transfer any data you want
Provided you have a network connection between the machines use SSIS. Much easier and a lot less messing around.
You can use Script Generator for your database and then select in the properties form : General-> Script for server version : SQL Server 2000.
The script generator will show you things which not compatible with your server version.
I've heard you can only do it by generating the SQL statement dump from the DB administrator tool and re-running those queries on the target older database.
You can generate a script that will recreate all the objects and transfer all the data...as long as everything in the db is valid in SQL 2000. So no ROW_NUMBER(), no PARTITION, no CTEs, no datetime2, hierarchy or several other field types, no EXECUTE AS, and lots of other goodness. Basically, there's a pretty good chance it's not possible unless your db is pretty basic.
We got a similar situation. A very low-tech but handy solution is:
backup and truncate the tables in SQL 2000.
create a LINKED server in SQL 2008, pointing to SQL 2000
run a select query at sysobjects to generate a query script for insert into LINKED SERVER.table select * from table
execute query script.

Resources