I have a internal database for an application, but this database is not online and cant be accessed remotely. I want to create a copy of that database at home so that I can query or work at home whenever I want. How would I do this??
Also how would I update the database of my home when changes occurs in the original database??
One of the ways you can do this is to take a dump of the remote database and restore the database daily on your local. You will need a little help from DBA in case you are not aware on how to take a dump. Also, your local changes will be lost. If you are OK with these two, then you can go for this solution.
Related
So I have a site hosted on GoDaddy (not my call...) that I'm working on an upgrade that required simply adding a column in a table. Did it locally, tested and worked like a charm. Connected to the remote DB and found I couldn't add a column. Called and after a lot of back and forth, I was told that they don't allow modifications to a db after it's created. Ummmmmmmm... okay, can I run an alter script? No...
OK, I'm not a dba so we're rapidly exceeding my comfort level but I thought I'd run a backup, restore it locally, make the modification, back that up and restore it on the host. Apparently I can't run backup from SSMS on their server. So I tried their backup tool from their control panel and it gives me a .txt file which doesn't appear to be a backup at all.
Just now I tried scripting the entire db and that isn't looking good either... throwing some kind of error as well.
What the heck else can I do to either make the changes I need or get my data the hell off there and tell my user that we simply MUST change hosts?
This is a little late..
One thing you could do from MSSMS...
Right click on your Database select Tasks->Generate Scripts.
Select a location on your PC.
Under Set Script Options click Advanced.
Change the option Types of data to script to Schema and Data. Then generate your script
Its not the best case scenario...but its better then nothing.
As for not being able to ALTER the Table...I would most definitely check the use rights of the user your logging in with. I am able to make changes to GoDaddy tables.
Instead of backup, you can try Extract data tier application from the database, which generates a bacpac file (containing schema and data) and Deploy this bacpac locally.
Make schema changes to this database and take backup of the same and restore in GoDaddy.
More information on extracting data tier application
I have a web application that has an SQL database.
For clarity I'm using Asp.Net 4.0/c#/SQL Server 2008 Web edition.
I recently puclished the site, which was my first, by creating a deployment package for the database.
Now a couple of months down the line, I need to update the database structure. The web application now has data that has been entered via the web, so i'll need to update the structure, then copy data across.
As this is the first time I've done it, I'm unsure of the process I should follow - is there a standard practice for this kind of update?
Also, since some of the tables use incremental ID's I need to ensure they remain the same in the newly updated database.
Any tips, links, advice appreciated.
Important Guidelines:
I assume you have not changed structure entirely (means keys column are same though solution is around for that too)
Steps are as follows:
Take export of the database
Add or remove the columns or whatever changes you want
Import the database back
Check the log for rows/tables (if some) were not updated successfully
Make SQL queries for them and run them to sync
Here are some general steps for this:
Take backup of your online database and restore it locally
Modify local database to suite your needs
Use third party comparison and synchronization tool to publish changes to your production database
There are many of these available and you can use them in trial mode to get the job done if you’re on a tight budget. You can try tools from Red Gate, ApexSQL, Idera, Dev Art and others…
So here's the challenge. I need to use C# to back up a database locally from a remote database server and the only share we have is \\computer\c$.
If the answer is to back up to a location on the remote database server and then copy that local, assume there is not a share on the remote location. Just b/c I have access to the database does not mean I have access to the file system.
This Q/A looks close to what I want, but remember the regular account in the database will not have access to the network. Sample sql script to zip and transfer database backup file
With all of that in mind...anyone done something like this and care to share? Or have an idea of how to do this?
UPDATE: I was being vague on purpose. The context here is this:
I do not have access to files on the server where the database is.
I am running the C# from the client under the client's credentials, so I have full control of the client computer and can do anything in this domain.
I think I actually have figured out what we are going to do though:
Create a special folder in the AppData area of the current user.
Create a fileshare to that folder
Add rights to Everyone for that particular share and folder.
Process the backup based on that share.
Remove the share and reset the permissions.
In case anyone is curious what this question refers to: RoundhousE
Context? Oracle? MySQL? SQL Server? Db Size? Backup time? Availability requirements? Encryption requirements? Rowcount validation?
I'm guessing you're talking about SQL Server, based on the TSQL example- to which I'd recommend checking out DMO objects. Here's a primer- http://www.codersource.net/csharp_sqldmo_sqlserver.aspx.
Truthfully- the vague nature of your question- and the fact that it's context free gives me some heebie jeebies. Be sure to test in a test envrionment and not run on production data, ok?
The backup system of SQL Server runs the entire backup procedure on the server, which basically means that the file has to be put somewhere the database server can put it and has access to.
In other words, the file will be written from the server.
If you:
Cannot access files directly on the server, from the client, in any way
Cannot download files from the server, to the client, in any way
Cannot write files from the server, to a common place, that is reachable by the client in any way
Then you are left with one way: Reimplement backup.
If your actual question is this:
With all of that in mind...anyone done something like this and care to share?
Then I'm going to hazard a guess that the answer to this question is: No.
Are you sure you cannot change the problem to one that is solvable?
think I actually have figured out what we are going to do:
Create a special folder in the AppData area of the current user.
Create a fileshare to that folder
Add rights to Everyone for that particular share and folder.
Process the backup based on that share.
Remove the share and reset the permissions.
In case anyone is curious what this question refers to: RoundhousE
If you want/need to back up a database, then in general, for the purpose of guaranteed database consistency, the database server will need to be either completely shut down, or at least be completely in read-only mode.
Your question sounds like your "challengers" have taken you to task to back up a remote server while none of those conditions are satisfied. The only sensible answer to such a challenge is that it cannot be done.
I have a client who owns a business with a handful of employees. He has a product website that has several hundred static product pages that are updated periodically via FTP.
We want to change this to a data-driven website, but the database (which will be hosted at an ISP) will have to be updated from data on my client's servers.
How best to do this on a shoestring? Can the database be hot-swapped via FTP, or do we need to build a web service we can push changes to?
Ask the ISP about the options. Some ISPs allow you to ftp upload the .mdf (database file).
Some will allow you to connect with SQL management studio.
some will allow both.
you gotta ask the ISP.
Last time I did this we created XML documents that were ftp'd to the website. We had an admin page that would clear out the old data by running some stored procs to truncate tables then import the xml docs to the sql tables.
Since we didn't have the whole server to ourselves, there was no access to SQL Server DTS to schedule this stuff.
There is a Database Publishing Wizard from MS which will take all your data and create a SQL file that can then be run on the ISP. It will also, though I've never tried it, go directly to an ISP database. There is an option button on one of the wizard screens that does it.
it does require the user to have a little training and it's still a manual process so mabe not what you're after but i think it will do the job.
Long-term, building a service to upload the data is probably the cleanest solution as the app can now control it's import procedures. You could go grossly simple with this and just have the local copy dump some sort of XML that the app could read, making it not much harder than uploading the file while still in the automatable category. Having this import procedure would also help with development as you now have an automated and repeatable way to sync data.
This is what I usually do:
You could use a tool like Red-Gate's SQL Data Compere to do this. The tool compares data between two catalogs (on same or different servers) and generates a script for syncing them.
I've seen lots of questions regarding moving data from Access to SQL Server, but I'd like to go the other route. Here's why:
I've been working on a sizable project with a SQL Server 2008 back-end and Access 2007 front-end. I'd like to be able to do some work on the front-end from home over the weekend, but I don't have access (VPN or otherwise) to SQL Server from there. I'd like to change my linked tables from SQL Server to another Access database file where I imported a snapshot of the SQL Server data. Then, come Monday morning, switch links back to SQL Server.
My problem is when I go to the Linked Table Manager and attempt to change the link, all I get is the ODBC Select Data Source dialog. If I try to link to an Access database, it tells me ODBC can't be used to link, import or export to another Access file.
One thought has occurred to me but I haven't tried yet; maybe someone could tell me if it's a good or bad idea: would I be able to delete the links, re-create them to the other Access file, and not lose any functionality in my queries/forms/reports?
My proposal would be to have SQLExpress (free) installed on your computer. You can then have all the data available on the machine. Create a publication on your main server, and have your local machine suscribe to this replication (if you don't need to save/synchronize the data changes done on your machine, you can stick to a basic 'snapshot' replication.)
You then just have to change your connection string from your network MSSQLSERVER to your localhost SQLEXPRESS server instance to have your app work.
If, for any reasons, you have to make changes to the database model while being off-line, you will then have to unsubscribe from the main server before making the changes on the local server. When you're back to the office, make sure that the same changes are done on the main server. My advice is to write your changes in T-SQL, save them in a file, and launch the file against the main server once you're back to work.
My opinion: don't work too much on weekends, or make sure your client is being billed for that.
For linking tables, you need to delete them and entirely and recreate them. Using the linked table manager to refresh ODBC links doesn't even work reliably when you're still using ODBC, as there is data cached in the table link definitions that doesn't get refreshed (e.g., if you change the number of columns in a SQL Server view, refreshing the table link with Linked Table Manager will update the number of columns, but you won't necessarily get an updateable view (assuming the original was updateable)).
But it's not clear whether or not you'll lose functionality or not. That all depends on how much of your application's logic is server-side, in SQL Server views and stored procedures. None of those will work if you link to a Jet back end.