Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit a42cb26

Browse files
authored
Merge pull request #21917 from arvindshmicrosoft/arvindsh/cross-server-db-copy-into-ep
Add T-SQL sample for cross-server DB copy into elastic pool
2 parents 1c27924 + 80665a6 commit a42cb26

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

azure-sql/database/database-copy.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ Database1 can be a single or pooled database. Copying between different tier poo
111111

112112
```sql
113113
-- Execute on the master database to start copying
114-
CREATE DATABASE "Database2"
115-
AS COPY OF "Database1"
116-
(SERVICE_OBJECTIVE = ELASTIC_POOL( name = "pool1" ) );
114+
CREATE DATABASE Database2
115+
AS COPY OF Database1
116+
(SERVICE_OBJECTIVE = ELASTIC_POOL( name = 'pool1' ) );
117117
```
118118

119119
### Copy to a different server
@@ -130,6 +130,13 @@ CREATE DATABASE Database2 AS COPY OF server1.Database1;
130130
> [!IMPORTANT]
131131
> Both servers' firewalls must be configured to allow inbound connection from the IP of the client issuing the T-SQL CREATE DATABASE ... AS COPY OF command. To determine the source IP address of current connection, execute `SELECT client_net_address FROM sys.dm_exec_connections WHERE session_id = @@SPID;`
132132
133+
Similarly, the below command copies Database1 on server1 to a new database named Database2 within an elastic pool called pool2, on server2.
134+
135+
```sql
136+
-- Execute on the master database of the target server (server2) to start copying from Server1 to Server2
137+
CREATE DATABASE Database2 AS COPY OF server1.Database1 (SERVICE_OBJECTIVE = ELASTIC_POOL( name = 'pool2' ) );
138+
```
139+
133140
### Copy to a different subscription
134141

135142
You can use the steps in the [Copy a SQL Database to a different server](#copy-to-a-different-server) section to copy your database to a server in a different subscription using T-SQL. Make sure you use a login that has the same name and password as the database owner of the source database. Additionally, the login must be a member of the `dbmanager` role or a server administrator, on both source and target servers.

0 commit comments

Comments
 (0)