November 21, 2009 at 5:44 am
hi,
i have installed visual studio 2008, so sql server 2005 is by default installed.can you tell me how to back up my database files through command prompt,sqlcmd 🙂
November 21, 2009 at 6:01 am
Is your SQL Server is a Express edition
November 21, 2009 at 6:04 am
http://msdn.microsoft.com/en-us/library/ms165702(SQL.90).aspx
use this link .
it shows to login and then once you login you write normal backup command
backup database dbname to disk='c:\db.bak'
November 21, 2009 at 9:29 am
yes,its sql express edition
November 21, 2009 at 9:55 am
the link you provided is not so fruitful.it did'nt solved my problem.Also ,you gave the commands for backup:
backup database databasename to disk='C:\db.bak'.
But it too gave errors:
Cannot open backup device 'C:\db.bak' Operating system error 5(Access is denied...).
BACKUP DATABASE is terminating abnormally.
THIS IS THE ERROR MESSAGE I GET IN COMMAND PROMPT OF SQLCMD.
PLZ HELP
November 21, 2009 at 9:58 am
the link you provided is not so fruitful.it did'nt solved my problem.Also ,you gave the commands for backup:
backup database databasename to disk='C:\db.bak'.
But it too gave errors:
Cannot open backup device 'C:\db.bak' Operating system error 5(Access is denied...).
BACKUP DATABASE is terminating abnormally.
THIS IS THE ERROR MESSAGE I GET IN COMMAND PROMPT OF SQLCMD.
PLZ HELP
November 21, 2009 at 10:10 am
error says that you do have access on the c drive..
open cmd
type sqlcmd -S"servername" -U"username" -P"password"
after successful login you see
>1
1 use master
2 backup database dbname to disk=N'c:\foldername\db.bak'
3 go
the db backed up
check the link for more details
November 21, 2009 at 5:48 pm
thanks.
November 23, 2009 at 6:15 am
Hi Shyam,
Please confirm if the problem is fixed now.
November 23, 2009 at 5:08 pm
hi,
yes,backup is successfully created.
now can u help me how to retrieve (or restore) by database to another sql server database?i.e if i send the backup file to another system and there i want to restore the database,then how?
can u tell me how to get the help menu in sqlcmd command prompt..where i can get a list of commands in sqlcmd?
November 23, 2009 at 10:45 pm
i guess you are new to dba world... i gues you want to restore the backuped database on new server.
restore database databasename from disk ='filepath'
syntax might be different check Books online.
November 24, 2009 at 5:29 am
You can restore the database on other server after moving the backup files.
The command prompt is run like this:
"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\OSQL.EXE" -E
Then write these lines to restore the database:
RESTORE DATABASE mydbname from DISK = 'C:\xxx\xxx\xxx.bak' WITH MOVE 'database_Data' to 'C:\Database\xxx\database_Data.mdf', MOVE 'database_Log' to 'C:\Database\xxx\database_Log.LDF'
GO
You have to write the correct path for file locations to complete the restoration process.
November 25, 2009 at 1:42 am
To get the list of command line switchs for sqlcmd, do what you do for every other command line tool - type this at a command prompt:
SQLCMD /?
As for the commands that you can submit to SQL through SQLCMD, that is the T-SQL language, which is explained in SQL Server help files.
November 25, 2009 at 2:59 am
hi,
'sqlcmd /?' command gives the commands that are available in sqlcmd,but there is no any listing of 'backup' command or 'restore' command and its parameters.so how can i get all the available commands in sqlcmd.
November 25, 2009 at 3:11 am
hi,
thanks for your valuable post.the command is working fine without any modification.
can u give me any link that deals with all the available commands in sqlcmd..like how to see in which database i am presently working in,to delete a database, to see description of a table...and so on
once again thanks..
Viewing 15 posts - 1 through 15 (of 16 total)
You must be logged in to reply to this topic. Login to reply