Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Restore to Different Server Leaves Database with Data from Earlier State

$
0
0

I have an SSIS package that I built consisting of three steps.

1. Backup database A on Server 1.

2. Copy the .bak file from Server 1 to Server 2.

3. Restore the .bak file to database A on Server 2.

I can see that the backup works fine.

I can see that the copy works fine, as the date of the .bak file indicates.

It even appears that my RESTORE works.  However, when I check for data that I know exists in database A on Server1, it is not there in database A on Server 2.

The SQL Statement for Step 1 (Backup) is:

BACKUP DATABASE [databaseA] TO  DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\Backup\databaseA.bak' WITH NOFORMAT, NOINIT,  NAME = N'databaseA', SKIP, REWIND, NOUNLOAD,  STATS = 10

The SQL State for Step 3 (Restore) is:

USE [master]

ALTER DATABASE [databaseA] SET SINGLE_USER WITH ROLLBACK IMMEDIATE

RESTORE DATABASE [databaseA] FROM  DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Backup\databaseA.bak' WITH  FILE = 15,  MOVE N'databaseA' TO N'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\databaseA.mdf',  MOVE N'databaseA_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\databaseA_log.ldf',  NOUNLOAD,  REPLACE,  STATS = 5

ALTER DATABASE [databaseA] SET MULTI_USER

Any idea why after the restore, the database doesn't show the latest data?

Thanks,

- N


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>