Teamcity fails to start after restore
We are in the process of moving TC ( 9.1.6 (build 37459) ) to a new server + upgrading + moving to an external database. I stopped teamcity in production and took a full backup of the internal DB.
Installed 9.1.6 (build 37459) on the new server and restored. Now on startup I get "Unexpected exception SQLException/HsqlException: SQL error when doing: Taking a connection from the data source SQL exception: error in script file line: C:\TeamCitydata\system\buildserver 45"
The line in buildserver is: CREATE INDEX BACKUP_INFO_FILE_I ON PUBLIC.BACKUP_INFO(FILE_NAME)
Where to go from here?
Please sign in to leave a comment.
Hi,
the teamcity-server.log should show a more detailed, with a stacktrace, error message that might help pointing out what the issue is. Could you check whether there is extra information and post it back here?
[2018-01-29 10:45:10,528] INFO - jetbrains.buildServer.STARTUP - ===========================================================
[2018-01-29 10:45:10,528] INFO - jetbrains.buildServer.STARTUP - Starting TeamCity server
[2018-01-29 10:45:10,747] INFO - jetbrains.buildServer.STARTUP - TeamCity version: 9.1.6 (build 37459), data format version 727
[2018-01-29 10:45:10,763] INFO - jetbrains.buildServer.STARTUP - OS: Windows NT (unknown), User: svc_teamcity_test, JRE: 1.8.0_66, Java HotSpot(TM) Server VM (32 bit) (25.66-b17, mixed mode), Java(TM) SE Runtime Environment (1.8.0_66-b17), Oracle Corporation
[2018-01-29 10:45:10,763] INFO - jetbrains.buildServer.STARTUP - JVM parameters: -Djava.util.logging.config.file=c:\TeamCity\bin\..\conf\logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xrs -Xmx512m -XX:MaxPermSize=270m -Dteamcity.configuration.path=../conf/teamcity-startup.properties -Dlog4j.configuration=file:../conf/teamcity-server-log4j.xml -Dteamcity_logs=../logs/ -Djava.endorsed.dirs=c:\TeamCity\bin\..\endorsed -Dcatalina.base=c:\TeamCity\bin\.. -Dcatalina.home=c:\TeamCity\bin\.. -Djava.io.tmpdir=c:\TeamCity\bin\..\temp
[2018-01-29 10:45:10,763] INFO - jetbrains.buildServer.STARTUP - Garbage collection: PS Scavenge, PS MarkSweep
[2018-01-29 10:45:10,778] INFO - jetbrains.buildServer.STARTUP - Web server version: Apache Tomcat/7.0.59
[2018-01-29 10:45:10,778] INFO - jetbrains.buildServer.STARTUP - Server IP address: 192.168.249.13
[2018-01-29 10:45:10,841] INFO - jetbrains.buildServer.STARTUP - Web server ports: 80 (protocol: org.apache.coyote.http11.Http11NioProtocol, scheme: http), 8105 (shutdown port)
[2018-01-29 10:45:10,841] INFO - rocesses.ProcessTreeTerminator - Using jetbrains.buildServer.processes.ProcessTreeTerminatorWindows
[2018-01-29 10:45:11,153] INFO - jetbrains.buildServer.STARTUP - TeamCity server process ID (4116) stored in: C:\TeamCity\logs\teamcity.pid
[2018-01-29 10:45:11,153] INFO - jetbrains.buildServer.STARTUP - Failed to obtain version file lock: c:\TeamCity\bin\..\webapps\ROOT\BUILD_37459: java.io.FileNotFoundException: c:\TeamCity\bin\..\webapps\ROOT\BUILD_37459 (Access is denied) (enable debug to see stacktrace)
[2018-01-29 10:45:11,184] INFO - jetbrains.buildServer.STARTUP - Servlet real path: c:\TeamCity\bin\..\webapps\ROOT\
[2018-01-29 10:45:11,200] INFO - jetbrains.buildServer.STARTUP - Current stage: Looking for the TeamCity Data Directory
[2018-01-29 10:45:11,200] INFO - jetbrains.buildServer.STARTUP - The TeamCity Data Directory path is determined using the startup configuration from 'C:\TeamCity\conf\teamcity-startup.properties' file
[2018-01-29 10:45:11,216] INFO - jetbrains.buildServer.STARTUP - The TeamCity Data Directory "C:\TeamCitydata" exists
[2018-01-29 10:45:11,216] INFO - jetbrains.buildServer.STARTUP - The main configuration file "C:\TeamCitydata\config\main-config.xml" exists
[2018-01-29 10:45:11,216] INFO - jetbrains.buildServer.STARTUP - The database properties file "C:\TeamCitydata\config\database.properties" exists
[2018-01-29 10:45:11,216] INFO - jetbrains.buildServer.STARTUP - The internal database data file "C:\TeamCitydata\system\buildserver.data" exists
[2018-01-29 10:45:11,278] INFO - jetbrains.buildServer.STARTUP - Data Directory version: 727
[2018-01-29 10:45:11,278] INFO - jetbrains.buildServer.STARTUP - Current stage: Looking for the database configuration
[2018-01-29 10:45:11,278] INFO - jetbrains.buildServer.STARTUP - Database properties file "C:\TeamCitydata\config\database.properties" exists
[2018-01-29 10:45:11,278] INFO - jetbrains.buildServer.STARTUP - Internal HSQL database file (C:\TeamCitydata\system\buildserver.data) exists, version: 2.3.2
[2018-01-29 10:45:11,278] INFO - jetbrains.buildServer.STARTUP - Database connection URL: jdbc:hsqldb:file:$TEAMCITY_SYSTEM_PATH/buildserver
[2018-01-29 10:45:11,278] INFO - jetbrains.buildServer.STARTUP - Using database connection URL from the database properties file. The URL is: jdbc:hsqldb:file:$TEAMCITY_SYSTEM_PATH/buildserver
[2018-01-29 10:45:11,278] INFO - jetbrains.buildServer.STARTUP - Using internal (HSQL) database
[2018-01-29 10:45:11,278] INFO - jetbrains.buildServer.STARTUP - Current stage: Connecting to the database
[2018-01-29 10:45:12,091] ERROR - jetbrains.buildServer.STARTUP - Unexpected exception SQLException/HsqlException: SQL error when doing: Taking a connection from the data source
SQL exception: error in script file line: C:\TeamCitydata\system\buildserver 45
Thanks for the log. This issue usually happens when the users that took the backup and restored it are different and the files don't have appropriate permissions for the user running teamcity to load them properly. Could you check which user runs teamcity and which user owns the files in "C:\TeamCitydata\system\" named buildserver.<some extension)
I had the same issue. It was resolved after launching TeamCity from elevated command line (Admin mode),
Thank you Denis for the hint!