Sunday, March 25, 2012

can I export a database from query analyzer?

Is there a command or script I can run from query analyzer to export a
database?
Its a long story but I can only get to the database through query analyzer
and there is one database I need to pull out to another machine.
Thanks,
You can do a couple of things:
1) Backup the database and then restore it on the other server. Refer to SQL Server Books Online for syntax and examples
2) If you have a copy of the database files (data + logs) then you can use sp_attach_db to attach the database files on another server.
3) If you don't have the database files but can take the database offline for sometime then you can take the database offline (one method will be to use sp_dboption) then
copy the files to the new server. Now you can take db online. connect to the new server using QA and use sp_attach_db
HTH,
Best Regards,
Uttam Parui
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? For information about the Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.
Microsoft highly recommends that users with Internet access update their Microsoft software to better protect against viruses and security vulnerabilities. The easiest way
to do this is to visit the following websites: http://www.microsoft.com/protect
http://www.microsoft.com/security/guidance/default.mspx
|||Great I do have the database files and log. I will just attach those in
another instance.
Thanks for your help.
"Uttam Parui[MS]" wrote:

> You can do a couple of things:
> 1) Backup the database and then restore it on the other server. Refer to SQL Server Books Online for syntax and examples
> 2) If you have a copy of the database files (data + logs) then you can use sp_attach_db to attach the database files on another server.
> 3) If you don't have the database files but can take the database offline for sometime then you can take the database offline (one method will be to use sp_dboption) then
> copy the files to the new server. Now you can take db online. connect to the new server using QA and use sp_attach_db
> HTH,
> Best Regards,
> Uttam Parui
> Microsoft Corporation
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Are you secure? For information about the Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit
> http://www.microsoft.com/security.
> Microsoft highly recommends that users with Internet access update their Microsoft software to better protect against viruses and security vulnerabilities. The easiest way
> to do this is to visit the following websites: http://www.microsoft.com/protect
> http://www.microsoft.com/security/guidance/default.mspx
>
>
sql

No comments:

Post a Comment