The Detected DB information will be displayed (see below). At the bottom, type /var/opt/mssql/data if its not already present, and expand the Data option in the part of the window above. In the Backup file path field that comes up as soon as you select the above option, select the three dots to enter the Select a file screen. You will get a window such as the one shown below:Ĭlick on Restore from and select Backup file. If all goes well, you will now be connected as per the steps given above.Įxpand Databases, right click on Test DB and select restore. Provide the password for the sa user that you have given in the command line above. Open Azure Data Studio and click on New connection. docker cp LOREAL_FINANCEv15.bak sql1:/var/opt/mssql/data/LOREAL_FINANCEv15.bak The steps below are to be executed on Azure Data Studio, installed on your MacOS. We are using the command to move the backup file into the SQL Server container for accessing through Azure Data Studio. You should replace it with your respective file name.Įxit the container and give the following command in your terminal window. We will be using the LOREAL_FINANCEv15.bak as the SQL backup file name in the following steps as an example. Now type the following commands (one per line). opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Welcome123" The command below is to log in into the SQL Server instance in the Docker container. Successful login will give you the root prompt. We will now be logging into the container. To check if the container is up or not: docker ps -a docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Welcome123" -p 1433:1433 -name sql1 -d /mssql/server:2017-latest Run the Docker image by passing the sa user’s password (Welcome123 in this case). Pull the latest SQL Server image using the Docker CLI.ĭocker pull /mssql/server:2017-latest Note: We will be installing SQL Server as a Docker image. You’ll need the SQL Server database backup file (.bak).Azure Data Studio for MacOS should be installed.Here are the steps to restore a SQL Server backup file on your MacOS using Docker containers. You can get a backup of your SQL Server database and can restore it using the Data Studio tool on your MacOS. For recent editions, Microsoft provides a tool called Azure Data Studio that can help MacOS users take advantage of SQL Server. However, this tool is not available for MacOS. SQL Server is usually managed using SQL Server Management Studio. This article is focused on a recent requirement in which SQL Server needed to be accessed locally on a MacOS machine to analyse the database and its structure.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |