Uninstalling SQL Server 2012 - database

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.

Related

Configure remote connections without sql server installation?

We have an application called IpSwitch Whatsup and it's installed in a machine that I can connect to remotely as administrator. This is all in our intranet.
We need to connect to the sql server database being used by IpSwitch Whatsup, but this particular machine doesn't have sql server installed. On the other hand, in sql server configuration manager there is indeed a sql server installation for whatsup (the entry says SQL Server (WHATSUP)).
So, two questions:
How does one go about in connecting to this database? I'm pretty sure I know the name of the database and I already know the server name and instance, so I would like to connect to this DB from a sql server installation in another machine.
How does one configure a sql server installation to receive remote connections if it doesn't have sql server installed?
Thanks.
For the first question, you just type in (or browse) the appropriate instance name and authentication options using SSMS - which is the GUI tool used to manage sql server instances. Note - the term "sql server installation" can mean different things so it is not a useful reference.
As for the second question, review the information here. Note that any task you do in SSMS can be done via tsql - you can see the appropriate commands using the script button in the SSMS dialog windows.
And you can also (and probably should based on these questions) install SSMS on the same machine as your server instance so you can do "anything" "anywhere". Now would probably be a good time to review your disaster recovery options (and start backing up your databases regularly).

How to rename sql server 2012 instance name standalone server configuration

I have been searching for directions and steps to rename a named server instance of SQL Server 2012. I have a rare opportunity to rename both the computer name and instance of the SQL Server. I stepped into a situation where all of the naming conventions need to be revamped. I'm assuming because I have no linked jobs or connections that I should be worried about, this will be okay. I have read that this isn't possible and others who say to use the sp_dropserver, sp_addserver but that doesn't work. Syntax would be helpful. My names are as such:
{machinename}\{instancename}
{COLO-VSR=SQLDW}\{SQLBISERVER}
I want to change it to {COLO-VSR-SQLDW}{SQLDW}
The "safest" way to do this is to (this does assume that downtime is possible for you):
Take a backup of each database (or, if you're going to install exactly the same version of SQL Server, including Service Pack level, detaching the databases is probably safe
Take the old instance offline
Rename the machine, including rebooting as required
Install the new instance of SQL Server
Restore the databases to the new instance of SQL Server
Validate
7. Uninstall the old instance of SQL Server
SQL Server has never seemed to handle renaming of the server it's installed on particularly well, hence the suggestion of creating a new SQL Server instance after renaming the machine. This may be better with newer, e.g. SQL Server 2016, versions but I suspect that "rename machine" is a scenario that doesn't get a lot of engineering priority or resource.

Copying Data from SQL Server 2008 to SQL Express

I would like to copy a database (tables, it’s data, stored procs & views) from SQL Server 2008 database to SQL Server Express. Is it possible? If so, would you please let me know how to do it? When I tried, it is giving some error.
Please note that I have only few records in SQL Server 2008 database tables.
Thanks and Regards..
Shruthi Keerthi..
The quickest way is to "detach" the source database from its server, copy the (2) files to a new name/location and (re)attach each database to the appropriate server.
Attach/detach is available as a command or via the SQL Visual Studio.
You can create a backup of the database and them restore that backup into the Express instance.
Another option, since you said you didn't have very many records in the DB, is to generate the SQL statements (right click on the database --> tasks -> generate scripts) and then run that on the Express instance. Then just copy over the tuples you want.
I prefer to use Backup/Restore when moving a database from one server to another. As long as your SQL Server and SQL Express are the same version, or the one you are moving to is newer than the one you are moving from (SQL 2005 to SQL Express 2008), it should work without a hitch.
If copying the entire database, I usually find it easiest to stop the source service, copy the *.mdf file to the appropriate new data directory, and just mount the MDF in the new service. As long as there aren't any changes in the setup (like FILESHARE), then this is the easiest way to clone a database.
And yes, this is possible. I just did this earlier today.
You could also try using the Microsoft Database Publishing Wizard.
It's simple to use and will create a SQL script that you can run to rebuild tables (including data), stored procs, views, etc...
You can download it here:
http://www.microsoft.com/downloads/details.aspx?FamilyID=56E5B1C5-BF17-42E0-A410-371A838E570A&displaylang=en

Easiest way to copy an entire SQL server Database from a server to local SQL Express

I need to copy an entire database from a SQL Server 2005 on my server over to my local SQL Express in order to run my application for a presentation. What is the fastest/easiest way to get this done?
EDIT: I have very limited access to my server so I don't think I can access the backup file that I could create so that is out.
If the database is not too big, you could use the Database Publishing Wizard.
This is a free tool from Microsoft which creates a complete SQL script of a database for you (not only the tables and stuff, but all data as well).
You can install the tool on your machine, connect to a remote server and let the tool create the script directly on your machine.
You can download the Database Publishing Wizard here.
Apparently the link above doesn't work anymore in 2019.
That's probably because in newer versions of SQL Server Management Studio, the functionality of the Database Publishing Wizard is included out-of-the-box, so there's no need to install it separately.
It's now called the Generate and Publish Scripts Wizard, but it does exactly the same.
You can right click the database -> Tasks -> Generate scripts. Here you can select one, multiple, or all objects. Then in the 'Set Scripting Options' step of the wizard, click Advanced. In here set the property 'Types of Data to script; to Schema and Data.
Having done these steps, make sure you publish to a file. Because only file can handle large amounts of data.
Now you should have all your objects, tables, and data scripted. Now start running the scripts and viola!
Back up the database on the server and then restore it locally in SQL Express.
EDIT: If this is part of your work, surely you can get someone in networks to get you a backup..?
If you can login to both servers (the Express and the 05 Server) using SQL Server Management Studio then you can do a DB Restore from one database to the other. No need for backup files at all.
You can use SSIS's database copy wizard, but it's not quick at all. Is there a DBA there that you can ask for the backup file? That will probably turn out to be the fastest way.
Depending which versions of SQL Server you are using, you might get some mileage out of the SQL Server Database Publishing Wizard from Microsoft. I've had mixed results with this tool in complex environments, but for most simple database scenarios it is a great tool.
An example of a scenario where I ran into difficulties was a DB with multiple distinct schemas, each with their own owner and extreme separation between the tables (don't ask...). As I said, though, most other scenarios have been fine.
Save your database as a sql script
EMS SQL Manager (for example) allows you to backup your database as a script in a .sql file. It is then possible to run this file against any other SQL server. Just update the first line of the script (CREATE DATABASE ....).
You can even fully parameter the script in order to include data from complete or filtered tables.

Can an MS SQL 2005 backup be restored onto an instance of MS SQL 2008?

Is it possible to restore a backup of a SQL Server 2005 database onto an instance of SQL Server 2008?
I need to rebuild a server as it's getting rather crufty, so I plan to take this opportunity to upgrade to SQL 2008 and wondered if I'll be able to restore my backups OK.
Upgrading from 2005 to 2008 is OK, moving back might require more work
N.B. You might have a problem with your database the logins (as they will not exist in the new server master db) but that's something which would happen regardless of the server version. Just re-create them and re-associate with your database.
Yes, but make sure that ALL of your servers are SQL 2008. If you have development, test, QA or disaster recovery servers, all of them will need to be 2008, since 2005 servers won't be able to restore a 2008 backup.
To prevent the lost-login problem that Ilya mentioned, follow the steps in this knowledge base article. SP_Help_Revlogin will script out your logins, and you can apply that script on the new server. Presto, all your logins are back with the same SIDs and everything.
http://support.microsoft.com/kb/246133
(And just for future reference, this is how we upgraded StackOverflow last night, heh.)
http://twitter.com/SuperDalgas/status/976719756
You can restore the 2005 backup with 2008 without any problems. The compatibility from this point of view is nice.
Backward is not possible only with backup files.
In any case you can also recreate the database structure and use SSIS to transfer data from one server to another.
You can also do a detach/attach with the database files (leastways you could going from 2000 to 2005), but there are more caveats with this approach (requires explicit rebuild indexes afterwards IRRC)

Resources