---
# System prepended metadata

title: 透過SqlPackage資料匯出匯入

---

# 透過SqlPackage資料匯出匯入

## 資料庫匯出
```bash=
sqlpackage/sqlpackage \
  /Action:Export \
  /SourceServerName:"192.168.1.1" \
  /SourceTrustServerCertificate:True \
  /SourceUser:"User1Id" \
  /SourcePassword:"User1Password" \
  /SourceDatabaseName:"TestDb" \
  /TargetFile:"TestDb001.bacpac"
```

## 資料庫匯入
```bash=
sqlpackage/sqlpackage \
  /Action:Import \
  /TargetServerName:"192.168.1.2" \
  /TargetTrustServerCertificate:True \
  /TargetUser:"User2Id" \
  /TargetPassword:"User2Password" \
  /TargetDatabaseName:"TestDbNew" \
  /SourceFile:"TestDb001.bacpac"

```