In procedure create folder for each database and backup of the
database should get saved in that folder.
For e.g : If your database name is 'Test' then in procedure create
folder 'test' and store backup of test database in test folder. Then
for database 'AdventureWorks' create folder called 'AdventureWorks'
and store backup in that folder.Mohit
SET @.CommandString = 'IF NOT EXIST "' + @.LocalBackupPath + '\' + @.name +
'" MD "' + @.LocalBackupPath + '\' + @.name + '"'
EXEC xp_cmdshell @.CommandString
SET @.SQL = 'BACKUP DATABASE [' + @.name + '] TO DISK = N''' +
@.LocalBackupPath + '\' + @.name + '\' + @.name + CONVERT(VARCHAR, GETDATE(),
112) + '.bak'' WITH INIT, NOUNLOAD, NAME = N''' + @.name + ' backup'', SKIP,
STATS = 10, NOFORMAT'
EXEC(@.SQL)
"mohit" <goenka.mohit@.gmail.com> wrote in message
news:69386449-4e88-44f4-9081-455ab5e32941@.k2g2000hse.googlegroups.com...
> In procedure create folder for each database and backup of the
> database should get saved in that folder.
>
> For e.g : If your database name is 'Test' then in procedure create
> folder 'test' and store backup of test database in test folder. Then
> for database 'AdventureWorks' create folder called 'AdventureWorks'
> and store backup in that folder.|||On Jan 10, 4:51=A0pm, "Uri Dimant" <u...@.iscar.co.il> wrote:
> Mohit
> =A0 SET @.CommandString =3D 'IF NOT EXIST "' + @.LocalBackupPath + '\' + @.na=me +
> '" MD "' + @.LocalBackupPath + '\' + @.name + '"'
> =A0 EXEC xp_cmdshell @.CommandString
> =A0 SET @.SQL =3D 'BACKUP DATABASE [' + @.name + '] TO DISK =3D N''' +
> @.LocalBackupPath + '\' + @.name + '\' + @.name + CONVERT(VARCHAR, GETDATE(),=
> 112) + '.bak'' WITH INIT, NOUNLOAD, NAME =3D N''' + @.name + ' backup'', SK=IP,
> STATS =3D 10, NOFORMAT'
> =A0 EXEC(@.SQL)
> "mohit" <goenka.mo...@.gmail.com> wrote in message
> news:69386449-4e88-44f4-9081-455ab5e32941@.k2g2000hse.googlegroups.com...
>
> > In procedure create folder for each database and backup of the
> > database should get saved in that folder.
> > For e.g =A0: If your database name is 'Test' then in procedure create
> > folder 'test' and store backup of test database in test folder. Then
> > for database 'AdventureWorks' create folder called 'AdventureWorks'
> > and store backup in that folder.- Hide quoted text -
> - Show quoted text -
hi,
i dont have admin permission to execute xp_cmdshell. Is there any
other option to solve this question.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment