设为首页 收藏本站
查看: 997|回复: 0

[经验分享] [开发手记]使用 InstallShield 安装和卸载SQL Server 数据库

[复制链接]

尚未签到

发表于 2015-7-4 16:17:25 | 显示全部楼层 |阅读模式
  本文主要介绍使用Installshield 进行数据库的安装和卸载,并在InstallShield 11.5 Premier Edition 和Installshield 12 Premier Edition 环境中测试通过。(关于InstallShield 这样一个大名鼎鼎的安装程序制作工具我就不多介绍了。)
  (在 Installshield 中打包 .NET Framework 参见:《关于使用 Installshield 部署 .NET Framework》)张磊.LIVE
  1、打开“SQL Scripts view”,如图1
DSC0000.jpg
图1.  打开SQL Script View 视图



2、建立一个连接,假定为“MasterConnection”,按照图2和图3设置该连接的属性。

DSC0001.jpg
图2 建立连接
DSC0002.jpg
图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是我们需要创建的数据库。
DSC0003.jpg
图4 新建一个Script

  4、新建连接“RelayBookkeepingConnection”,按照图5设置General属性。Requirements属性的设置参照图3的一样。
DSC0004.jpg
图5 设置连接的属性

  5、在“RelayBookkeepingConnection”下,新建你自己的数据库脚本。如图6。
DSC0005.jpg
图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:






  • Create a new InstallShield project.


  • Go to the Property Manager view.


  • Create a new property named "IS_SQLSERVER_DATABASE2".


  • Go to the SQL Scripts view.


  • Create a new connection and call it "NewConnection1".


  • Click NewConnection1 in the explorer, and select the General tab.


  • Specify "TESTSQLSERVER" as the Target Server Name, and clear the Create Catalog If Absent option.


  • Select the Server Authentication option and specify "sa" as the Login ID and leave the Password field blank.


  • Click the Requirements tab.


  • Select the SQL Server check box and clear the Oracle and MySQL check boxes as the target databases.


  • Right-click NewConnection1 in the explorer, and choose New Script.


  • Rename the new script "NewScript1".


  • Select NewScript1 in the explorer, and click the Script tab.


  • 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





  • Click the Runtime tab, select Run Script During Login, and then clear the other script execution options.


  • Create a new connection in the SQL Scripts view, and call it "NewConnection2".


  • Click NewConnection2 in the explorer, and select the Advanced tab.


  • From the Target Catalog Property Name box, choose IS_SQLSERVER_DATABASE2.


  • Click the General tab.


  • Specify "TESTSQLSERVER" as the Target Server Name and "TestDB" as the Catalog Name, and then clear the Create Catalog If Absent option.


  • Select the Server Authentication option and specify "sa" as the Login ID and leave the Password field blank.


  • Click the Requirements tab.


  • Select the SQL Server check box and clear the Oracle and MySQL check boxes as the target databases.


  • Right-click NewConnection2 in the explorer, and choose New Script.


  • Rename the new script "NewScript2".


  • Select NewScript2 in the explorer, and click the Script tab.


  • Add the following script:
    CREATE TABLE TestTable (TestColumn1 CHAR NOT NULL PRIMARY KEY)





  • 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:






  • Create a new InstallShield project.


  • Go to the Property Manager view.


  • Create a new property named "IS_SQLSERVER_DATABASE2".


  • Go to the SQL Scripts view.


  • Create a new connection and call it "NewConnection1".


  • Click NewConnection1 in the explorer, and select the General tab.


  • Specify "//sch01jsmith.macrvision.com:1521/orcl" as the Target Server Name, and clear the Create Catalog If Absent option.


  • Select the Server Authentication option and specify "Scott" as the login ID and "Scott" as the password.


  • Click the Requirements tab.


  • Select the Oracle check box and clear the SQL Server and MySQL check boxes as the target databases.


  • Right-click NewConnection1 in the explorer, and choose New Script.


  • Rename the new script "NewScript1".


  • Select NewScript1 in the explorer, and click the Script tab.


  • 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



  • Click the Runtime tab, select Run Script During Login, and then clear the other script execution options.


  • Create a new connection in the SQL Scripts view, and call it "NewConnection2".


  • Click NewConnection2 in the explorer, and select the Advanced tab.


  • From the Target Catalog Property Name box, choose IS_SQLSERVER_DATABASE2.


  • Click the General tab.


  • 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.


  • Select the Server Authentication option and specify "TEST_USER" as the Login ID and "MYPSWD" as the password.


  • Click the Requirements tab.


  • Select the Oracle check box and clear the SQL Server and MySQL check boxes as the target databases.


  • Right-click NewConnection2 in the explorer, and choose New Script.


  • Rename the new script "NewScript2".


  • Select NewScript2 in the explorer, and click the Script tab.


  • Add the following script:
    CREATE TABLE TestTable (TestColumn1 CHAR NOT NULL PRIMARY KEY)





  • Click the Runtime tab, select Run Script During Install, and then clear the other script execution options.
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-83155-1-1.html 上篇帖子: 配置sql server 2000以允许远程访问 及 连接中的四个最常见错误 下篇帖子: SQL Server-流程控制 2,If...Else 语句
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表