I was wondering if there exists some scripts or something like this.
The core DB tables are defined in lib/db/install.xml, with the tables for each plugin (core or otherwise) stored in [path_to_plugin]/db/install.xml.
The code that parses these files and installs the DB tables can be found in lib/upgradelib.php.
The install is done by admin/index.php. Try reading that file. They key bits are where you get the calls to functions like install_core / upgrade_core / upgrade_noncore. Those functions are defined in lib/upgradelib.php.