Showing posts with label installshield. Show all posts
Showing posts with label installshield. Show all posts

Friday, March 23, 2012

Restore SQL2000 database using vbscript

Hello,
I am trying to use a VBscript thru installshield to restore a sql2000 database. the script (below) worked fine for default instance of database. but with a specific named instance I get error 3201. any ideas? thx - Prasanna
-----------
code:

dim sql
dim sqlRest

on error resume next
Set sql = CreateObject("SQLDMO.SQLServer")
sql.LoginSecure = True
sql.Connect ".\TEST2000"

Set sqlRest = CreateObject("SQLDMO.Restore")
sqlRest.Files = "c:\testdb.bak"
sqlRest.Database = "TESTDB"
sqlRest.Action = SQLDMORestore_Database
sqlRest.ReplaceDatabase = True
sqlRest.SQLRestore sql
msgbox err.numberFound a solution:

The backup was created using default instance of SQL2000 and once I used a backup created using the 'TEST2000' instance the script worked. I think you can use the RelocateFiles property of the SQLDMO Restore object to set the location of the data and log files but due to time constraints I could not try that solution.

-Prasanna

Restore SQL Server to default SQL data directory

Hi,
I need to prepare an Installshield project that restore a database on
my target machine.
No problem with script
RESTORE DATABASE BIGStudio FROM DISK=MyDir\MyBackup.bak'
WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10, MOVE 'DB_dat' TO
'\Data\DB_Data.mdf',
MOVE 'DB__log' TO '\Data\DB_log.ldf'.
But in my target machine I can have SQL Server 2000, SQL Server 2005,
MSDE 2000...
I've tried to restore DB on my INSTALL dir but I receive an access
denied error. How can I restore my DB to the default SQL Server data
directory on my target machine?
Thank you
Gianluca DhoYou may need to obtain this info dynamically?
Check out xp_instance_regread
Immy
"Gianluca Dho" <gianluca.dho@.gmail.com> wrote in message
news:1159535209.992156.163070@.b28g2000cwb.googlegroups.com...
> Hi,
> I need to prepare an Installshield project that restore a database on
> my target machine.
> No problem with script
> RESTORE DATABASE BIGStudio FROM DISK=MyDir\MyBackup.bak'
> WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10, MOVE 'DB_dat' TO
> '\Data\DB_Data.mdf',
> MOVE 'DB__log' TO '\Data\DB_log.ldf'.
> But in my target machine I can have SQL Server 2000, SQL Server 2005,
> MSDE 2000...
> I've tried to restore DB on my INSTALL dir but I receive an access
> denied error. How can I restore my DB to the default SQL Server data
> directory on my target machine?
> Thank you
> Gianluca Dho
>

Restore SQL Server to default SQL data directory

Hi,
I need to prepare an Installshield project that restore a database on
my target machine.
No problem with script
RESTORE DATABASE BIGStudio FROM DISK=MyDir\MyBackup.bak'
WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10, MOVE 'DB_dat' TO
'\Data\DB_Data.mdf',
MOVE 'DB__log' TO '\Data\DB_log.ldf'.
But in my target machine I can have SQL Server 2000, SQL Server 2005,
MSDE 2000...
I've tried to restore DB on my INSTALL dir but I receive an access
denied error. How can I restore my DB to the default SQL Server data
directory on my target machine?
Thank you
Gianluca Dho
You may need to obtain this info dynamically?
Check out xp_instance_regread
Immy
"Gianluca Dho" <gianluca.dho@.gmail.com> wrote in message
news:1159535209.992156.163070@.b28g2000cwb.googlegr oups.com...
> Hi,
> I need to prepare an Installshield project that restore a database on
> my target machine.
> No problem with script
> RESTORE DATABASE BIGStudio FROM DISK=MyDir\MyBackup.bak'
> WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10, MOVE 'DB_dat' TO
> '\Data\DB_Data.mdf',
> MOVE 'DB__log' TO '\Data\DB_log.ldf'.
> But in my target machine I can have SQL Server 2000, SQL Server 2005,
> MSDE 2000...
> I've tried to restore DB on my INSTALL dir but I receive an access
> denied error. How can I restore my DB to the default SQL Server data
> directory on my target machine?
> Thank you
> Gianluca Dho
>
sql

Restore SQL Server to default SQL data directory

Hi,
I need to prepare an Installshield project that restore a database on
my target machine.
No problem with script
RESTORE DATABASE BIGStudio FROM DISK=MyDir\MyBackup.bak'
WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10, MOVE 'DB_dat' TO
'\Data\DB_Data.mdf',
MOVE 'DB__log' TO '\Data\DB_log.ldf'.
But in my target machine I can have SQL Server 2000, SQL Server 2005,
MSDE 2000...
I've tried to restore DB on my INSTALL dir but I receive an access
denied error. How can I restore my DB to the default SQL Server data
directory on my target machine?
Thank you
Gianluca DhoYou may need to obtain this info dynamically?
Check out xp_instance_regread
Immy
"Gianluca Dho" <gianluca.dho@.gmail.com> wrote in message
news:1159535209.992156.163070@.b28g2000cwb.googlegroups.com...
> Hi,
> I need to prepare an Installshield project that restore a database on
> my target machine.
> No problem with script
> RESTORE DATABASE BIGStudio FROM DISK=MyDir\MyBackup.bak'
> WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10, MOVE 'DB_dat' TO
> '\Data\DB_Data.mdf',
> MOVE 'DB__log' TO '\Data\DB_log.ldf'.
> But in my target machine I can have SQL Server 2000, SQL Server 2005,
> MSDE 2000...
> I've tried to restore DB on my INSTALL dir but I receive an access
> denied error. How can I restore my DB to the default SQL Server data
> directory on my target machine?
> Thank you
> Gianluca Dho
>