I'm currently using the PHP language laravel framework for my project, and there is a backup and restore in my feature and functions. for this, I have been trying to use spatial/laravel-backup .. but seems like it was not compatible with Windows. because it always shows up the error of
"Backup failed because: The dump process failed with exitcode 1 : General error: The system cannot find the path specified."
I believe the path is correct and I have tried to add it to the environment variance but still not working It was stated on the requirement of the spatie document that
“ It's not compatible with Windows servers.”
Can someone suggest to me a different way how to create a backup and restore for MySQL database In laravel?
Is there a way to transfer a file from a MySQL database to a MSSQL Server using Nodejs?
Say, I have two applications,
Application A uses MySQL database and nodejs for the backend.
Application B uses MSSQL Server database.
I uploaded an image/document from Application A. I want to transfer/synchronize that image/document to Application B from the source code of Application A.
I've tried using mssql client for Node.js. It works as the rows from MySQL database is transferred to MSSQL Server database.
The problem is when I download the image/document from Application B, the image/document is a plain text with a file size of 0 byte.
Any suggestions or solutions that can help?
Thank you.
Requirements
Before starting the database migration, you will need the following software on your Windows machine :
A running MS SQL Server instance.
A running MySQL Server instance (this depends on your environment, we work with the MySQL server available in Xampp ). The idea is basically to have a MySQL server instance accessible on port 3306.
SQL Server Management Studio installed.
MySQL Workbench . This tool will allow you to migrate the data at the end.
1. Identify the database you are trying to migrate.
As a first step, you must verify that the database you want to migrate is exposed in your SQL Server instance. The easiest way to do this is through the SSMS tool. SQL Server Management Studio (SSMS) is an integrated environment for managing any SQL infrastructure, from SQL Server to Azure SQL Database. SSMS provides tools to configure, monitor and manage SQL Server instances and databases. Use SSMS to deploy, monitor and update the data layer components used by your applications, as well as create queries and scripts.
Open SSMS and access the database engine with the default Windows authentication (or from the connection you want to access) :
Connect to the server and browse the databases in the object browser. In our case, we want to export the my_database database, which, as you can see, is available in the Databases directory :
Now that you know that the database is accessible on the server, we will start with the migration using MySQL Workbench.
2. Start with the migration in MySQL Workbench
MySQL Workbench is a unified visual tool for database architects, developers and administrators. MySQL Workbench provides data modeling, SQL development and comprehensive administration tools for server configuration, user management, backup and much more. MySQL Workbench is available on Windows, Linux and Mac OS X.
Start MySQL Workbench and access the migration wizard from the toolbar (in this tutorial, we use MySQL Workbench 8.0) :
After opening the wizard, click on start migration :
This will open the source selection form. Here you will need to select SQL Server as the source relational database management system (RDBMS). A relational database management system (RDBMS) is a collection of programs and capabilities that allow IT teams and others to create, update, manage and otherwise interact with a relational database, most of which use Structured Query Language (SQL) to access the database. In our case, as mentioned in the article, we will migrate from a Microsoft SQL Server database to a MySQL database, so it will be the source. In our example, we have the MS SQL Server configured on the same computer and it automatically authenticates with Windows Authentication, if your server is hosted remotely, you will need to change the parameters according to your needs. You can test the connection :
And if you are successful, you can continue with the next step of configuring the target RDBMS, which means MySQL. As we mentioned at the beginning of the article, we assume that you already have a MySQL server configured and running in the background, in our case we used Xampp's MySQL server, which allows you to start/stop it with a control panel. The idea is basically to know the credentials to access the running MySQL instance, which in Xampp is accessible with a rootuser and an empty password :
If you are connecting to another MySQL server, you can configure it with SSH keys, etc. Now that both connections are established, you can proceed to the next step which fetches a list of schemas from the source RDBMS. This will create a list that can be toggled with all databases in the SQL Server instance, where you must select the database you want to migrate (as well as the schema name mapping method) :
In our case, we only want to work with the my_database database, so we will extract only that database. Now, if you continue and everything works as expected, you will now see the Source Objects window, which basically allows you to filter which tables you want to migrate or not, normally we would like to migrate them all :
Click next and you will see the migration page, which allows you to pre-check the MySQL script for each table and if there are warnings or errors that you need to correct manually, they will be highlighted in the list. For example, in our case, we have a warning (when importing it will be an error) that specifies a problem with the migration, if we read the code we will see a syntax error of incompatibility with the VISIBLEkeyword. In our example, simply removing that keyword from the lines will allow us to import the scripts without any problem :
After manually correcting the warnings and applying the changes, you can finally export the database structure to a file (.sql) or create the database in the target RDBMS (MySQL Server). In our case, it is easier to import it directly to the server, so we will choose Create schema in target RDBMS (you can export it to a file if you wish) :
Before MySQL workbench starts with the migration, it will check again for errors and warnings; if there are still any, you must manually correct them again :
Click on Recreate object, this will take you to the previous step to build the schematic once again, click next and if everything is successful you will see, everything should be marked as correct :
Finally, all that is left is the data. We already migrated the database structure, so now we need to transfer all the data:
Since we are working with both servers on the same computer, we can make an online copy of the data from the SQL Server database to the MySQL database. Click next and the data migration will start :
Once finished, you will now have the original SQL database in MySQL format on the server. You can now access your MySQL server, where you will find the database available.
Introduction
To integrate any database with nodejs, you need a driver package or you can call it npm module which will provide you with a basic API to connect to the database and perform interactions. The same goes for mssql database, here we will integrate mssql with nodejs and perform some basic queries on SQL tables.
Remarks
We have assumed that we will have a local instance of the mssql database server running on the local machine. You can refer this document to do the same.
Also make sure that the appropriate user created with added privileges as well.
Connecting to SQL via. mssql npm module
We will start by creating a simple node application with a basic structure and then connecting to the local SQL server database and performing some queries on that database.
Step 1: Create a directory / folder with the name of the project you are trying to create. Initialize a node application with the npm init command which will create a package.json in the current directory.
mkdir mySqlApp
//folder created
cd mwSqlApp
//change to newly created directory
npm init
//answer all the question ..
npm install
//This will complete quickly since we have not added any packages to our app.
Step 2: Now we will create an App.js file in this directory and install some packages that we will need to connect to sql db.
sudo gedit App.js
//This will create App.js file , you can use your fav. text editor :)
npm install --save mssql
//This will install the mssql package to you app
Step 3: Now we will add a basic configuration variable to our application that will be used by the mssql module to establish a connection.
console.log("Hello world, This is an app to connect to sql server.");
var config = {
"user": "myusername", //default is sa
"password": "yourStrong(!)Password",
"server": "localhost", // for local machine
"database": "staging", // name of database
"options": {
"encrypt": true
}
}
sql.connect(config, err => {
if(err){
throw err ;
}
console.log("Connection Successful !");
new sql.Request().query('select 1 as number', (err, result) => {
//handle err
console.dir(result)
// This example uses callbacks strategy for getting results.
})
});
sql.on('error', err => {
// ... error handler
console.log("Sql database connection error " ,err);
})
Step 4: This is the easiest step, where we start the application and the application will connect to the SQL server and print some simple results.
node App.js
// Output :
// Hello world, This is an app to connect to sql server.
// Connection Successful !
// 1
I have a task to Migrate MySQL DB to Oracle (its my requirement) i tried to Migrate using SQL developer as defined in below link.
https://www.packtpub.com/books/content/migrating-mysql-table-using-oracle-sql-developer-15
As the DB is huge, the constraints are not copied properly from MySQL to Oracle, i need to define/alter/add constraints explicitly, which is time consuming (SQL developer migrates data 300rec/min from mysql to Oracle) & the entire procedure, views, functions is need to re write.
How can i ensure that data has migrated properly or not.?
Is this is a right approach to migrate?
Should i move to any tool which helps to Migrate? If yes please suggest the tool..!!
Or it is the right thing to Move from MySQL to Oracle.
Thanks in Advance.
No specific answer, but some genaral thoughts based on my experiences with migration.
I've found that there normally isn't one tool that does the whole migration job well, and by whole job I mean:
Fast
Handles all data types, scenarios
And that is from Oracle to Oracle!!
Last project we tried Oracle Golden Gate, and found there were issues with that.
We always end up with a hybrid approach, somethings like:
Extract all DDL manually and pre-create objects - there are weaknesses in the stagndard tools that confound them when extracting DDL, e.g. we found 10g expdp did not handle some quirky PLSQL well, so we resorted to extracting this ourselves.
Some tables work well with SQL Loader, others with GG, others (rare) with a custom extract and load process. We had over 3,500 tables and identified about 100 that worked better done as SQLLoader rather than GG. When I say better I mean with data handling and speed of migration. We created different groups of processing each group having a different method.
Once we have an overall hybrid scheme that works, we tune, mainly by splitting that task into parallel processes, both the export and import side.
All my migrations have been big projects where we have shifted from one Oracle system/server to another, always with the target being a newer version of OS and Oracle.
So, I would imagine that migration between non-Oracle and Oracle will through up even more challenges, and probably not as trivial as imply clicking a few buttons in SQL*Developer.
You may find the expected content from the SQL developer documentation at the Oracle website.
There are migration information available for all Microsoft Access users, MySQL users, Microsoft SQL Server and Sybase Adaptive Server users.
You can also download the tutorial in forms of PDF (best for offline viewing and printing), ePub (best for most mobile devices) and Mobi (best for Amazon Kindle devices).
Recently, I have successfully migrated the MySQL database to Oracle database. Below are detail steps:
Operating System: Desktop Ubuntu local and Desktop Ubuntu on amazon aws
Please Note: Here I am using aws desktop ubuntu server because my mysql
database was pretty big. In my case there were 800 tables, 200 views,
procedures, triggers, and functions. The total size of the database was almost
20GB. In case of small database I would recommend to use local ubuntu server.
Tools Used: SQL Developer, VNCServer, Remote Desktop Client, JAVA 8, Third Party MySql JDBC Driver
1. Setup ec2 ubuntu desktop server : https://www.youtube.com/watch?v=ljvgwmJCUjw
2. Install SQL Developer on #1
Download the SQL Developer package from this link :
http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html
Accept the license agreement and download "Other Platforms" for ubuntu.
Install the SQL developer package as the following.
sudo apt-get install sqldeveloper-package debhelper openjdk-7-jdk
openjdk-7-jre icedtea-7-plugin
Now all that you need to do is to run the command (you might have a
different version)
make-sqldeveloper-package sqldeveloper-4.1.3.20.78-no-jre.zip
This will generate a debian package that you can use to install SQL developer.
Now install the resulting .deb package using the command (Your deb
might have a different version too)
sudo dpkg -i sqldeveloper_4.1.3.20.78+0.2.4-1_all.deb
In my case, I have used java 8.
3. Once you have done with your SQL developer installation on your newly created ec2 instance with VNCServer then all you need to do is to connect to that ec2 instance with the Remote Desktop Client by default available in your ubuntu local machine.
Use IP:1 with user/pass setup for VNCServer in #1
You can see the remote ec2 ubuntu desktop server. You have to grab the keyboard inputs from the Remote Desktop tool if you want to tab inside the remote server.
Once you get connected with the remote client, open SQL Developer from the terminal or from the explorer.
sqldeveloper
Follow the migration steps provided by Oracle corporation:
http://www.oracle.com/technetwork/database/migration/mysql-093223.html
Please Note: While following the migration steps provided by the
oracle they will ask for the destination database connection i.e. oracle
database connection. This is not the database where your MySQL
database will be migrated. Instead, this database connection will
be used for the migration process. Your database connection user
must have user and database create privileges. Once your connection
have user create privilege, then migration process automatically create
the corresponding database user in Oracle database[if you have mysql_test_db in MySQL
database, same mysql_test_db will be created in Oracle db too].
I recently used sqline's tool http://www.sqlines.com/cmd to convert a dump from mysql in the form of an .sql script to an (almost) Oracle-compatible sql script.
sqlines31113\sqlines.exe -s=mysql -t=oracle "-in=$infile"
I just had to (semi-manually) fix some things in the output and then I could run it on my oracle database.
I have a database installed in C:\ and I created an other database in C:\ to log users' data because the data size is very big, So I want to save it somewhere else.
Then I moved the second database with its data to D:\ through a symbolic link file to point out the new directory.
Here the file name : archive_file.sym
And here its content : D:\MySQLData\data\archive_db
archive_db : is the name of my second database
the problem is when I executed a MySQL command to see the content of one of the tables in the seconde database:
use 'archive_db';
select * from 'log_user';
I've got this error :
'log_user' Table doesn't exist
I've tried symbolique_link throughout MySQL documentation :
Using Symbolic Links for Databases on Windows.
Any advices ? Any idea how to proceed otherwise?
I'm working on Windows server 2008-r2 , MySQL server version 5.6
I'm having a small issue. I'm trying to install a plugin (http://plugins.cakephp.org/p/720-users), the user management plugin. For this, I need to create some mysql tables, but I guess you need to create these via a php file and the Console of cakephp. The problem is that I have a very simple server that can only run php and a mysql database. Is there a way to create the sql code out of this php file without the console? The file is question is https://github.com/CakeDC/users/blob/master/Confi
No, you can't. Get a less crappy host. I'm paying only $12 for 3 month (!) for my private virtual server with root access.
Alternatively you could run the migration or schema shell locally, dump the tables and insert them via phpmyadmin on your crappy host.