If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > using mysqldump and preserver view

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-16-10, 16:55
sunfire sunfire is offline
Registered User
 
Join Date: Aug 2003
Posts: 19
using mysqldump and preserver view

Hello,
I have done a few searches but have not found what I'm looking for. I have a MySQL database and I want to do a nightly dump, for now. This is really not that hard, but what I'm seeing is not what I expect. My views are not in the SQL dump in any kind of format to restore the view. Is there a switch or something that will create the view sql statement in the dump file as well?

Thanks!
Reply With Quote
  #2 (permalink)  
Old 03-16-10, 22:33
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
since views don't contain any data, it's not surprising that they aren't included in the dump

do you dump your CREATE TABLE statements too, or just the data?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 03-17-10, 10:49
sunfire sunfire is offline
Registered User
 
Join Date: Aug 2003
Posts: 19
I have two dumps one is just structure only, no data. This I want to have done on a daily basis since the schema can change fairly often, new tables etc. The other is data and structure.
Reply With Quote
  #4 (permalink)  
Old 03-17-10, 11:04
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
for the views, you will have to write your own script

run a query against the INFORMATION_SCHEMA to pick up the view names, then use these to generate the SHOW CREATE VIEW statements
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On