Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create-db.sh Could not open .ldf file, halts alloy sample database creation. #55

Open
MicahBredenhorst opened this issue Oct 30, 2024 · 1 comment

Comments

@MicahBredenhorst
Copy link

System:

  • Windows 11 host

I am experiencing the following issue when creating the alloy template database.
When starting up the database and web project using docker-compose up, after creating the tempdb's, I get the following error:

  • Could not open file /var/opt/mssql/host_data/alloy-docker/alloy-docker.ldf for file number 0. OS error: 2(The system cannot find the file specified.).

When removing the LOG ON part of the script, it continues as it should and creates the log file:

/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$SA_PASSWORD" -C -Q "IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = '${DB_NAME}') CREATE DATABASE ${DB_NAME} ON (NAME=${DB_NAME}_data, FILENAME='/var/opt/mssql/host_data/${DB_DIRECTORY}/${DB_NAME}.mdf') LOG ON (NAME=${DB_NAME}_log, FILENAME='/var/opt/mssql/host_data/${DB_DIRECTORY}/${DB_NAME}.ldf') FOR ATTACH;"

The .ldf file is not present in the App_Data folder only the .mdf file.

@MicahBredenhorst MicahBredenhorst changed the title create-db.sh Could not open ldf file, halts alloy sample database creation. create-db.sh Could not open .ldf file, halts alloy sample database creation. Oct 30, 2024
@pbustamantes
Copy link

A workaround that I found was that if I run the "dotnet run" first on a windows 10/11, it will generate the .ldf files next to the .mdf. Note that the ldf files have a suffix of "_log.ldf" and create-db.sh script will fail with error

Unable to open the physical file "/var/opt/mssql/host_data/<project name>/<project name>.ldf".

create-db.sh needs to have it update to pass this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants