Tuesday, March 6, 2012

2005: BACKUP

Hello,
I am learning SQL Server 2005. I need to know how to make a backup of
a database. I tried (according to my book):
BACKUP DATABASE DemoSQLServer TO DISK = "G:\DemoSQLServer.bak"
But I got error:
Incorrect syntax near 'G:\DemoSQLServer.bak'.
Please help.
Thank you very much.
/RAM/RAM (r_ahimsa_m@.poczta.onet.pl) writes:

Quote:

Originally Posted by

I am learning SQL Server 2005. I need to know how to make a backup of
a database. I tried (according to my book):
BACKUP DATABASE DemoSQLServer TO DISK = "G:\DemoSQLServer.bak"
But I got error:
Incorrect syntax near 'G:\DemoSQLServer.bak'.
Please help.


If the book fails, try Books Online.

Generally, in T-SQL, single quote is used as the string delimiter. (Although
it is possible with a legacy setting in force also use double quote as
string delimiter, but this is not recommended.)

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||The error is the double quotes! You need to use single quotes to
specify the filename. The statement should be rewritten as:
BACKUP DATABASE DemoSQLServer TO DISK = 'G:\DemoSQLServer.bak'

N.I.T.I.N.

RAM wrote:

Quote:

Originally Posted by

Hello,
I am learning SQL Server 2005. I need to know how to make a backup of
a database. I tried (according to my book):
BACKUP DATABASE DemoSQLServer TO DISK = "G:\DemoSQLServer.bak"
But I got error:
Incorrect syntax near 'G:\DemoSQLServer.bak'.
Please help.
Thank you very much.
/RAM/

|||On 25 Jul 2006 00:24:24 -0700, "NiTiN" <emailme.nitin@.gmail.com>
wrote:

Quote:

Originally Posted by

>The error is the double quotes! You need to use single quotes to
>specify the filename. The statement should be rewritten as:
>BACKUP DATABASE DemoSQLServer TO DISK = 'G:\DemoSQLServer.bak'


Thanks,
but I have another problem:
Cannot open backup device 'G:\DemoSQLServer.bak'. Operating system
error 5(Access denied.).

(Changing drive don't help.)
I have no problem with accessing drives from other applications. I had
no problems with SQL Server setup.

Please help.
/RAM/|||"RAM" <r_ahimsa_m@.poczta.onet.plwrote in message
news:6lkec292thjpbhkm7b2h03unpeg045jhp2@.4ax.com...

Quote:

Originally Posted by

On 25 Jul 2006 00:24:24 -0700, "NiTiN" <emailme.nitin@.gmail.com>
wrote:
>

Quote:

Originally Posted by

The error is the double quotes! You need to use single quotes to
specify the filename. The statement should be rewritten as:
BACKUP DATABASE DemoSQLServer TO DISK = 'G:\DemoSQLServer.bak'


>
Thanks,
but I have another problem:
Cannot open backup device 'G:\DemoSQLServer.bak'. Operating system
error 5(Access denied.).
>
(Changing drive don't help.)
I have no problem with accessing drives from other applications. I had
no problems with SQL Server setup.


SQL Server itself for some reason doesn't have access to this drive.

If it's local, check permissions.

If it's remote, change it to a UNC path and make sure the user has domain
priviliges.

Quote:

Originally Posted by

>
Please help.
/RAM/
>

|||but I have another problem:

Quote:

Originally Posted by

Cannot open backup device 'G:\DemoSQLServer.bak'. Operating system
error 5(Access denied.).
>
(Changing drive don't help.)


Hi!

My guess is that you need to grant filesystem privileges to the account
that SQL Server runs as. That account is usually sysopr.

N.I.T.I.N.|||>My guess is that you need to grant filesystem privileges to the account

Quote:

Originally Posted by

>that SQL Server runs as. That account is usually sysopr.


I have little experience with Microsoft software...
On my Windows XP computer I have two accounts Robert (admin) and
Guest. I have installed SQL Server 2005 on Robert's account. I haven't
found information about sysopr in BOL nor Internet. Could you help me
please?
/RAM/|||A few months ago I could create backup using right-click menu, now I
cannot. What's going on?
/RAM/|||RAM (r_ahimsa_m@.poczta.onet.pl) writes:

Quote:

Originally Posted by

but I have another problem:
Cannot open backup device 'G:\DemoSQLServer.bak'. Operating system
error 5(Access denied.).
>
(Changing drive don't help.)
I have no problem with accessing drives from other applications. I had
no problems with SQL Server setup.


Is that a local drive or a network drive?

Presumably the service account for SQL Server does not have access to
this place. Keep in mind that SQL Server is a server application that
logs on its own.

Start SQL Server Configuraiton Manager. Select "SQL Server 2005 Services".
Find the SQL Server service you have problem with. Double-click. Here
you can see under which account SQL Server runs. If you change, you will
have to restart SQL Server.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

No comments:

Post a Comment