Export SQL database (all tables) from remote server - sql

I'm current using a 3rd party product, which uses an SQL Server database. I've been asked to take a copy of the database for our own backup/security purposes, but I'm having trouble.
To access the database I'm currently logging into one of my companies servers using remote desktop, where SQL Server 2005 Express is installed. Using that instance of SQL Server I then connect to the 3rd party's SQL server.
when I execute Tasks -> Back Up..., it appears to work, but the files are stored locally on the remote SQL Databases server, which my IT teams tells me is expected.
I tried using Tasks -> Generate Scripts... but the option to "Script Data" isn't available, either because it's SQL Server 2005 Express, or because the database is remote (not sure which, but probably one of those).
I've tried other things that I can't recall at the moment, and I'm out of ideas.
Can anyone suggest something that will let me get a 'local' copy of the remote databases table structure AND data?

The Generate Scripts wizard is unavailable because you are using a very old version of Management Studio Express. The 2012 version will work just fine against 2005 instances, but there is no longer an Express edition anyway, because all of the SSMS features are now available without any license.
Download the latest versions here:
https://learn.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms
I list downloads for the older versions at the bottom of this post:
https://blogs.sentryone.com/team-posts/latest-builds-management-studio/

Backups do generate locally. That is to be expected, as your team has already told you. You can generate it locally and then download it with a tool such as an FTP client. I highly recommend Redgate tools. See http://www.red-gate.com/products/dba/sql-backup/ It's a great tool and has some network backup options built in to ship your backups elsewhere. If it's a one-time thing, Redgate also has tools for that too, e.g. SQL Compare and SQL Data Compare.
The solution you pick really depends on how frequently you have to run and download backups locally and how big the DB is.

Related

Can't connect to SQL Server local database and can't find the SQL Server browser

My problem is that after I installed SQL Server Management Studio and use .\SQLEXPRESS as a server name. It says that it can't connect it.
I read lots of things about that problem and one thing was to go to computer management and check the sql server browser if it is started.
When I go there I do not find any files for sql. On time of the installing I do everything correct as it is supposed to be. That's why I cannot understand why it doesn't work. Any ideas ?
I suspect that you have installed the tools only (SQL Management Studio) and not SQL Server itself. If you want to connect to your own SQL Server (any instance starting with a dot ".") then you will need to install it on your machine.
You can download the full installation SQL Express package direct from Microsoft. There are several editions available to suit your environment and needs.
http://www.microsoft.com/en-au/server-cloud/products/sql-server-editions/sql-server-express.aspx
It gets a little complicated trying to find what you want since there are so many variants and editions. I recommend that you head over to Scott Hanselman's blog where he has laid it all out very nicely by release version, edition and environment (32/64 bit)
His preferred link: http://downloadsqlserverexpress.com
Original post: http://www.hanselman.com/blog/DownloadSQLServerExpress.aspx
So, it seems it isnt installed... was it installed? Check google what it's folders are for your system and go look if the folders exist. Make a backup of existing folders and re-install if need be. then attach any existing files to to recreate the databases, if any.

VB.NET Creating a local database in VS2013 or in SQL Server Management Studio

I am about to begin a personal project to build my skills in the .net environment. I am familiar with SQL Server Management Studio and how to create a database in it but I discovered how to make a local database in Visual Studio as well. My program is only going to require local database access as it will be used for individual inventory systems rather than connected ones. Am I ok to use the onboard tools in visual studio and create a local databasse or should I be using the SQL Server Management Studio?
When you use the Local Database item template in VS, it creates a SQL Server CE data file (SDF) and adds it to your project. When you use the Service-based Database item templete, it creates a SQL Server (Express) data file (MDF) and adds it to your project.
The advantage of using the VS tools is that the data file becomes part of your project and can therefore be easily deployed with the compiled application. As such, the database is basically part of the application.
If you choose SQL Server CE then you don't need a server installed on the user's local machine. They can install SQL Server CE or you can install it with your app if you want, but you also have the option of simply deploying a DLL with your app and it will work.
If you choose SQL Server Express then the user actually needs a SQL Server instance installed on their machine. To be honest, I'm not 100% sure whether that instance must be SQL Server Express or it can be a full SQL Server instance too. It would usually be SQL Server Express though, which you can install and even download automatically when you install your app, depending on the deployment method you choose.
If you use the VS tools to create an MDF data file then your connection string will contain the Data Source and AttachDbFilename attributes. The Data Source will generally be ".\SQLExpress", i.e. an instance named "SQLExpress" on the local machine. That instance name is not required, although it is the default for SQL Server Express, but it must be on the local machine. The MDF file gets attached at run time and detached again when you're app is done with it. It will also usually be attached to a user instance, which means that other users can't see it, even when it's attached. Note that, in later versions, the LocalDB feature of SQL Server may also be utilised.
If you create your database in Management Studio then it's not actually part of your app. It will be permanently attached to the SQL Server instance so, everyone will be able to see it and open it, assuming permissions allow. Creating the database during deployment will be an extra step in that case. You might create a backup and restore that during deployment or generate SQL scripts that get run. In this case, your connection string will contain the Initial Catalog attribute to specify the name of database to connect to, as well as the Data Source attribute. This option is required if you want multiple clients to be able to connect to the database.
In short, if you are only going to be accessing a database from the local instance of the one application then creating a database in VS is OK and probably a good idea. Whether you choose SQL Server CE or SQL Server Express may well depend on what level of functionality you need.

SQL Query Source Control

Does anyone have a good method for doing source control against SQL Queries. I am not concerned with the database itself but rather just the SQL queries.
Currently I store them in a folder on my local machine and intend to just point GITHUB at that folder. However, it would be ideal if there is a solution that integrates into SQL Server Management Studio.
The one that I use is RedGate's Source Control, this product integrates directly in to SQL Server Management Studio. Unfortunately, this is not a free product.
Another option with a trial version (55 days)
Agent SVN - SCC Subversion Plug-in

Creating a Database Server for home use in SQL Server 2005 Express

I am looking to create a database server that can be used to store data using a VB.net application. When I initially installed SQL Server 2005 Express edition, I believe I installed this using the LocalDB option.
As it stands my application is a simple tool which utilises the Process.Start command under certain situations, depending on user input, to launch Game Servers for use at a gaming LAN I assist in running.
I wish to progress the application by being able to update, delete and query a database created in SQL Server 2005 Express. I understand the use of connection strings etc, however I am wondering if the installation using LocalDB will mean that I cannot connect to the server to process the data I require.
Can I continue to use the LocalDB option and create a Database Server for specific use using my application or is a different installation option required?
Secondly, can someone point me in the right direction of how to create a new Server for this purpose? All of my searches so far have provided results for creating a database only, and not the server.
I have a couple questions about what you are trying to do.
First, why are you installing SQL Server 2005? It was released almost a decade ago.
I would go with 2012 express edition.
http://www.microsoft.com/en-us/download/details.aspx?id=29062
Second, install the management tools. SSMS is a nice GUI to do work in.
Third, If you are spinning up anything other than express, there are licensing costs which are quite high. 9K for standard and 25K for enterprise per socket or such.
Here are the versions and features list from microsoft.
http://technet.microsoft.com/en-us/library/ms144275.aspx
Last but not least, having the express edition on another computer is fine. However, you will have to use a network protocol such as TCP/IP instead of shared memory.
It will take longer to send Tabular Data Stream (TDS) to the other computer versus talking to memory on the same computer.
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/c4f06669-41fd-42e6-b4a9-564cf04ca9f7/how-to-choose-between-shared-memory-named-pipes-tcpip-via?forum=sqlgetstarted
Good luck with your project.
You can use a local instance of SQL Server just fine, if you want to set up a separate server for some reason then you'll need either a 2nd machine on which to install SQL Server, or to spin up a virtual machine. If running Windows 8 (and barring hardware limitations) you have Hyper-V at your fingertips.
This is not a complete answer for you but may give you some things to think about.
First you might want to think about your choice of database. If you don't have a compelling reason for using 2005 you will probably at least want to move to SQL Express 2008.
Second, to answer the part about creating a server... A server is something that serves data. In a general sense a computer configured to be contacted by external machines and respond with data is a server. A web server runs a program like IIS or Apache to respond with web pages. A database server contains a database and allows connections to that database. So as long as you install the database on a computer and configure it to allow external connections, you have your database server.
In MS SQL there are several things that need to be set up to allow a database to accept external connections. One is that the SQL Server Browser service will need to be active. Another is that the database itself will need to be configured to allow external connections (SQL Authentication type probably).
Hope this helps.
Addition:
SQL Remote Connection Configuration
Disclaimer, I don't have SQL Express 2005 installed but I think the settings are found in the same place in 2008. If the info here is not exact to SQL Express 2005, the general terminology used here should be enough to get you headed in the right direction to find the specifics.
While viewing the database in Server Management Studio or Enterprise Manager, right click the database server instance name (the root of the tree) and select properties. There should be a section title Connections and within this section there should be an option "Allow remote connections to this server". Make sure it is checked. The other setting you need in this properties menu is under the security area. There is a radio button for "Windows Authentication Mode" and "SQL Server and Windows Authentication Mode", you want the second that allows both.
The next step you have may be to create a new user, add a password, and connect the user to the database. That will give you the credentials you will use in your database connection string while programming. I usually add new users through the security section of the database then set the User Roles for each database that I need to connect to. It is good practice to limit the permissions to those needed by the application. Typically this is read and write, but sometimes you can get away with just read. The less the better.

SQL Azure database using SQL Server Management Studio

I've been trying to work out whether it's possible to manage (i.e. add tables, modify them, create stored procedures) a SQL Azure database using some kind of GUI like SSMS and I keep coming up against different answers.
I found a post from the end of 2009 saying that it would be supported in SSMS but I'm not sure if that includes the Express version? Does anybody know what the most recent update of the express version is and whether it supports it?
I think I'm right in saying that it can't be done in Visual Web Developer 2010 (and I can't afford the full fat VS2010).
I'm prepared to consider alternatives though if anybody knows any full features GUI tools that work with SQL azure and I don't mind paying for a commercial license if it's not too expensive.
Thanks.
Yes, SQL Server 2008 R2's Management Studio does support working with SQL Azure databases.
See:
Getting Started with SQL Azure Development
There are a couple of options
1) You can use SSMS (get the free version by downloading SQL Express v2008 or greater) with advanced services. This will give you SSMS. You can then connect to SQL Azure using SSMS. However - there is a limited set of functionality available via this tool.
2) You can use SSDT (stand-alone for free) or from within VS2010 SP1 or greater. Again, you can connect to SQL Azure, but there are some restrictions on what you can do.
I am using the SQL Express on AWS RDS (free usage tier) myself lately (and connecting via SSMS or SSDT). I prefer their implementation of SQL Server in the cloud to Microsoft's implementation of SQL Azure.