12.07.2015 Views

Solution Guide for Migrating Oracle on UNIX to SQL Server - Willy .Net

Solution Guide for Migrating Oracle on UNIX to SQL Server - Willy .Net

Solution Guide for Migrating Oracle on UNIX to SQL Server - Willy .Net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<str<strong>on</strong>g>Soluti<strong>on</strong></str<strong>on</strong>g> <str<strong>on</strong>g>Guide</str<strong>on</strong>g> <str<strong>on</strong>g>for</str<strong>on</strong>g> <str<strong>on</strong>g>Migrating</str<strong>on</strong>g> <str<strong>on</strong>g>Oracle</str<strong>on</strong>g> <strong>on</strong> <strong>UNIX</strong> <strong>to</strong> <strong>SQL</strong> <strong>Server</strong> <strong>on</strong> Windows 133@name_in_db='HR'3. Gra nt privileges <strong>to</strong> create objects in the database.Priv ileges can be granted <strong>to</strong> the schema owner <strong>to</strong> create objects in a databaseusing either the CREATE permissi<strong>on</strong>s or the db_owner fixed database role.a.b.Grant complete authority <strong>on</strong> the database.The following command can be used <strong>to</strong> grant the db_owner role:EXEC sp_addrolemember@rolename='db_owner',@membername='HR'Grant privileges <strong>to</strong> create objects <strong>on</strong>ly.The following commands can be executed <strong>to</strong> <strong>on</strong>ly grant permissi<strong>on</strong> <strong>to</strong> createobjects:GRANT CREATE FUNCTION TO HRGRANT CREATE PROCEDURE TO HRGRANT CREATE TABLE TO HRGRANT CREATE VIEW TO HR4. Create sequences.While sequences cannot be migrated <strong>to</strong> <strong>SQL</strong> <strong>Server</strong>, in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong> about theseq uences in the <str<strong>on</strong>g>Oracle</str<strong>on</strong>g> database should be extracted first. Because sequencesare migrated <strong>to</strong> IDENTITY columns in tables, the in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong> about sequences isrequired <strong>to</strong> appropriately define tables (in the next step).The following command extracts the required in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong> <strong>on</strong> sequences.SELECT sequence_name, min_value, max_value, increment_byFROM dba_sequencesWHERE sequence_owner = 'HR'The following output is obtained:SEQUENCE_NAME MIN_VALUE MAX_VALUE INCREMENT_BYDEPARTMENTS_SEQ 1 9990 10EMPLOYEES_SEQ 1 999999999999999999999999999 1LOCATIONS_SEQ 1 9900 100The three sequences in the HR schema are assumed <strong>to</strong> be used <strong>to</strong> populate thecolumns DEPARTMENTS.DEPARTMENT_ID, EMPLOYEES.EMPLOYEE_ID andLOCATIONS.LOCATION_ID, respectively.5. Create tables.There are two opti<strong>on</strong>s <str<strong>on</strong>g>for</str<strong>on</strong>g> how <strong>to</strong> migrate tables. Opti<strong>on</strong> <strong>on</strong>e is <strong>to</strong> create tables in aspecific order based <strong>on</strong> the <str<strong>on</strong>g>for</str<strong>on</strong>g>eign key c<strong>on</strong>straints (parent tables first). Opti<strong>on</strong> twois <strong>to</strong> create tables in any order, leaving out the <str<strong>on</strong>g>for</str<strong>on</strong>g>eign key c<strong>on</strong>straints and thenadding them after all the tables have been created.a. Obtain a list of tables.If opti<strong>on</strong> <strong>on</strong>e is followed, the dependenci es between tables and the right orderin which <strong>to</strong> create the tables is required. There are several scripts available(mostly PL/<strong>SQL</strong>-based) <strong>to</strong> produce such a list. Tables without anydependencies <str<strong>on</strong>g>for</str<strong>on</strong>g>m the first level, and other levels are <str<strong>on</strong>g>for</str<strong>on</strong>g>med based <strong>on</strong> thenesting of the dependencies.Note N<strong>on</strong>e of the available scripts will work when there are interdependenciesbetween tables that <str<strong>on</strong>g>for</str<strong>on</strong>g>m a closed loop. The following script shows suchcircular dependencies thatmake these scripts not viable.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!