Microsoft SQL Server 2012 Expired - sql-server-2012

I've been working on this ASP.Net Project for a few months, and today my SQL Server 2012 Management Studio has expired. Completely overlooked that i may have been using a trial version and not the express edition. I can not access SQL management studio as it says the evaluation has expired.
Is there a way i can downgrade to the express edition (Free), without losing any databases?
Is there a way i can still backup/export the database i have been working on? Ive tried using the import/export 64 bit tool, but ive forgotten my sql server password. I had just been using the default all this time.
Thanks

Backup database: You can get close backup of your databases by copying the data and log files from your Data directory. You can do this just using Windows copy and paste command.
Re-install from trail version: I faced this problem for SQL Server 2008 trial version. When SQL Server 2008 expired, I was able to re-install it as follows:
a) Remove or uninstall all tools of SQL Server completely from Control Panel > Programs and Features.
b) Then, re-install SQL Server as a new fresh tool.
c) After completing the installation successfully, Cope and paste those backup data and log files into new data directory of new installation.
d) Open SQL Server Mgmt Studio and attach the data file to re-create your old database. Your database will be resumed in this way.
I believe you can do this procedure for your SQL Server 2012 trial version too.

Related

SSDT failing to publish: "Unable to connect to master or target server"

I'm attempting to use SSDT to publish to a SQL Server database in Azure. When I do so, I am seeing the following error:
Unable to connect to master or target server 'DATABASE_NAME'. You must have a user with the same password in master or target server 'DATABASE_NAME'.
Ignoring the fact that it's listing a database name as the server name in the error, I'm not sure how to resolve it. When I specify the target database, I can successfully Test Connection. I can also connect using the same creds to the database through SSMS.
After researching the error, it seems like it is often that the firewall for the database in Azure does not include the IP address of the machine you're publishing from. It not only contains my IP, but I added another firewall rule to allow every IP (0.0.0.0-255.255.255.255) to eliminate the firewall as a potential cause of the problem.
Any ideas?
This is a known issue. This happens due to the new compatibility level 140 for newly created SQL Azure databases. The issue has been documented here and updating SSDT from here to the latest version may solve the issue.
Alternatively, you can change the compatibility level of your database to 130.
ALTER DATABASE database_name
SET COMPATIBILITY_LEVEL = 130;
Hope this helps.
Initializing deployment (Start)
Initializing deployment (Failed)
*** Could not deploy package.
Unable to connect to master or target server 'DbName'. You must have a user with the same password in master or target server 'DbName'.
Issue occurred while deploying build through VisualStudio-2015 and it support to publish database on the database servers whose version up to only 2016.
Solution: For SQL server 2017 we need to Publish Database with Visual Studia 2017 only. Need to upgrade SSDT.
Faced same issue when trying to deploy a DB from local SQL Server to Azure SQL DB via SSMS.
Tried to alter source DB's compatibility level to 130, still got same error.
Tried to add same user logins to master DB, no help.
Eventually, started looking for other approaches. Succeeded by using Data Migration Assistant, as instructed in https://learn.microsoft.com/en-us/azure/sql-database/sql-database-cloud-migrate.
My situation was slightly different in that I had exported an Azure database (with compat level 140) from SQL Azure and then tried to import it into a local SQL Server 2017 installation - using the latest SSMS 2017 that I just installed yesterday - and still got this message.
Turned out that although I did have latest SSMS installed, I was actually opening SSMS 2016 by mistake! So be sure to select and pin the correct version to avoid it happening again. Just typing 'SSMS' into the Windows Start menu may not show both.
So if you use SSMS to import you only need the latest version, and no separate tools.
Footnote: Even after opening the correct SSMS version I got another error - something about contained databases.
An Azure database is a 'contained' database (or at least mine was) - meaning that its user logins are embedded in the database. This isn't enabled by default apparently in standard SQL Server 2017.
After running this in the local SQL in master I was able to import it successfully.
sp_configure 'contained database authentication', 1;
GO
RECONFIGURE;
GO
When this happened to me it was due to the version of tools I was using. I thought it strange that the most recent SqlPackage.exe I found in C:\Program Files (x86)\Microsoft SQL Server didn't work and publishing from visual studio did, so I found the most recent
under the visual studio directories:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150\SqlPackage.exe
* to publish to a SQL Server database in Azure*, you can use "Data Migration Assistant" (DMA).
I just tried it and it works smoothly without any issues (firewall and compatibility level)
please refer to this link SQL Server database migration to Azure SQL Database
for step by step: 10. How to migrate the SQL database to Azure with the Azure Database Migration Service
I got the same error while trying to update a local SQL Server database from Visual Studio database project (i.e. not i Azure). Turns out the problem was I was running SSDT for Visual Studio 2017 while using Visual Studio 2015. Visual Studio discovered an updated version of SSDT (just happened to see it in notifications!), pointing to the right Visual Studio version. Now it works!
My setup: BizTalk Server 2016 forces me to use Visual Studio 2015. My local database is on SQL Server 2017. Using SSDT for Visual Studio 2015 works for updating databases in SQL Server 2017. Just so you know. ;)
Most of the sources recommend to set COMPATIBILITY_LEVEL = 130; and, usually, it solves the issue. Unfortunately, this did not help me.
In my case, I had to downgrade SQL Server 2017 on my machine to SQL Server 2016 Developer Edition.
I ended up having to install DacFramework.msi on the SQL server that my azure runner agent was installed to get past this error. My server is a VM running in our network. not running in azure...
the description on the msi says:
'This installer database contains the logic and data required to install Microsoft SQL Server Data-Tier Application Framework (x64).'
Try to connect to the SQL Azure database using Sql Server Management Studio and the ip getting listed in the management studio is the right ip address. Try to add to the SQL Azure firewall rules. The ip address listed in the firewall page of Sql Azure portal is not accurate.

Deploy SQL Database to MS Azure Storage - Error: 40804 [duplicate]

I'm trying to move my databases to a newer Azure subscription. I used to simply click "Deploy to Azure" on a local database from SSMS and have it deployed to a specified Azure server. Importing/Exporting a BACPAC file also works. However, I can't seem to do any of this on the new server. I keep getting the error:
"The service objective 'Web' specified is invalid."
Googling around, I found this thread explaining the need to update the CREATE DATABASE template to accommodate Azure Databases (Azure upgrade, I'm guessing). However, the hotfix provided is specifically for SQL Server 2014 and I'm using SQL Server 2012. I checked other cumulative updates for 2012 here but found no fix for the issue.
Is there any other way I can fix this without having to upgrade to 2014?
Just to summarize my software versions:
SQL Server 2012
SQL Management Studio 11.0.2100.60
Local database: SQL Server 10.50.16000
Old Azure server: SQL Server 11.0.9230
New Azure server: SQL Server 13.0.15
You are getting this error because the latest V12 servers are not supporting the Web and Business Editions anymore. If you don't want to upgrade to SSMS 2014, you can create a V11 server and import your DB on this server. However this is only a temporary solution as Web and Business edition databases will be retired in September. At this point you will have to work with the latest tools to avoid this problem.
There is a Hotfix for it you can download and install on your machine. Please navigate to:
https://support.microsoft.com/en-gb/kb/2936603
You need to enter your email then download link will be sent to your email address. Then install it on your machine and you can see the following options:
Install the database as a Data Project into Visual Studio,
Set the target framework in the properties window to SQL Azure,
Build the project and resolve any unsupported issues.
Publish to your azure site.
I have tried the above and did not work for me - this solution worked!

How to import Sql Server 2008 database into sql server 2012

My problem is I am working on a project and its database is created in SQL Server 2008. But I has SQL SERVER 2012 installed in my PC. I cannot import this file into my sql server and also cannot connect this database file with visual studio 2013
Help me please
The easiest way is creating a database backup in 2008, and restoring that into 2012. Should work without any issues, and the restore process will automatically upgrade the database to 2012.
Alternatively, it should also be possible to detach the database from 2008, after which you can copy the files (Do not move them, but copy. That way if anything goes wrong, you have a fallback option). You should then be able to attach it in 2012, which again, will convert the database to 2012.
There's also an option of using the copy database wizard from inside SSMS, which also converts the database.
Please note that if you convert the database, from that moment onwards, all other developers will have to upgrade to 2012 as well.

SQL Server 2008 Version Problem [duplicate]

I am getting following error.
Restore failed for Server
I have recently upgraded SQL Server 2005 Express to SQL Server 2008 Express.
I have taken a Backup on Production Server, having SQL Server 2008
Backup was good and I tried restoring Backup on Production Server, that works great.
Than I downloaded that backup file in .Zip format with FileZila Software (And that is good too).
But when I tried to restore that file I am getting following error.
Restore failed for Server
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------ ADDITIONAL INFORMATION:
The media family on device 'C:\go4sharepoint_1384_8481.bak' is incorrectly formed. SQL Server cannot process this media family. RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3241)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.4053&EvtSrc=MSSQLServer&EvtID=3241&LinkId=20476
Things I tried which didn't worked
Attempt 1
Try to take backup using following command
BACKUP DATABASE go4sharepoint_1384_8481
TO DISK='C:\HostingSpaces\dbname_jun14_2010_new.bak' with FORMAT
And tried restore that file.
Attempt 2
Somebody wrote to test Version of my SQL Server.
When I tried to run following command in SQL Server 2008
Select ##Version
It is giving following output
Microsoft SQL Server 2005 - 9.00.4053.00 (Intel X86) May 26 2009 14:24:20 Copyright (c) 1988-2005 Microsoft Corporation Express Edition on Windows NT 6.0 (Build 6002: Service Pack 2)
My Production Database is in SQL Server 2008, and I am trying to restore DB in SQL Server 2008 but above version is showing as if i am using SQL Server 2005.
Any idea how can I restore SQL Server 2008 DB.
Many Thanks.
Is it possible that, instead of upgrading your 2005 instance to 2008, you instead installed 2008 side-by-side with 2005, and you're connecting to your existing 2005 instance? Look for other instances on your machine.
You cannot restore a backup from a higher SQL Server version on a lower version - this has never been able in SQL Server.
If you have a SQL Server 2008 backup, you can only restore that on a SQL Server 2008 (or later) machine - but not on a 2005 box. No trick, no workaround, no way to do it.
You have 2 options here.
Use WITH REPLACE while using the RESTORE command. This will overwrite the existing database and restore the database state represented by the backup files.
Delete the database to which you are trying to restore to and restore again using RESTORE command. This will create a new database with the state represented by the backup files.
Please note that in both these options you will lose the existing data of the database you are trying to restore to.
Make sure it is installed correctly - in your program files\microsoft sql server directory there whould be a 100/150 folder. Check out the install log in setup bootstrap\log.
As described above the reason for this behaviour is that by default SQL Server doesn't allow restoring a database backup to an older version of SQL Server, regardless of the compatibility level of the database the backup was taken from.
You can try to:
Start SQL Server Management Studio and connect to the instance where the database resides
In the database context menu navigate to Tasks | Generate Scripts…. This will invoke the Generate and Publish Scripts wizard
In the Introduction step of the wizard click Next
In the Choose Objects step of the wizard make sure that the Script entire database and all database objects option is selected and click Next
In the Set Scripting options step of the wizard:
Select the Save scripts to a specific location option
Specify whether the database objects and data will be scripted to a single file multiple files, as well as the path and encoding of the generated scripts
Click Advanced
In the Advanced Scripting Options dialog that will appear:
Specify the version of the SQL Server you need the database restored to in the Script for Server Version option
In the Script for Server Version option specify Schema and data
Set the following options to True:
Script Logins
Script Full-Text Indexes
Script Triggers
Click OK
Click Next
In the Summary step of the wizard click Next
In the Save or Publish Scripts step of the wizard click Finish
Execute the generated SQL script(s) against the older SQL instance
Although the procedure listed above should work:
1. It doesn’t migrate all of the database objects (e.g. sequences or queues)
2. It might fail if your database contains dependencies which SQL Server fails to recognize (e.g. dependencies to databases residing on linked servers)
You can take a look at the rest of the article on Solution center. There is also third party tools you can take in consideration.

Importing Sql Server 2005 database into Sql Server express 2008

Is there any way to import a database backup from 2005 into 2008 express edition. What I've had to resort to is doing a script the database, then import all the data through DTS. Whenever I tried to import straight from a backup file it says something about not being to import into a new version of sql server or I'll get the below error.
title: Microsoft SQL Server Management Studio
Specified cast is not valid. (SqlManagerUI)
SQL 2005 backups should be restored on 2008 without problem (have done that myself many times). What exact error message did you got about versions?
The other error (Specified cast is not valid) seems to be Management Studio error, not server error. Have you full rights on 2008 server?
Look at this question - any-reason-to-have-sql-server-2005-and-2008-installed-on-same-machine - there are talked both about restoring SQL2005 backups and about attaching SQL2005 data files.
(Of course you cannot attach production databases. To attach non-production databases just detach them, make file level copy of these and attach copies to new server. Orginal files need to attach to original server too :))
I imagine that you are in a development process where your data will have to be regularly copied to you SQL 2008 server.
You can then think of configuring a replication between the SQL 2005 server (publisher) and SQL Server Express 2008 (suscriber). Depending on your requirements, you have the choice between snapshot or merge replication. If no update is done on the suscriber side, go for snapshot.
Once you want to have your 2008 server running independantely from the publisher, just delete the replication.
A valid SQL Server 2005 Express backup file should be able to be restored to SQL Server 2008 Express. If the SQL Server 2005 backup is from the Standard or Enterprise versions, you might hit problems restoring it to Express. The user context that the backup was created from should not affect the ability to restore that backup.
One thing you can do is to try running the restore operation as a verification, without actually trying to run the restore. That will tell you if the backup file is valid or not. You can use this syntax:
RESTORE VERIFYONLY
FROM yourbackupfile.bak
If possible, I would also suggest trying to simply detach the original database from 2005 and then attaching the file at the 2008 edition.
While I have only tried this with the standard edition myself, it has worked perfectly with the compatibility mode keeping the database set to 2005.
Have you tried running the Upgrade Advisor http://www.microsoft.com/download/en/details.aspx?id=11455 - it might be able to highlight problems for upgrading the original database.