Azure Database backup to Local Storage - c#

I build a web program and hosted it on an Azure Virtual Machine. I'm using the database as Azure Database.
This is the first time I hosted a web application all by programing and finalization and did it by self-studies.
So I want to know when I test it on a local server I used to run a scheduled script that took a daily backup of my database. But when I hosted it on the Azure Database, I couldn't find a way to get a backup of my database. ( It has an option but I have to buy another storage to create a backup. So it costs a additional fee)
Is there any way to get a database backup without paying the additional cost? I can connect to the database using the credentials in my local SQL server. I tried right-clicking the database name and tried to get a backup but the option wasn't there. Then I tried to get it by generating scripts and selecting the option, data, and schema. It fails to take the all data it currently has.
Want to know how you guys doing this. And another thing, The reason why I used a Virtual machine to host my web application and used Azure database as the database is, that I tried installing the SQL Server on the Virtual machine. But from the application, I couldn't connect to the created server on the VM. Followed a few tutorials but couldn't figure it out. So if anyone knows how to do it, please help me to solve it because then I can re-write the auto backup script and get the backup on the VM.
Waiting for a better solution from the experts.

Is there any way to get a database backup without paying the additional cost?
You can Export the database to a BACPAC file

Related

Do I have to install sql server on each client to use my disk top application?

I have a disk top application made by c# visual studio. My question is do I have to setup SQL server on each client to use my application? or there is another way to attach my database with my application and compress it as one and send to each client and those just extract that file and use the application correctly?
On a real scenario, your database should be placed on a remote server and the clients should only access the database through your API (that will need to support authentication or any other identity based systems).
If your application only needs to store some local information (relevant only for your client app), then you can just use LocalDB or AppSettings, depending on your data structure.
Otherwise, if your application contains more complex features, then you will need an API and a remote DB managed only by you.
To conclude, you only need to setup Sql Server once, when you want to create the design of it (tables, columns, links). The clients will only have to connect to it and pull their data. And this task can be done without installing SqlServer. This link shows you that you only need System. Data assembly to connect to a Sql Server DB.
Yes you need to instal SQL server on each machine or if you go for LocalDB then also u need to instal SQL server engine ,and you have a better option u need to buy sqlserver from AZURE (it's free for one month try if want click here AZURE)

Making database mdf work across different computers

I know this is kind of a stupid question but it gives me a lot of problems. Me and my partners in college projects have a lot of issues making the database mdf work when we send each other the visual studio projects. It gives us errors about the versions of sql server. Is the only solution to this to install same version of sql servers for the entire team or is there some other workaround?
Yes, you must be using the same version of SQL Server across all PC's.
You can never "go back" in time with a SQL Server database - once a .mdf file has been attached to a given version, it can never be attached to an older version anymore. And you cannot get around this by using the database compatibility level, either - the internal database file structures are just too different between versions, and no backwards "downgrade" path is provided.
One way to get around this would be to have a common, shared server somewhere that everyone can connect to and everyone can work with - making in unnecessary to send around "free-floating" .mdf files altogether... after all, it's SQL Server - a server-based system - not so much a file-based "database" system ....
Another way to go would be to stop sharing the binary .mdf file, but instead work with SQL scripts that you can exchange within your team, and that each team member can execute locally on their respective SQL Server instances - regardless of their local version
I suggest that instead of passing around mdf files, every person on your team creates the DB and then uses SQL scripts to create the objects. These scripts can be very easily created and exported from the SQL Server Management Studio.
This has the added bonus of being able to put the scripts under version control as part of the project.
I made such practice, with one way , by create separate pc running under windows server, only using as sql server to store all data record , then the data is called via "connectionStrings" of IP with server name of user policy, which is also secured by password and username , so this practice is used , to enabled two different programs to share that data , for example , that I made ( one web localhost app to create internal registration ),( the other web app using to access to mainpage via Login form).

How can I modify a hosting database if is not possible to reach it remotely?

I have to develop a desktop app, this app has to be able to connect into a hosted database (ipage.com) im order to get and insert data, the problem is that I can not reach the database remotely, so I don't know what to do, what do you guys recommend me to do?
note: I can't reach it because the webhost doesn't allow remotely connection.
Thanks.
As dub stylee write, you'll need to write an API which you'll make available from a webserver that does have database access. Then instead of making direct database calls your application will access the API, authenticate, and the API will make the database calls and return information on behalf of your application.
from what I understand that you sometimes can't reach the database due to net connection problem
if that so
you may create a copy of the database locally and when the app reconnect to internet again it sync the databases
if not can you give a little more details
You need to create a local database and whenver you get a chance to connect with the remote database need to sync data through jobs or sp's

Local SQL Changes To SQL Azure Database

I have a local database I am working on for a website, I can publish the website changes to azure but cannot see an easy way to just get my 'changes' pushed up to SQL Azure.
I used this https://sqlazuremw.codeplex.com/ to initially get my local database onto Azure, but it seems to only support entire database migrations. Not minor changes like data, or a new field added?
This is my first time using Azure and it seems great, it's just this issue with the database which is now putting me off slightly.
I'm afraid that without any third-party tool you will not be able to achieve much.
What I usually do is create migration sql scripts and run them directly against the production database after the scripts have been thoroughly tested
If you manage your database schema using Visual Studio Database project then you can sync it with the SQL Azure database. I believe you can also sync data but I have not used that.

I'm trying to grasp the concept of creating a program that uses a SQL Server database, but I'm used to running it only on my local machine

How can I make a program use a SQL Server database, and have that program work on whatever computer it's installed on.
If you've been following my string of questions today, you'd know that I'm making an open source and free Help Desk suite for small and medium businesses.
The client application.
The client application is a Windows Forms app. On installation and first launch on every client machine, it'll ask for the address of the main Help Desk server.
The server.
Here I plan to handle all incoming help requests, show them to the IT guys, and provide WCF services for the Client application to consume.
My dilemma lies in that, I know how to make the program run on my local machine; but I'm really stumped on how to make this work for everyone who wants to download and install the server bit on their Windows Server.
Would I have to make an SQL Script and have it run on the MS SQL server when a user wants to install the 'server' application?
Many thanks to all for your valuable time and effort to teach me. It's really really appreciated. :)
Edit:
To clarify, each business will have their server completely separate from me. I will have no access whatsoever to them nor will they be in any way connected to me. (I don't know why I should clarify this :P )
So, assuming the have ABSOLUTELY NO DATABASE SERVER installed; what can I do?
Ok, part of the answer, dealing with the SQL Server Database (and frankly SQL Server Express will take you a long way - 4Gb of data) and the server install elements.
Firstly make installation of the SQL an SEP, make it a pre-requisite possibly tweak your installers to test (challenging) but substantially point them at the links to SQL Server express and let them get on with it).
Secondly separate installers, as suggested, for your client and your server elements.
Finally, how to build the database - I'd suggest using code to create and maintain (update) the schema i.e. once you have a connection to a server you can run code that calls DDL that does what is necessary (something like suggested here: How to create "embedded" SQL 2008 database file if it doesn't exist?)
A question - are you intending all communications from the clients to go through you WCF service?
Your install application should:
Obtain a SQL Server name, a username (with apprpriate rights to create a database) and password.
Either run SQL scripts using the locally installed command line tool or from code using SMO (for instance), against the user supplied server with the supplied credentials.
BTW, Before you expend effort writing an open-source help desk, have you checked what is already available? Also, Open Source Helpdesk
It is not so straightforward to deploy a client/server solution with an automatic installation.
You probably would then be better off to deploy your server installation together with a database engine and a skeleton database already setup according to your wishes. This is to avoid tampering too much with the existing server - who knows whats on it.
Also you say you want to install WCF services, well this would probably mean installing them on a customer server, in theory this shouldn't be a problem however in reality it could be, depending on what is previously on the server.
Do you want a single SQL Server instance running on your machine, or one on each of your customers' servers? If it's the latter, you'll want to install a SQL Server instance - anything from the (free, but limited and not open-source) SQL Server Express to a more expensive SKU - on each server. You can include this step in your server installation package; MSI installs make it very easy to bundle a MSSQL install.
Then you'll need to drop a schema, and maybe data, on the instance. You could do this as a step in your installer, or as part of your application setup process. It possible that a SQL Server instance, or more than one, might already be installed on the server, and your post-install step should allow the user to specify which instance on which to install your pieces.
Then, include a database configuration piece in your client application. Ask the user - or take from a configuration file at client install time, to allow for unattended or unprompted client installs - server connection details, like server name and authentication information.
A word on authentication - since you appear to be building Windows-based tools, use Windows integrated (domain-managed) authentication if at all possible. Don't get in the business of storing logins, but instead rely on the existing domain to manage logins. A good strategy is to use active directory groups to manage access. Grant access to a particular group in SQL Server, and defer group membership to Active Directory itself. If you can't gain the access necessary to do this, then grant permissions to AD user accounts themselves. Avoid creating SQL Server logins, the use of which open the door to some possible security problems.
I understand what you are trying to do. If I were you, I'd do the following:
Provide 2 downloads - 1 for client and 1 for server.
Forget about MS SQL Server and perhaps go with MySQL, since it really is open source. You could probably get away with using MS SQL Server Express Edition, but if your data set gets gigantic large (which is common with help desk databases), you'd be stuck.
As other people pointed out, on very first run (or at setup time), I'd have the client app locate the server.

Categories