Showing posts with label names. Show all posts
Showing posts with label names. Show all posts

Wednesday, March 28, 2012

restore db daily with a job but BAK file is diff

i have to restore database from production bakup to development
everyday, there is a program which does this bakup and names the file
like PROD_20070523.BAK based on the date.
is there any way to run this with SQL agent and make sure everytime
the current file is backed up. can i rename the file to a different
name everyday automatically.
Also this file is a zip file so can i unzip this automatically.Yes you can run this using a job in SQL Agent and you can name the name using
a datetime stamp. I do all my backups this way. Then you can run code to
delete the older files. If you want to copy then to another server everyday,
I do this as a VBScript that is called by a SQL Agent job but you could use a
DOS copy command executed by xp_cmdshell as well. Many Zip programs have a
command line interface (not the one that comes with Windows XP but others) so
you could script this as well via xp_cmdshell.
"ashley.sql@.gmail.com" wrote:
> i have to restore database from production bakup to development
> everyday, there is a program which does this bakup and names the file
> like PROD_20070523.BAK based on the date.
> is there any way to run this with SQL agent and make sure everytime
> the current file is backed up. can i rename the file to a different
> name everyday automatically.
> Also this file is a zip file so can i unzip this automatically.
>

restore db daily with a job but BAK file is diff

i have to restore database from production bakup to development
everyday, there is a program which does this bakup and names the file
like PROD_20070523.BAK based on the date.
is there any way to run this with SQL agent and make sure everytime
the current file is backed up. can i rename the file to a different
name everyday automatically.
Also this file is a zip file so can i unzip this automatically.
Yes you can run this using a job in SQL Agent and you can name the name using
a datetime stamp. I do all my backups this way. Then you can run code to
delete the older files. If you want to copy then to another server everyday,
I do this as a VBScript that is called by a SQL Agent job but you could use a
DOS copy command executed by xp_cmdshell as well. Many Zip programs have a
command line interface (not the one that comes with Windows XP but others) so
you could script this as well via xp_cmdshell.
"ashley.sql@.gmail.com" wrote:

> i have to restore database from production bakup to development
> everyday, there is a program which does this bakup and names the file
> like PROD_20070523.BAK based on the date.
> is there any way to run this with SQL agent and make sure everytime
> the current file is backed up. can i rename the file to a different
> name everyday automatically.
> Also this file is a zip file so can i unzip this automatically.
>

restore db daily with a job but BAK file is diff

i have to restore database from production bakup to development
everyday, there is a program which does this bakup and names the file
like PROD_20070523.BAK based on the date.
is there any way to run this with SQL agent and make sure everytime
the current file is backed up. can i rename the file to a different
name everyday automatically.
Also this file is a zip file so can i unzip this automatically.Yes you can run this using a job in SQL Agent and you can name the name usin
g
a datetime stamp. I do all my backups this way. Then you can run code to
delete the older files. If you want to copy then to another server everyday
,
I do this as a VBScript that is called by a SQL Agent job but you could use
a
DOS copy command executed by xp_cmdshell as well. Many Zip programs have a
command line interface (not the one that comes with Windows XP but others) s
o
you could script this as well via xp_cmdshell.
"ashley.sql@.gmail.com" wrote:

> i have to restore database from production bakup to development
> everyday, there is a program which does this bakup and names the file
> like PROD_20070523.BAK based on the date.
> is there any way to run this with SQL agent and make sure everytime
> the current file is backed up. can i rename the file to a different
> name everyday automatically.
> Also this file is a zip file so can i unzip this automatically.
>

Monday, March 26, 2012

RESTORE DATABASE question

Hello,
I ran the script bellow, then the statsales datbase log and data
"logical" file names changed to those of the database
'statsales_staging_victory_full' which I restored from as shown in the
script bellow.
The questions are:
Do I have one chared log file now, for both statsales and
statsales_staging ?
Will this hurt or confuse anything on the server?
How can I change those names back to there original names?
Thanks for any help.
mFH
================================================================== USE master
RESTORE DATABASE statsales
FROM DISK = 'E:\backup\statsales_staging_victory_full'
WITH REPLACE ,
MOVE 'statsales_staging_dat' TO 'G:\statsales\statsales_Data.MDF',
MOVE 'statsales_staging_log' TO 'D:\statsales_Log\statsales.LDF'
GO
==================================================================They don't share a log. I think you are ok. The boundry on the logical
name for database devices (bad memories) is the database.
Christian Smith
"shaab mohagir" <shaab.mohagir@.bonbon.net> wrote in message
news:e1b3da1b.0402121213.3b0d353d@.posting.google.com...
> Hello,
> I ran the script bellow, then the statsales datbase log and data
> "logical" file names changed to those of the database
> 'statsales_staging_victory_full' which I restored from as shown in the
> script bellow.
> The questions are:
> Do I have one chared log file now, for both statsales and
> statsales_staging ?
> Will this hurt or confuse anything on the server?
> How can I change those names back to there original names?
> Thanks for any help.
> mFH
> ==================================================================> USE master
> RESTORE DATABASE statsales
> FROM DISK = 'E:\backup\statsales_staging_victory_full'
> WITH REPLACE ,
> MOVE 'statsales_staging_dat' TO 'G:\statsales\statsales_Data.MDF',
> MOVE 'statsales_staging_log' TO 'D:\statsales_Log\statsales.LDF'
> GO
> ==================================================================|||Correct, Christian.
It might also be worth mentioning that in SQL2K, you can rename the logical
filename using ALTER DATABASE.
--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Christian Smith" <csmith@.digex.com> wrote in message
news:u9Govfa8DHA.2168@.TK2MSFTNGP12.phx.gbl...
> They don't share a log. I think you are ok. The boundry on the logical
> name for database devices (bad memories) is the database.
> Christian Smith
> "shaab mohagir" <shaab.mohagir@.bonbon.net> wrote in message
> news:e1b3da1b.0402121213.3b0d353d@.posting.google.com...
> > Hello,
> >
> > I ran the script bellow, then the statsales datbase log and data
> > "logical" file names changed to those of the database
> > 'statsales_staging_victory_full' which I restored from as shown in the
> > script bellow.
> >
> > The questions are:
> >
> > Do I have one chared log file now, for both statsales and
> > statsales_staging ?
> > Will this hurt or confuse anything on the server?
> > How can I change those names back to there original names?
> >
> > Thanks for any help.
> >
> > mFH
> >
> > ==================================================================> > USE master
> > RESTORE DATABASE statsales
> > FROM DISK = 'E:\backup\statsales_staging_victory_full'
> > WITH REPLACE ,
> > MOVE 'statsales_staging_dat' TO 'G:\statsales\statsales_Data.MDF',
> > MOVE 'statsales_staging_log' TO 'D:\statsales_Log\statsales.LDF'
> >
> > GO
> > ==================================================================>|||Thanks Christian and Thanks Tibor...
I'll see how can I change the log names using ALTER DATABASE, I hope
it's something I can do.
Thanks again.
mfharraz
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message news:<eQvgLra8DHA.1428@.TK2MSFTNGP12.phx.gbl>...
> Correct, Christian.
> It might also be worth mentioning that in SQL2K, you can rename the logical
> filename using ALTER DATABASE.
> --
> Tibor Karaszi, SQL Server MVP
> Archive at:
> http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
>
> "Christian Smith" <csmith@.digex.com> wrote in message
> news:u9Govfa8DHA.2168@.TK2MSFTNGP12.phx.gbl...
> > They don't share a log. I think you are ok. The boundry on the logical
> > name for database devices (bad memories) is the database.
> >
> > Christian Smith
> >
> > "shaab mohagir" <shaab.mohagir@.bonbon.net> wrote in message
> > news:e1b3da1b.0402121213.3b0d353d@.posting.google.com...
> > > Hello,
> > >
> > > I ran the script bellow, then the statsales datbase log and data
> > > "logical" file names changed to those of the database
> > > 'statsales_staging_victory_full' which I restored from as shown in the
> > > script bellow.
> > >
> > > The questions are:
> > >
> > > Do I have one chared log file now, for both statsales and
> > > statsales_staging ?
> > > Will this hurt or confuse anything on the server?
> > > How can I change those names back to there original names?
> > >
> > > Thanks for any help.
> > >
> > > mFH
> > >
> > > ==================================================================> > > USE master
> > > RESTORE DATABASE statsales
> > > FROM DISK = 'E:\backup\statsales_staging_victory_full'
> > > WITH REPLACE ,
> > > MOVE 'statsales_staging_dat' TO 'G:\statsales\statsales_Data.MDF',
> > > MOVE 'statsales_staging_log' TO 'D:\statsales_Log\statsales.LDF'
> > >
> > > GO
> > > ==================================================================> >
> >

RESTORE DATABASE question

Hello,
I ran the script bellow, then the statsales datbase log and data
"logical" file names changed to those of the database
'statsales_staging_victory_full' which I restored from as shown in the
script bellow.
The questions are:
Do I have one chared log file now, for both statsales and
statsales_staging ?
Will this hurt or confuse anything on the server?
How can I change those names back to there original names?
Thanks for any help.
mFH
========================================
==========================
USE master
RESTORE DATABASE statsales
FROM DISK = 'E:\backup\statsales_staging_victory_ful
l'
WITH REPLACE ,
MOVE 'statsales_staging_dat' TO 'G:\statsales\statsales_Data.MDF',
MOVE 'statsales_staging_log' TO 'D:\statsales_Log\statsales.LDF'
GO
========================================
==========================They don't share a log. I think you are ok. The boundry on the logical
name for database devices (bad memories) is the database.
Christian Smith
"shaab mohagir" <shaab.mohagir@.bonbon.net> wrote in message
news:e1b3da1b.0402121213.3b0d353d@.posting.google.com...
> Hello,
> I ran the script bellow, then the statsales datbase log and data
> "logical" file names changed to those of the database
> 'statsales_staging_victory_full' which I restored from as shown in the
> script bellow.
> The questions are:
> Do I have one chared log file now, for both statsales and
> statsales_staging ?
> Will this hurt or confuse anything on the server?
> How can I change those names back to there original names?
> Thanks for any help.
> mFH
> ========================================
==========================
> USE master
> RESTORE DATABASE statsales
> FROM DISK = 'E:\backup\statsales_staging_victory_ful
l'
> WITH REPLACE ,
> MOVE 'statsales_staging_dat' TO 'G:\statsales\statsales_Data.MDF',
> MOVE 'statsales_staging_log' TO 'D:\statsales_Log\statsales.LDF'
> GO
> ========================================
==========================|||Correct, Christian.
It might also be worth mentioning that in SQL2K, you can rename the logical
filename using ALTER DATABASE.
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=...ublic.sqlserver
"Christian Smith" <csmith@.digex.com> wrote in message
news:u9Govfa8DHA.2168@.TK2MSFTNGP12.phx.gbl...
> They don't share a log. I think you are ok. The boundry on the logical
> name for database devices (bad memories) is the database.
> Christian Smith
> "shaab mohagir" <shaab.mohagir@.bonbon.net> wrote in message
> news:e1b3da1b.0402121213.3b0d353d@.posting.google.com...
>|||Thanks Christian and Thanks Tibor...
I'll see how can I change the log names using ALTER DATABASE, I hope
it's something I can do.
Thanks again.
mfharraz
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message news
:<eQvgLra8DHA.1428@.TK2MSFTNGP12.phx.gbl>...
> Correct, Christian.
> It might also be worth mentioning that in SQL2K, you can rename the logica
l
> filename using ALTER DATABASE.
> --
> Tibor Karaszi, SQL Server MVP
> Archive at:
> [url]http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver[/url
]
>
> "Christian Smith" <csmith@.digex.com> wrote in message
> news:u9Govfa8DHA.2168@.TK2MSFTNGP12.phx.gbl...