我正在尝试将5.6.1 sonarqube实例升级到6.5,它在Linux上针对Oracle数据库运行。
我添加了以下插件;
oracle驱动程序是ojdbc6-11.2.0.2.0 jdk是1.8.0_144
流程启动但网络只是挂起。我添加了TRACE日志记录并查看
2017.09.07 22:07:02 TRACE web[][o.s.s.p.Platform] level1 started | time=2286ms
2017.09.07 22:07:02 TRACE web[][o.s.s.p.Platform] level2 configured | time=33ms
直到
2017.09.07 23:47:53 TRACE web[][o.s.c.p.ComponentContainer] org.sonar.server.platform.db.migration.history.MigrationHistoryTableImpl started | time=2139938ms
2017.09.08 00:27:00 TRACE web[][o.s.c.p.ComponentContainer] org.sonar.server.platform.db.migration.history.MigrationHistoryImpl started | time=2347061ms
2017.09.08 00:27:00 TRACE web[][sql] time=4ms | sql=select version from schema_migrations
2017.09.08 00:27:00 TRACE web[][sql] time=2ms | sql=select version from schema_migrations
2017.09.08 00:27:00 WARN web[][o.s.s.p.DatabaseServerCompatibility] Database must be upgraded. Please backup database and browse /setup
迁移开始后,这种缓慢持续,例如
2017.09.08 17:06:45 INFO web[][o.s.s.p.d.m.v.v.DropRelatedDashboardTables] Removing tables [widget_properties, widgets, active_dashboards, dashboards]
2017.09.08 17:06:45 TRACE web[][sql] time=35ms | sql=BEGIN EXECUTE IMMEDIATE 'DROP SEQUENCE widget_properties_seq'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -2289 THEN RAISE; END IF; END;
2017.09.08 17:06:45 TRACE web[][sql] time=19ms | sql=BEGIN EXECUTE IMMEDIATE 'DROP TRIGGER widget_properties_idt'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -4080 THEN RAISE; END IF; END;
2017.09.08 17:06:45 TRACE web[][sql] time=87ms | sql=DROP TABLE widget_properties
2017.09.08 17:06:45 TRACE web[][sql] time=12ms | sql=BEGIN EXECUTE IMMEDIATE 'DROP SEQUENCE widgets_seq'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -2289 THEN RAISE; END IF; END;
2017.09.08 17:06:45 TRACE web[][sql] time=16ms | sql=BEGIN EXECUTE IMMEDIATE 'DROP TRIGGER widgets_idt'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -4080 THEN RAISE; END IF; END;
2017.09.08 17:06:45 TRACE web[][sql] time=43ms | sql=DROP TABLE widgets
2017.09.08 17:06:45 TRACE web[][sql] time=11ms | sql=BEGIN EXECUTE IMMEDIATE 'DROP SEQUENCE active_dashboards_seq'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -2289 THEN RAISE; END IF; END;
2017.09.08 17:06:45 TRACE web[][sql] time=27ms | sql=BEGIN EXECUTE IMMEDIATE 'DROP TRIGGER active_dashboards_idt'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -4080 THEN RAISE; END IF; END;
2017.09.08 17:06:45 TRACE web[][sql] time=64ms | sql=DROP TABLE active_dashboards
2017.09.08 17:06:45 TRACE web[][sql] time=12ms | sql=BEGIN EXECUTE IMMEDIATE 'DROP SEQUENCE dashboards_seq'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -2289 THEN RAISE; END IF; END;
2017.09.08 17:06:45 TRACE web[][sql] time=19ms | sql=BEGIN EXECUTE IMMEDIATE 'DROP TRIGGER dashboards_idt'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -4080 THEN RAISE; END IF; END;
2017.09.08 17:06:45 TRACE web[][sql] time=37ms | sql=DROP TABLE dashboards
2017.09.08 17:06:45 TRACE web[][sql] time=6ms | sql=insert into schema_migrations(version) values (?) | params=1420
2017.09.08 17:06:45 INFO web[][DbMigrations] #1420 'Drop tables related to dashboards': success | time=8515237ms
2017.09.08 17:06:45 INFO web[][DbMigrations] #1421 'Drop tables related to measure filters'...
即。大量的操作似乎需要一小时才能完成
什么可能导致如此缓慢的表现?由于实际查询执行时间不足,日志中没有提示可以了解它正在做什么。
答案 0 :(得分:1)
这个问题的根本原因是数据字典查询执行不力,一个例子是像
这样的查询SELECT NULL AS table_cat,
o.owner AS table_schem,
o.object_name AS table_name,
o.object_type AS table_type,
NULL AS remarks
FROM all_objects o
WHERE o.owner LIKE :1 ESCAPE '/'
AND o.object_name LIKE :2 ESCAPE '/'
AND o.object_type IN ('xxx', 'TABLE')
ORDER BY table_type, table_schem, table_name
这在sonarqube 5.6中没有出现。