Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

MSDE 2000 start service and uninstall


3 replies to this topic

Heike

Heike
  • Members
  • 20 posts

Posted 05 March 2002 - 11:16

Hello!
After Installation of MSDE 2000 I want to run a script, creatind a database ...
Is the service already running? If not, how can I start it?

Another Problem is, that after the Installation (with MSDE) it'S not possible to unInstall the product. Any Idea?
THX

// heike

Gavin

Gavin
  • Members
  • 16 posts

Posted 05 March 2002 - 19:04

Check out the SQL-DMO help topics in MSDN and/or SQL Server Books Online.  There is a really handy SQLServer object that has a Start() function that will serve your purposes. Of course, make sure the DMO merge modules are included in your setup.

One word of caution: If your user installs over SQL Server 7.0, their client tools (enterprise mgr, query analyzer, etc.) will be adversely affected because the DMO will be upgraded to the 2000 version. :(

Rastislav Zima

Rastislav Zima
  • Members
  • 34 posts

Posted 07 March 2002 - 10:50

Hi Gavin,

I am using SQL-DMO to start SQL server and run the script, but I wonder how to solve these problems on Win9x:

1. After instal of MSDE on Win9x restart is required - how can I make installation to continue after the restart just to start service and run scripts. (maybe to force the installation to restart machine and than it will start from the point where it was restarted???).
2. How to set autostart on of SQL Server (its not default on Win9x)? By using scm utility? Isn't there any installation option to turn autostart on?

Thanks,
ross

Gavin

Gavin
  • Members
  • 16 posts

Posted 12 March 2002 - 20:00

Hi,

What you need to do is really quite simple and I have found that reboot is NOT necessary!  Instead of explaining, I will provide a sample script. Note the use of the term "MyInstance".  Substitute your unique instance name.

// MSDE install path
#define MSDE_KEY "\\SOFTWARE\\Microsoft\\Microsoft SQL Server\\80\\Tools\\ClientSetup"

function StartSQLServer(hMSI)
       STRING szSQLPath, szComputerName, szCommandLine;
       NUMBER nvType, nvSize;
begin
       // build a path to the SCM
       RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
       RegDBGetKeyValueEx (MSDE_KEY, "SQLPath" , nvType , szSQLPath , nvSize );
       szSQLPath = szSQLPath ^ "Binn\\SCM.exe";
       LongPathToQuote(szSQLPath, TRUE);

       // get the local machine name
       nvSize = 40;
       MsiGetProperty(hMSI, "ComputerName", szComputerName, nvSize);

       // build the command line to start the SQL Server
       szCommandLine = "-Action 1 -Silent 1 -Server " + szComputerName + " -Service MSSQL$MyInstance";

       // use the following line to start the server NOW
       LaunchAppAndWait(szSQLPath, szCommandLine, WAIT);

       // use the following line to have the server AUTO-START
       AddFolderIcon (FOLDER_STARTUP, "SQL Server Instance MyInstance",
               szSQLPath + " " + szCommandLine, "", "", 0, "", REPLACE);
end;

That should do the trick!