Sql management Studio 2014 crashed + backup databases before reinstall - sql-server

I have installed sql server 2014 standard edition on windows server 2012R2, it was working fine. but after few days i try to open management studio but it says cannot find one or more components try reinstalling the application. i have seen many solution for recovery and reinstalling but my first concern is data backup. as its a live system i dont want to lose any data. can any one tell so surely that how i can backup data and recover management studio. are there any files which need to be copied and can be replaced after reinstalling. i will be thankful if some one can give sure answer. Again remember its a live system i cannot lose any data. Thanks

I hope that SQL services are still online, you can take backup using sqlcmd and try to repair the management studio.
example.
SqlCmd -E -S Server_Name –Q “BACKUP DATABASE [Name_of_Database] TO DISK=’X:PathToBackupLocation[Name_of_Database].bak'”

Related

How to restore SQL Server 2014 database to SQL Server Express 2012

When I try to restored DB , every time I am getting this error
TITLE: Microsoft SQL Server Management Studio ------------------------------ Restore of database 'PramodDb' failed.
(Microsoft.SqlServer.Management.RelationalEngineTasks)
------------------------------ ADDITIONAL INFORMATION: System.Data.SqlClient.SqlError: The database was backed up on a server
running version 12.00.4100. That version is incompatible with this
server, which is running version 11.00.6020. Either restore the
database on a server that supports the backup, or use a backup that is
compatible with this server. (Microsoft.SqlServer.SmoExtented)
Please help me.
Like always it helps to read the error. Let me quote pretty much all of your error message:
The database was backed up on a server running version 12.00.4100. That
version is incompatible with this server, which is running version 11.00.6020.
Either restore the database on a server that supports the backup, or use a
backup that is compatible with this server.
General rule: No downgrade. On top, restoring on express is generally possibly problematic due to the limitations of the express version.
So, you need to either export/script import the database, or grab yourself and install the free developer version. Ever since they made this one free there is no excuse for even the most junior developer not to work against it.
The answer you cannot do that. You cannot downgrade a database.
As far as the work around is concerned you need to use the Import/Export wizards in SSMS to make it working.
You can't, but...
You can try Scripting your 2014 database and execute the Scripts on a blank 2012 database.
To open the Generate and Publish Scripts Wizard: In Object Explorer, expand Databases, right-click a database, point to Tasks, and then click Generate Scripts. Follow the steps in the Wizard to script all database's objects.
Note the disk space required.
You can script schema and data. See the following article:
https://www.mssqltips.com/sqlservertip/2810/how-to-migrate-a-sql-server-database-to-a-lower-version/

Adventureworks restore failed

I've just installed MS SQL Server Express 2014 and SQL Server Management Studio 2014 under Windows 10. I'm following the official Microsoft tutorial on database fundamentals, which uses the Adventureworks DW2008 database. I have tried to restore this dB using the Restore GUI, but it fails every time, as shown here:
AdventureWorks restore failure
I have verified the backup media, but it still fails. I have also restored a different dB, and that worked fine, so I know I am following the correct procedure. I have the file (AdventureworksDW2008Big.bak) in the following location:
C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\Backup
Yes, I have thoroughly researched this, but still apologies if there is already an answer on here - I couldn't find it.
The DW in the filename is for Data Warehouse and only works on that edition of SQL Server. As you only installed SQL Express you cannot use it.
Why not try Adventure Works 2014 Full Database Backup.zip instead. If you really need 2008/R2 try the none-DW from here:
AdventureWorks2008R2_Database.zip
AdventureWorks2008_Database.zip
I do not know if it will solve your problem or not,
but I had same problem. I mean I am using SQL SERVER 2017 and I wanted to restore AdventureWorks2012.
I received restore failed error, and I decided to restore AdventureWorks2017. my queries on AdventureWorks2012 in an older system in university led to the same results as my queries in AdventureWorks2017 in my system. if you are using a version of SQL SERVER and trying to restore an older or another version of AdventureWorks, you can try the same way.
I mean restoring a version of AdventureWorks which is the same as the version of your SQL SERVER.
Best to run SSMS as an administrator to avoid access denied errors (do this by right click on SSMS and choose More -> administrator)
copy adventureworksxx.bak into the sql server DATA directory where by
default all databases are usually located. ( Note: if it is in other directory
the restore may not find it OR may cause errors later)
Restore the database

Where is my all procedures, etc. from SQL Server?

I guess this or similar question was asked, but can not find one such.
Where are stored on my computer (automatically if you do not specify otherwise) all procedures and scripts that I wrote?
And if I am doing a new installation on the computer what the simplest and safest recover for everything?
Thanks
If you saved any files in SQL Server Management Studio and used default path then your saved scripts are in "C:\Users\**YourWindowsLoginName**\Documents\SQL Server Management Studio\"
If you created your stored procedures in a database you have to remember in which database you've created these them and on which server.
If you did it on another server, they might be still there, you just have to ask somebody, who knows more about SQL Server on how to connect to that server and how to get access to the database you've used.
If you used SQL Server on your local PC, then Database files might also be still there. Search your Drive C:\ for files with extension ".mdf" and ".ldf".
Most probably they are stored in the default location: "C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\" - That location for SQL 2014, but it might give you an idea where to search for.
PLEASE keep us posted if you find these Stored procedures, everybody have to know where to search it next time if anybody lost them. Help everybody else as I help you.
Thanks.
By default, SQL Server Management Studio will save queries to "C:\Users(windows log in username)\Documents\SQL Server Management Studio" and they should be saved as .sql
This is by default even with a new installation. So if you upgrade, or uninstall and/or reinstall a new version the folder and the scripts should still be there. I did this when I uninstalled SSMS and reinstalled to another drive on my machine.

Uninstalling SQL Server 2012

I need to uninstall SQL Server 2012 on computer with Windows Server 2008, but I need to leave all existing databases. In other words, I need to remove SQL Server, but without deleting all data. How could I manage that? Also, where should be all databases phisically(.mdf files)?
Unless you have or can take backups then you could:
Shut down your database instance using SQL Server Configuration
Manager.
Find where your database files are located and copy these safely
somewhere.
At this point you could try mounting these on an alternative (test) SQL
Server (using the SQL Server 'Attach Database'). This will give you
confidence that the re-install will work on whatever SQL Version you
are planning to move them to.
Then as others have stated, uninstall SQL Server
Reinstall
Re-attach
NOTE - this does not preserve instance level security, so you will need to script out any special security settings for these databases and then re-import it back in (See https://dba.stackexchange.com/questions/58772/how-to-export-all-the-security-related-information-from-a-sql-server-database).
Detach Databases ,keep Database files , run controlpanel program and feature and unistall it.

Moving SQL Server database to shared hosting using backup

I need to move my SQL Server database to shared hosting. Is there a tool there that allows me to import a database backup file? I'm stuck with actually making .bak file.
Its suggested that I use SQL Server Management Studio (SSMS), I tried downloading it from here, but failed to install.
I found I could run a query like
BACKUP DATABASE mydbname TO disk = 'd:\bak'
but can't figure out where I do this in VS 2010.
I'm stuck on this lame problem, please give me a hint.
This little utility could be your solution, it's free for any manually backups.
SQLBackupAndFTP
However, remember that a SQLServer backup could be restored only on the same or subsequent versions of SQLServer
Resolved: I found this detailed tutorial on how to install SSMS here.
Then I used following query to make backup:
BACKUP DATABASE mydbname TO disk = 'd:\bak'

Resources