clone or copy my instance self hosted

Lion Kesler
Tera Contributor

Hello everyone,

I want to multiply the my instance  - table, columns, script, forms But not the data 

another problem - my instance not connected to the internet.

and the destination instance not connect to source instance  (I need a solution using files)

 

Thanks

 

1 ACCEPTED SOLUTION

Matyas Tichy
Kilo Expert

Hello Lion,

 

The simplest, unfortunately time consuming (first time you do it), way is using mysqldump (mariadb-dump) utility and leveraging it's "--no-data" and "--no-create-info" variables.

The mysqldump documentation can be found here: https://mariadb.com/kb/en/mariadb-dumpmysqldump/ 

 

You would do mysqldump with --no-data variable for entire schema this will preserve entire structure - so you'd have all tables and columns in the target instance.

 

And you would do another mysqldump or series of them with --no-create-info for all the tables except those you want to leave empty. Be careful when you are choosing to skip any of the tables though. As there are thousands of tables this can take some time to identify 90% of what you could leave empty. To simplify this process I recommend you start by tables well known to you (e.g. you have table u_my_records containing some very important records you have made in production then you know you can empty it), then follow it up with largest tables (both by size and number of records) and so on. I suggest you leave all of the system or unclear tables as are. The only exception I can think of would be user tables, and attachments. For some table hierarchies you can also simplify by using wildcards to skip children tables as well. 

 

When you are satisfied with the list you make thos dumps, import them to target DB, follow the remaining steps needed for self-hosted cloning (e.g. disabling some properties or chaning instance id,name) and you should have the instance almost as you wanted.

You can cleanup remaining data either through the application (e.g. system tables) or in case you still find large table that can be completely emptied, you can truncate it via DB host.

 

If you retain your filters, next copy should be cleaner and a lot faster.

I hope this helps.

Matyas

View solution in original post

5 REPLIES 5

Matyas Tichy
Kilo Expert

Hello Lion,

 

The simplest, unfortunately time consuming (first time you do it), way is using mysqldump (mariadb-dump) utility and leveraging it's "--no-data" and "--no-create-info" variables.

The mysqldump documentation can be found here: https://mariadb.com/kb/en/mariadb-dumpmysqldump/ 

 

You would do mysqldump with --no-data variable for entire schema this will preserve entire structure - so you'd have all tables and columns in the target instance.

 

And you would do another mysqldump or series of them with --no-create-info for all the tables except those you want to leave empty. Be careful when you are choosing to skip any of the tables though. As there are thousands of tables this can take some time to identify 90% of what you could leave empty. To simplify this process I recommend you start by tables well known to you (e.g. you have table u_my_records containing some very important records you have made in production then you know you can empty it), then follow it up with largest tables (both by size and number of records) and so on. I suggest you leave all of the system or unclear tables as are. The only exception I can think of would be user tables, and attachments. For some table hierarchies you can also simplify by using wildcards to skip children tables as well. 

 

When you are satisfied with the list you make thos dumps, import them to target DB, follow the remaining steps needed for self-hosted cloning (e.g. disabling some properties or chaning instance id,name) and you should have the instance almost as you wanted.

You can cleanup remaining data either through the application (e.g. system tables) or in case you still find large table that can be completely emptied, you can truncate it via DB host.

 

If you retain your filters, next copy should be cleaner and a lot faster.

I hope this helps.

Matyas