Showing posts with label disk. Show all posts
Showing posts with label disk. Show all posts

Friday, March 23, 2012

How could I reloaction primary transaction log file to another disk.

Hey, All,
Recently, we have installed a new raid disk on server, I want to migrate
transaction log to new disk for improving performance, is this possible and
how can I do it?
Thanks
YifeiOne method is to detach the database, move the log file and attach the
database files from the new location. See sp_detach_db and sp_attach_db in
the Books Online for details.
Hope this helps.
Dan Guzman
SQL Server MVP
"Yifei" <yjiang@.sdg.aust.com> wrote in message
news:%23hbx8Pk3DHA.1908@.TK2MSFTNGP10.phx.gbl...
quote:

> Hey, All,
> Recently, we have installed a new raid disk on server, I want to migrate
> transaction log to new disk for improving performance, is this possible

and
quote:

> how can I do it?
> Thanks
> Yifei
>
|||Hey, Dan,
I think I need to clarify that I only need change transaction log file
location and keep the database file as is.
I have tried detach and attach, it seems not work at this situation.
Any other ideas would be appreciated.
Thanks
Yifei
"Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
news:%23jPQCkk3DHA.2144@.TK2MSFTNGP10.phx.gbl...
quote:

> One method is to detach the database, move the log file and attach the
> database files from the new location. See sp_detach_db and sp_attach_db

in
quote:

> the Books Online for details.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Yifei" <yjiang@.sdg.aust.com> wrote in message
> news:%23hbx8Pk3DHA.1908@.TK2MSFTNGP10.phx.gbl...
> and
>
|||Dan is right,,, sp_attach/detach will work..
Do an sp_detachdb dbname,
then copy the log file to the new destination, and remove the orig.
then sp_attachdb dbname, datafilename, logfilename
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.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
"Yifei" <yjiang@.sdg.aust.com> wrote in message
news:eKtOf8k3DHA.556@.TK2MSFTNGP11.phx.gbl...
quote:

> Hey, Dan,
> I think I need to clarify that I only need change transaction log file
> location and keep the database file as is.
> I have tried detach and attach, it seems not work at this situation.
> Any other ideas would be appreciated.
> Thanks
> Yifei
> "Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
> news:%23jPQCkk3DHA.2144@.TK2MSFTNGP10.phx.gbl...
> in
migrate[QUOTE]
possible[QUOTE]
>
|||Like Wayne said, you can leave the data file(s) in the original location.
However, you should specify all database data and files when attaching the
database regardless of whether or not they were moved.
Hope this helps.
Dan Guzman
SQL Server MVP
"Yifei" <yjiang@.sdg.aust.com> wrote in message
news:eKtOf8k3DHA.556@.TK2MSFTNGP11.phx.gbl...
quote:

> Hey, Dan,
> I think I need to clarify that I only need change transaction log file
> location and keep the database file as is.
> I have tried detach and attach, it seems not work at this situation.
> Any other ideas would be appreciated.
> Thanks
> Yifei
> "Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
> news:%23jPQCkk3DHA.2144@.TK2MSFTNGP10.phx.gbl...
> in
migrate[QUOTE]
possible[QUOTE]
>
|||Thanks Dan and Wayne, It works.
Yifei
"Wayne Snyder" <wsnyder@.computeredservices.com> wrote in message
news:uI5jQ1o3DHA.360@.TK2MSFTNGP12.phx.gbl...
quote:

> Dan is right,,, sp_attach/detach will work..
> Do an sp_detachdb dbname,
> then copy the log file to the new destination, and remove the orig.
> then sp_attachdb dbname, datafilename, logfilename
>
> --
> Wayne Snyder, MCDBA, SQL Server MVP
> Computer Education Services Corporation (CESC), Charlotte, NC
> www.computeredservices.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
>
> "Yifei" <yjiang@.sdg.aust.com> wrote in message
> news:eKtOf8k3DHA.556@.TK2MSFTNGP11.phx.gbl...
sp_attach_db[QUOTE]
> migrate
> possible
>

How could I reloaction primary transaction log file to another disk.

Hey, All,
Recently, we have installed a new raid disk on server, I want to migrate
transaction log to new disk for improving performance, is this possible and
how can I do it?
Thanks
YifeiOne method is to detach the database, move the log file and attach the
database files from the new location. See sp_detach_db and sp_attach_db in
the Books Online for details.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Yifei" <yjiang@.sdg.aust.com> wrote in message
news:%23hbx8Pk3DHA.1908@.TK2MSFTNGP10.phx.gbl...
> Hey, All,
> Recently, we have installed a new raid disk on server, I want to migrate
> transaction log to new disk for improving performance, is this possible
and
> how can I do it?
> Thanks
> Yifei
>|||Hey, Dan,
I think I need to clarify that I only need change transaction log file
location and keep the database file as is.
I have tried detach and attach, it seems not work at this situation.
Any other ideas would be appreciated.
Thanks
Yifei
"Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
news:%23jPQCkk3DHA.2144@.TK2MSFTNGP10.phx.gbl...
> One method is to detach the database, move the log file and attach the
> database files from the new location. See sp_detach_db and sp_attach_db
in
> the Books Online for details.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Yifei" <yjiang@.sdg.aust.com> wrote in message
> news:%23hbx8Pk3DHA.1908@.TK2MSFTNGP10.phx.gbl...
> > Hey, All,
> >
> > Recently, we have installed a new raid disk on server, I want to migrate
> > transaction log to new disk for improving performance, is this possible
> and
> > how can I do it?
> >
> > Thanks
> >
> > Yifei
> >
> >
>|||Dan is right,,, sp_attach/detach will work..
Do an sp_detachdb dbname,
then copy the log file to the new destination, and remove the orig.
then sp_attachdb dbname, datafilename, logfilename
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.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
"Yifei" <yjiang@.sdg.aust.com> wrote in message
news:eKtOf8k3DHA.556@.TK2MSFTNGP11.phx.gbl...
> Hey, Dan,
> I think I need to clarify that I only need change transaction log file
> location and keep the database file as is.
> I have tried detach and attach, it seems not work at this situation.
> Any other ideas would be appreciated.
> Thanks
> Yifei
> "Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
> news:%23jPQCkk3DHA.2144@.TK2MSFTNGP10.phx.gbl...
> > One method is to detach the database, move the log file and attach the
> > database files from the new location. See sp_detach_db and sp_attach_db
> in
> > the Books Online for details.
> >
> > --
> > Hope this helps.
> >
> > Dan Guzman
> > SQL Server MVP
> >
> > "Yifei" <yjiang@.sdg.aust.com> wrote in message
> > news:%23hbx8Pk3DHA.1908@.TK2MSFTNGP10.phx.gbl...
> > > Hey, All,
> > >
> > > Recently, we have installed a new raid disk on server, I want to
migrate
> > > transaction log to new disk for improving performance, is this
possible
> > and
> > > how can I do it?
> > >
> > > Thanks
> > >
> > > Yifei
> > >
> > >
> >
> >
>|||Like Wayne said, you can leave the data file(s) in the original location.
However, you should specify all database data and files when attaching the
database regardless of whether or not they were moved.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Yifei" <yjiang@.sdg.aust.com> wrote in message
news:eKtOf8k3DHA.556@.TK2MSFTNGP11.phx.gbl...
> Hey, Dan,
> I think I need to clarify that I only need change transaction log file
> location and keep the database file as is.
> I have tried detach and attach, it seems not work at this situation.
> Any other ideas would be appreciated.
> Thanks
> Yifei
> "Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
> news:%23jPQCkk3DHA.2144@.TK2MSFTNGP10.phx.gbl...
> > One method is to detach the database, move the log file and attach the
> > database files from the new location. See sp_detach_db and sp_attach_db
> in
> > the Books Online for details.
> >
> > --
> > Hope this helps.
> >
> > Dan Guzman
> > SQL Server MVP
> >
> > "Yifei" <yjiang@.sdg.aust.com> wrote in message
> > news:%23hbx8Pk3DHA.1908@.TK2MSFTNGP10.phx.gbl...
> > > Hey, All,
> > >
> > > Recently, we have installed a new raid disk on server, I want to
migrate
> > > transaction log to new disk for improving performance, is this
possible
> > and
> > > how can I do it?
> > >
> > > Thanks
> > >
> > > Yifei
> > >
> > >
> >
> >
>|||Thanks Dan and Wayne, It works.
Yifei
"Wayne Snyder" <wsnyder@.computeredservices.com> wrote in message
news:uI5jQ1o3DHA.360@.TK2MSFTNGP12.phx.gbl...
> Dan is right,,, sp_attach/detach will work..
> Do an sp_detachdb dbname,
> then copy the log file to the new destination, and remove the orig.
> then sp_attachdb dbname, datafilename, logfilename
>
> --
> Wayne Snyder, MCDBA, SQL Server MVP
> Computer Education Services Corporation (CESC), Charlotte, NC
> www.computeredservices.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
>
> "Yifei" <yjiang@.sdg.aust.com> wrote in message
> news:eKtOf8k3DHA.556@.TK2MSFTNGP11.phx.gbl...
> > Hey, Dan,
> >
> > I think I need to clarify that I only need change transaction log file
> > location and keep the database file as is.
> >
> > I have tried detach and attach, it seems not work at this situation.
> >
> > Any other ideas would be appreciated.
> >
> > Thanks
> >
> > Yifei
> >
> > "Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
> > news:%23jPQCkk3DHA.2144@.TK2MSFTNGP10.phx.gbl...
> > > One method is to detach the database, move the log file and attach the
> > > database files from the new location. See sp_detach_db and
sp_attach_db
> > in
> > > the Books Online for details.
> > >
> > > --
> > > Hope this helps.
> > >
> > > Dan Guzman
> > > SQL Server MVP
> > >
> > > "Yifei" <yjiang@.sdg.aust.com> wrote in message
> > > news:%23hbx8Pk3DHA.1908@.TK2MSFTNGP10.phx.gbl...
> > > > Hey, All,
> > > >
> > > > Recently, we have installed a new raid disk on server, I want to
> migrate
> > > > transaction log to new disk for improving performance, is this
> possible
> > > and
> > > > how can I do it?
> > > >
> > > > Thanks
> > > >
> > > > Yifei
> > > >
> > > >
> > >
> > >
> >
> >
>sql

Wednesday, March 7, 2012

How can I write results of a query to output file and save it to the disk

Hi All,
Is there a way to write the results of a query to a file and save it to the
disk? I know that the SQL Query Analyzer gives us the option of 'results to
file'. I want to know whether I can write a script which can query the
database and redirect the results to a file, so that I can open the script
file thru SQL Query Analyzer and run it or even I can use this script in Job
Scheduling when I want.
Thanks,
NN> Is there a way to write the results of a query to a file and save it to
the
> disk? I know that the SQL Query Analyzer gives us the option of 'results
to
> file'. I want to know whether I can write a script which can query the
> database and redirect the results to a file, so that I can open the script
> file thru SQL Query Analyzer and run it or even I can use this script in
Job
> Scheduling when I want.
Just create a regular script, only T-SQL commands; you can run this commands
in QA, job task, or with OSQL.EXE command prompt utility. OSQL can save the
results to an output file. Check the parameters (specifically -i and -o) for
osql in Books onLine.
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com|||Q: How can I read/write to a flat file from inside a SQL Server TSQL
script/stored-procedure/trigger?
A: http://www.mssqlserver.com/faq/general-flatfile.asp
HTH, Jens Smeyer.
http://www.sqlserver2005.de
--
"Nagaraju Nookala" <iranichai@.netscape.net> schrieb im Newsbeitrag
news:OU6DYFFRFHA.3296@.TK2MSFTNGP15.phx.gbl...
> Hi All,
> Is there a way to write the results of a query to a file and save it to
> the disk? I know that the SQL Query Analyzer gives us the option of
> 'results to file'. I want to know whether I can write a script which can
> query the database and redirect the results to a file, so that I can open
> the script file thru SQL Query Analyzer and run it or even I can use this
> script in Job Scheduling when I want.
> Thanks,
> NN
>