im trying to use MySQLDump to achieve this but im finding it very hard to do.
i need to duplicate a "master" database which is on the server into a new database, with everything from triggers to stores procedures.
if i use the .ExportAll = TRUE option to export the triggers and procedures i find i can't actually achieve what i want. the .DumpText shows that when i use ExportAll it has a statement of the sort USE [fromdb] instead of the USE [todb] that i need.
i've tried to play with settings for over an hour, including the .Database setting, .Connection.Database setting, etc. the documentation is actually not very clear on this issue and the Intellisense neither. e.g. if i type MySQLDump.Database, intellisense says "get or set database to dump data from".
so it would make sense to me to have my connection open to my TODATABASE database, assign this connection to the dump, assign the .Database property of the Dump to my FROMDATABASE. this doesnt work like i expect actually.
would you please direct me on how to proceed to achieve this that i want? summing it up: i have a "master" database which i need to duplicate in its entirety to another newly created database, triggers and procedures and all. i would like the dump to have the create database statements for the new db and drop tables that already exist. i also don't want to store the dump in a text file and make modifications to it, i would like it all to be in memory, very fast.
thanks for your help
P
Trying to fully copy a database into a new one to no avail
yes
yes i read the documentation and because i did not find what i was looking for i came to the forums. i dont see any more than 1 example and it doesnt address my issue.
i will rephrase the question:
i need to backup a database in memory in order to create a new database. but i need to backup triggers and procedures too. setting .IncludeALL to true will not only include triggers and procedures, but will also insert this in the beginning:
use [fromdb];
which does not happen when i set IncludeALL to false. that little line causes that i backup from a database and restore to the same database no matter what .Database is set to.
i am using MySQLDump not to backup a database, but to DUPLICATE a database into another. what i need help with is achieving this because i wasnt able to find help for this specific issue in the documentation. maybe im misinterpreting the properties and what they do, or maybe im just plain wrong. i would appreciate any suggestions
thanks
i will rephrase the question:
i need to backup a database in memory in order to create a new database. but i need to backup triggers and procedures too. setting .IncludeALL to true will not only include triggers and procedures, but will also insert this in the beginning:
use [fromdb];
which does not happen when i set IncludeALL to false. that little line causes that i backup from a database and restore to the same database no matter what .Database is set to.
i am using MySQLDump not to backup a database, but to DUPLICATE a database into another. what i need help with is achieving this because i wasnt able to find help for this specific issue in the documentation. maybe im misinterpreting the properties and what they do, or maybe im just plain wrong. i would appreciate any suggestions
thanks
Database is backed up into DumpText property which, of course, is stored in memory.i need to backup a database in memory in order to create a new database.
As stated in documentation, ExportAll propertry determines whether to export functions, procedures, and views together with tables. Judging from the fact that triggers are not enumerated there, they are not dumped.i need to backup triggers and procedures too.
You can change that line yourself or completely erase it from DumpText property."use [fromdb];" line causes that i backup from a database and restore to the same database no matter what .Database is set to.
how do i erase that line from the DumpText property, having .ExportAll set to True that seems not possible. Please assist me how to do thisAlexey wrote:You can change that line yourself or completely erase it from DumpText property."use [fromdb];" line causes that i backup from a database and restore to the same database no matter what .Database is set to.
Use the following code string:
Code: Select all
mySqlDump1.DumpText = mySqlDump1.DumpText.Substring(0, mySqlDump1.DumpText.IndexOf("use [fromdb];")) + mySqlDump1.DumpText.Substring(mySqlDump1.DumpText.IndexOf("use [fromdb];") + "use [fromdb];".Length);