goldmansachs / obevo

Obevo is a database deployment tool that handles enterprise scale schemas and complexity
Apache License 2.0
232 stars 56 forks source link

Issue with reverse engineering SQL Server database #281

Open santhoshkotte opened 3 years ago

santhoshkotte commented 3 years ago

Environment: SQL Server Developer Edition 2019 installed on Windows 10 Following is the script that has been tried

There is no error reported by the above command.

Command Output

Starting action at time [Tue Oct 06 17:18:20 EDT 2020] Using "C:\Users*\AppData\Local\Temp\vfs_cache" as temporary files store. WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.eclipse.collections.impl.utility.ArrayListIterate (file:/C:/**/Obevo/obevo-cli-8.1.1-dist/lib/eclipse-collections-7.0.2.jar) to field java.util.ArrayList.elementData WARNING: Please consider reporting this to the maintainers of org.eclipse.collections.impl.utility.ArrayListIterate WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release Arguments parsed: AquaRevengArgs [outputPathc:\output, tablespaceToken=false, tokenizeDefaultSchema=false, generateBaseline=false, platform=com.gs.obevo.db.impl.platforms.mssql.MsSqlDbPlatform@162be91c, dbHost=localhost, dbPort=null, dbServer=localhost, dbSchema=dbo, mode=SCHEMA, preprocessSchemaTokens=true]

1) Download the powershell script from: https://github.com/goldmansachs/obevo/tree/master/obevo-db-impls/obevo-db-mssql/src/main/resources/SqlServerDdlReveng.ps1

2) Open a powershell prompt (assuming you have one installed):

3) Source the script, e.g.:

. .\SqlServerDdlReveng.ps1

4) Run the following command to generate the DDL file: SqlServerDdlReveng c:\output localhost dbo

Here is an example command (in case your input arguments are not filled in): SqlServerDdlReveng c:\output localhost dbo myuser mypassword


NOTE - This script is still in beta and subject to signature changes. Please give it a try and provide us feedback, or contribute changes as needed.


Once those steps are done, rerun the reverse-engineering command you just ran, but add the following argument based on the value passed in above the argument: -inputPath c:\output\interim

If you need more information on the vendor reverse engineer process, see the doc: https://goldmansachs.github.io/obevo/reverse-engineer-dbmstools.html

Action completed successfully at Tue Oct 06 17:23:09 EDT 2020, took 0 seconds.

Detailed Log File is available at: C:\Users***\AppData\Local\Temp\obevo-2310019843451602426/obevo-NEWREVENG-20201006172308.log

Content of obevo-NEWREVENG-20201006172308.log

[INFO] c.g.o.d.Main [main] [10-06 17:23:08] - Starting action at time [Tue Oct 06 17:23:08 EDT 2020] [INFO] o.a.c.v.i.StandardFileSystemManager [main] [10-06 17:23:09] - Using "C:\Users****\AppData\Local\Temp\vfs_cache" as temporary files store. [INFO] c.g.o.u.ArgsParser [main] [10-06 17:23:09] - Arguments parsed: AquaRevengArgs [outputPathc:\output, tablespaceToken=false, tokenizeDefaultSchema=false, generateBaseline=false, platform=com.gs.obevo.db.impl.platforms.mssql.MsSqlDbPlatform@2488b073, dbHost=localhost, dbPort=1433, dbServer=LAPTOP-M76R3DN1, dbSchema=dbo, mode=SCHEMA, preprocessSchemaTokens=true] [INFO] c.g.o.d.Main [main] [10-06 17:23:09] - [INFO] c.g.o.d.Main [main] [10-06 17:23:09] - Action completed successfully at Tue Oct 06 17:23:09 EDT 2020, took 0 seconds. [INFO] c.g.o.d.Main [main] [10-06 17:23:09] - [INFO] c.g.o.d.Main [main] [10-06 17:23:09] - Detailed Log File is available at: C:\Users\santh\AppData\Local\Temp\obevo-santh2310019843451602426/obevo-NEWREVENG-20201006172308.log [INFO] c.g.o.d.Main [main] [10-06 17:23:09] - [INFO] c.g.o.d.Main [main] [10-06 17:23:09] - Exiting successfully!

sandeep-chekuri commented 3 years ago

Can you be more explicit on the issue. You can follow Obevo Kata

santhoshkotte commented 3 years ago

Hi Sandeep Can you share the reverse engineering command line options for MS SQL Server. The information that have posted above is from the logs itself. The reveng command does not produce any content in the c:\output directory. I will take a look at the kata as well.

santhoshkotte commented 3 years ago

Hi Sandeep To be more specific, the following error is thrown when the powershell script "SqlServerDdlReveng" is run SqlServerDdlReveng.ps1:31 Line | 31 | … onnection = New-Object ('Microsoft.SqlServer.Management.Common.Server … | ~~~~~~~~~~~~~ | Exception calling ".ctor" with "3" argument(s): "Could not load type | 'Microsoft.SqlServer.Server.SqlContext' from assembly 'System.Data, Version=4.0.0.0, Culture=neutral, | PublicKeyToken=b77a5c561934e089'."

Hope that helps.

sandeep-chekuri commented 3 years ago

Similar issue is raised in StackOverFlow and hope it resolves your issue