Backup remote SQL Server 2005 - sql

How do I backup data from a remote MS-SQL Server DB to my local computer?
I'm having access to Management Studio 2008.

sqldumper.ruizata.com solved my problem.

You'd specify the target for the backup file to a UNC path on your local machine. When you specify to Backup you have to specify a Desination. That destination can be either a Filename locally pathed to the SQL Server instance (e.g. E:\Backups\Database.BAK) or a UNC path such as \\YOURMACHINENAME\SHAREDFOLDERONYOURMACHINE\FILENAME.BAK.

If you want to backup the remote database then you can run a query such as
BACKUP DATABASE mydb TO DISK = 'd:\whatever\location\mydb.bak'
Where the 'd:' drive will be local to the SQL Server, otherwise use the format
BACKUP DATABASE mydb TO DISK = '\\mylocalcomputer\share\mydb.bak'
to backup to your machine.

Related

Attach .mdf / .ldf files in SQL Server database from shared location in a local network

Actually, I want to install a database from installer on remote machine SQL Server from server machine.

How to restore SQL server database from external drive without uploading database to local hard disk?

I am running win7 on a VM. I have Microsoft SQL Server 2014 downloaded on the VM. I have an external drive with a .bak file that I wish to restore a database with. The database is 400+ GBs. My local disk cannot support a database of this size, but my external drive can. How do I run SQL Server locally and restore from and keep the database files externally?
You can create database then configure it for files run on external drive. Then try to restore it.
Creating db on another folder example here: Create a database using T SQL on a specified location
It's possible, search for DBCC TRACEOFF(1807), e. g.:
http://sql-articles.com/articles/general/day-2trace-flag-1807attach-network-data-file/

backup remote database locally

I have MSsql database on the remote server
how can I store the backup of this database (locally) on my disk
Map a network drive from your PC to the server, then copy the file to your PC.
\\SERVERNAME\DRIVEWHEREBACKUPFILEIS

How to copy a SQL Server 2005 database from local to the server

I want to export database from local computer to database server in SQL Server 2005.
How can I restore database without having access to file system of database server
You can use SQL Server's built-in backup and restore functions.
Make a backup of your local database, and write it on some network share (can be anywhere in the network, doesn't have to be on the database server):
BACKUP DATABASE MyDatabase TO DISK = '\\Servername\Share\MyBackup.bak'
Then, you can restore the database on the database server, reading the backup directly from the network share:
RESTORE DATABASE MyDatabase FROM DISK = '\\Servername\Share\MyBackup.bak'
Note that you have to everything in T-SQL to be able to read and write directly to network shares!
(You can also backup and restore databases from the GUI in SQL Server Management Studio, but you can only use local folders there)
Your situation is, you want to copy the database from your local to remote database server but you do have access to the remote machine thats why you cannot use a restore or attach database function.
Solution:
For me the best thing to do is generate a script that will include the schema and the data of the database. This will serve as a script backup of your local database which can be run to any sql servers that you wanted. Sql Server 2008 already have the interface for this but for Sql Server 2005 you will need to have Sql Publishing Wizard.
You can download it from here: (remove spaces)
http: //www.codeplex.com/sqlhost/Wiki /View.aspx?title=Database%20Publishing%20Wizard
To create a script you can do this:
Command to run which will create schema and database:
C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\sqlpubwiz script -d AdventureWorks “C:\AdventureWorks.sql”
Command to run which will create schema:
C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\sqlpubwiz script -d AdventureWorks “C:\AdventureWorks.sql” -schemaonly
Command to run which will create data:
C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\sqlpubwiz script -d AdventureWorks “C:\AdventureWorks.sql” -dataonly
For more details please read...(Remove Spaces)
http: //blog.sqlauthority.com/2007/11/16/ sql-server-2005-generate-script-with-data-from-database-database-publishing-wizard/
This worked for me a lot of times.
You will need access to the file system of the database server.
You have to detach the database from your local server and then copy the related .mdf and .ldf files to the target database server and then attach the files in the SQL server management studio of that database server.

Restore DB from one server to another by sql-script

Are there any way to restore db from one server to another, if I know other server IP address?
Can I do it by sql-script or some wizard?
I use MS Sql Server Managment Studio 2008
TSQL script as
USE DATABASE -- TO TAKE BACKUP
GO
BACKUP DATABASE XXX -- XXX is database backup name
TO DISK = '\\\YYYY\XXX.BAK' -- YYYY is the shared folder to your backup and restore. Servers need access permissions on the folder as shared to available for both servers.
GO
USE MASTER
RESTORE DATABASE XXX
FROM DISK = '\\\YYYY\XXX.BAK'
GO
thanks
prav
As far as I know, you must do this in a two step process: create a backup file from the source database server, use the backup file to restore onto the target server. You can script the backup and restore presuming that one server can talk to the other, the destination server could (assuming the appropriate permissions), fire off a backup to an accessible location and then restore from that file.
you can restore your database from one server to another server by executing below script
RESTORE DATABASE mydb
FROM DISK='d:\mydb.bak'
WITH
MOVE 'mydb' TO 'D:\TSQL\mydb.mdf',
MOVE 'mydb_log' TO 'D:\TSQL\mydb_log.ldf'