How to Restore data from MS SQL 2012 to MS SQL 2008 using .bak file. Is this Possible? - sql-server-2008-r2

I have a requirement that am facing difficulty i.e. restoring a data from MS SQL 2012 to MS SQL 2008 using .bak file. when am trying to restore , am getting an error. is this possibility to restore this to downgrade.
can any one help me how to restore ?

Unfortunately SQL Server will not go backwards. The only way you can do this is Using SSIS to transfer the data or you can use the import/export utility.
On your 2012 Server Right click on the DB you want to export data from and scroll down to tasks and then choose export data it will have you then insert all of the information for both the source and destination servers then on the summary page click mappings and make sure they are correct for what you need and the DB it is going to is correct. Then follow the screens until you can click finish. YOu may have too play with it for a little bit to get it to behave nicely but this should work for you.
If all you have is a BAK file you may have to resotre it to a dummy DB on the 2012 server first.

Related

Crystal Reports - Update SQL in Command without connecting to database

I have a problem to update Command in Database Expert. After editing SQL query in Command and click on OK button, Crystal Reports wants to connect into database. But the database is on serves, where I don't have access.
My question is if, there is any possibility, how to update and save edited SQL in Command without connection into database?
I am using Crystal Reports - Product version 10.
No way around this.
But you could create a test/development database with the same structure that you do have access to...

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.

How to export data from SQL Server to PostgreSQL?

I need to export all tables from SQL Server to PostgreSQL.
Try: I tried from SQL Server IDE but at some stage its giving the error about data types are different.
Question:How can I do export of data from SQL Server to PostgreSQL? Is COPY does my job? If yes, then how can I export all tables including records?
You can't export data from MSsql then import to PostgreSql because it is not same syntax, data type, but you can use tool to migration data from mssql to postgreSql,
See more in topic
migrate data from MS SQL to PostgreSQL?
Use https://dbeaver.io/
Create MS SQL and PostgreSQL database connections (login)
Create target tables in PostgreSQL (same structures in MS SQL)
F5 to see new tables
Right-click on new tables -> 'Import Data' -> You will see 'Data Transfer' window
Choose 'Table' type then click 'Next' -> You will see 'Select input object', where you can choose tables from MS SQL connection
Just 'next' and check settings that you need, done :D
First export the schema into a file and run it against PostgreSQL until you've removed all incompatibilities.
You could try to do the same with the data you want to export but you may be better off writing a Python script to migrate it.
There is an absolutely simple way using built-in SSIS tool using Management Studio. You can find the detailed answer here.
Use https://dbeaver.io/ , as An Le mentioned.
After 40 years of DB development, migrating DB data is still a challenge. DBeaver is a free tool to use for data migration. But you still have to migrate the schema.
Exporting data from DBeaver
From contextual menu of your SQLServer database or schema select Tools > Create new Task > Common > Data Export
You will generate SQL insert files or CSV files. For migration between database types use CSV files.
Cons of SQL Server Migration Tool
Unable to migrate rows containing booleans.
Export ended up in errors of migrationg data with Bool columns, complaining that value is not boolean, although both source and destination columns where of boolean type.
Unable to continue with the next tables afer one table migration fails.
SQL Server - A single error stops all migration even for tables that are not related to the initial error.
Configuring the tool over and over again, trying to export your data is a waste of time. SQL Server migration task does not save the configuration of the source and destination connections. And the wizard is not user friendly, spending your time on it is frustrating. I assume the migration project was abandoned for at least 10 years.

Oracle 10g Enterprise Edition Backup to .sql file

I have oracle 10g enterprise edition. I want to perform table backup and full database backup to .sql files to be able to move to another server/PC ...
If possible, image explanation ...
If you want to move to a different Oracle server, you should use:
expdp
To export your data. And:
impdp
To import it on the other database. Here's a WIKI entry that might help you. It's the easy way of moving data around Oracle servers.
On the other hand, ff you want to move your data to a different DATABASE SERVER (not Oracle branded) you would need some sort of translator in the way.

Automatic "Script database as... create" for SQL Server 2008

I'd like to make a daily automatic creation of the creation script for a database in SQL Server 2008, meaning having a (bat, exe, ... whatever) that creates a text file with the very same output obtained by right-clicking on the database in SQL Management Studio and do Script database as... --> Create to... --> New Query window.
Any hint?
Thanks in advance,
Mauro
EDIT 1: We already used SMO but a couple of things are annoying
Needs compatibility pack in SQL Server 2008 (confirm?)
Some things were not created in script (some indexes and keys and in table creation schema is lost)
Best choice for me would something with a powershell script but any other idea is welcome!
You can use SMO. For example: http://www.sqlteam.com/article/scripting-database-objects-using-smo-updated (see the Scripting Objects section).
More info on SMO: http://msdn.microsoft.com/en-us/library/ms162169.aspx