Solved

VMware vSphere 5.1 vCenter and SSO SQL scripts

Posted on 2013-02-06
1
1,232 Views
Last Modified: 2013-07-29
Hi Experts,

I am currently looking for a way of How to combined two SQL scripts into one, by doing this, will allow me to save time when deploying a SQL server database, rather than build it manually, below is the scripts:

use [master]

go

CREATE DATABASE [VCDB] ON PRIMARY

(NAME = N'vcdb', FILENAME = N'C:\VCDB.mdf' , SIZE = 3000KB , FILEGROWTH = 10% )

LOG ON

(NAME = N'vcdb_log', FILENAME = N'C:\VCDB.ldf' , SIZE = 1500KB , FILEGROWTH = 10%)

COLLATE SQL_Latin1_General_CP1_CI_AS

go

use VCDB

go

sp_addlogin @loginame=[vpxuser], @passwd=N'vpxuser', @defdb='VCDB', @deflanguage='us_english'

go

ALTER LOGIN [vpxuser] WITH CHECK_POLICY = OFF

go

CREATE USER [vpxuser] for LOGIN [vpxuser]

go

CREATE SCHEMA [VMW]

go

ALTER USER [vpxuser] WITH DEFAULT_SCHEMA =[VMW]

go

User should have DBO Privileges or VC_ADMIN_ROLE and VC_USER_ROLE database roles

sp_addrolemember @rolename = 'db_owner', @membername = 'vpxuser'
go


--------------------------------------------------------------------------------------------------------------------

-- PROJECT     IMS
-- MODEL       IDENTITY MANAGEMENT SERVICE
-- COMPANY     RSA, the Security Division of EMC
-- DATABASE    MSSQL

USE MASTER
GO

-------------------------------------------------------------------------------------
-- Create database
--
-- Using this script is not mandatory. The database can be created with
-- SQL Management Studio, ensuring that there are two tablespaces, named RSA_DATA
-- and RSA_INDEX, and that there are only alphanumeric characters in the database name.
--
-- Before running this script, customize the file paths (CHANGE ME) below.
-- 1. Decide on a folder to hold the database files (10 GB of space required).
-- For example, it can be the DATA folder of the SQL Server, usually
-- C:\Program Files\Microsoft SQL Server\MSSQL10_50.<instance name>\MSSQL\DATA
-- 2. Replace all 3 occurrences of C:\CHANGE ME with the path to the folder

-- The database name can also be customized, but it is forbidden to include
-- reserved keywords like database or any characters other than letters, numbers,
-- _, @ and #.

-- Advanced users can put the different files (RSA_DATA, RSA_INDEX and LOG)
-- on different storage devices to improve performance. RSA_INDEX is a small file which
-- is recommended to be stored on a fast device.
-- For more details, please refer to Microsoft documentation at http://technet.microsoft.com/en-us/library/ms143547.aspx
-------------------------------------------------------------------------------------
CREATE DATABASE RSA ON PRIMARY(
    NAME='RSA_DATA',
    FILENAME='C:\CHANGE ME\RSA_DATA.mdf',
    SIZE=10MB,
    MAXSIZE=UNLIMITED,
    FILEGROWTH=10%),
FILEGROUP RSA_INDEX(
    NAME='RSA_INDEX',
    FILENAME='C:\CHANGE ME\RSA_INDEX.ndf',
    SIZE=10MB,
    MAXSIZE=UNLIMITED,
    FILEGROWTH=10%)
LOG ON(
    NAME='translog',
    FILENAME='C:\CHANGE ME\translog.ldf',
    SIZE=10MB,
    MAXSIZE=UNLIMITED,
    FILEGROWTH=10% )
GO

-- Set recommended perform settings on the database
EXEC SP_DBOPTION 'RSA', 'autoshrink', true
GO
EXEC SP_DBOPTION 'RSA', 'trunc. log on chkpt.', true
GO

CHECKPOINT
GO

-------------------------------------------------------------------------------------
-- To drop the database, the commands is:
-------------------------------------------------------------------------------------
-- DROP DATABASE RSA

I have taken the original files from the VMware vSphere installation media and pasted them here, so again what I am looking for is to combined the two files into a single SQL script.

Please let me know if this is possible.

Thanks,
0
Comment
Question by:Islandr
1 Comment
 
LVL 42

Accepted Solution

by:
EugeneZ earned 250 total points
ID: 38862153
it is already 1 script: did you try to run it ? (just if you can adjust file location instead of C: drive)

 
use [master]

go

CREATE DATABASE [VCDB] ON PRIMARY

(NAME = N'vcdb', FILENAME = N'C:\VCDB.mdf' , SIZE = 3000KB , FILEGROWTH = 10% )

LOG ON

(NAME = N'vcdb_log', FILENAME = N'C:\VCDB.ldf' , SIZE = 1500KB , FILEGROWTH = 10%)

COLLATE SQL_Latin1_General_CP1_CI_AS

go

use VCDB

go

sp_addlogin @loginame=[vpxuser], @passwd=N'vpxuser', @defdb='VCDB', @deflanguage='us_english'

go

ALTER LOGIN [vpxuser] WITH CHECK_POLICY = OFF

go

CREATE USER [vpxuser] for LOGIN [vpxuser]

go

CREATE SCHEMA [VMW] 

go

ALTER USER [vpxuser] WITH DEFAULT_SCHEMA =[VMW]

go

User should have DBO Privileges or VC_ADMIN_ROLE and VC_USER_ROLE database roles

sp_addrolemember @rolename = 'db_owner', @membername = 'vpxuser'
go


--------------------------------------------------------------------------------------------------------------------

-- PROJECT     IMS
-- MODEL       IDENTITY MANAGEMENT SERVICE
-- COMPANY     RSA, the Security Division of EMC
-- DATABASE    MSSQL

USE MASTER
GO

-------------------------------------------------------------------------------------
-- Create database
--
-- Using this script is not mandatory. The database can be created with
-- SQL Management Studio, ensuring that there are two tablespaces, named RSA_DATA
-- and RSA_INDEX, and that there are only alphanumeric characters in the database name.
--
-- Before running this script, customize the file paths (CHANGE ME) below.
-- 1. Decide on a folder to hold the database files (10 GB of space required).
-- For example, it can be the DATA folder of the SQL Server, usually
-- C:\Program Files\Microsoft SQL Server\MSSQL10_50.<instance name>\MSSQL\DATA
-- 2. Replace all 3 occurrences of C:\CHANGE ME with the path to the folder

-- The database name can also be customized, but it is forbidden to include
-- reserved keywords like database or any characters other than letters, numbers,
-- _, @ and #.

-- Advanced users can put the different files (RSA_DATA, RSA_INDEX and LOG)
-- on different storage devices to improve performance. RSA_INDEX is a small file which
-- is recommended to be stored on a fast device.
-- For more details, please refer to Microsoft documentation at http://technet.microsoft.com/en-us/library/ms143547.aspx
-------------------------------------------------------------------------------------
CREATE DATABASE RSA ON PRIMARY(
    NAME='RSA_DATA',
    FILENAME='C:\CHANGE ME\RSA_DATA.mdf',
    SIZE=10MB,
    MAXSIZE=UNLIMITED,
    FILEGROWTH=10%),
FILEGROUP RSA_INDEX(
    NAME='RSA_INDEX',
    FILENAME='C:\CHANGE ME\RSA_INDEX.ndf',
    SIZE=10MB,
    MAXSIZE=UNLIMITED,
    FILEGROWTH=10%)
LOG ON(
    NAME='translog',
    FILENAME='C:\CHANGE ME\translog.ldf',
    SIZE=10MB,
    MAXSIZE=UNLIMITED,
    FILEGROWTH=10% )
GO

-- Set recommended perform settings on the database
EXEC SP_DBOPTION 'RSA', 'autoshrink', true
GO
EXEC SP_DBOPTION 'RSA', 'trunc. log on chkpt.', true
GO

CHECKPOINT
GO

-------------------------------------------------------------------------------------
-- To drop the database, the commands is:
-------------------------------------------------------------------------------------
-- DROP DATABASE RSA

Open in new window

0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

805 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question