Sqlcmd
Jump to navigation
Jump to search
backup
sqlcmd -S 10.x.x.x -U sa -P ${PASS} -d master -Q "BACKUP DATABASE demo TO DISK='C:\Temp\demo.bak' WITH COPY_ONLY"
- WITH FORMAT
Backup Restore
List DB Logical Names
RESTORE FILELISTONLY FROM DISK = '/bkp/mydb.bak';
Restore in container
RESTORE DATABASE mydb FROM DISK = '/bkp/file.bak' WITH MOVE 'mydb' TO '/var/opt/mssql/data/mydb.mdf', MOVE 'mydb_log' TO '/var/opt/mssql/data/mydb.ldf', REPLACE; -- Use REPLACE if the database already exists GO