#백업폴더생성
docker exec -it mssql20192 mkdir /var/opt/mssql/backup
#파일복사
docker cp d:\database\?.bak mssql20192:/var/opt/mssql/backup
#논리적파일명확인
docker exec -it mssql20192 /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "dbsa#2012" -Q "RESTORE FILELISTONLY FROM DISK = '/var/opt/mssql/backup/?.bak'"
#복원
docker exec -it mssql20192 /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "dbsa#2012" -Q "RESTORE DATABASE ? FROM DISK = '/var/opt/mssql/backup/?.bak' WITH MOVE '?' TO '/var/opt/mssql/data/?newdbname.mdf', MOVE '?' TO '/var/opt/mssql/data/?.ldf'"
docker database
2023. 8. 24. 10:25