Hey anyone know how to take automatic backup of a SQL Server database once a day (or it may be daily or periodic bases)?
If you know any configuration of SQL Server then please tell me.
Or you may have solution by using a C# / .NET Windows application, then please also tell me.
Created a scheduled job, and look at the following to create the backup http://www.sqlexamples.info/SQL/tsql_backup_database.htm.
It makes use of BACKUP DATABASE #db_name TO DISK = #fileName;
Sure, it's quite easy!
Use SQL Server Agent. From SSMS go to "SQL Server Agent". Expand "Jobs", right click and select "New job". Go to "Steps" and add "New" step. Write your T-SQL code for SQL backup.
Go to "Schedules" and create new job "Schedule".
Finally, check if your agent has been started.
EDIT: You can also use "Maintenance Plan Wizard" from "Management" group, it's even easier because Wizard should generate (almost) all of the code for you and set up the Agent job.
You could use a third-party products though. Check this opensource backup windows service MFSQLBackupService, it did a great job for me.
Related
I have made a web page which uses a local SQL database server.
Now that I want to publish the web page and place it online, I have to change everything, because the hosting server uses mySQL and presents me with his own mySQL database, and I don't know how to make that transition, I have an entity model in my solution and the Controller my database.
The specific question is - what are the steps to make that transition?
1 use SQL Tools (don't know what version you have) do a full backup.
2 from the new hosting server, restore the database.
3 change your connection strings or path (depends on programming environment) to use new MySQL.
Here is a link to what I used when I migrated in a similar way as to automate the whole process(Yes, it took a little learning but worth it). https://www.youtube.com/watch?v=rpPANKhbpDs
try to install mysql connector
https://dev.mysql.com/doc/connector-net/en/connector-net-entityframework60.html
MySQL Workbench provides you with the Migration Wizard feature. It allows you to migrate databases from various RDBMS products to MySQL.
This documentation would help you get started,... http://mysqlworkbench.org/2012/07/migrating-from-ms-sql-server-to-mysql-using-workbench-migration-wizard/
There are also several paid tools available which convert MS SQL to MySQL, but I've never used them personally. These tool come with free trial so you can actually test them before purchase. You can also refer similar threads on Stackoverflow,...
How to migrate SQL Server database to MySQL?
How to export SQL Server database to MySQL?
I'm looking for some advice over the best way to transfer data from a local MSSQL DB to a remote MYSQL database every 5 mins?
At the moment I am using a tool called SQLYOG which allows me to create a connection to my local MSSQL database and to my remote MYSQL server and set up some queries and mapping.
It also allows me to create a windows scheduled task which runs every 5 minutes.
This solution has been working ok but is only about 95% reliable and seems to struggle sometimes.
This software runs in GUI mode and via cmd prompt so is reasonably light weight when running a scheduled task.
Does anyone know of any other light weight tools or methods I can use to get the same outcome?
You can use SymmetricDS. its a good & efficient open source tool for this purpose.
you can use SSIS packages to do that.
SQL Server Integration Services (SSIS) is a component of the Microsoft SQL Server database software that can be used to perform a broad range of data migration tasks.
Couple of options:
1. create linked server to mysql then copy rows via linked server in sp, set sql job to execute.
2. build ssis package and run it in sql job.
What I feel is the best soultion for this is to design an ETL job using either SSIS or Talen Open Studio.
I have a database backup in "SQL Server 2008 R2", Can i store this database backup in "SQL 2008 Express" ?
Anyone who have knowledge about SQL-2008 kindly share to me.
No and 'yes'.
A backup (.bak) is not possible, nor is copying .mdf over but you can downgrade.
You could go back to 2005 if you wish to.
I found this information which runs you through it the easy way.
How to Downgrade SQL Server Database
Direct link: http://www.mytechmantra.com/LearnSQLServer/Downgrade_SQL_Server_Database_P1.html
TIP: Use Microsoft OLEDB connector to destination instead of the native client and you should avoid any errors in the transfer
Nothing is impossible, you just have to get creative :)
Install an instance of SQL 2008 R2 on one machine and SQL 2008 on another
Open SQL Server Management Studio R2
Select your source Database
Select Tasks>Generate Scripts.
Select 'Script entire database and all database objects', press 'Next'
Select 'Save to File' and click on the 'Advanced' button
Select 'Script for Server Version' and select the version you want: 200/2005/2008
Select 'Type of data to Script' and select Schema/Data/both
Click 'OK',Next and do it!
Copy the resulting file to the target machine with SQL 2008 [or whatever]
Log onto your SQL Management Studio and open the copied .sql file... be aware that there may be limitations on the file size.
There may also be issues with the order that the .SQL file inserts the data into the target database and if there are FK constraints in place, this could be an issue.... simply re-order the insert lists.
Once the .sql file is organized, parse it [just to sure], and then execute.
Let me clarify a little on these directions.
On the SQL Management Tools be logged into both the old and the new server if possible.This makes these steps even easier.
So, start with the source server, right click on the database and script it. There is one option called ‘Script Data’ that is off by default, we set it to true so the script will include inserts for all of the data. We choose to script the tables, views, indexes and keys (and triggers … not sure if you use any of those). I also did not mess with the users, since that is problematic. It is easier to create the user by hand once on the local SQL server and give them permissions to the dbs.
Then script the DB to a file.
Then select the local SQL server and add the database by hand, then open up the script file and execute it under the new database, all the tables, data, indexes, etc came over just fine. Setup the user permission and you are golden.
NO, you cannot do this.
There is no way, no method, no hack, no workaround, no trick to get a backup from a more recent version of SQL Server back into an older version.
It just doesn't work - it's not supported.
You'll need to synchronize your structure using some kind of SQL diff tool, and possibly your data by exporting and importing, e.g. via the "Data Export / Import" wizard or some custom way.
What is the prefer way to generate mysql backup while application is running ?
I want to provide functionality to admin to take backup of database at the same time when other admin using the same application from other computer.
What is the prefer way to handling this scenario ?
Hopefully you can take backup using mysqldump utility without stopping the database. Mysqlworkbench application provides easier interface to do this. If you are looking for a more advanced option and worry about transaction you can set up a replicated server, so that you can take the stable backups without stopping the master server.
if you are working on a webserver with php support use phpMyAdmin or any mySQL Dumper
Often I need to pull the production database of some project to my local sql server to add features, test out stuff etc.
Today my procedure is to create a backup on the production server, somehow get that to my local machine - and then create a new database locally and restore the backup on top of that.
It is a pain, and takes more time than I like - and I would like to think, there must be a better way.
I have access via SQL Server Management Studio to the production database - isn't there an easier way, that requires fewer manual steps?
How do you do it?
Can't think of a quicker way using SQL Sever Management Studio. I'd recommend SQL Compare from Red Gate for synchronising the schema, SQL Data Compare can sync the data, but it's not quick for large databases over the internet.
You can use SSIS and copy objects between these environments, assuming you have a direct connection to the production server.
Another way, it's a must to make regular backups of the production databases, a simple maintenance plan can make a full backup at night, by example. If this is the case here, just request an early backup to the administrators and then mount it into your environment.
One more way, because production data disclosure can involve legal issues, you can just extract the database schema and then use testing data to make any development. This is also the fastest way to get a database.
A new option is to clone the database. Red Gate SQL Clone is one solution, and Windocks provides SQL Server containers with built-in DB cloning support. Full disclosure, I work for Windocks.
Backup and Restore is slow for my databases, so what I do is:
1. Detach production database
2. Copy files to my dev machine
3. Attach database to dev server.
but no body should work on the production database.
My backup procedure is similar - I am detaching the database and archive the files, it is faster than backing up.