I run MSSQL as a statefulset on Kubernetes (I use the official docker image)
I wrote a startup script that should restore $n backups on $n databases.
my problem is: first database gets restored successfully, no errors. it for whatever reason hold the terminal session for 10 minutes before passing it to the command after it.
I tried to execute my commands from shell directly, same exact behaviour.
and it doesn't happen with all queries, only the restore.
it eventually will restore all databases and the whole script but it takes ages.
does anybody know why? and how I can stop it from doing that? because waiting nx10 mins for all databases to be restored is quite painful, and I really need this to be automated.
here is the command that this issue happens on:
/opt/mssql-tools/bin/sqlcmd -U "$username_var" -P "$password_var" -e -Q "RESTORE DATABASE [mssqldb1] FROM DISK = N'/var/opt/mssql/backup/template_dbs/mssqldb1.bak' WITH FILE = 1, MOVE N'mssqldb1_Data' TO N'/var/opt/mssql/data/mssqldb1.mdf', MOVE N'mssqldb1_Log' TO N'/var/opt/mssql/translogs/mssqldb1.ldf', NOUNLOAD, REPLACE, STATS = 5"