You are here: Foswiki>Applications Web>LsaMainPage>LsaInternalDataImportBase (18 Oct 2017, RaphaelMueller)Edit Attach

Data import into LSA

1. Create the LSA database

Necessary database users:

LSA (table owner)
LSA_APPS (read- and write access, for accessing LSA through applications)
LSA_PUB (readonly)

Execute all scripts from Chris (except comments, seem duplicate), then make sure, that all packages compile (removed one error reporting method)

Create synonyms (execute for user LSA_APPS and LSA_PUB):

SET serveroutput ON;
DECLARE
  l_from_user VARCHAR2(30) := 'LSA';     -- table owner of the real tables
  l_to_user   VARCHAR2(30) := 'LSAREAD'; -- user that should receive the synonyms
  -- local temporary variables
  l_sql_query      VARCHAR(2048) := '';
  l_drop_counter   NUMBER        := 0;
  l_create_counter NUMBER        := 0;
BEGIN
  DBMS_OUTPUT.enable(1000000);
  -- drop all the existing synonyms for l_to_user that point to tables from l_from_user
  FOR x IN
  (SELECT synonym_name FROM all_synonyms
    WHERE owner     = l_to_user
    AND table_owner = l_from_user
  )
  LOOP
    l_sql_query := 'DROP SYNONYM "' || l_to_user || '"."' || x.synonym_name || '"';
    EXECUTE IMMEDIATE l_sql_query;
    l_drop_counter := l_drop_counter + 1;
  END LOOP;
  
  -- (re)create synonyms for l_to_user that point to tables and views from l_from_user
  FOR x IN
  (SELECT DISTINCT OBJECT_NAME, OBJECT_TYPE FROM all_objects
    WHERE object_type IN ('TABLE', 'VIEW', 'SEQUENCE', 'PROCEDURE', 'FUNCTION', 'PACKAGE', 'TYPE')
    AND owner          = l_from_user
  )
  LOOP
    l_sql_query := 'CREATE OR REPLACE SYNONYM "' || l_to_user || '"."' || x.OBJECT_NAME || '" FOR "' || l_from_user || '"."' || x.OBJECT_NAME || '"';
    EXECUTE IMMEDIATE l_sql_query;
    l_create_counter := l_create_counter + 1;
  END LOOP;
  
  -- output some basic feedback information
  DBMS_OUTPUT.PUT_LINE('Dropped ' || l_drop_counter || ' objects and (re)created ' || l_create_counter || ' new ones.');
END;
/

2. Data import of static data

Import scripts for data from gsi-db package via calling gsi_content_2010.sql
(Watch out to really stop on errors and read the file comments !!! (at certain points, the import tools described below have to be used!!!!)

3. Device type import from xmls and device import from OPERDB

Device type import from eqmod xmls and device import from the OPERDB is done via the gsi-utilities/../ImportDeviceTypePropertiesAndFields -Tool.

4. Device import from FESA

TBD

5. Model Import

The import of the model is described in detail here: LSA Database Import (Model)

-- JuttaFitzek - 20 Jan 2010
-- RaphaelMueller - 21 Jan 2010
Topic revision: r12 - 18 Oct 2017, RaphaelMueller
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback