?
Solved

VMware vSphere 5.1 vCenter and SSO SQL scripts

Posted on 2013-02-06
1
Medium Priority
?
1,264 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 43

Accepted Solution

by:
Eugene Z earned 750 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

770 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