Re: Backu plan

From: Wayne Snyder (wayne.nospam.snyder_at_mariner-usa.com)
Date: 11/19/04


Date: Fri, 19 Nov 2004 15:53:48 -0500

You can write a small script to delete files older than X...

-- 
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Ed" <Ed@discussions.microsoft.com> wrote in message
news:54D2703C-845E-48BC-BCDB-3C98AAE220BD@microsoft.com...
> Thanks...
> but if i use the codes, the folder will have so many backup files after
> days/months, does that mean i have manually delete all unused backups???
> Thanks again...
> Ed
>
> "Andrew J. Kelly" wrote:
>
> > Why not simply use a different file name for each backup.  Here is a
simple
> > example of backing up all DB's to disk and it will generate a different
file
> > each day based on the datetime:
> >
> >
> > DECLARE @DBName NVARCHAR(100), @Device NVARCHAR(100), @Name
NVARCHAR(150)
> >
> >
> > DECLARE cur_DBs CURSOR STATIC LOCAL
> > FOR SELECT Catalog_Name
> >         FROM Information_Schema.Schemata
> > --            WHERE [Catalog_Name] NOT IN
('MASTER','MODEL','MSDB','TEMPDB')
> >             WHERE [Catalog_Name] IN ('MASTER','MODEL','MSDB')
> >
> >
> > OPEN cur_DBs
> > FETCH NEXT FROM cur_DBs INTO @DBName
> >
> > WHILE @@FETCH_STATUS = 0
> > BEGIN
> >
> >     SET @Device = N'C:\Data\Backups\DD_' + @DBName + '_Full_' +
> >                     CONVERT(NVARCHAR(16),GETDATE(),112) + N'.BAK'
> >
> >     SET @Name = @DBName + N' Full Backup'
> >
> >     PRINT 'Backing up database ' + @DBName
> >
> >     BACKUP DATABASE @DBName TO DISK = @Device WITH  INIT ,  NOUNLOAD ,
> >                  NAME = @Name,  NOSKIP ,  STATS = 10,  NOFORMAT
> >
> >     RESTORE VERIFYONLY FROM DISK = @Device  WITH FILE = 1
> >
> >     PRINT '--------------------------------------- '
> >
> >     FETCH NEXT FROM cur_DBs INTO @DBName
> > END
> >
> > CLOSE cur_DBs
> > DEALLOCATE cur_DBs
> >
> > -- 
> > Andrew J. Kelly  SQL MVP
> >
> >
> > "Ed" <Ed@discussions.microsoft.com> wrote in message
> > news:B715BC32-C9B5-436D-B469-E0866FBF1756@microsoft.com...
> > >I would like to know the proper backup plan
> > > the previous company that I worked, they backup all the database into
two
> > > folders with the same drive...
> > >
> > > Z:\SQL\Backup\Users
> > > Z:\SQL\Backup\Systems
> > >
> > > In each folder, they also contain five different folders called
"Monday",
> > > "Tuesday", .... to "Friday"
> > >
> > > The reason why they do that is because they don't want to keep
appending
> > > the
> > > backup to the prior one...
> > >
> > > If i follow the above rules, do i need to create five different backup
> > > schedule since they are in different folders?
> > >
> > > Please suggest.
> > >
> > > Thanks
> > >
> > > Ed
> >
> >
> >


Relevant Pages

  • Re: Database Backup
    ... Have you checked the actual permissions for the folder? ... Columnist, SQL Server Professional ... > I am trying to backup the database, ...
    (microsoft.public.sqlserver.security)
  • Re: Backup to Network Drive
    ... The SQL Server service account needs to be a domain account, ... Mike Epprecht, Microsoft SQL Server MVP ... > Am trying to backup to a network drive as the other machine has loads of ...
    (microsoft.public.sqlserver.msde)
  • Re: detaching db and stopping services
    ... > Tibor Karaszi, SQL Server MVP ... >>> backup the filecreated by that process and you should have your database ... >> blown the standby database once. ...
    (microsoft.public.sqlserver.server)
  • Re: Database Backup
    ... domain account here and it should have the permissions to ... write to the folder, it always did before. ... running a repair on the SQL server OS. ... > I am trying to backup the database, ...
    (microsoft.public.sqlserver.security)
  • Re: Problem with database restore after MS03-031
    ... the backup could be corrupt or you've encountered a bug in SQL Server ... I'd be first attempting a t-sql restore command to identify ... >>SQL Server MVP ...
    (microsoft.public.sqlserver.server)