Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Use ASP to create a complete Database Backup

Reply
Thread Tools

Use ASP to create a complete Database Backup

 
 
Daniel
Guest
Posts: n/a
 
      04-02-2009
I am trying to help a colleague to backup his website to migrate it
elsewhere. As such, I am trying to figure out how I can using ASP
perform a backup to my hard drive of the entire db (it is actually
very small). The host provides no admin console, so I have none of the
usual tools to create a backup. Thus the question.

The host is being more than difficult to work with. They were asked
for a backup and they refused to provide one. So now I am trying to
find a way to do it myself.


I have been trying to use the following but it doesn't seem to produce
any results?


<%
SQL_Server_Name = "servername"
DB_Name = "dbname"
DB_User_ID = "username"
DB_Password = "password"
strcon = "Provider=SQLOLEDB;Data Source="& SQL_Server_Name
&";Initial Catalog=" & DB_Name &";User ID="& DB_User_ID &";Password="&
DB_Password&";charset=utf-8"
set con = Server.CreateObject("ADODB.Connection")
con.Open strCon
sql="BACKUP DATABASE ["& DB_Name &"] TO DISK = N'c:/db.bak' WITH
NOFORMAT, NOINIT, NAME = N'backup', SKIP, NOREWIND, NOUNLOAD, STATS =
10"
con.Execute(sql)
%>


Since I am running the script on the server, I suppose it is being
saved to the server rather than on my hard drive. What do I need to
do to be able to save it to my drive or e-mail it or so method I can
actually get a copy?


Also worth explaining. The website files are hosted on one server
while the db is on another. So the Backup file is not on the local
computer with the asp files... I tried to add an e-mail routine but
the server running the asp file cannot locate the file (as it is
actually on another machine, I assume is the reason).


Please keep in mind I know next to nothing about both SQL Server and
ASP. I truly am just trying to help someone who is completely
technologically ignorant out of a mess.


Also, I am using the credentials given by the Host. Is there a
simple way to find out if they have the required permissions to
perform a backup? I was simply wondering if it wasn't a permission
issue.


I have also tried to connect my server (SQL Server 200 to the remote
server using the supplied credentials, but it doesn't work and returns
an error #53...?


Thank you very much for your help!!!


QB


 
Reply With Quote
 
 
 
 
Bob Barrows
Guest
Posts: n/a
 
      04-02-2009
Daniel wrote:
> I am trying to help a colleague to backup his website to migrate it
> elsewhere. As such, I am trying to figure out how I can using ASP
> perform a backup to my hard drive of the entire db (it is actually
> very small). The host provides no admin console, so I have none of
> the usual tools to create a backup. Thus the question.
>
> The host is being more than difficult to work with. They were asked
> for a backup and they refused to provide one. So now I am trying to
> find a way to do it myself.
>
>
> I have been trying to use the following but it doesn't seem to produce
> any results?
>
>
> <%
> SQL_Server_Name = "servername"
> DB_Name = "dbname"
> DB_User_ID = "username"
> DB_Password = "password"
> strcon = "Provider=SQLOLEDB;Data Source="& SQL_Server_Name
> &";Initial Catalog=" & DB_Name &";User ID="& DB_User_ID &";Password="&
> DB_Password&";charset=utf-8"
> set con = Server.CreateObject("ADODB.Connection")
> con.Open strCon
> sql="BACKUP DATABASE ["& DB_Name &"] TO DISK = N'c:/db.bak' WITH
> NOFORMAT, NOINIT, NAME = N'backup', SKIP, NOREWIND, NOUNLOAD, STATS =
> 10"
> con.Execute(sql)
> %>
>
>
> Since I am running the script on the server, I suppose it is being
> saved to the server rather than on my hard drive. What do I need to
> do to be able to save it to my drive or e-mail it or so method I can
> actually get a copy?


Are you in the same domain as the SQL Server? It soesn't sound like it.

If the host knows how to do security (and it sounds like he does), you
are not likely going to be able to get a copy of this database. All of
the techniques I would typically use (DTS/SSIS, xp_cmdshell,
sp_sendmail, etc.)are easily locked down by a system administrator.

Frankly, going behind the host's back sounds more than a little shady to
me, and I am really hesitant to provide more information to you.
--
HTH,
Bob Barrows


 
Reply With Quote
 
 
 
 
Daniel
Guest
Posts: n/a
 
      04-02-2009
There is nothing shady going on!

The website owner wishes to switch and the host is being as uncooperative as
can be. i am simply trying to resolve this issue quickly before things
degerate further.

I have the permission of the website owner and the credentials to access the
website (ftp) and the sql server given to the client by the host.

This is not a request to become a hacker. It is a ligitemate problem to be
resolved.

QB


"Bob Barrows" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Daniel wrote:
>> I am trying to help a colleague to backup his website to migrate it
>> elsewhere. As such, I am trying to figure out how I can using ASP
>> perform a backup to my hard drive of the entire db (it is actually
>> very small). The host provides no admin console, so I have none of
>> the usual tools to create a backup. Thus the question.
>>
>> The host is being more than difficult to work with. They were asked
>> for a backup and they refused to provide one. So now I am trying to
>> find a way to do it myself.
>>
>>
>> I have been trying to use the following but it doesn't seem to produce
>> any results?
>>
>>
>> <%
>> SQL_Server_Name = "servername"
>> DB_Name = "dbname"
>> DB_User_ID = "username"
>> DB_Password = "password"
>> strcon = "Provider=SQLOLEDB;Data Source="& SQL_Server_Name
>> &";Initial Catalog=" & DB_Name &";User ID="& DB_User_ID &";Password="&
>> DB_Password&";charset=utf-8"
>> set con = Server.CreateObject("ADODB.Connection")
>> con.Open strCon
>> sql="BACKUP DATABASE ["& DB_Name &"] TO DISK = N'c:/db.bak' WITH
>> NOFORMAT, NOINIT, NAME = N'backup', SKIP, NOREWIND, NOUNLOAD, STATS =
>> 10"
>> con.Execute(sql)
>> %>
>>
>>
>> Since I am running the script on the server, I suppose it is being
>> saved to the server rather than on my hard drive. What do I need to
>> do to be able to save it to my drive or e-mail it or so method I can
>> actually get a copy?

>
> Are you in the same domain as the SQL Server? It soesn't sound like it.
>
> If the host knows how to do security (and it sounds like he does), you
> are not likely going to be able to get a copy of this database. All of
> the techniques I would typically use (DTS/SSIS, xp_cmdshell,
> sp_sendmail, etc.)are easily locked down by a system administrator.
>
> Frankly, going behind the host's back sounds more than a little shady to
> me, and I am really hesitant to provide more information to you.
> --
> HTH,
> Bob Barrows
>
>



 
Reply With Quote
 
Daniel
Guest
Posts: n/a
 
      04-02-2009
Sounds fine to me. All I want are the tables and data. How can I do that?




"Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot com> wrote in message
news:(E-Mail Removed) acquisition...
>I think what you need to do is an "export", not a backup, to retrieve it
>from the server.
>
>
> "Daniel" <(E-Mail Removed)> wrote in message
> news:OxP$(E-Mail Removed)...
>>I am trying to help a colleague to backup his website to migrate it
>> elsewhere. As such, I am trying to figure out how I can using ASP
>> perform a backup to my hard drive of the entire db (it is actually
>> very small). The host provides no admin console, so I have none of the
>> usual tools to create a backup. Thus the question.
>>
>> The host is being more than difficult to work with. They were asked
>> for a backup and they refused to provide one. So now I am trying to
>> find a way to do it myself.
>>
>>
>> I have been trying to use the following but it doesn't seem to produce
>> any results?
>>
>>
>> <%
>> SQL_Server_Name = "servername"
>> DB_Name = "dbname"
>> DB_User_ID = "username"
>> DB_Password = "password"
>> strcon = "Provider=SQLOLEDB;Data Source="& SQL_Server_Name
>> &";Initial Catalog=" & DB_Name &";User ID="& DB_User_ID &";Password="&
>> DB_Password&";charset=utf-8"
>> set con = Server.CreateObject("ADODB.Connection")
>> con.Open strCon
>> sql="BACKUP DATABASE ["& DB_Name &"] TO DISK = N'c:/db.bak' WITH
>> NOFORMAT, NOINIT, NAME = N'backup', SKIP, NOREWIND, NOUNLOAD, STATS =
>> 10"
>> con.Execute(sql)
>> %>
>>
>>
>> Since I am running the script on the server, I suppose it is being
>> saved to the server rather than on my hard drive. What do I need to
>> do to be able to save it to my drive or e-mail it or so method I can
>> actually get a copy?
>>
>>
>> Also worth explaining. The website files are hosted on one server
>> while the db is on another. So the Backup file is not on the local
>> computer with the asp files... I tried to add an e-mail routine but
>> the server running the asp file cannot locate the file (as it is
>> actually on another machine, I assume is the reason).
>>
>>
>> Please keep in mind I know next to nothing about both SQL Server and
>> ASP. I truly am just trying to help someone who is completely
>> technologically ignorant out of a mess.
>>
>>
>> Also, I am using the credentials given by the Host. Is there a
>> simple way to find out if they have the required permissions to
>> perform a backup? I was simply wondering if it wasn't a permission
>> issue.
>>
>>
>> I have also tried to connect my server (SQL Server 200 to the remote
>> server using the supplied credentials, but it doesn't work and returns
>> an error #53...?
>>
>>
>> Thank you very much for your help!!!
>>
>>
>> QB
>>
>>

>
>



 
Reply With Quote
 
Bob Barrows
Guest
Posts: n/a
 
      04-02-2009
Daniel wrote:
> There is nothing shady going on!


Forgive me, but these are just words on my screen. Why should I be
convinced by them? After all, if you really were a potential hacker,
would you really come out and reply "dammit, you're too smart for me, I
guess I'll give up on the idea of hacking ... "

>
> The website owner wishes to switch and the host is being as
> uncooperative as can be. i am simply trying to resolve this issue
> quickly before things degerate further.
>
> I have the permission of the website owner and the credentials to
> access the website (ftp) and the sql server given to the client by
> the host.


That's the issue - the credentials for the sql server are likely to have
limited rights, so atempting things like sp_sendmail or xp_cmdshell are
not likely to be successful if the host has things locked down the way
he should.

>
> This is not a request to become a hacker. It is a ligitemate problem
> to be resolved.
>
> QB
>



Bottom line, even if this is a legitimate problem, I still see no way to
do it if the host wants to prevent you from doing it.
The best you can do is query each of the tables in the database and
write the results to response in an html table. In fact you can set the
contenttype to excel and see the results in an excel spreadsheet that
you can save locally. There are many examples of doing this in this
newsgroup as well as in .asp.db so google should quickly get you going.

Oh! It just occurred to me that there are ASP-based SQL Server
management tools out there that might be useful for you. I think one of
them is called MyLittleSQL or something like that. Be right back, I'm
going to do a quick search ...

No, it's MyLitleAdmin I was thinking of. This page has a list of this
and other tools, some of which are discontinued:
http://sqlserver2000.databases.aspfa...rver/msde.html

--
HTH,
Bob Barrows


 
Reply With Quote
 
Bob Barrows
Guest
Posts: n/a
 
      04-03-2009
Jon Paal [MSMD] wrote:
> just google:
>
> sql server import / export database
>
> you can also google:
>
> sql server import / export DTS


I do not believe this is a viable solution in his situation. He would
need to be able to directly access the SQL Server from his client
machine (or vice versa) to make that work. From what he's been saying,
he does not have such access, which is why he was attempting to use ASP
to do it.

--
HTH,
Bob Barrows


 
Reply With Quote
 
Daniel
Guest
Posts: n/a
 
      04-03-2009
Bob,

Is there a way for me, using ASP, to query the db to find what permission
the logon credentials I have been supplied with actually have. This way I
can then affirm to my colleague and his host that the supplied login info
does not permit the backing up of the db.

Thank you for all your help,

QB


"Bob Barrows" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Daniel wrote:
>> There is nothing shady going on!

>
> Forgive me, but these are just words on my screen. Why should I be
> convinced by them? After all, if you really were a potential hacker,
> would you really come out and reply "dammit, you're too smart for me, I
> guess I'll give up on the idea of hacking ... "
>
>>
>> The website owner wishes to switch and the host is being as
>> uncooperative as can be. i am simply trying to resolve this issue
>> quickly before things degerate further.
>>
>> I have the permission of the website owner and the credentials to
>> access the website (ftp) and the sql server given to the client by
>> the host.

>
> That's the issue - the credentials for the sql server are likely to have
> limited rights, so atempting things like sp_sendmail or xp_cmdshell are
> not likely to be successful if the host has things locked down the way
> he should.
>
>>
>> This is not a request to become a hacker. It is a ligitemate problem
>> to be resolved.
>>
>> QB
>>

>
>
> Bottom line, even if this is a legitimate problem, I still see no way to
> do it if the host wants to prevent you from doing it.
> The best you can do is query each of the tables in the database and
> write the results to response in an html table. In fact you can set the
> contenttype to excel and see the results in an excel spreadsheet that
> you can save locally. There are many examples of doing this in this
> newsgroup as well as in .asp.db so google should quickly get you going.
>
> Oh! It just occurred to me that there are ASP-based SQL Server
> management tools out there that might be useful for you. I think one of
> them is called MyLittleSQL or something like that. Be right back, I'm
> going to do a quick search ...
>
> No, it's MyLitleAdmin I was thinking of. This page has a list of this
> and other tools, some of which are discontinued:
> http://sqlserver2000.databases.aspfa...rver/msde.html
>
> --
> HTH,
> Bob Barrows
>
>



 
Reply With Quote
 
Bob Barrows
Guest
Posts: n/a
 
      04-03-2009
I'm pretty sure that your account does have rights to perform a backup.
You would have gotten an error message if it didn't (unless you used on
error resume next to suppress error messages ...).

What it likely does not have rights for is to go out to the operating
system and work with files in the file system. Neither is it likely to
be able to use the smtp server to send email. Or ftp for that matter.
You can try running xp_cmdshell just to see if the host didn't lock that
down ...

Daniel wrote:
> Bob,
>
> Is there a way for me, using ASP, to query the db to find what
> permission the logon credentials I have been supplied with actually
> have. This way I can then affirm to my colleague and his host that
> the supplied login info does not permit the backing up of the db.
>
> Thank you for all your help,
>
> QB
>
>
> "Bob Barrows" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Daniel wrote:
>>> There is nothing shady going on!

>>
>> Forgive me, but these are just words on my screen. Why should I be
>> convinced by them? After all, if you really were a potential hacker,
>> would you really come out and reply "dammit, you're too smart for
>> me, I guess I'll give up on the idea of hacking ... "
>>
>>>
>>> The website owner wishes to switch and the host is being as
>>> uncooperative as can be. i am simply trying to resolve this issue
>>> quickly before things degerate further.
>>>
>>> I have the permission of the website owner and the credentials to
>>> access the website (ftp) and the sql server given to the client by
>>> the host.

>>
>> That's the issue - the credentials for the sql server are likely to
>> have limited rights, so atempting things like sp_sendmail or
>> xp_cmdshell are not likely to be successful if the host has things
>> locked down the way he should.
>>
>>>
>>> This is not a request to become a hacker. It is a ligitemate
>>> problem to be resolved.
>>>
>>> QB
>>>

>>
>>
>> Bottom line, even if this is a legitimate problem, I still see no
>> way to do it if the host wants to prevent you from doing it.
>> The best you can do is query each of the tables in the database and
>> write the results to response in an html table. In fact you can set
>> the contenttype to excel and see the results in an excel spreadsheet
>> that you can save locally. There are many examples of doing this in
>> this newsgroup as well as in .asp.db so google should quickly get
>> you going.
>>
>> Oh! It just occurred to me that there are ASP-based SQL Server
>> management tools out there that might be useful for you. I think one
>> of them is called MyLittleSQL or something like that. Be right back,
>> I'm going to do a quick search ...
>>
>> No, it's MyLitleAdmin I was thinking of. This page has a list of this
>> and other tools, some of which are discontinued:
>>

http://sqlserver2000.databases.aspfa...rver/msde.html
>>
>> --
>> HTH,
>> Bob Barrows


--
HTH,
Bob Barrows


 
Reply With Quote
 
p byers
Guest
Posts: n/a
 
      04-04-2009
Why not take a copy using ftp ??

Daniel wrote:

> There is nothing shady going on!
>
> The website owner wishes to switch and the host is being as uncooperative as
> can be. i am simply trying to resolve this issue quickly before things
> degerate further.
>
> I have the permission of the website owner and the credentials to access the
> website (ftp) and the sql server given to the client by the host.
>
> This is not a request to become a hacker. It is a ligitemate problem to be
> resolved.
>
> QB
>
> "Bob Barrows" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Daniel wrote:
> >> I am trying to help a colleague to backup his website to migrate it
> >> elsewhere. As such, I am trying to figure out how I can using ASP
> >> perform a backup to my hard drive of the entire db (it is actually
> >> very small). The host provides no admin console, so I have none of
> >> the usual tools to create a backup. Thus the question.
> >>
> >> The host is being more than difficult to work with. They were asked
> >> for a backup and they refused to provide one. So now I am trying to
> >> find a way to do it myself.
> >>
> >>
> >> I have been trying to use the following but it doesn't seem to produce
> >> any results?
> >>
> >>
> >> <%
> >> SQL_Server_Name = "servername"
> >> DB_Name = "dbname"
> >> DB_User_ID = "username"
> >> DB_Password = "password"
> >> strcon = "Provider=SQLOLEDB;Data Source="& SQL_Server_Name
> >> &";Initial Catalog=" & DB_Name &";User ID="& DB_User_ID &";Password="&
> >> DB_Password&";charset=utf-8"
> >> set con = Server.CreateObject("ADODB.Connection")
> >> con.Open strCon
> >> sql="BACKUP DATABASE ["& DB_Name &"] TO DISK = N'c:/db.bak' WITH
> >> NOFORMAT, NOINIT, NAME = N'backup', SKIP, NOREWIND, NOUNLOAD, STATS =
> >> 10"
> >> con.Execute(sql)
> >> %>
> >>
> >>
> >> Since I am running the script on the server, I suppose it is being
> >> saved to the server rather than on my hard drive. What do I need to
> >> do to be able to save it to my drive or e-mail it or so method I can
> >> actually get a copy?

> >
> > Are you in the same domain as the SQL Server? It soesn't sound like it.
> >
> > If the host knows how to do security (and it sounds like he does), you
> > are not likely going to be able to get a copy of this database. All of
> > the techniques I would typically use (DTS/SSIS, xp_cmdshell,
> > sp_sendmail, etc.)are easily locked down by a system administrator.
> >
> > Frankly, going behind the host's back sounds more than a little shady to
> > me, and I am really hesitant to provide more information to you.
> > --
> > HTH,
> > Bob Barrows
> >
> >


 
Reply With Quote
 
Bob Barrows
Guest
Posts: n/a
 
      04-04-2009
Yeah, I thought of this, but the database is not on the web server. The
database server might not have an ftp server running. And even if it did,
the host is being uncooperative here so it is likely that he has locked it
down.

p byers wrote:
> Why not take a copy using ftp ??
>
> Daniel wrote:
>
>> There is nothing shady going on!
>>
>> The website owner wishes to switch and the host is being as
>> uncooperative as can be. i am simply trying to resolve this issue
>> quickly before things degerate further.
>>
>> I have the permission of the website owner and the credentials to
>> access the website (ftp) and the sql server given to the client by
>> the host.
>>
>> This is not a request to become a hacker. It is a ligitemate
>> problem to be resolved.
>>
>> QB
>>
>> "Bob Barrows" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Daniel wrote:
>>>> I am trying to help a colleague to backup his website to migrate it
>>>> elsewhere. As such, I am trying to figure out how I can using ASP
>>>> perform a backup to my hard drive of the entire db (it is actually
>>>> very small). The host provides no admin console, so I have none of
>>>> the usual tools to create a backup. Thus the question.
>>>>
>>>> The host is being more than difficult to work with. They were
>>>> asked
>>>> for a backup and they refused to provide one. So now I am trying
>>>> to find a way to do it myself.
>>>>
>>>>
>>>> I have been trying to use the following but it doesn't seem to
>>>> produce any results?
>>>>
>>>>
>>>> <%
>>>> SQL_Server_Name = "servername"
>>>> DB_Name = "dbname"
>>>> DB_User_ID = "username"
>>>> DB_Password = "password"
>>>> strcon = "Provider=SQLOLEDB;Data Source="& SQL_Server_Name
>>>> &";Initial Catalog=" & DB_Name &";User ID="& DB_User_ID
>>>> &";Password="& DB_Password&";charset=utf-8"
>>>> set con = Server.CreateObject("ADODB.Connection")
>>>> con.Open strCon
>>>> sql="BACKUP DATABASE ["& DB_Name &"] TO DISK = N'c:/db.bak' WITH
>>>> NOFORMAT, NOINIT, NAME = N'backup', SKIP, NOREWIND, NOUNLOAD,
>>>> STATS = 10"
>>>> con.Execute(sql)
>>>> %>
>>>>
>>>>
>>>> Since I am running the script on the server, I suppose it is being
>>>> saved to the server rather than on my hard drive. What do I need
>>>> to
>>>> do to be able to save it to my drive or e-mail it or so method I
>>>> can actually get a copy?
>>>
>>> Are you in the same domain as the SQL Server? It soesn't sound like
>>> it.
>>>
>>> If the host knows how to do security (and it sounds like he does),
>>> you are not likely going to be able to get a copy of this database.
>>> All of the techniques I would typically use (DTS/SSIS, xp_cmdshell,
>>> sp_sendmail, etc.)are easily locked down by a system administrator.
>>>
>>> Frankly, going behind the host's back sounds more than a little
>>> shady to me, and I am really hesitant to provide more information
>>> to you. --
>>> HTH,
>>> Bob Barrows


--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
Bytecc Backup Star One-Touch Backup External Enclosure @ A True Review Silverstrand Front Page News 0 11-24-2005 04:01 PM
How to backup registry without backup utility The Babaloughesian Computer Support 8 02-27-2005 04:11 AM
Backup Exec 9.1: The Backup Exec job engine system service is not responding Christian Falch Computer Support 1 06-23-2004 02:22 AM



Advertisments