0

I wanna open two datafiles (test.mdf and testlog.ldf) on Azure Data Studio but I can't. I expose the steps that I have followed until the problem which I'm writing here. I've moved both of files from local to docker's container for working with them on Azure Data Studio.

I've followed the next steps on terminal:

> docker stop NameContainer
> docker cp /Users/user/Downloads/NameFile/test.mdf NameContainer:/var/opt/mssql/data/
> docker cp /Users/user/Downloads/NameFile/testlog.ldf NameContainer:/var/opt/mssql/data/
> docker start NameContainer

Now with that command lines, I have on my container both of datafiles with I wanna working on Azure Data Studio but I have the next problem. I execute my CREATE DATABASE:

CREATE DATABASE Testing
    ON 
    (FILENAME = '/var/opt/mssql/data/test.mdf'),
    (FILENAME = '/var/opt/mssql/data/testlog.ldf')
    FOR ATTACH;

And Azure reports the next error message:

Msg 3415, Level 16, State 2, Line 1
Database 'Testing' cannot be upgraded because it is read-only, has read-only files or the user does not have permissions to modify some of the files. Make the database or files writeable, and rerun recovery.

So, I open Terminal, execute ls -l and both of files have -rwxr-xr-x permissions but a different UID and GID that the rest of files in the directory:

> -rwxr-xr-x 1   501 dialout  4194304 Nov  2  2008 test.mdf
> -rwxr-xr-x 1   501 dialout  1048576 Nov  2  2008 testlog.ldf
> -rw-r----- 1 mssql root     4653056 Feb 24 10:56 master.mdf
> -rw-r----- 1 mssql root     2097152 Feb 24 11:19 mastlog.ldf

So I try to change that using the next:

> docker exec  -i -t NameContainer /bin/bash
> cd /var/opt/mssql/data/
> ls -l
> chown -f mssql:root /var/opt/var/opt/mssql/data/test.mdf
> chown -f mssql:root /var/opt/var/opt/mssql/data/testlog.ldf

But the UID and GID still are the same (501 dialout), what is the problem or what steps am I having a mistake?

molik
  • 15
  • 4
  • *"But don't work on it."* what does this mean? DO you get an error? – Thom A Feb 24 '23 at 11:35
  • I'm sorry @Larnu I've already edit my question, when I wrote **don't work on it** I mean which UID and GID are the same (501 dialout) and the changes that I expected after execute the command line don't have had effect. – molik Feb 24 '23 at 11:40
  • I also would have expected an error for those `chown` commands: *"chown: changing ownership of '{File Path}': Operation not permitted"* – Thom A Feb 24 '23 at 11:54

0 Answers0