If you read the Chargeback 2.5 documentation you’ll notice you have to create a database first – but doesn’t give you a script (see below). Once created you’re asked to create a new role and assign the chargeback database owner that role. The install PDF shows a short SQL script to create the role and add it to your user.
lines 2-8 start something like this:
GRANT ALTER ON SCHEMA :: DBO TO CB_ADMIN_ROLE;
the catch is all those lines (assuming you copy and past from the PDF) will return:
Cannot find the schema ‘DBO’, because it does not exist or you do not have permission.
The catch: “dbo” should be lower case. Fix that on all the lines before you run it, or just run those lines again if you already hit the error and went googling 😉
More Chargeback database tips: look on your SQL server for the name in paranthesis after the running SQL Server service. The SQL server IP address plus “” plus that name is your database URL.
Also, enter 1433 as the port #. Yeah it says it’s optional, but no it isn’t
Bonus tip: When adding a vCenter Server to Chargeback only put in the IP address where it says URL *do not list the instance*. Yes, the installation routine only worked if you entered an instance. Well, adding the vCenter database only works if you don’t and you’ll only see this:
Error: Unable to connect to the vCenter database with the specified credentials
Here’s a script intended to build vCloud databases, but it works to create a chargeback database with a user “chargeback” and password “vmware2012”
Note it also create the log and database files on the root of C: so you might want to change that…
To run the script launch SQL Server Management studio, right-click your SQL server instance and choose “New Query”. Paste the script into the window and hit ! Execute.
Note also to use the user created here (“chargeback” unless you change it) in the last line of the script referenced above from the documentation.
USE [master]
GO
CREATE DATABASE [chargeback] ON PRIMARY
(NAME = N’chargeback’, FILENAME = N’C:chargeback.mdf’, SIZE = 100MB, FILEGROWTH = 10% )
LOG ON
(NAME = N’chargeback_log’, FILENAME = N’C:chargeback.ldf’, SIZE = 1MB, FILEGROWTH = 10%)
COLLATE Latin1_General_CS_AS
GO
USE [chargeback]
GO
ALTER DATABASE [chargeback] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
ALTER DATABASE [chargeback] SET ALLOW_SNAPSHOT_ISOLATION ON;
ALTER DATABASE [chargeback] SET READ_COMMITTED_SNAPSHOT ON WITH NO_WAIT;
ALTER DATABASE [chargeback] SET MULTI_USER;
GO
USE [chargeback]
GO
CREATE LOGIN [chargeback] WITH PASSWORD = ‘vmware2012’, DEFAULT_DATABASE =[chargeback], DEFAULT_LANGUAGE =[us_english], CHECK_POLICY=OFF
GO
CREATE USER [chargeback] for LOGIN [chargeback]
GO
USE [chargeback]
GO
sp_addrolemember [db_owner], [chargeback]
GO