数据库转移:下载脚本并设置 MS SQL 数据库

IBM Knowledge Center 中提供了配置向导中的手动步骤,以供您参考并供高级用户使用。此过程针对不同的数据库提供了变量和步骤。使用此向导配置部署时,它会将变量替换为您在此向导中提供的信息。另外,它还仅显示特定于环境的步骤。此向导生成的指示信息特定于环境。

关于此任务

注意: 提供了针对所有数据库环境的所有步骤,而未考虑您的环境。使用配置向导可以针对您的环境生成定制指示信息。

过程

  1. 将下载的脚本复制到数据库服务器并将其解压缩。
  2. 在 SQL 处理器中运行此脚本中列出的 SQL 语句。 db2 -tvf SetupDB2Database.sql

    下面是配置向导生成的脚本示例。

    -- Create the schema
    USE [WPSDB];
    GO
    CREATE SCHEMA release;
    GO
    -- Create the configuration user
    USE [WPSDB];
    EXEC sp_addlogin 'config_ID', 'config_pwd', 'WPSDB';
    -- Add a role to the user for XA transactions
    USE [master];
    EXEC sp_addrolemember N'SqlJDBCXAUser', N'config_ID';
    GO
    -- Add the configuration user to the database
    USE [WPSDB];
    EXEC sp_grantdbaccess 'config_ID';
    GO
    -- Create the runtime user
    USE [WPSDB];
    EXEC sp_addlogin 'runtime_ID', 'run_pwd', 'WPSDB';
    -- Add a role to the user for XA transactions
    USE [master];
    EXEC sp_addrolemember N'SqlJDBCXAUser', N'runtime_ID';
    GO
    -- Add the runtime user to the database
    USE [WPSDB];
    EXEC sp_grantdbaccess 'runtime_ID';
    GO
    -- Create the configuration role
    USE [WPSDB];
    CREATE ROLE [WP_BASE_CONFIG_USERS];
    GRANT CREATE TABLE TO [WP_BASE_CONFIG_USERS];
    GRANT ALTER, SELECT, INSERT, UPDATE, DELETE, REFERENCES ON SCHEMA::[release] TO [WP_BASE_CONFIG_USERS];
    EXEC sp_addrolemember N'WP_BASE_CONFIG_USERS', N'config_ID';
    GO
    -- Create the runtime role
    CREATE ROLE [WP_BASE_RUNTIME_USERS];
    EXEC sp_addrolemember N'WP_BASE_RUNTIME_USERS', N'runtime_ID';
    GO
    -- Create the schema
    USE [WPSDB];
    GO
    CREATE SCHEMA community;
    GO
    -- Add the configuration user to the database
    USE [WPSDB];
    EXEC sp_grantdbaccess 'config_ID';
    GO
    -- Add the runtime user to the database
    USE [WPSDB];
    EXEC sp_grantdbaccess 'runtime_ID';
    GO
    -- Create the configuration role
    USE [WPSDB];
    GRANT ALTER, SELECT, INSERT, UPDATE, DELETE, REFERENCES ON SCHEMA::[community] TO [WP_BASE_CONFIG_USERS];
    EXEC sp_addrolemember N'WP_BASE_CONFIG_USERS', N'config_ID';
    GO
    -- Create the runtime role
    EXEC sp_addrolemember N'WP_BASE_RUNTIME_USERS', N'runtime_ID';
    GO
    -- Create the schema
    USE [WPSDB];
    GO
    CREATE SCHEMA customization;
    GO
    -- Add the configuration user to the database
    USE [WPSDB];
    EXEC sp_grantdbaccess 'config_ID';
    GO
    -- Add the runtime user to the database
    USE [WPSDB];
    EXEC sp_grantdbaccess 'runtime_ID';
    GO
    -- Create the configuration role
    USE [WPSDB];
    GRANT ALTER, SELECT, INSERT, UPDATE, DELETE, REFERENCES ON SCHEMA::[customization] TO [WP_BASE_CONFIG_USERS];
    EXEC sp_addrolemember N'WP_BASE_CONFIG_USERS', N'config';
    GO
    -- Create the runtime role
    EXEC sp_addrolemember N'WP_BASE_RUNTIME_USERS', N'runtime_ID';
    GO
    -- Create the schema
    USE [WPSDB];
    GO
    CREATE SCHEMA jcr;
    GO
    -- Add the configuration user to the database
    USE [WPSDB];
    EXEC sp_grantdbaccess 'config_ID';
    GO
    -- Add the runtime user to the database
    USE [WPSDB];
    EXEC sp_grantdbaccess 'runtime_ID';
    GO
    -- Create the configuration role
    USE [WPSDB];
    CREATE ROLE [WP_JCR_CONFIG_USERS];
    GRANT CREATE TABLE TO [WP_JCR_CONFIG_USERS];
    GRANT CREATE VIEW TO [WP_JCR_CONFIG_USERS];
    GRANT ALTER, SELECT, INSERT, UPDATE, DELETE, REFERENCES ON SCHEMA::[jcr] TO [WP_JCR_CONFIG_USERS];
    EXEC sp_addrolemember N'WP_JCR_CONFIG_USERS', N'config_ID';
    GO
    -- Create the runtime role
    CREATE ROLE [WP_JCR_RUNTIME_USERS];
    EXEC sp_addrolemember N'WP_JCR_RUNTIME_USERS', N'runtime_ID';
    GO
    -- Create the schema
    USE [WPSDB];
    GO
    CREATE SCHEMA feedback;
    GO
    -- Add the configuration user to the database
    USE [WPSDB];
    EXEC sp_grantdbaccess 'config_ID';
    GO
    -- Add the runtime user to the database
    USE [WPSDB];
    EXEC sp_grantdbaccess 'runtime_ID';
    GO
    -- Create the configuration role
    USE [WPSDB];
    CREATE ROLE [WP_PZN_CONFIG_USERS];
    GRANT CREATE TABLE TO [WP_PZN_CONFIG_USERS];
    GRANT ALTER, SELECT, INSERT, UPDATE, DELETE, REFERENCES ON SCHEMA::[feedback] TO [WP_PZN_CONFIG_USERS];
    EXEC sp_addrolemember N'WP_PZN_CONFIG_USERS', N'config_ID';
    GO
    -- Create the runtime role
    CREATE ROLE [WP_PZN_RUNTIME_USERS];
    EXEC sp_addrolemember N'WP_PZN_RUNTIME_USERS', N'runtime_ID';
    GO
    -- Create the schema
    USE [WPSDB];
    GO
    CREATE SCHEMA likeminds;
    GO
    -- Add the configuration user to the database
    USE [WPSDB];
    EXEC sp_grantdbaccess 'config_ID';
    GO
    -- Add the runtime user to the database
    USE [WPSDB];
    EXEC sp_grantdbaccess 'runtime_ID';
    GO
    -- Create the configuration role
    USE [WPSDB];
    GRANT CREATE PROCEDURE TO [WP_PZN_CONFIG_USERS];
    GRANT ALTER, SELECT, INSERT, UPDATE, DELETE, REFERENCES ON SCHEMA::[likeminds] TO [WP_PZN_CONFIG_USERS];
    EXEC sp_addrolemember N'WP_PZN_CONFIG_USERS', N'config_ID';
    GO
    -- Create the runtime role
    EXEC sp_addrolemember N'WP_PZN_RUNTIME_USERS', N'runtime_ID';
    GO