When managing complex projects, it is beneficial to use a project management methodology for guidance. PRINCE2 is one of the most popular and widely used methodologies available.
What is PRINCE2?
PRINCE2 (or Projects in Controlled Environments) offers a structured process for projects & provides recommendations for each project phase. It is one of the leading project management methodologies (next to PMBOK (from the Project Management Institute)) and used in over 150 countries.
Basic principles of PRINCE2
PRINCE2 provides a clear structure for projects and is based on 7 principles, 7 themes and 7 processes as described by PRINCE2.com.
PRINCE2 is build on seven principles which represent guiding obligations and good practices.
The 7 Principles are:
- Continued Business Justification: A project must make good business sense (justified use of time and resources, clear return on investment).
- Learn from Experience: Previous projects should be taken into account. Project teams use a lessons log for this purpose.
- Define Roles and Responsibilities: The decision makers in the project are clearly defined. Everyone in the project knows what they and others are doing.
- Manage by Stages: Difficult tasks are broken into manageable chunks, or management stages.
- Manage by Exception: The project board is only informed if there is or may be a problem. As long as the product is running well, there is not a lot intervention from managers
- Focus on Products: Everyone knows ahead of time what is expected of the product. Product requirements determine work activity.
- Tailor to the Environment: The PRINCE2 methodology can be tailored and scaled. Projects which are adjusted based on the actual needs perform better in general than projects which use PRINCE2 dogmatically.
In addition to these 7 Principles, there are 7 Themes which are addressed continually throughout the project. They provide guidance for how the project should be managed. They are set up at the beginning of the project and then monitored continually to keep the project on track:
- Business Case: This theme is used to determine if a project is worthwhile and achievable. It is related to the principle of Continued Business Justification.
- Organisation: Project managers are required to keep a record every team member’s roles and responsibilities. It is related to the Define Roles and Responsibilities principle.
- Quality: At the beginning of the project the project manager defines what constitutes the quality of the projects. This is related to the Focus on Products principle.
- Plans: A plan is set up which describes how objectives are going to be achieved. It is focused on cost, quality, benefits, timescale and products.
- Risk: Uncertain events during the project are identified, assessed and controlled. They are recorded in a risk log. Positive risks are called opportunities, negative risks are called threats.
- Change: How to handle change requests and issues which arise during the project. Changes shouldn’t be avoided but they should be agreed on before they are executed.
- Progress: This principle is about tracking the project. This allows project managers to verify and control if they are performing according to the project plan.
To structure the step-wise progression through a project, there are 7 Processes. Every one of the steps is overseen by the project manager and approved by the project board:
- 1. Starting up a project
- Create a project mandate to answer logistical questions about the project. It covers the purpose of the project, who will carry it out and how to execute it.
- From the project mandate a project brief is derived, as well as lessons log and discussions with project members.
- A project team is assigned.
- 2. Initiating a project
- During this stage project manager determines what needs to be done to complete the project and outlines how the performance targets will be managed (cost, time, quality, benefits, risks, scope)
- 3. Directing a project
- This is an ongoing process covering the entire life time of the project.
- The project board manages activities such as initiation, stage boundaries, guidance, project closure.
- 4. Controlling a stage
- Project managers break the project into work packages / manageable activities and assigns them to the project members.
- The project manager oversees and reports the work package progress.
- 5. Managing product delivery
- This manages how the communication between the team and the project manager is controlled.
- The activities include accepting, executing and delivering work packages.
- 6. Managing stage boundaries
- The project manager and the board review every stage. The board decides whether to continue the project. The project manager records lessons learned with the team for the next stage.
- This process includes
- Planning the next stage
- Updating the project plan
- Updating the business case
- Reporting the stage end or producing an exception plan
- 7. Closing a project
- In the final process the project is closed. This includes decommissioning the project, identifying follow-on actions, preparing project evaluation and benefits reviews, freeing up leftover resources and handing over products to the customer
Install SQL Server
To configure SQL Server on Ubuntu, run the following commands in a terminal to install the mssql-server package.
If you have previously installed a CTP or RC release of SQL Server 2017, you must first remove the old repository before registering one of the GA repositories. For more information, see Change repositories from the preview repository to the GA repository.
- Import the public repository GPG keys:
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
- Register the Microsoft SQL Server Ubuntu repository:
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)"
This is the Cumulative Update (CU) repository. For more information about your repository options and their differences, see Configure repositories for SQL Server on Linux.
- Run the following commands to install SQL Server:
sudo apt-get update sudo apt-get install -y mssql-server
- After the package installation finishes, run mssql-conf setup and follow the prompts to set the SA password and choose your edition.
sudo /opt/mssql/bin/mssql-conf setup
If you are trying SQL Server 2017 in this tutorial, the following editions are freely licensed: Evaluation, Developer, and Express.
Make sure to specify a strong password for the SA account (Minimum length 8 characters, including uppercase and lowercase letters, base 10 digits and/or non-alphanumeric symbols).
- Once the configuration is done, verify that the service is running:
systemctl status mssql-server
- If you plan to connect remotely, you might also need to open the SQL Server TCP port (default 1433) on your firewall.
At this point, SQL Server is running on your Ubuntu machine and is ready to use!
Install the SQL Server command-line tools
Use the following steps to install the mssql-tools on Ubuntu.
- Import the public repository GPG keys.
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
- Register the Microsoft Ubuntu repository.
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
- Update the sources list and run the installation command with the unixODBC developer package.
sudo apt-get update sudo apt-get install mssql-tools unixodbc-dev
To update to the latest version of mssql-tools run the following commands:bash
sudo apt-get update sudo apt-get install mssql-tools
- Optional: Add
/opt/mssql-tools/bin/to your PATH environment variable in a bash shell.
To make sqlcmd/bcp accessible from the bash shell for login sessions, modify your PATH in the ~/.bash_profile file with the following command:bash
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
To make sqlcmd/bcp accessible from the bash shell for interactive/non-login sessions, modify the PATH in the ~/.bashrc file with the following command:bash
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc source ~/.bashrc
Sqlcmd is just one tool for connecting to SQL Server to run queries and perform management and development tasks. Other tools include:
The following steps use sqlcmd to locally connect to your new SQL Server instance.
- Run sqlcmd with parameters for your SQL Server name (-S), the user name (-U), and the password (-P). In this tutorial, you are connecting locally, so the server name is
localhost. The user name is
SAand the password is the one you provided for the SA account during setup.bash
sqlcmd -S localhost -U SA -P '<YourPassword>'
You can omit the password on the command line to be prompted to enter it.
If you later decide to connect remotely, specify the machine name or IP address for the -S parameter, and make sure port 1433 is open on your firewall.
- If successful, you should get to a sqlcmd command prompt:
- If you get a connection failure, first attempt to diagnose the problem from the error message. Then review the connection troubleshooting recommendations.
Create and query data
The following sections walk you through using sqlcmd to create a new database, add data, and run a simple query.
Create a new database
The following steps create a new database named
- From the sqlcmd command prompt, paste the following Transact-SQL command to create a test database:
CREATE DATABASE TestDB
- On the next line, write a query to return the name of all of the databases on your server:
SELECT Name from sys.Databases
- The previous two commands were not executed immediately. You must type
GOon a new line to execute the previous commands:SQL
Next create a new table,
Inventory, and insert two new rows.
- From the sqlcmd command prompt, switch context to the new
- Create new table named
CREATE TABLE Inventory (id INT, name NVARCHAR(50), quantity INT)
- Insert data into the new table:
INSERT INTO Inventory VALUES (1, 'banana', 150); INSERT INTO Inventory VALUES (2, 'orange', 154);
GOto execute the previous commands:SQL
Now, run a query to return data from the
- From the sqlcmd command prompt, enter a query that returns rows from the
Inventorytable where the quantity is greater than 152:SQL
SELECT * FROM Inventory WHERE quantity > 152;
- Execute the command:
Exit the sqlcmd command prompt
To end your sqlcmd session, type
Connect from Windows
SQL Server tools on Windows connect to SQL Server instances on Linux in the same way they would connect to any remote SQL Server instance.
If you have a Windows machine that can connect to your Linux machine, try the same steps in this topic from a Windows command-prompt running sqlcmd. Just verify that you use the target Linux machine name or IP address rather than localhost, and make sure that TCP port 1433 is open. If you have any problems connecting from Windows, see connection troubleshooting recommendations.
For other tools that run on Windows but connect to SQL Server on Linux, see:
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -Q “BACKUP DATABASE [MYDATABASE_DEV] TO DISK = N’/var/opt/mssql/data/MYDATABASE-20180615.bak’ WITH NOFORMAT, NOINIT, NAME = ‘MYDATABASE_STD50_DEV’, SKIP, NOREWIND, NOUNLOAD, STATS = 10”
First, this report is not just about issue with mssql-docker but I suspect it is related to about mssql-tools for Linux in general, more specifically the
sqlcmd. (Not sure where would be better and more accessible by others place to report it.)
I run docker container based on
ubuntu:latest image and I install the
mssql-tools in order to be able to run
sqlcmd (I’m connecting to SQL Server in separate container).
Here is my Dockerfile
RUN apt-get -qy update && apt-get -qy install --no-upgrade --no-install-recommends \ apt-transport-https \ apt-utils \ curl \ software-properties-common RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - RUN add-apt-repository "$(curl -s https://packages.microsoft.com/config/ubuntu/16.04/prod.list)" RUN ACCEPT_EULA=Y apt-get -qy install --no-upgrade --no-install-recommends \ msodbcsql \ mssql-tools \ unixodbc-dev RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
Then I do
docker exec -it bash and BANG!
root@2531848bc8e4:/# /opt/mssql-tools/bin/sqlcmd terminate called after throwing an instance of 'std::runtime_error' what(): locale::facet::_S_create_c_locale name not valid
The SQL Server installation docs do not mention anything about specific locale required.
The only source of any hints is the
Dockerfile-s like https://github.com/Microsoft/mssql-docker/blob/master/oss-drivers/msphpsql/Dockerfile, which contain:
# install necessary locales RUN apt-get install -y locales \ && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \ && locale-gen
Clearly, this is a bug in the implementation of the
mssql-tools, specifically the
sqlcmd which should detect it runs in environment with incompatible locale and, obviously, print an informative message, not just terminate.
What is Pssdiag/Sqldiag Manager?
Pssdiag/Sqldiag Manager is a graphic interface that provides customization capabilities to collect data for SQL Server using sqldiag collector engine. The data collected can be used by SQL Nexus tool which help you troubleshoot SQL Server performance problems. This is the same tool Microsoft SQL Server support engineers use to for data collection to troubleshoot customer’s performance problems.