You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm backing up my database with SCRIPT TO ....
When I run the script to restore, everything works except one of my views.
When I look in INFORMATION_SCHEMA.VIEWS."VIEW DEFINITION" and copy the SQL and run it, all works ok.
When I run select * from the view, it fails, complaining that one of the tables doesn't exist.
My guess is that the problem is that in the script file, the view is created before the table. My guess is that the view is stored optimised and at the time the view was created, the table didn't exist, so the optimised version couldn't find it. But I'm no expert.
I'm using 2.1.214.
An excerpt from the script is attached, including the view definition and the definition of the missing table, which happens to come right after. scipt file segment.txt
The text was updated successfully, but these errors were encountered:
Unfortunately, you need to edit the exported script and re-order definitions of views and tables by yourself. If this file is too large for regular text editors you can try to use some stream editor or some special editor for large files.
Usually this issue appears after various modifications of database schema. The SCRIPT command doesn't check dependencies between tables and views (view may depend on other tables and views, and in some cases tables may depend on views) and exports them in their creation order. Usually this order is good enough, but after some ALTER commands a different order can be needed.
I'm backing up my database with SCRIPT TO ....
When I run the script to restore, everything works except one of my views.
When I look in INFORMATION_SCHEMA.VIEWS."VIEW DEFINITION" and copy the SQL and run it, all works ok.
When I run select * from the view, it fails, complaining that one of the tables doesn't exist.
My guess is that the problem is that in the script file, the view is created before the table. My guess is that the view is stored optimised and at the time the view was created, the table didn't exist, so the optimised version couldn't find it. But I'm no expert.
I'm using 2.1.214.
An excerpt from the script is attached, including the view definition and the definition of the missing table, which happens to come right after.
scipt file segment.txt
The text was updated successfully, but these errors were encountered: