[轉帖] 使用 InstallShield 安裝和卸載SQL Server 資料庫

來源:互聯網
上載者:User
文章目錄
  • Creating a Sample Project that Will Create a SQL Server Catalog by Running Customized SQL Script
  • Creating a Sample Project that Will Create an Oracle Catalog by Running Customized SQL Script

很不想轉,因為既然可以google到,轉帖純粹是多此一舉的事情,自己要看,可以儲存網頁或者添加到收藏夾裡。但是真的很失望於許多人只會在群裡拚命地拋問題,但是卻學不會自己去google一下。甚至告訴了他們在哪裡可以找到,還會跑來問詳細的用法。自己去實驗一下真的就那麼難嗎?

甚至現在,連現成的答案都不想看了,要求我錄教學視頻,要求我遠程協助,唉~

 

原帖地址:

http://www.cnblogs.com/zhangleixp/archive/2006/11/11/installshielddatabase.html

 

本文主要介紹使用Installshield 進行資料庫的安裝和卸載,並在InstallShield 11.5 Premier Edition 和Installshield 12 Premier Edition 環境中測試通過。(關於InstallShield 這樣一個大名鼎鼎的安裝程式製作工具我就不多介紹了。)

(在 Installshield 中打包 .NET Framework 參見:《關於使用 Installshield 部署 .NET Framework》)張磊.LIVE

1、開啟“SQL Scripts view”,1


圖1.  開啟SQL Script View 視圖

2、建立一個串連,假定為“MasterConnection”,按照圖2和圖3設定該串連的屬性。


圖2 建立串連

圖3 設定串連的屬性

3、在“MasterConnection”下,建立一個Script,屬性的設定4,script 的內容如下:

1 USE master
2
3 IF NOT EXISTS (SELECT *
4
5 FROM   master.dbo.sysdatabases 
6
7 WHERE name = 'RelayBookkeeping')
8
9 CREATE DATABASE 'RelayBookkeeping'
10
11 GO
12

註:RelayBookkeeping是我們需要建立的資料庫。


圖4 建立一個Script

4、建立串連“RelayBookkeepingConnection”,按照圖5設定General屬性。Requirements屬性的設定參照圖3的一樣。


圖5 設定串連的屬性

5、在“RelayBookkeepingConnection”下,建立你自己的資料庫指令碼。6。


圖6 添加自己的資料庫指令碼

6、卸載程式時刪除資料庫。

操作方法和和建立資料庫(步驟1,2,3)類似。建立一個串連,General 屬性頁面中,設定資料庫名為Master。然後添加一個Script檔案,Runtime屬性設定為卸載時,內容為:

USE Master 
DROP DATABASE RelayBookkeeping
GO

[以下內容編輯於2006-11-13 17:00]
今天在協助裡看到的,一篇是安裝SQL Server的,一篇是ORACLE的。帖在到後面。

Creating a Sample Project that Will Create a SQL Server Catalog by Running Customized SQL Script

TASK

The following describes how to create a sample project that will create a SQL Server catalog on the target machine by running customized SQL script:

  1. Create a new InstallShield project.
  2. Go to the Property Manager view.
  3. Create a new property named "IS_SQLSERVER_DATABASE2".
  4. Go to the SQL Scripts view.
  5. Create a new connection and call it "NewConnection1".
  6. Click NewConnection1 in the explorer, and select the General tab.
  7. Specify "TESTSQLSERVER" as the Target Server Name, and clear the Create Catalog If Absent option.
  8. Select the Server Authentication option and specify "sa" as the Login ID and leave the Password field blank.
  9. Click the Requirements tab.
  10. Select the SQL Server check box and clear the Oracle and MySQL check boxes as the target databases.
  11. Right-click NewConnection1 in the explorer, and choose New Script.
  12. Rename the new script "NewScript1".
  13. Select NewScript1 in the explorer, and click the Script tab.
  14. Add the following script:
    CREATE DATABASE [TestDB]  ON (NAME = N' TestDB', FILENAME =    N'C:\Program Files\Microsoft SQL Server\MSSQL\data\testdb.mdf' ,    SIZE = 3, FILEGROWTH = 10%) LOG ON (NAME = N' TestDB_log', FILENAME    = N'C:\Program Files\Microsoft SQL Server\MSSQL\data\testdb.ldf' ,    SIZE = 1, FILEGROWTH = 10%)    
    COLLATE SQL_Latin1_General_CP1_CI_AS    
  15. Click the Runtime tab, select Run Script During Login, and then clear the other script execution options.
  16. Create a new connection in the SQL Scripts view, and call it "NewConnection2".
  17. Click NewConnection2 in the explorer, and select the Advanced tab.
  18. From the Target Catalog Property Name box, choose IS_SQLSERVER_DATABASE2.
  19. Click the General tab.
  20. Specify "TESTSQLSERVER" as the Target Server Name and "TestDB" as the Catalog Name, and then clear the Create Catalog If Absent option.
  21. Select the Server Authentication option and specify "sa" as the Login ID and leave the Password field blank.
  22. Click the Requirements tab.
  23. Select the SQL Server check box and clear the Oracle and MySQL check boxes as the target databases.
  24. Right-click NewConnection2 in the explorer, and choose New Script.
  25. Rename the new script "NewScript2".
  26. Select NewScript2 in the explorer, and click the Script tab.
  27. Add the following script:
    CREATE TABLE TestTable (TestColumn1 CHAR NOT NULL PRIMARY KEY)    
  28. Click the Runtime tab, select Run Script During Install, and then clear the other script execution options.
Creating a Sample Project that Will Create an Oracle Catalog by Running Customized SQL Script

TASK

The following describes how to create a sample project that will create an Oracle catalog on the target machine by running customized SQL script:

  1. Create a new InstallShield project.
  2. Go to the Property Manager view.
  3. Create a new property named "IS_SQLSERVER_DATABASE2".
  4. Go to the SQL Scripts view.
  5. Create a new connection and call it "NewConnection1".
  6. Click NewConnection1 in the explorer, and select the General tab.
  7. Specify "//sch01jsmith.macrvision.com:1521/orcl" as the Target Server Name, and clear the Create Catalog If Absent option.
  8. Select the Server Authentication option and specify "Scott" as the login ID and "Scott" as the password.
  9. Click the Requirements tab.
  10. Select the Oracle check box and clear the SQL Server and MySQL check boxes as the target databases.
  11. Right-click NewConnection1 in the explorer, and choose New Script.
  12. Rename the new script "NewScript1".
  13. Select NewScript1 in the explorer, and click the Script tab.
  14. Add the following script:
    CREATE TABLESPACE TEST_TS LOGGING DATAFILE ' /muddle/oracle/sts/    test01.dbf ' SIZE 64K AUTOEXTEND ON NEXT 2M MAXSIZE UNLIMITED    
    Go    
    CREATE USER TEST_USER IDENTIFIED BY MYPSWD DEFAULT TABLESPACE    TEST_TS QUOTA UNLIMITED on TEST_TS    
    Go    
    GRANT CONNECT TO TEST_USER    
    Go    
    GRANT DBA TO TEST_USER    
    Go    
    ALTER USER TEST_USER DEFAULT ROLE ALL    
    Go    
  15. Click the Runtime tab, select Run Script During Login, and then clear the other script execution options.
  16. Create a new connection in the SQL Scripts view, and call it "NewConnection2".
  17. Click NewConnection2 in the explorer, and select the Advanced tab.
  18. From the Target Catalog Property Name box, choose IS_SQLSERVER_DATABASE2.
  19. Click the General tab.
  20. Specify "//sch01jsmith.macrvision.com:1521/orcl" as the Target Server Name and "TEST_USER" as the Catalog Name, and then clear the Create Catalog If Absent option.
  21. Select the Server Authentication option and specify "TEST_USER" as the Login ID and "MYPSWD" as the password.
  22. Click the Requirements tab.
  23. Select the Oracle check box and clear the SQL Server and MySQL check boxes as the target databases.
  24. Right-click NewConnection2 in the explorer, and choose New Script.
  25. Rename the new script "NewScript2".
  26. Select NewScript2 in the explorer, and click the Script tab.
  27. Add the following script:
    CREATE TABLE TestTable (TestColumn1 CHAR NOT NULL PRIMARY KEY)    
  28. Click the Runtime tab, select Run Script During Install, and then clear the other script execution options.
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.