SQL Server 2017 on linux presenting system error 2 - sql-server

The SQL Server 2017 running on a Ubuntu container started to present errors with permissions after the log file went full. Running
create database example
presents
CREATE FILE encountered operating system error 2(The system cannot find the file specified.) while attempting to open or create the physical file '/mssql-translog/translog/example_log.ldf'.
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
Does anyone knows how to solve this?
I tried to change permissions directly on the container but it says the file system is read only.

Related

Double hop issue? - SSIS gives access denied when writing to a flat CSV file on a network share

I'm hoping someone can help me resolve and issue I'm running into. I have a user run app that calls an SSIS package to create a CSV file on a network file share. The app then processes the CSV file. This had been working but then we started getting an Access denied error coming from the SSIS package. The app it self is able to read/write to the file and the directory. When I run the SSIS package in Visual Studio on a VM then the package is able to create the output file and the app can process it. I was getting issues even reading the file from TSQL. I have been working with our support staff to edit the user delegation settings in Active Directory and I have gotten to the point where I can use TSQL to read the CSV file without issues. If I start the SSIS job using TSQL the job runs without errors. When I execute the package from the App using DT_EXEC then I get access denied. When I start the job using SSMS, I get access denied. I'm thinking this is still a double hop issue.
The msDS-allowedToDelegateTo setting on both server A and file server B are:
server A (running SQL Server and SSIS):
cifs/VM-SQL-B
cifs/VM-SQL-A.Domain.Biz
cifs/VM-SQL-A
cifs/VM-SQL-B.Domain.Biz
WSMAN/VM-SQL-B.Domain.Biz
HOST/VM-SQL-B
MSSQLSvc/VM-SQL-A.Domain.Biz:1433
MSSQLSvc/VM-SQL-B.Domain.Biz:1433
server B (File server):
cifs/VM-SQL-A.Domain.Biz
cifs/VM-SQL-A
cifs/VM-SQL-B.Domain.Biz
cifs/VM-SQL-B
WSMAN/VM-SQL-A.Domain.Biz
HOST/VM-SQL-A
MSSQLSvc/VM-SQL-A.Domain.Biz:1433
MSSQLSvc/VM-SQL-B.Domain.Biz:1433
I looking for input as to what I am missing.
Thanks much,

Azure Data Studio: unable to restore SQL Server database - Access Denied

I'm in the process of migrating the database from one server to another. When I try to select the backup file (.bak) within Docker, I'm getting an 'Access Denied' error. How to provide access permission to the Docker container?
enter image description here
I had the same error, and what I concluded is that the problem is the file is not in the format it should be, to be precise since I have remote access to my Linux server with GUI, I just copied the .bak file from the windows machine to Linux, which I repeat is not advised way to transfer files form one OS to another. I solved the problem by posting .bak on Google Drive and then generating a download link that I typed in the terminal later.
To generate a proper link from Google Drive I recommend the following guide:
https://bytesbin.com/skip-google-drive-virus-scan-warning-large-files/
When you get the link type in the terminal:
$ curl -L -o The_Name.bak "The_link"
For restoring the database follow this tutorial:
https://learn.microsoft.com/en-us/sql/linux/tutorial-restore-backup-in-sql-server-container?view=sql-server-ver16

Unable to open the file .mdf/.ldf. Operating system error 5: 5"(Access is denied.)" - Trying to replace .mdf/.ldf file with new one

I have the ability to move .mdf/.ldf files at will from the default \DATA folder location. I can set the database online and offline whenever I move these files manually.
We get a new set of .mdf/.ldf file every month to replace the one that we have. I am trying to automate this process with SSIS. I have managed to create a package that will handle replacing the old .mdf/.ldf files with the new ones.
BUT!
The SQL task to turn on the database with the new .mdf/.ldf files does not run.
I get this error:
Error: 0xC002F210 at Take Sandbox Online, Execute SQL Task: Executing the query "ALTER DATABASE Sandbox SET ONLINE" failed with the following error: "Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL13.SERVER\MSSQL\DATA\SANDBOX.mdf". Operating system error 5: "5(Access is denied.)".
Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL13.SERVER\MSSQL\DATA\SANDBOX_LOG.ldf". Operating system error 5: "5(Access is denied.)".
I am able to do this process manually, but for some reason SSIS is not able to turn the database back on with a SQL Task. I clearly have permissions to perform this task, but I am ignorant of how running through SSIS would be an issue.
Please help!
Thank you
SQL Server uses a service account, usually called NT SERVICE\MSSQLSERVER, which needs to have permissions on the mdf/ldf files.
Right click the files, click properties / security /edit / add, and add the account to permissions.

Load trace file into SQL Server - Access is Denied

So at work I've been given a 500MB trace file to try and diagnose some issues. We've found a few culprits I think are the problems but they want me to run some queries against the data to prove my hypothesis. I installed SQL Server 2017 Developer locally so I could have a local database to mess with and can't get it to work.
DROP TABLE TraceTemp;
SELECT * INTO TraceTemp FROM::fn_trace_gettable('C:\Users\chalewis\Desktop\sql.trc',default);
I keep getting the following error. File 'C:\Users\chalewis\Desktop\sql.trc' either does not exist or there was an error opening the file. Error = '5(Access is denied.)'.
Database and file are on same machine so the path should be correct (used copy as path windows function to get it).
I'm logged in using Windows Authentication and can load the file into
SQL Server Profiler just fine.
The trace was captured by SQL Server Profiler.
I have given permission to my desktop to {ComputerName}/MSSQLSERVER
Anything else I can possibly do?
The access to the folder/file is normally done with the user your Sql Server service is running (check via services.msc) and give this user access rights to the folder (I guess it's NT Service\MSSQLSERVER in your case).

ssis [File System Task] Error: An error occurred with the following error message: "Access to the path is denied."

So, I have an SSIS package that checks for file existence on the server, copies data from the file onto a table on sql server and moves the file to a done folder.
I have created environment variables and since I have full access to folders and to the server..the package got executed successfully. But, When I selected QA environment in the configuration manager and when I run the package..it's failing to move the file to the done folder and the error in execution result is - [File System Task] Error: An error occurred with the following error message: "Access to the path is denied.".
I have used user variables within the File system task
and the package overview
My question here is - since the file is present in file explorer on QA box and I don't have access..is it the reason for it to fail. But, I am not using my credentials to login at the connection manager level. I am using SQL server authentication (got a service account created).
Please let me know if you have any questions.
Thank you!
My question here is - since the file is present in file explorer on QA box and I don't have access..is it the reason for it to fail.
This is the reason for the failure, yes.
When running a SSIS package in Visual Studio most things will run under your credentials. Yes, you need to specify credentials for some connection managers, but File System Tasks use the Local User's credentials. If you, personally, do not have access to a file, neither does an SSIS package you are running.

Resources