Árvore de páginas

Contents

Objective

The objective of this guide is to indicate a method of migrating data from a base with collation different than the standard "Latin1_General_CI_AS" required for the proper use of the Fluig base.

Data Migration and Conversion Procedure


Attention!

Icon

This operation must take place before the conversion of a TOTVS | ECM base to TOTVS Fluig Platform. Even with modification of the default collation, the existing fields remain incorrect, and can therefore result in unexpected behavior by the platform.

 

The following is a checklist for Fluig conversion. 

 

  1. Check procedures for the service/instance of the SGBD Microsoft SQL Server, describe in the following page: Configuration of the SQL Server data bank.

  2. Create a new data base with grouping (Collate/Collation) Latin1_General_CI_AS.

  3. Immediately after creation, with no connection in this data base, execute the command:



    ALTER DATABASE [fluig] SET READ_COMMITTED_SNAPSHOT ON;


    The configurations for grouping of characters (Collate/Collation) of the data bases may still be queried through the following instruction:


    SELECT [name] , [is_read_committed_snapshot_on] , [collation_name] 
    FROM [sys].[databases] 
    WHERE [name] LIKE 'fluig%';



  4. Install the latest version of Fluig and configure it to point to this data base (fluig).

  5. Start the Fluig service, and observe the LOG to make sure that the service started correctly, without any serious errors, such as failure to connect with SGBD.

  6. After the service has finished starting up (with the message "== FLUIG STARTED AND RUNNING RIGHT NOW ==" reported in the LOG), interrupt the Fluig service.

  7. Generate a DUMP of this data base, with the entire structure of tables and fields. 
    For the SGBD Microsoft SQL Server, use the following procedure:
      1. Move the mouse over the database and click on the right button.
      2. In the drop-down menu, choose Tasks > Generate Scripts...
      3. Click on Next > to see the presentation Introducing Generate and Post Scripts wizard.
      4. Check Generate script for entire data base and all data base objects and click Next >.
      5. In the following screen, in the Output Type group, and in the group below,  select Save in the new query window.
      6. Click on Advanced.
      7. In the Advanced Script Options screen, change the option  Grouping Scripts to True and click on OK.
      8. When returning to the Generate and Post Scripts screen, click  on Next >.
      9. In the next step, adjust the configurations to generate a script of the base. Click on Next >.

      10. Go back to the Microsoft SQL Server Management Studio window.

      11. In the new window open with the script, comment/remove the first few lines, up to the USE [fluig] instruction.


  8. Select and delete all tables in this new database.

     

  9. Execute the script DUMP generate in this new database in order to create the entire structure with no records.

     

  10. Proceed with constraints in the database tables. For the SGBD Microsoft SQL Server, use the following instruction:


      1. Open a New Query window (menu File > New > Database Mechanism Query);.

      2. Insert the query below and execute it in the new database.

        DECLARE @TABLENAME VARCHAR(8000) 
        DECLARE @TABLENAME_HEADER VARCHAR(8000) 
        DECLARE TNAMES_CURSOR CURSOR FOR 
         
        SELECT [name] from [sys].[tables] 
         
        OPEN TNAMES_CURSOR 
         	FETCH NEXT FROM TNAMES_CURSOR INTO @TABLENAME 
         		WHILE (@@FETCH_STATUS <> -1) 
         		BEGIN 
         			IF (@@FETCH_STATUS <> -2) 
         			BEGIN 
         			SELECT @TABLENAME_HEADER = 'ALTER TABLE ' + RTRIM(UPPER(@TABLENAME)) + ' NOCHECK CONSTRAINT ALL;' 
        			--Change NOCHECK to CHECK and then enable constraints 
        			PRINT @TABLENAME_HEADER 
        		END 
        	FETCH NEXT FROM TNAMES_CURSOR INTO @TABLENAME 
        END
         
        SELECT @TABLENAME_HEADER = '--************* End of Tables *************--' 
        PRINT @TABLENAME_HEADER PRINT ' ' 
        DEALLOCATE TNAMES_CURSOR 
      3. Copy the result, paste it in a New Query window and execute it (in the new database).

         

  11. With the Fluig services interrupted, import the data from the old database, using, for example, an import and export data wizard. For the SGBD Microsoft SQL Server, use the following procedure:


      1. Move the mouse over the new database and click on the right button.

      2. In the drop-down menu, select Tasks > Import Data...

      3. In the introductory screen for the SQL Server Import and Export Wizard, click on Next >.

      4. In the field Data source, select SQL Server Native Client (the version number is displayed at the end, use the same number as the data bank service version).

      5. In the field Server name, enter the server (enter or select from drop-down box) and the instance that has the previous database (which must be reconciled / normalized). 

      6. In the Authentication group, use the method that allows access to all data from this previous database. A user with db_owner permission is recommended.

      7. In the field Database, select or enter the previous base and click on Advance >.

      8. In the screen with the header Choose a Target, the fields with access information to this new database should be automatically filled out. Correct any incorrect or incomplete information and click Next >.

      9. In the screen with the header Specify Copy or Table Query, select Copy data from one or more tables or views and click Next >.

      10. In the screen with the header Select Tables and Source Views, click on the first selection box in the headers of the Tables and views list.

      11. With all options checked, click Edit Mappings...

      12. In the box Transfer Settings, check the box Enable insertion of identity and OK.

        Attention!

        Icon

        Make sure to check this option to avoid failure in data copying.

      13. Back to the previous window, Select Tables e Source Views, click on Next >.

      14. In the screen with the header Review Data Type Mapping, click Next.

      15. In the screen with the header Execute Package, check Execute immediately and click Next >.

      16. In the screen with the header Conclude Wizard, review the actions taken and click Next.

      17. The following screen, displaying execution of the actions, should also display a message that import was successful.

     

  12. Perform access permissions transfer procedure to the appropriate users in the new database. These permissions may have been lost. 

     

  13. Delete the temporary directories (tmp, log and data), located in the path <INSTALL_FLUIG>/jboss/standalone.

     

  14. In the setting file, located in the path <INSTALL_FLUIG>/jboss/standalone/standalone.xml, change the setting for access to the database to use of the new database.

     

  15. Restart the service.

     

  16. Perform the desired validation and use the new installation.