Dear all,
How can I restore from a SQL backup file but only the data part? When I
restore my backup file in SQL 2000 Server, the restore process stops and
said "TErminating abnormally" I am wondering the problem can be the
transaction log part in the backup file. So, is it possible to restore only
the data part?
Thanks,
ACAllen
CREATE DATABASE mywind
GO
ALTER DATABASE mywind ADD FILEGROUP new_customers
ALTER DATABASE mywind ADD FILEGROUP sales
GO
ALTER DATABASE mywind ADD FILE
(NAME='mywind_data_1',
FILENAME='d:\mw.dat1')
TO FILEGROUP new_customers
ALTER DATABASE mywind
ADD FILE
(NAME='mywind_data_2',
FILENAME='d:\mw.dat2')
TO FILEGROUP sales
BACKUP DATABASE mywind
TO DISK ='d:\mywind.dmp'
WITH INIT
GO
USE mywind
GO
CREATE TABLE t1 (id int) ON new_customers
CREATE TABLE t2 (id int) ON sales
GO
BACKUP LOG mywind TO DISK='d:\mywind.dmp'
WITH NOINIT
RESTORE FILELISTONLY FROM DISK='d:\mywind.dmp'
GO
RESTORE HEADERONLY FROM DISK='d:\mywind.dmp'
GO
RESTORE DATABASE mywind_part
FILEGROUP = 'sales'
FROM DISK='d:\mywind.dmp'
WITH FILE=1,NORECOVERY,PARTIAL,
MOVE 'mywind' TO 'd:\mw2.pri',
MOVE 'mywind_log' TO 'd:\mw2.log',
MOVE 'mywind_data_2' TO 'd:\mw2.dat2'
GO
RESTORE LOG mywind_part
FROM DISK = 'g:\mywind.dmp'
WITH FILE = 2,RECOVERY
GO
Notice that t2 is accessible after the partial restore operation.
SELECT COUNT(*) FROM mywind_part..t2
Here is the result:
--
0
Notice that t1 is not accessible after the partial restore operation.
SELECT COUNT(*) FROM mywind_part..t1
Here is the resulting message:
The query processor is unable to produce a plan because
the table 'mywind_part..t1' is marked OFFLINE.
"Allen Cheng" <acheng@.hk.eclipsecomputing.com> wrote in message
news:bf5q4d$6g0$1@.hfc.pacific.net.hk...
> Dear all,
> How can I restore from a SQL backup file but only the data part? When I
> restore my backup file in SQL 2000 Server, the restore process stops and
> said "TErminating abnormally" I am wondering the problem can be the
> transaction log part in the backup file. So, is it possible to restore
only
> the data part?
> Thanks,
> AC
>|||Let me give you another option:
sp_attach_single_file_db
All you need is the path to the mdf file.
You can always browse to the mdf file through Windows Explorer and then drag
and drop the file into an open START / RUN dialog box to get the full path
to the mdf easily.
"Allen Cheng" <acheng@.hk.eclipsecomputing.com> wrote in message
news:bf5q4d$6g0$1@.hfc.pacific.net.hk...
> Dear all,
> How can I restore from a SQL backup file but only the data part? When I
> restore my backup file in SQL 2000 Server, the restore process stops and
> said "TErminating abnormally" I am wondering the problem can be the
> transaction log part in the backup file. So, is it possible to restore
only
> the data part?
> Thanks,
> AC
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment