Refresh database structure

Hello !
I'm using VB.net 2013 , Entity Framework 6 , SQL server 2008R2 and SMO.
I have the application that use the database.
But sometime I make changes to database structure , and I want to add to my application a "Refresh Database" command.
Let's say that I have a database model called "Model" ( as a .bak file). The refresh command should compare the current database with this model and after make all the changes needed to make the current database up to date according to model.
How this can be done using SMO ?
Thank you !

Do you think that creating a new database and migrating data it's more easy ?
Let's get an example :
The new Model.bak contains only a new field in one of the tables comparing with the current database.
Do you think that only for 1 field , I should create a new database and migrate thousand of records ? After that of course I should make additional work to make this "New database" connect with my program because I use Entity framework that
is created with wizard on design time with the database ( that have a specific name ) , and the new database have another name.
So I think is more easy to add this new field to the current database ( so make a "Refresh" )  and end of the story.
what do you think ?
thank you !
Hi dcode25,
For such a scenario adding only one more field, what you should do in the upgrade is neither to restore nor to "refresh", the only approach is to run the ALTER table script to add the column when your upgrade wizard fires. This approach should be
applied to the cases that there's not much modification in your "model". For the cases which are more complex, the restore and migration is the option.
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support
Hello !
I think that the conversion now is transformed in how we  should call this process.
Why you don't like the word "Refresh". I like to call this process refresh , but we can call how we want.
The point is that I want to do this process within my application . I don't know what do you mean with "When your upgrade wizard fire ?"
Is possible to use the Alter table script in vb.net inside my application and what are the steps ? But of course I want to make this process general so regardless of how many field are added , this process should work. But how can I compare first the
current database with new model to find out what are the changes that I should made ?
And what you consider  "too much modification "
The modifications on new "Model.Bak" may  be :
- One (or some ) field(s) are added to one (or several )  existing table(s).
- One (or some ) field(s) are deleted to one (or several )  existing table (s).
- One (or some ) field(s) in one (or several )  existing table (s) have a different type.
- A new table is added to database
- A new table is added that have a new relationship with an existing table
- 2 or more new tables are added that may have relationship between each other.
On your opinion , which of these modifications can be done without migration and inside my application ?
For the others , why do you think that cannot be done without migrating ? Because it's impossible to do , or is difficult ?
In my opinion ( of course I can be wrong because I don't know ) these may be the steps :
1) Get one by one the tables in "Model.Bak"
2) With each table , first detect if this exist in the current database
3) If not exist , create the table ( or copy from Model ???? I don't know if can be done ).
4) If exist , compare one by one the fields , and if a field doesn't exist , add the new field. If a field exist but has a different type , change the type. After detect if one of fields in current database doesn't exist on model. If so , delete that field.
5) If a new relationship exist , add the new relationship
If you agree with these steps , which of them may be impossible to be done ?
Or if can be done , how can I realize each of these steps inside my program in vb.net ?
Thank you !

Similar Messages

  • Refresh Database structure on UD-connect

    hello,
    For a customer i'm extracting two MSSQL db's using UD-connect. In one of the DB's there was a change in a table strcuture ( some fields are deleted) , but this is not visable in SAP. Obviously the Datasource will not activate while the old field definitions are still selected for output.
    We can manualy exclude these fields, but if a field would be added in the future this would'nt be an option. We already tried the following options:
    (re)activate Datasource and Sourcesystem
    Creating new datasources on the existing sourcesytem
    (re)proposing fields
    We hope we won't have to recreate the source system, this would not be a workable solution once this funcionality is in production.
    If you have any idea's, please share them.
    Daniel

    We found the solotion.
    Unselect the field that are removed and activate the datasource manualy. Seen as the old version ( the active version ) of de datasource still needs the obsolete fields, it refused to refresh intill you manualy remove these fields.
    Goodluck

  • Message: "The database structure has been modified" every time I log to SAP

    Hello,
    "The database structure has been modified. In order to resume this process, all open windows will be closed". Every time I log to one of my companies in SAP Business One this message appears.
    I haven't installed any new addons and made no changes in database structure (and any other user hasn't done any changes), but this message appears always when I log to company for the first time (when I try to log on another user or log to another company there is no message). Can anyone help me with this problem?
    Best regards
    Ela Świderska

    Hi Ela Świderska,
    You may check this thread first:
    UDFs disappeared
    Thanks,
    Gordon

  • DATABASE STRUCTURE HAS BEEN MODIFIED PROBLEM...

    Hi
    I am getting the message " The database structure has been modified " after every 5 minutes.
    Regards

    Hi,
    You may check this thread:
    Message: "The database structure has been modified" every time I log to SAP
    Thanks,
    Gordon

  • The Database Structure Has Been Modified

    Good Day!
    Just want to ask what is the probable reason why upon using SAP, there is a system message " The database structure has been modified. In order to resume the process, all open windows will be closed. Continue?"  Even upon user log in , this system message appear affecting other user's data entry. Upon adding of the document (of other users when this system message appear), all the UDFs are missing, causing their data entry to be inaccurate since you cannot update row level once the document has been added.
    Hope to hear from you soon.
    Thanks
    Sandra

    Hello ...
    This error message appears every time that has altered the structure of the database, either by creating a new field of user or user table, so it is inevitable that appear the same.
    Now, it is necessary as a measure, to control who has access to make these changes, and that they are made without users.
    I hope it will help
    Best regards,

  • The database structure has been modified - how to check if it happend?

    Hello,
    I have a question. How to check if the database structure has been modified? I know that there is shown a messagebox after creating table and adding some fields, but sometimes this message appear after some seconds. The problem is that I want to create table and UDO for this table, and until database structure is not modified I got an error message. If I wait and DB strucuture modifies then UDO is creating correctly.
    My question is - does anyone know how to check if database structure has been modified?
    Regards,
    Hmg

    Hi Szymon,
    I guess you are stuck up in a kinda scenario, where in, you will be populating a form with values, before the structure modifies, if this is going to be your problem, I can help you out with a work around.
    In the beginning of the process, before the creation of the UDO or tables, set a boolean value to false, and once all UDO's and Tables are created, only then, should you make it true and only after the boolean becomes true, you should proceed with populating the values from the screen.
    I really ament sure what your problem is, but one of my guys faced this problem, I then, thought even you might have a similar problem.
    Satish.

  • Is it possible to change selection screen of logical database structure?

    I have to create a z report for a standard transaction FBL01N which is extracting data according to the vendor account number(LIFNR) at the selection screen. Now as per the requirement the system should extract details according to 'vendor name' keeping the same functionality.
    But the standard program is using some logical database structure KDB and the include for the selection screen is DBKDFSEL.So can I modify the selection screen of this transaction replacing Vendor No with Vendor Name.

    Hi..
    Refer this links
    http://help.sap.com/saphelp_46c/helpdata/en/9f/db9b8535c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/9f/db9b8535c111d1829f0000e829fbfe/content.htm
    Hope this may b very helpful to u
    Sravani
    Plz reward points

  • Refresh database and another is create database

    Hi All,
    In the Hyperion planning under the administration menu there are two option, one is refresh database and another is create database.
    Is there any way to hide/delete or not give the access to users of ”create database” option? I mean other than admin I don’t want any users to see “create database option” once they login.
    Thank you

    There is no option to hide the create database button, but the good news is the planning users won't be able to see that option anyways. Due to the provisioning, only Admins have access to the Administation Menu.
    Cheers,
    Mehmet

  • Use same report with same database structure to different database server.

    Hi,
    I have standard crystal reports which needs to be copied to another database server.
    The origin database has exactly same database structure with the data base in other server.
    My only question is how to change the connection of the crystal report file from old database server to new one without affecting the linked tables in the report. Would it be possible?
    Note: origin database and new database has same structure, tables and columns but differ in data on it. and both has different server. (MS SQL)
    Thanks,

    Hi Mark,
    Open the report in the CR Designer > select Database option on the top > select Set Datasource location.
    The pane on the top shows the current connection. Go ahead and create a new connection to the target database from the pane at the bottom. Once created, highlight one table from the top, highlight the corresponding table from the bottom pane and click Update. Do this for each table.
    -Abhilash

  • Automatic Checking of Database Structures

    In OSS note 521870 SAP recommends to perform a weekly
    check of the Database Structures to verify that the
    Maxdb database is not corrupt. Unfortunately this
    OSS note only describes the manual procedure to
    perform this task:
    dbmgui -> Check -> Database Structure
    Is there any way to easily schedule this also via dbmcli?
    The SAP online documentation contains some interesting
    information about integrating the check into the CCMS,
    here I can see whether the database structure check
    was performed recently, but unfortunately I cannot
    schedule it
    http://dev.mysql.com/doc/maxdb/en/30/5ada6e596211d4aa83006094b92fad/content.htm
    All I can find here is to schedule it via DB13,
    but unfortunately my SCM 4.1 system is running on
    Oracle and I want to check the liveCache on Maxdb,
    so I cannot use DB13 for scheduling the check.

    Hello Mark,
    Central DBA Planning Calendar ::
    In the user menu, choose the Central DBA Planning Calendar
    (transaction DB13C).
    If it is not already there, add your liveCache to the list of systems.
    To do this, choose Configuration ® Add System.
    System ID: Enter here the liveCache name that you assigned during the
    integration of the liveCache (using MaxDB/liveCache System Overview).
    Database: Choose SDB/LVC.
    Database Release: Choose the liveCache Version in accordance with the      
     version notation .
    Select No SAP Basis.
    Database Server: Enter the name of the liveCache server.
    Connection Name: Enter the name of the database connection.
    To switch to a local DBA planning calendar, choose Local Calendar and then
    select the system for which you want to edit actions.
    Please also review the SAP notes 940420, 521870 ( you already know this note ).
    And note 820824 FAQ: MaxDB to find the note for the documentation & more -
    For SAP liveCache documentation in English:
    http://help.sap.com/saphelp_nw04/helpdata/en/f2/0271f49770f0498d32844fc0283645/frameset.htm
    ->Database Administration in CCMS: SAP liveCache ->
    -> Central DBA Planning Calendar
    If you are the official SAP customer, I recommend you to create
    the ticket to SAP on 'BC-DB-LVC' queue.
    Thank you and best regards, Natalia Khlopina

  • SQL server database structure

     
    Is it possible to create an 'XML file' from a SQ Server 2008R2 database structure?

    You could query the information from DMVs (sys.columns, sys.tables etc) and use the FOR XML PATH() clause to create xml file of the data.
    http://msdn.microsoft.com/en-IN/library/ms178107.aspx
    Satheesh
    My Blog |
    How to ask questions in technical forum

  • Update the database structure from entity Framework Model

    Hello !
    I'm using VB.net , EF6 with SQL server 2008R2 database.
    This is the situation :
    I have created the application. Using wizard I have created the Entity model from an existing database.
    A client start using this application using this database on his computer.
    After some month , I made some modifications on the database and I have updated the model on my application .
    Now I have a new .exe file that has the new model from the new database.
    I put the new .exe file on the client computer.
    Now on his computer : The .exe file has the new database model , but the sql server database has the old structure.
    I want to know : Is possible to update the database structure from the entity model on application ?
    I want to add a command on application that can make ( if is possible ) this update , so the database become up to date according to entity model ?
    Thank you !

    Hello,
    From your description, it seems that you want to apply a migration for a database first approach, unfortunately, as far as I know, EF Migrations is a product targeted at Code First and doesn't support Database First operations. A workaround I know is to
    use update-scripts. If your database structure would be changed frequently, it is recommended to use the Code First approach which would have a better workaround for migrations, for details, you could refer to this
    video,
     and with the
    Entity Framework Power Tools, it is easy to create a code first based project form an existing database.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • MMS Topology Database Structure

    Hello,
    Is there an Appnote out there somewhere that describes the database
    structure for MMS topology? I need to somehow extract the info populated
    by ZSM discovery and port it to our central database in HP openview.
    Cheers,
    Dennis.

    Dennis,
    It appears that in the past few days you have not received a response to your posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Do a search of our knowledgebase at http://support.novell.com/search/kb_index.jsp
    - Check all of the other support tools and options available at http://support.novell.com in both the "free product support" and "paid product support" drop down boxes.
    - You could also try posting your message again. Make sure it is posted in the correct newsgroup. (http://support.novell.com/forums)
    If this is a reply to a duplicate posting, please ignore and accept our apologies and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://support.novell.com/forums/

  • Changing database structure

    I have to add a tabel a mailalerttext and link that to mailalertypes which is linked to mailalerts. I had some problems with the selectlists, underneath you will find something that will solve that problem I thought, but it may be easier to solve it simpler, but thats apex stuff.
    If a default user and default applicationcode would exist, it would be possible to use them in the mailalert table which has following colums:
    MAILALERTID,APPLICATIECD,GEBRUIKERID,MAILALERTTYPEID,SENDMAILIND
    gebruikerid means userid.
    The defaultuser and application code would then be used in the mailalerts table and the column mailalertype would be replaced by mailalerttypecode. These are defined they can't change.
    The reason is that if mailalerttext is linked to maillalerts using the mailalertid as the foreign key, then that allows to find the correct text, or select it straightaway by using the mailtextid. All the selects would then be made on the mailalert table.
    The numbers used as default are just those that are free, a default user can be filled in like that in te gebruikers table, and a default application code in the apps table.
    Only the standard user and the mailalerttypecode are important, the standard applicationcode could be used as an extra check but might not be necessary.
    A select could then be made on that applicationcode, that user, that typecode if not found select standarduser and typecode.
    Applicationcode is only filled in to stick to the table definitions. To solve a problem with a select list on a page in apex i think this is overkill, as it requires more changes then does the first solution, It means changing tables, dropping columns adding them, changing triggers, changing code in apex pages, a lot of work.
    But I was wondering if concerning a database structure, starting from scratch this is something that would be considered good, not so good, bad, something to not do ?
    I'm not sure this is the right group, but it isn't strictly apex, and it isn't really sql/plsql either. More database structure.
    I'm just beginning, so i'd like to know your opinions and why it would be bad, or possibly good.
    Message was edited by: Floris Vermeir
    Removed the spelling mistakes.
    Floris

    I'm still not sure I understand your existing data model properly. The following is my interpretation of what I think your're trying to achieve.
    There are four core data tables -
    * APPLICATIONS - holds information relating to the programs you administer
    * MAIL_TEXT - holds boilerplate text for each type of e-mail (I'm assuming this text can be shared across applications)
    * MAIL_TYPES - the different kinds of e-mail alerts which can be sent
    * USERS - holds information about the support staff.
    I think you need two intersection tables
    * APP_MAIL_TYPES - application X uses text Y for e-mails of type Z (candidate key: app id and type id)
    * USER_MAIL_REGS - user Joe gets e-mails of type Z from application X (candidate key: app id, type id and user id)
    NB If the registration is just done against alert type for all apps, then the USER_MAIL_REGS table shoudl intersect USERS and MAIL_TYPES.
    |                      |
    |  applications        |
    |                      |
           |
           |
          /|\
    |                      |                |                      |
    |  app_mail_types      |>---------------|  mail types          |
    |                      |                |                      |
             \|/     |
              |      |
                |      ---------------------------------          
                |                            |
                |                              /|\
    |                      |                |                      |    
    |  mail text           |                |  user_mail_regs      |    
    |                      |                |                      |    
                                             \|/
                                              |
                                                       |
                                            |                      |                       
                                            |       users          |                       
                                            |                      |                       
                                            ----------------------                        I think USER_MAIL_REGS corresponds to your "overview" table. (It's a good idea to use names which convey as much info as possible. I acknowledge the difficulty of doing this in another language). Changing the users' registrations would simply be a matter of inserting or deleting rows from the USER_MAIL_REGS.
    If this doesn't help you then I'm afraid you will need to give me more info. Specifically, what tables you have, the role they play and the relationships between them.
    Cheers, APC

  • Different Database structure migartion

    In second version of our software we change the database structure.
    Now we need to migrate data from version 1 to version 2 that have different database structure.
    Is Streaming or any other oracle feature provides possibility or I should write code by hand?

    I sugeest you migrate the tables individaully having in mind the DML and DDL statements
    hitting the database from the application end. You need to do a mapping for both the databse.
    Do the events from your old application still update the same tables as the new application
    You need to really think this out to avoid having complications in your new version.
    I dont think stream option is the best at this stage rather export/import of tables would be the best option
    then you can think of stream to update your new version at run time.

Maybe you are looking for

  • Slim to XDM

    Hi, I've tried this using slim from extra, slim-plus and slim-cursor from AUR, but these features have never worked for me. So I'm guessing I'm doing something wrong? 1. Welcome message doesn't appear. It just says "Login" and a text field for enteri

  • Parallel Execution of  Sub Queries using WITH clause ?

    Hi , For the below query is it that Oracle Optimizer executes "sum_data" and "avg_data" queries parallely ? WITH sum_data AS SELECT deptno, sum(sal) AS S FROM emp GROUP BY deptno ), avg_data AS SELECT deptno, avg(sal) AS A FROM emp GROUP BY deptno )

  • Tabular form for text item -save changes not working

    Hello, I have created a tabular form in which I have made one of the columns say deptno as an Text item using APEX_TEXT.ITEM package. In my tabular form by default I have created it with all the buttons like with ADD ROW,CANCEL,SUBMIT(SAVE). My probl

  • Mouse position help

    When using MouseListener and MouseMotionListener in an applet, I can not record events that happen outside the applet. Is there a way to record the x and y position of the mouse along with button presses when they occur outside the applet window? Tha

  • RGBImage filter, how to use?

    I found this piece of code on an old forum post.. supposively I can use it to filter an image in any color I choose.. I just dont know how to use it.. Could someone whos more experienced with Image filtering, show me how this code was intended to be