Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Programming / SQL / July 2008

Tip: Looking for answers? Try searching our database.

Simple Recovery, Filegroup Backups

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bob - 31 Jul 2008 17:02 GMT
-- If I have a database in Simple recovery mode, it is possible to BACKUP a
FILEGROUP.  However, it does not seem possible to RESTORE it.
-- Is it ever possible to RESTORE it?  I personally didn't think it was
possible in Simple recovery mode, but then it doesn't make sense you can back
it up successfully.
IF EXISTS (SELECT * FROM   master..sysdatabases WHERE  name = N'test_db' )
    DROP DATABASE test_db
GO

CREATE DATABASE test_db
ON PRIMARY
    ( NAME = test_db_file_1,
     FILENAME = N'C:\program files\microsoft sql
server\MSSQL.2\MSSQL\Data\test_db_1.mdf',
         SIZE = 3MB,
         MAXSIZE = 200MB,
         FILEGROWTH = 10%),
   
    ( NAME = test_db_file_2,
     FILENAME = N'C:\program files\microsoft sql
server\MSSQL.2\MSSQL\Data\test_db_2.ndf',
         SIZE = 1MB,
         MAXSIZE = 200MB,
         FILEGROWTH = 10%),

FILEGROUP test_db_group_1
    ( NAME = test_db_file_3,
     FILENAME = N'C:\program files\microsoft sql
server\MSSQL.2\MSSQL\Data\test_db_3.ndf',
         SIZE = 1MB,
         MAXSIZE = 200MB,
         FILEGROWTH = 10%),
   
    ( NAME = test_db_file_4,
     FILENAME = N'C:\program files\microsoft sql
server\MSSQL.2\MSSQL\Data\test_db_4.ndf',
         SIZE = 1MB,
         MAXSIZE = 200MB,
         FILEGROWTH = 10%),

FILEGROUP test_db_group_2
    ( NAME = test_db_file_5,
     FILENAME = N'C:\program files\microsoft sql
server\MSSQL.2\MSSQL\Data\test_db_5.ndf',
         SIZE = 1MB,
         MAXSIZE = 200MB,
         FILEGROWTH = 10%)

LOG ON
    ( NAME = test_db_log_file_1,
     FILENAME = N'C:\program files\microsoft sql
server\MSSQL.2\MSSQL\Data\test_db_log_1.ldf',
         SIZE = 1MB,
         MAXSIZE = 200MB,
         FILEGROWTH = 10%)
GO

-- Put it into simple recovery model
ALTER DATABASE test_db SET RECOVERY SIMPLE
GO

-- Backup single filegroup
BACKUP DATABASE test_db FILEGROUP = 'test_db_group_1' TO DISK =
'test_db_group_1 fg2.bak' WITH INIT
GO

BACKUP DATABASE test_db FILEGROUP = 'test_db_group_2' TO DISK =
'test_db_group_2 fg2.bak' WITH INIT
GO

-- Can I ever RESTORE it
RESTORE DATABASE test_db ???
GO
Andrew J. Kelly - 31 Jul 2008 18:57 GMT
I believe if the Filegroup is Read-only you can back it up and restore it.
But otherwise you need to be able to apply the logs after you restore a file
or filegroup to ensure consistency. I don't know why they don't throw an
error, maybe they should.

Signature

Andrew J. Kelly    SQL MVP
Solid Quality Mentors

> -- If I have a database in Simple recovery mode, it is possible to BACKUP
> a
[quoted text clipped - 71 lines]
> RESTORE DATABASE test_db ???
> GO
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.